diff --git a/.clang-tidy b/.clang-tidy index 02e90d9148..de1800f410 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -90,6 +90,13 @@ CheckOptions: readability-identifier-naming.ClassCase: CamelCase readability-identifier-naming.StructCase: CamelCase readability-identifier-naming.UnionCase: CamelCase + readability-identifier-naming.TypeAliasCase: CamelCase + readability-identifier-naming.TypedefCase: CamelCase + # Member type names mandated by std/Boost concepts. Subtrees that need more + # than these carry their own .clang-tidy (include/xrpl/{beast,basics,protocol, + # peerfinder}, src/test/beast); one-off cases use an inline NOLINT. + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(const_iterator|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(const_iterator|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|value_type)$" readability-identifier-naming.EnumCase: CamelCase readability-identifier-naming.EnumConstantCase: CamelCase readability-identifier-naming.ScopedEnumConstantCase: CamelCase @@ -122,5 +129,5 @@ CheckOptions: readability-identifier-naming.GlobalFunctionIgnoredRegexp: "^(to_string|hash_append|tuple_hash)$" HeaderFilterRegex: '^.*/(tests?|xrpl|xrpld)/.*\.(h|hpp|ipp)$' -ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$' +ExcludeHeaderFilterRegex: '^.*/protocol_autogen/.*\.(h|hpp)$|^.*\.pb\.h$' WarningsAsErrors: "*" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1035124f31..6fe25d6638 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -479,8 +479,12 @@ exists, then no other unit test will be executed, apart from `TestSuiteName`. elsewhere in the codebase. 12. Use clear and self-explanatory names for functions, variables, structs and classes. -13. Use TitleCase for classes, structs and filenames, camelCase for - function and variable names, lower case for namespaces and folders. +13. Use TitleCase for classes, structs, type aliases and filenames, + camelCase for function and variable names, lower case for namespaces and + folders. The exception is a type alias that generic code looks up by name + (`value_type`, `iterator`, `result_type`, and the rest of the standard + container, hash and clock members), which keeps its snake_case spelling; + `.clang-tidy` lists the names that are allowed. 14. Provide as many comments as you feel that a competent programmer would need to understand what your code does. diff --git a/cmake/scripts/codegen/generate_tx_classes.py b/cmake/scripts/codegen/generate_tx_classes.py index 09fb898840..86ff65bfda 100644 --- a/cmake/scripts/codegen/generate_tx_classes.py +++ b/cmake/scripts/codegen/generate_tx_classes.py @@ -59,7 +59,7 @@ def create_transaction_parser(): # the members that differ from these. SETTING_DEFAULTS = { "delegable": "Delegation::NotDelegable", - "amendment": "uint256{}", + "amendment": "UInt256{}", "privileges": "Privilege::NoPriv", } diff --git a/cmake/scripts/codegen/templates/LedgerEntry.h.mako b/cmake/scripts/codegen/templates/LedgerEntry.h.mako index c799903b21..0138c630a3 100644 --- a/cmake/scripts/codegen/templates/LedgerEntry.h.mako +++ b/cmake/scripts/codegen/templates/LedgerEntry.h.mako @@ -209,7 +209,7 @@ ${field['typeData']['setter_type']} ${field['paramName']}${',' if i < len(requir * @return The constructed ledger entry wrapper. */ ${name} - build(uint256 const& index) + build(UInt256 const& index) { return ${name}{std::make_shared(std::move(object_), index)}; } diff --git a/cmake/scripts/codegen/templates/LedgerEntryTests.cpp.mako b/cmake/scripts/codegen/templates/LedgerEntryTests.cpp.mako index 011cf933dd..f6c62c9ddb 100644 --- a/cmake/scripts/codegen/templates/LedgerEntryTests.cpp.mako +++ b/cmake/scripts/codegen/templates/LedgerEntryTests.cpp.mako @@ -31,7 +31,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(${name}Tests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; % for field in fields: auto const ${field["paramName"]}Value = ${canonical_expr(field)}; @@ -85,7 +85,7 @@ TEST(${name}Tests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(${name}Tests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; % for field in fields: auto const ${field["paramName"]}Value = ${canonical_expr(field)}; @@ -146,7 +146,7 @@ TEST(${name}Tests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(${name}Tests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -177,7 +177,7 @@ TEST(${name}Tests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(${name}Tests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type % if wrong_le_include == "Ticket": @@ -207,7 +207,7 @@ TEST(${name}Tests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(${name}Tests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; % for field in required_fields: auto const ${field["paramName"]}Value = ${canonical_expr(field)}; diff --git a/include/xrpl/basics/.clang-tidy b/include/xrpl/basics/.clang-tidy new file mode 100644 index 0000000000..d9ffcf3bec --- /dev/null +++ b/include/xrpl/basics/.clang-tidy @@ -0,0 +1,11 @@ +# basics' container adapters (TaggedCache, partitioned_unordered_map, +# base_uint) model std concepts, which mandate +# snake_case member type names. +# +# clang-tidy replaces rather than merges this option, so the list is the +# top-level one restated plus the 6 name(s) needed only here: +# allocator_type const_pointer const_reverse_iterator hasher key_equal reverse_iterator +InheritParentConfig: true +CheckOptions: + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(allocator_type|const_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|hasher|iterator|iterator_category|key_equal|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(allocator_type|const_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|hasher|iterator|iterator_category|key_equal|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" diff --git a/include/xrpl/basics/KeyCache.h b/include/xrpl/basics/KeyCache.h index 4f2ca20cca..86547f3840 100644 --- a/include/xrpl/basics/KeyCache.h +++ b/include/xrpl/basics/KeyCache.h @@ -5,6 +5,6 @@ namespace xrpl { -using KeyCache = TaggedCache; +using KeyCache = TaggedCache; } // namespace xrpl diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index f6ce0b300d..d33c1ee71e 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -350,10 +350,10 @@ concept Integral64 = std::is_same_v || std::is_same_v::lowest()}; public: @@ -361,10 +361,10 @@ public: static constexpr int kMinExponent = -32768; static constexpr int kMaxExponent = 32768; - static constexpr internalrep kMaxRep = std::numeric_limits::max(); + static constexpr InternalRep kMaxRep = std::numeric_limits::max(); static_assert(kMaxRep == 9'223'372'036'854'775'807); static_assert(-kMaxRep == std::numeric_limits::min() + 1); - static constexpr internalrep kMaxRepUp = ((kMaxRep / 10) + 1) * 10; + static constexpr InternalRep kMaxRepUp = ((kMaxRep / 10) + 1) * 10; static_assert(kMaxRepUp == 9'223'372'036'854'775'810ULL); // May need to make unchecked private @@ -388,15 +388,15 @@ public: explicit Number(rep mantissa, int exponent); explicit constexpr Number( bool negative, - internalrep mantissa, + InternalRep mantissa, int exponent, Unchecked) noexcept; // Assume unsigned values are... unsigned. i.e. positive - explicit constexpr Number(internalrep mantissa, int exponent, Unchecked) noexcept; + explicit constexpr Number(InternalRep mantissa, int exponent, Unchecked) noexcept; // Only unit tests are expected to use this ctor - explicit Number(bool negative, internalrep mantissa, int exponent, Normalized); + explicit Number(bool negative, InternalRep mantissa, int exponent, Normalized); // Assume unsigned values are... unsigned. i.e. positive - explicit Number(internalrep mantissa, int exponent, Normalized); + explicit Number(InternalRep mantissa, int exponent, Normalized); [[nodiscard]] constexpr rep mantissa() const noexcept; @@ -558,13 +558,13 @@ public: static void setMantissaScale(MantissaRange::MantissaScale scale); - static internalrep + static InternalRep minMantissa() { return kRange.get().min; } - static internalrep + static InternalRep maxMantissa() { return kRange.get().max; @@ -591,7 +591,7 @@ public: // is negative, returns the positive value. This takes a little extra work // because converting std::numeric_limits::min() flirts with // UB, and can vary across compilers. - static internalrep + static InternalRep externalToInternal(rep mantissa); private: @@ -625,8 +625,8 @@ private: bool& negative, T& mantissa, int& exponent, - internalrep const& minMantissa, - internalrep const& maxMantissa, + InternalRep const& minMantissa, + InternalRep const& maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFix); template @@ -650,25 +650,25 @@ private: shiftExponent(int exponentDelta) const; }; -constexpr Number::Number(bool negative, internalrep mantissa, int exponent, Unchecked) noexcept +constexpr Number::Number(bool negative, InternalRep mantissa, int exponent, Unchecked) noexcept : negative_(negative), mantissa_{mantissa}, exponent_{exponent} { } -constexpr Number::Number(internalrep mantissa, int exponent, Unchecked) noexcept +constexpr Number::Number(InternalRep mantissa, int exponent, Unchecked) noexcept : Number(false, mantissa, exponent, Unchecked{}) { } static constexpr Number kNumZero{}; -inline Number::Number(bool negative, internalrep mantissa, int exponent, Normalized) +inline Number::Number(bool negative, InternalRep mantissa, int exponent, Normalized) : Number(negative, mantissa, exponent, Unchecked{}) { normalize(kRange); } -inline Number::Number(internalrep mantissa, int exponent, Normalized) +inline Number::Number(InternalRep mantissa, int exponent, Normalized) : Number(false, mantissa, exponent, Normalized{}) { } @@ -853,7 +853,7 @@ Number::normalizeToRange() const static_assert((kMAX + 1) / 10 == kMIN); bool negative = negative_; - internalrep mantissa = mantissa_; + InternalRep mantissa = mantissa_; int exponent = exponent_; if constexpr (std::is_unsigned_v) diff --git a/include/xrpl/basics/README.md b/include/xrpl/basics/README.md index b20b837ed7..62f74b61c2 100644 --- a/include/xrpl/basics/README.md +++ b/include/xrpl/basics/README.md @@ -21,11 +21,11 @@ The module xrpl/basics should contain no dependencies on other modules. - `std::set` - For sorted containers. -- `xrpl::hash_set` +- `xrpl::HashSet` - Where inserts and contains need to be O(1). - For "small" sets, `std::set` might be faster and smaller. -- `xrpl::hardened_hash_set` +- `xrpl::HardenedHashSet` - For data sets where the key could be manipulated by an attacker in an attempt to mount an algorithmic complexity attack: see http://en.wikipedia.org/wiki/Algorithmic_complexity_attack @@ -33,5 +33,5 @@ The module xrpl/basics should contain no dependencies on other modules. The following container is deprecated - `std::unordered_set` -- Use `xrpl::hash_set` instead, which uses a better hashing algorithm. -- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks. +- Use `xrpl::HashSet` instead, which uses a better hashing algorithm. +- Or use `xrpl::HardenedHashSet` to prevent algorithmic complexity attacks. diff --git a/include/xrpl/basics/SHAMapHash.h b/include/xrpl/basics/SHAMapHash.h index 1902a3b2ec..7c96a0ae12 100644 --- a/include/xrpl/basics/SHAMapHash.h +++ b/include/xrpl/basics/SHAMapHash.h @@ -14,20 +14,20 @@ namespace xrpl { class SHAMapHash { - uint256 hash_; + UInt256 hash_; public: SHAMapHash() = default; - explicit SHAMapHash(uint256 const& hash) : hash_(hash) + explicit SHAMapHash(UInt256 const& hash) : hash_(hash) { } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& asUInt256() const { return hash_; } - uint256& + UInt256& asUInt256() { return hash_; diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 7bb2cb552b..a637887106 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -59,34 +59,34 @@ template < class T, bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer, - class SharedPointerType = std::shared_ptr, + class SharedPointer = std::shared_ptr, class Hash = HardenedHash<>, class KeyEqual = std::equal_to, class Mutex = std::recursive_mutex> class TaggedCache { public: - using mutex_type = Mutex; + using MutexType = Mutex; using key_type = Key; using mapped_type = T; - using clock_type = beast::AbstractClock; - using shared_weak_combo_pointer_type = SharedWeakUnionPointerType; - using shared_pointer_type = SharedPointerType; + using ClockType = beast::AbstractClock; + using SharedWeakComboPointerType = SharedWeakUnionPointerType; + using SharedPointerType = SharedPointer; public: TaggedCache( std::string const& name, int size, - clock_type::duration expiration, - clock_type& clock, + ClockType::duration expiration, + ClockType& clock, beast::Journal journal, - beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make()); + beast::insight::Collector::Ptr const& collector = beast::insight::NullCollector::make()); public: /** * Return the clock associated with the cache. */ - clock_type& + ClockType& clock(); /** @@ -239,7 +239,7 @@ public: bool retrieve(key_type const& key, T& data); - mutex_type& + MutexType& peekMutex(); std::vector @@ -265,7 +265,7 @@ public: private: SharedPointerType - initialFetch(key_type const& key, std::scoped_lock const& l); + initialFetch(key_type const& key, std::scoped_lock const& l); void collectMetrics(); @@ -277,7 +277,7 @@ private: Stats( std::string const& prefix, Handler const& handler, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : hook(collector->makeHook(handler)) , size(collector->makeGauge(prefix, "size")) , hitRate(collector->makeGauge(prefix, "hit_rate")) @@ -296,14 +296,14 @@ private: class KeyOnlyEntry { public: - clock_type::time_point lastAccess; + ClockType::time_point lastAccess; - explicit KeyOnlyEntry(clock_type::time_point const& lastAccess) : lastAccess(lastAccess) + explicit KeyOnlyEntry(ClockType::time_point const& lastAccess) : lastAccess(lastAccess) { } void - touch(clock_type::time_point const& now) + touch(ClockType::time_point const& now) { lastAccess = now; } @@ -312,10 +312,10 @@ private: class ValueEntry { public: - shared_weak_combo_pointer_type ptr; - clock_type::time_point lastAccess; + SharedWeakComboPointerType ptr; + ClockType::time_point lastAccess; - ValueEntry(clock_type::time_point const& lastAccess, shared_pointer_type const& ptr) + ValueEntry(ClockType::time_point const& lastAccess, SharedPointerType const& ptr) : ptr(ptr), lastAccess(lastAccess) { } @@ -343,7 +343,7 @@ private: return ptr.lock(); } void - touch(clock_type::time_point const& now) + touch(ClockType::time_point const& now) { lastAccess = now; } @@ -351,35 +351,35 @@ private: using Entry = std::conditional_t; - using KeyOnlyCacheType = hardened_partitioned_hash_map; + using KeyOnlyCacheType = HardenedPartitionedHashMap; - using KeyValueCacheType = hardened_partitioned_hash_map; + using KeyValueCacheType = HardenedPartitionedHashMap; - using cache_type = hardened_partitioned_hash_map; + using CacheType = HardenedPartitionedHashMap; [[nodiscard]] std::thread sweepHelper( - clock_type::time_point const& whenExpire, - [[maybe_unused]] clock_type::time_point const& now, - KeyValueCacheType::map_type& partition, + ClockType::time_point const& whenExpire, + [[maybe_unused]] ClockType::time_point const& now, + KeyValueCacheType::MapType& partition, SweptPointersVector& stuffToSweep, std::atomic& allRemovals, std::scoped_lock const&); [[nodiscard]] std::thread sweepHelper( - clock_type::time_point const& whenExpire, - clock_type::time_point const& now, - KeyOnlyCacheType::map_type& partition, + ClockType::time_point const& whenExpire, + ClockType::time_point const& now, + KeyOnlyCacheType::MapType& partition, SweptPointersVector&, std::atomic& allRemovals, std::scoped_lock const&); beast::Journal journal_; - clock_type& clock_; + ClockType& clock_; Stats stats_; - mutex_type mutable mutex_; + MutexType mutable mutex_; // Used for logging std::string name_; @@ -388,11 +388,11 @@ private: int const targetSize_; // Desired maximum cache age - clock_type::duration const targetAge_; + ClockType::duration const targetAge_; // Number of items cached int cacheCount_{0}; - cache_type cache_; // Hold strong reference to recent objects + CacheType cache_; // Hold strong reference to recent objects std::uint64_t hits_{0}; std::uint64_t misses_{0}; }; diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index 447743a7b7..1a5cf56aa1 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -54,10 +54,10 @@ inline TaggedCache< TaggedCache( std::string const& name, int size, - clock_type::duration expiration, - clock_type& clock, + ClockType::duration expiration, + ClockType& clock, beast::Journal journal, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : journal_(journal) , clock_(clock) , stats_( @@ -81,7 +81,7 @@ template < class Mutex> inline auto TaggedCache:: - clock() -> clock_type& + clock() -> ClockType& { return clock_; } @@ -237,8 +237,8 @@ TaggedCache allStuffToSweep(cache_.partitions()); - clock_type::time_point const now(clock_.now()); - clock_type::time_point whenExpire; + ClockType::time_point const now(clock_.now()); + ClockType::time_point whenExpire; auto const start = std::chrono::steady_clock::now(); { @@ -252,7 +252,7 @@ TaggedCache (now - minimumAge)) whenExpire = now - minimumAge; @@ -487,7 +487,7 @@ inline SharedPointerType TaggedCache:: fetch(key_type const& key) { - std::scoped_lock const l(mutex_); + std::scoped_lock const l(mutex_); auto ret = initialFetch(key, l); if (!ret) ++misses_; @@ -541,7 +541,7 @@ TaggedCache inline auto TaggedCache:: - peekMutex() -> mutex_type& + peekMutex() -> MutexType& { return mutex_; } @@ -711,7 +711,7 @@ template < class Mutex> inline SharedPointerType TaggedCache:: - initialFetch(key_type const& key, std::scoped_lock const& l) + initialFetch(key_type const& key, std::scoped_lock const& l) { auto cit = cache_.find(key); if (cit == cache_.end()) @@ -776,9 +776,9 @@ template < inline std::thread TaggedCache:: sweepHelper( - clock_type::time_point const& whenExpire, - [[maybe_unused]] clock_type::time_point const& now, - KeyValueCacheType::map_type& partition, + ClockType::time_point const& whenExpire, + [[maybe_unused]] ClockType::time_point const& now, + KeyValueCacheType::MapType& partition, SweptPointersVector& stuffToSweep, std::atomic& allRemovals, std::scoped_lock const&) @@ -856,9 +856,9 @@ template < inline std::thread TaggedCache:: sweepHelper( - clock_type::time_point const& whenExpire, - clock_type::time_point const& now, - KeyOnlyCacheType::map_type& partition, + ClockType::time_point const& whenExpire, + ClockType::time_point const& now, + KeyOnlyCacheType::MapType& partition, SweptPointersVector&, std::atomic& allRemovals, std::scoped_lock const&) diff --git a/include/xrpl/basics/UnorderedContainers.h b/include/xrpl/basics/UnorderedContainers.h index e0700c4055..aab0b21638 100644 --- a/include/xrpl/basics/UnorderedContainers.h +++ b/include/xrpl/basics/UnorderedContainers.h @@ -33,7 +33,7 @@ template < class Hash = beast::Uhash<>, class Pred = std::equal_to, class Allocator = std::allocator>> -using hash_map = std::unordered_map; +using HashMap = std::unordered_map; template < class Key, @@ -41,62 +41,62 @@ template < class Hash = beast::Uhash<>, class Pred = std::equal_to, class Allocator = std::allocator>> -using hash_multimap = std::unordered_multimap; +using HashMultimap = std::unordered_multimap; template < class Value, class Hash = beast::Uhash<>, class Pred = std::equal_to, class Allocator = std::allocator> -using hash_set = std::unordered_set; +using HashSet = std::unordered_set; template < class Value, class Hash = beast::Uhash<>, class Pred = std::equal_to, class Allocator = std::allocator> -using hash_multiset = std::unordered_multiset; +using HashMultiset = std::unordered_multiset; // hardened_hash containers -using strong_hash = beast::Xxhasher; +using StrongHash = beast::Xxhasher; template < class Key, class Value, - class Hash = HardenedHash, + class Hash = HardenedHash, class Pred = std::equal_to, class Allocator = std::allocator>> -using hardened_hash_map = std::unordered_map; +using HardenedHashMap = std::unordered_map; template < class Key, class Value, - class Hash = HardenedHash, + class Hash = HardenedHash, class Pred = std::equal_to, class Allocator = std::allocator>> -using hardened_partitioned_hash_map = PartitionedUnorderedMap; +using HardenedPartitionedHashMap = PartitionedUnorderedMap; template < class Key, class Value, - class Hash = HardenedHash, + class Hash = HardenedHash, class Pred = std::equal_to, class Allocator = std::allocator>> -using hardened_hash_multimap = std::unordered_multimap; +using HardenedHashMultimap = std::unordered_multimap; template < class Value, - class Hash = HardenedHash, + class Hash = HardenedHash, class Pred = std::equal_to, class Allocator = std::allocator> -using hardened_hash_set = std::unordered_set; +using HardenedHashSet = std::unordered_set; template < class Value, - class Hash = HardenedHash, + class Hash = HardenedHash, class Pred = std::equal_to, class Allocator = std::allocator> -using hardened_hash_multiset = std::unordered_multiset; +using HardenedHashMultiset = std::unordered_multiset; } // namespace xrpl diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 3786f28c6a..58ed61c605 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -111,7 +111,7 @@ public: using const_iterator = const_pointer; using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; - using tag_type = Tag; + using TagType = Tag; pointer data() @@ -575,10 +575,16 @@ public: } }; -using uint128 = BaseUInt<128>; -using uint160 = BaseUInt<160>; -using uint256 = BaseUInt<256>; -using uint192 = BaseUInt<192>; +using UInt128 = BaseUInt<128>; +using UInt160 = BaseUInt<160>; +using UInt256 = BaseUInt<256>; +using UInt192 = BaseUInt<192>; + +// TODO [#8340]: Legacy names still used by external consumers of libxrpl (e.g. rpc-spec). +// Do not use in new code; remove once those consumers have migrated. +using uint160 = UInt160; // NOLINT(readability-identifier-naming) +using uint256 = UInt256; // NOLINT(readability-identifier-naming) +using uint192 = UInt192; // NOLINT(readability-identifier-naming) template [[nodiscard]] constexpr std::strong_ordering @@ -670,7 +676,7 @@ operator<<(std::ostream& out, BaseUInt const& u) template <> inline std::size_t -extract(uint256 const& key) +extract(UInt256 const& key) { std::size_t result = 0; // Use memcpy to avoid unaligned UB @@ -680,10 +686,10 @@ extract(uint256 const& key) } #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"); -static_assert(sizeof(uint192) == 192 / 8, "There should be no padding bytes"); -static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes"); +static_assert(sizeof(UInt128) == 128 / 8, "There should be no padding bytes"); +static_assert(sizeof(UInt160) == 160 / 8, "There should be no padding bytes"); +static_assert(sizeof(UInt192) == 192 / 8, "There should be no padding bytes"); +static_assert(sizeof(UInt256) == 256 / 8, "There should be no padding bytes"); #endif } // namespace xrpl diff --git a/include/xrpl/basics/chrono.h b/include/xrpl/basics/chrono.h index b855318524..77b79c5eee 100644 --- a/include/xrpl/basics/chrono.h +++ b/include/xrpl/basics/chrono.h @@ -16,10 +16,10 @@ namespace xrpl { // A few handy aliases -using days = +using Days = std::chrono::duration>>; -using weeks = std::chrono::duration>>; +using Weeks = std::chrono::duration>>; /** * Clock for measuring the network time. diff --git a/include/xrpl/basics/hardened_hash.h b/include/xrpl/basics/hardened_hash.h index 6b8277a560..bc7630aa90 100644 --- a/include/xrpl/basics/hardened_hash.h +++ b/include/xrpl/basics/hardened_hash.h @@ -11,10 +11,10 @@ namespace xrpl { namespace detail { -using seed_pair = std::pair; +using SeedPair = std::pair; template -seed_pair +SeedPair makeSeedPair() noexcept { struct StateT @@ -71,7 +71,7 @@ template class HardenedHash { private: - detail::seed_pair seeds_{detail::makeSeedPair<>()}; + detail::SeedPair seeds_{detail::makeSeedPair<>()}; public: using result_type = HashAlgorithm::result_type; diff --git a/include/xrpl/basics/partitioned_unordered_map.h b/include/xrpl/basics/partitioned_unordered_map.h index c6b0107b93..a31a3f3ed0 100644 --- a/include/xrpl/basics/partitioned_unordered_map.h +++ b/include/xrpl/basics/partitioned_unordered_map.h @@ -53,19 +53,19 @@ public: using const_reference = value_type const&; using pointer = value_type*; using const_pointer = value_type const*; - using map_type = std::unordered_map; - using partition_map_type = std::vector; + using MapType = std::unordered_map; + using PartitionMapType = std::vector; struct Iterator { using iterator_category = std::forward_iterator_tag; - partition_map_type* map{nullptr}; - partition_map_type::iterator ait{}; - map_type::iterator mit; + PartitionMapType* map{nullptr}; + PartitionMapType::iterator ait{}; + MapType::iterator mit; Iterator() = default; - Iterator(partition_map_type* m) : map(m) + Iterator(PartitionMapType* m) : map(m) { } @@ -122,13 +122,13 @@ public: { using iterator_category = std::forward_iterator_tag; - partition_map_type* map{nullptr}; - partition_map_type::iterator ait{}; - map_type::iterator mit; + PartitionMapType* map{nullptr}; + PartitionMapType::iterator ait{}; + MapType::iterator mit; ConstIterator() = default; - ConstIterator(partition_map_type* m) : map(m) + ConstIterator(PartitionMapType* m) : map(m) { } @@ -234,7 +234,7 @@ public: return partitions_; } - partition_map_type& + PartitionMapType& map() { return map_; @@ -377,7 +377,7 @@ public: } private: - mutable partition_map_type map_{}; + mutable PartitionMapType map_{}; }; } // namespace xrpl diff --git a/include/xrpl/basics/random.h b/include/xrpl/basics/random.h index 7aeb7d6145..f4f3773dc3 100644 --- a/include/xrpl/basics/random.h +++ b/include/xrpl/basics/random.h @@ -14,13 +14,13 @@ namespace xrpl { #ifndef __INTELLISENSE__ static_assert( // NOLINTNEXTLINE(misc-redundant-expression) - std::is_integral_v && - std::is_unsigned_v, + std::is_integral_v && + std::is_unsigned_v, "The XRPL default PRNG engine must return an unsigned integral type."); static_assert( // NOLINTNEXTLINE(misc-redundant-expression) - std::numeric_limits::max() >= + std::numeric_limits::max() >= std::numeric_limits::max(), "The XRPL default PRNG engine return must be at least 64 bits wide."); #endif @@ -30,7 +30,7 @@ namespace detail { // Determines if a type can be called like an Engine // NOLINTNEXTLINE(readability-redundant-typename): typename required by MSVC template -using is_engine = std::is_invocable_r; +using IsEngine = std::is_invocable_r; } // namespace detail /** @@ -44,28 +44,28 @@ using is_engine = std::is_invocable_r; * Each thread gets its own instance of the engine which * will be randomly seeded. */ -inline beast::xor_shift_engine& +inline beast::XorShiftEngine& defaultPrng() { // This is used to seed the thread-specific PRNGs on demand - static beast::xor_shift_engine kSeeder = [] { + static beast::XorShiftEngine kSeeder = [] { std::random_device rng; std::uniform_int_distribution distribution{1}; - return beast::xor_shift_engine(distribution(rng)); + return beast::XorShiftEngine(distribution(rng)); }(); // This protects the seeder static std::mutex kM; // The thread-specific PRNGs: - thread_local beast::xor_shift_engine kEngine = [] { + thread_local beast::XorShiftEngine kEngine = [] { std::uint64_t seed = 0; { std::scoped_lock const lk(kM); std::uniform_int_distribution distribution{1}; seed = distribution(kSeeder); } - return beast::xor_shift_engine{seed}; + return beast::XorShiftEngine{seed}; }(); return kEngine; @@ -95,7 +95,7 @@ defaultPrng() template Integral randInt(Engine& engine, Integral min, Integral max) - requires(std::is_integral_v && detail::is_engine::value) + requires(std::is_integral_v && detail::IsEngine::value) { XRPL_ASSERT(max > min, "xrpl::randInt : max over min inputs"); @@ -116,7 +116,7 @@ randInt(Integral min, Integral max) template Integral randInt(Engine& engine, Integral max) - requires(std::is_integral_v && detail::is_engine::value) + requires(std::is_integral_v && detail::IsEngine::value) { return randInt(engine, Integral(0), max); } @@ -132,7 +132,7 @@ randInt(Integral max) template Integral randInt(Engine& engine) - requires(std::is_integral_v && detail::is_engine::value) + requires(std::is_integral_v && detail::IsEngine::value) { return randInt(engine, std::numeric_limits::max()); } @@ -155,7 +155,7 @@ Byte randByte(Engine& engine) requires( (std::is_same_v || std::is_same_v) && - detail::is_engine::value) + detail::IsEngine::value) { return static_cast(randInt( engine, std::numeric_limits::min(), std::numeric_limits::max())); diff --git a/include/xrpl/basics/tagged_integer.h b/include/xrpl/basics/tagged_integer.h index 2edb314a16..6e336e72d1 100644 --- a/include/xrpl/basics/tagged_integer.h +++ b/include/xrpl/basics/tagged_integer.h @@ -40,7 +40,7 @@ private: public: using value_type = Int; - using tag_type = Tag; + using TagType = Tag; TaggedInteger() = default; diff --git a/include/xrpl/beast/.clang-tidy b/include/xrpl/beast/.clang-tidy new file mode 100644 index 0000000000..42ef904dfe --- /dev/null +++ b/include/xrpl/beast/.clang-tidy @@ -0,0 +1,10 @@ +# beast's containers, clocks and Journal streambuf model std concepts, which mandate +# snake_case member type names. +# +# clang-tidy replaces rather than merges this option, so the list is the +# top-level one restated plus the 20 name(s) needed only here: +# allocator_type argument_type char_type const_local_iterator const_pointer const_reverse_iterator first_argument_type hasher int_type key_compare key_equal local_iterator native_handle_type off_type pos_type reverse_iterator second_argument_type traits_type type value_compare +InheritParentConfig: true +CheckOptions: + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(allocator_type|argument_type|char_type|const_iterator|const_local_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|hasher|int_type|iterator|iterator_category|key_compare|key_equal|key_type|local_iterator|mapped_type|native_handle_type|off_type|period|pointer|pos_type|reference|rep|result_type|reverse_iterator|second_argument_type|size_type|time_point|traits_type|type|value_compare|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(allocator_type|argument_type|char_type|const_iterator|const_local_iterator|const_pointer|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|hasher|int_type|iterator|iterator_category|key_compare|key_equal|key_type|local_iterator|mapped_type|native_handle_type|off_type|period|pointer|pos_type|reference|rep|result_type|reverse_iterator|second_argument_type|size_type|time_point|traits_type|type|value_compare|value_type)$" diff --git a/include/xrpl/beast/clock/abstract_clock.h b/include/xrpl/beast/clock/abstract_clock.h index 6e23700730..da286522b5 100644 --- a/include/xrpl/beast/clock/abstract_clock.h +++ b/include/xrpl/beast/clock/abstract_clock.h @@ -9,7 +9,7 @@ namespace beast { * an instance of the class can be dependency injected, facilitating * unit tests where time may be controlled. * - * An abstract_clock inherits all the nested types of the Clock + * An AbstractClock inherits all the nested types of the Clock * template parameter. * * Example: @@ -18,9 +18,9 @@ namespace beast { * * struct Implementation * { - * using clock_type = abstract_clock ; - * clock_type& clock_; - * explicit Implementation (clock_type& clock) + * using ClockType = AbstractClock; + * ClockType& clock_; + * explicit Implementation(ClockType& clock) * : clock_(clock) * { * } @@ -39,7 +39,7 @@ public: using period = Clock::period; using duration = Clock::duration; using time_point = Clock::time_point; - using clock_type = Clock; + using ClockType = Clock; static bool const is_steady = Clock::is_steady; // NOLINT(readability-identifier-naming) diff --git a/include/xrpl/beast/container/aged_map.h b/include/xrpl/beast/container/aged_map.h index 20daab70a4..b9af889406 100644 --- a/include/xrpl/beast/container/aged_map.h +++ b/include/xrpl/beast/container/aged_map.h @@ -15,6 +15,6 @@ template < class Clock = std::chrono::steady_clock, class Compare = std::less, class Allocator = std::allocator>> -using aged_map = detail::AgedOrderedContainer; +using AgedMap = detail::AgedOrderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_multimap.h b/include/xrpl/beast/container/aged_multimap.h index f6133ced1c..709a0772f1 100644 --- a/include/xrpl/beast/container/aged_multimap.h +++ b/include/xrpl/beast/container/aged_multimap.h @@ -15,6 +15,6 @@ template < class Clock = std::chrono::steady_clock, class Compare = std::less, class Allocator = std::allocator>> -using aged_multimap = detail::AgedOrderedContainer; +using AgedMultimap = detail::AgedOrderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_multiset.h b/include/xrpl/beast/container/aged_multiset.h index c31afb8c26..8f8ab12dd6 100644 --- a/include/xrpl/beast/container/aged_multiset.h +++ b/include/xrpl/beast/container/aged_multiset.h @@ -13,7 +13,7 @@ template < class Clock = std::chrono::steady_clock, class Compare = std::less, class Allocator = std::allocator> -using aged_multiset = +using AgedMultiset = detail::AgedOrderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_set.h b/include/xrpl/beast/container/aged_set.h index 280572be79..f8e95cc093 100644 --- a/include/xrpl/beast/container/aged_set.h +++ b/include/xrpl/beast/container/aged_set.h @@ -13,6 +13,6 @@ template < class Clock = std::chrono::steady_clock, class Compare = std::less, class Allocator = std::allocator> -using aged_set = detail::AgedOrderedContainer; +using AgedSet = detail::AgedOrderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_unordered_map.h b/include/xrpl/beast/container/aged_unordered_map.h index d6ea6e97bd..a455822c6a 100644 --- a/include/xrpl/beast/container/aged_unordered_map.h +++ b/include/xrpl/beast/container/aged_unordered_map.h @@ -16,7 +16,7 @@ template < class Hash = std::hash, class KeyEqual = std::equal_to, class Allocator = std::allocator>> -using aged_unordered_map = +using AgedUnorderedMap = detail::AgedUnorderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_unordered_multimap.h b/include/xrpl/beast/container/aged_unordered_multimap.h index 3b72be98b7..90b338f677 100644 --- a/include/xrpl/beast/container/aged_unordered_multimap.h +++ b/include/xrpl/beast/container/aged_unordered_multimap.h @@ -16,7 +16,7 @@ template < class Hash = std::hash, class KeyEqual = std::equal_to, class Allocator = std::allocator>> -using aged_unordered_multimap = +using AgedUnorderedMultimap = detail::AgedUnorderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_unordered_multiset.h b/include/xrpl/beast/container/aged_unordered_multiset.h index a178c62544..465e212207 100644 --- a/include/xrpl/beast/container/aged_unordered_multiset.h +++ b/include/xrpl/beast/container/aged_unordered_multiset.h @@ -14,7 +14,7 @@ template < class Hash = std::hash, class KeyEqual = std::equal_to, class Allocator = std::allocator> -using aged_unordered_multiset = +using AgedUnorderedMultiset = detail::AgedUnorderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/aged_unordered_set.h b/include/xrpl/beast/container/aged_unordered_set.h index b37ec23e90..97460b9896 100644 --- a/include/xrpl/beast/container/aged_unordered_set.h +++ b/include/xrpl/beast/container/aged_unordered_set.h @@ -14,7 +14,7 @@ template < class Hash = std::hash, class KeyEqual = std::equal_to, class Allocator = std::allocator> -using aged_unordered_set = +using AgedUnorderedSet = detail::AgedUnorderedContainer; } // namespace beast diff --git a/include/xrpl/beast/container/detail/aged_container_iterator.h b/include/xrpl/beast/container/detail/aged_container_iterator.h index d6c061bb86..6d40022224 100644 --- a/include/xrpl/beast/container/detail/aged_container_iterator.h +++ b/include/xrpl/beast/container/detail/aged_container_iterator.h @@ -4,12 +4,7 @@ #include #include -namespace beast { - -template -class aged_ordered_container; - -namespace detail { +namespace beast::detail { // If Iterator is SCARY then this iterator will be as well. template @@ -144,6 +139,4 @@ private: Iterator iter_; }; -} // namespace detail - -} // namespace beast +} // namespace beast::detail diff --git a/include/xrpl/beast/container/detail/aged_ordered_container.h b/include/xrpl/beast/container/detail/aged_ordered_container.h index 9dd83d466b..ec1370f3dc 100644 --- a/include/xrpl/beast/container/detail/aged_ordered_container.h +++ b/include/xrpl/beast/container/detail/aged_ordered_container.h @@ -54,7 +54,7 @@ struct IsBoostReverseIterator> : std::tru * whose items expire after a certain amount of time. The chronological * iterators allow for fully customizable expiration strategies. * - * @see aged_set, aged_multiset, aged_map, aged_multimap + * @see AgedSet, AgedMultiset, AgedMap, AgedMultimap */ template < bool IsMulti, @@ -67,9 +67,9 @@ template < class AgedOrderedContainer { public: - using clock_type = AbstractClock; - using time_point = clock_type::time_point; - using duration = clock_type::duration; + using ClockType = AbstractClock; + using time_point = ClockType::time_point; + using duration = ClockType::duration; using key_type = Key; using mapped_type = T; using value_type = std::conditional_t, Key>; @@ -77,9 +77,9 @@ public: using difference_type = std::ptrdiff_t; // Introspection (for unit tests) - using is_unordered = std::false_type; - using is_multi = std::integral_constant; - using is_map = std::integral_constant; + using IsUnorderedType = std::false_type; + using IsMultiType = std::integral_constant; + using IsMapType = std::integral_constant; private: static Key const& @@ -127,8 +127,8 @@ private: class PairValueCompare : public Compare { public: - using first_argument = value_type; - using second_argument = value_type; + using FirstArgument = value_type; + using SecondArgument = value_type; using result_type = bool; bool @@ -156,8 +156,8 @@ private: class KeyValueCompare : public Compare { public: - using first_argument = Key; - using second_argument = Element; + using FirstArgument = Key; + using SecondArgument = Element; using result_type = bool; KeyValueCompare() = default; @@ -197,10 +197,10 @@ private: } }; - using list_type = + using ListType = boost::intrusive::make_list>::type; - using cont_type = std::conditional_t< + using ContType = std::conditional_t< IsMulti, typename boost::intrusive::make_multiset< Element, @@ -219,20 +219,20 @@ private: public beast::detail::EmptyBaseOptimization { public: - explicit ConfigT(clock_type& clock) : clock(clock) + explicit ConfigT(ClockType& clock) : clock(clock) { } - ConfigT(clock_type& clock, Compare const& comp) : KeyValueCompare(comp), clock(clock) + ConfigT(ClockType& clock, Compare const& comp) : KeyValueCompare(comp), clock(clock) { } - ConfigT(clock_type& clock, Allocator const& alloc) + ConfigT(ClockType& clock, Allocator const& alloc) : beast::detail::EmptyBaseOptimization(alloc), clock(clock) { } - ConfigT(clock_type& clock, Compare const& comp, Allocator const& alloc) + ConfigT(ClockType& clock, Compare const& comp, Allocator const& alloc) : KeyValueCompare(comp) , beast::detail::EmptyBaseOptimization(alloc) , clock(clock) @@ -328,7 +328,7 @@ private: return beast::detail::EmptyBaseOptimization::member(); } - std::reference_wrapper clock; + std::reference_wrapper clock; }; template @@ -383,12 +383,12 @@ public: // A set iterator (IsMap==false) is always const // because the elements of a set are immutable. - using iterator = beast::detail::AgedContainerIterator; - using const_iterator = beast::detail::AgedContainerIterator; + using iterator = beast::detail::AgedContainerIterator; + using const_iterator = beast::detail::AgedContainerIterator; using reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using const_reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; //-------------------------------------------------------------------------- // @@ -406,13 +406,13 @@ public: public: // A set iterator (IsMap==false) is always const // because the elements of a set are immutable. - using iterator = beast::detail::AgedContainerIterator; + using iterator = beast::detail::AgedContainerIterator; using const_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using const_reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; iterator begin() @@ -509,7 +509,7 @@ public: private: friend class AgedOrderedContainer; - list_type mutable list_; + ListType mutable list_; } chronological; //-------------------------------------------------------------------------- @@ -520,28 +520,28 @@ public: AgedOrderedContainer() = delete; - explicit AgedOrderedContainer(clock_type& clock); + explicit AgedOrderedContainer(ClockType& clock); - AgedOrderedContainer(clock_type& clock, Compare const& comp); + AgedOrderedContainer(ClockType& clock, Compare const& comp); - AgedOrderedContainer(clock_type& clock, Allocator const& alloc); + AgedOrderedContainer(ClockType& clock, Allocator const& alloc); - AgedOrderedContainer(clock_type& clock, Compare const& comp, Allocator const& alloc); + AgedOrderedContainer(ClockType& clock, Compare const& comp, Allocator const& alloc); template - AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock); + AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock); template - AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock, Compare const& comp); + AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock, Compare const& comp); template - AgedOrderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc); + AgedOrderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc); template AgedOrderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Compare const& comp, Allocator const& alloc); @@ -556,21 +556,21 @@ public: AgedOrderedContainer&& other, Allocator const& alloc); - AgedOrderedContainer(std::initializer_list init, clock_type& clock); + AgedOrderedContainer(std::initializer_list init, ClockType& clock); AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Compare const& comp); AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Allocator const& alloc); AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Compare const& comp, Allocator const& alloc); @@ -591,13 +591,13 @@ public: return config_.alloc(); } - clock_type& + ClockType& clock() { return config_.clock; } - clock_type const& + ClockType const& clock() const { return config_.clock; @@ -1121,7 +1121,7 @@ private: void touch( beast::detail::AgedContainerIterator pos, - clock_type::time_point const& now) + ClockType::time_point const& now) requires(!IsBoostReverseIterator::value); template < @@ -1138,21 +1138,21 @@ private: private: ConfigT config_; - cont_type mutable cont_; + ContType mutable cont_; }; //------------------------------------------------------------------------------ template AgedOrderedContainer::AgedOrderedContainer( - clock_type& clock) + ClockType& clock) : config_(clock) { } template AgedOrderedContainer::AgedOrderedContainer( - clock_type& clock, + ClockType& clock, Compare const& comp) : config_(clock, comp), cont_(comp) { @@ -1160,7 +1160,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( - clock_type& clock, + ClockType& clock, Allocator const& alloc) : config_(clock, alloc) { @@ -1168,7 +1168,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( - clock_type& clock, + ClockType& clock, Compare const& comp, Allocator const& alloc) : config_(clock, comp, alloc), cont_(comp) @@ -1180,7 +1180,7 @@ template AgedOrderedContainer::AgedOrderedContainer( InputIt first, InputIt last, - clock_type& clock) + ClockType& clock) : config_(clock) { insert(first, last); @@ -1191,7 +1191,7 @@ template AgedOrderedContainer::AgedOrderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Compare const& comp) : config_(clock, comp), cont_(comp) { @@ -1203,7 +1203,7 @@ template AgedOrderedContainer::AgedOrderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Allocator const& alloc) : config_(clock, alloc) { @@ -1215,7 +1215,7 @@ template AgedOrderedContainer::AgedOrderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Compare const& comp, Allocator const& alloc) : config_(clock, comp, alloc), cont_(comp) @@ -1261,7 +1261,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( std::initializer_list init, - clock_type& clock) + ClockType& clock) : config_(clock) { insert(init.begin(), init.end()); @@ -1270,7 +1270,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Compare const& comp) : config_(clock, comp), cont_(comp) { @@ -1280,7 +1280,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Allocator const& alloc) : config_(clock, alloc) { @@ -1290,7 +1290,7 @@ AgedOrderedContainer::AgedOrd template AgedOrderedContainer::AgedOrderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Compare const& comp, Allocator const& alloc) : config_(clock, comp, alloc), cont_(comp) @@ -1372,7 +1372,7 @@ std::conditional_t& AgedOrderedContainer::operator[](Key const& key) requires(MaybeMap && !MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d)); if (result.second) { @@ -1391,7 +1391,7 @@ std::conditional_t& AgedOrderedContainer::operator[](Key&& key) requires(MaybeMap && !MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check(key, std::cref(config_.keyCompare()), d)); if (result.second) { @@ -1426,7 +1426,7 @@ AgedOrderedContainer::insert( value_type const& value) -> std::pair requires(!MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d)); if (result.second) { @@ -1461,7 +1461,7 @@ AgedOrderedContainer::insert( -> std::pair requires(!MaybeMulti && !MaybeMap) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check(extract(value), std::cref(config_.keyCompare()), d)); if (result.second) { @@ -1499,7 +1499,7 @@ AgedOrderedContainer::insert( value_type const& value) -> iterator requires(!MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result( cont_.insert_check(hint.iterator(), extract(value), std::cref(config_.keyCompare()), d)); if (result.second) @@ -1521,7 +1521,7 @@ AgedOrderedContainer::insert( value_type&& value) -> iterator requires(!MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result( cont_.insert_check(hint.iterator(), extract(value), std::cref(config_.keyCompare()), d)); if (result.second) @@ -1545,7 +1545,7 @@ AgedOrderedContainer::emplace // VFALCO NOTE Its unfortunate that we need to // construct element here Element* const p(newElement(std::forward(args)...)); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check(extract(p->value), std::cref(config_.keyCompare()), d)); if (result.second) { @@ -1584,7 +1584,7 @@ AgedOrderedContainer::emplace // VFALCO NOTE Its unfortunate that we need to // construct element here Element* const p(newElement(std::forward(args)...)); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result( cont_.insert_check(hint.iterator(), extract(p->value), std::cref(config_.keyCompare()), d)); if (result.second) @@ -1721,7 +1721,7 @@ template void AgedOrderedContainer::touch( beast::detail::AgedContainerIterator pos, - clock_type::time_point const& now) + ClockType::time_point const& now) requires(!IsBoostReverseIterator::value) { auto& e(*pos.iterator()); diff --git a/include/xrpl/beast/container/detail/aged_unordered_container.h b/include/xrpl/beast/container/detail/aged_unordered_container.h index ea271feed0..8cf06cdb00 100644 --- a/include/xrpl/beast/container/detail/aged_unordered_container.h +++ b/include/xrpl/beast/container/detail/aged_unordered_container.h @@ -59,8 +59,8 @@ namespace detail { * whose items expire after a certain amount of time. The chronological * iterators allow for fully customizable expiration strategies. * - * @see aged_unordered_set, aged_unordered_multiset - * @see aged_unordered_map, aged_unordered_multimap + * @see AgedUnorderedSet, AgedUnorderedMultiset + * @see AgedUnorderedMap, AgedUnorderedMultimap */ template < bool IsMulti, @@ -74,9 +74,9 @@ template < class AgedUnorderedContainer { public: - using clock_type = AbstractClock; - using time_point = clock_type::time_point; - using duration = clock_type::duration; + using ClockType = AbstractClock; + using time_point = ClockType::time_point; + using duration = ClockType::duration; using key_type = Key; using mapped_type = T; using value_type = std::conditional_t, Key>; @@ -84,9 +84,9 @@ public: using difference_type = std::ptrdiff_t; // Introspection (for unit tests) - using is_unordered = std::true_type; - using is_multi = std::integral_constant; - using is_map = std::integral_constant; + using IsUnorderedType = std::true_type; + using IsMultiType = std::integral_constant; + using IsMapType = std::integral_constant; private: static Key const& @@ -208,10 +208,10 @@ private: } }; - using list_type = + using ListType = boost::intrusive::make_list>::type; - using cont_type = std::conditional_t< + using ContType = std::conditional_t< IsMulti, typename boost::intrusive::make_unordered_multiset< Element, @@ -226,8 +226,8 @@ private: boost::intrusive::equal, boost::intrusive::cache_begin>::type>; - using bucket_type = cont_type::bucket_type; - using bucket_traits = cont_type::bucket_traits; + using BucketType = ContType::bucket_type; + using BucketTraits = ContType::bucket_traits; using ElementAllocator = std::allocator_traits::template rebind_alloc; @@ -242,36 +242,36 @@ private: private beast::detail::EmptyBaseOptimization { public: - explicit ConfigT(clock_type& clock) : clock(clock) + explicit ConfigT(ClockType& clock) : clock(clock) { } - ConfigT(clock_type& clock, Hash const& hash) : ValueHash(hash), clock(clock) + ConfigT(ClockType& clock, Hash const& hash) : ValueHash(hash), clock(clock) { } - ConfigT(clock_type& clock, KeyEqual const& keyEqual) : KeyValueEqual(keyEqual), clock(clock) + ConfigT(ClockType& clock, KeyEqual const& keyEqual) : KeyValueEqual(keyEqual), clock(clock) { } - ConfigT(clock_type& clock, Allocator const& alloc) + ConfigT(ClockType& clock, Allocator const& alloc) : beast::detail::EmptyBaseOptimization(alloc), clock(clock) { } - ConfigT(clock_type& clock, Hash const& hash, KeyEqual const& keyEqual) + ConfigT(ClockType& clock, Hash const& hash, KeyEqual const& keyEqual) : ValueHash(hash), KeyValueEqual(keyEqual), clock(clock) { } - ConfigT(clock_type& clock, Hash const& hash, Allocator const& alloc) + ConfigT(ClockType& clock, Hash const& hash, Allocator const& alloc) : ValueHash(hash) , beast::detail::EmptyBaseOptimization(alloc) , clock(clock) { } - ConfigT(clock_type& clock, KeyEqual const& keyEqual, Allocator const& alloc) + ConfigT(ClockType& clock, KeyEqual const& keyEqual, Allocator const& alloc) : KeyValueEqual(keyEqual) , beast::detail::EmptyBaseOptimization(alloc) , clock(clock) @@ -279,7 +279,7 @@ private: } ConfigT( - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEqual, Allocator const& alloc) @@ -405,29 +405,29 @@ private: return beast::detail::EmptyBaseOptimization::member(); } - std::reference_wrapper clock; + std::reference_wrapper clock; }; class Buckets { public: - using vec_type = std::vector< - bucket_type, - typename std::allocator_traits::template rebind_alloc>; + using VecType = std::vector< + BucketType, + typename std::allocator_traits::template rebind_alloc>; Buckets() : maxLoadFactor_(1.f), vec_() { - vec_.resize(cont_type::suggested_upper_bucket_count(0)); + vec_.resize(ContType::suggested_upper_bucket_count(0)); } Buckets(Allocator const& alloc) : maxLoadFactor_(1.f), vec_(alloc) { - vec_.resize(cont_type::suggested_upper_bucket_count(0)); + vec_.resize(ContType::suggested_upper_bucket_count(0)); } - operator bucket_traits() + operator BucketTraits() { - return bucket_traits(&vec_[0], vec_.size()); + return BucketTraits(&vec_[0], vec_.size()); } void @@ -466,10 +466,10 @@ private: { // Need two vectors otherwise we // will destroy non-empty buckets. - vec_type vec(vec_.get_allocator()); + VecType vec(vec_.get_allocator()); std::swap(vec_, vec); vec_.resize(count); - c.rehash(bucket_traits(&vec_[0], vec_.size())); + c.rehash(BucketTraits(&vec_[0], vec_.size())); return; } // Rehash in place. @@ -478,12 +478,12 @@ private: // This should not reallocate since // we checked capacity earlier. vec_.resize(count); - c.rehash(bucket_traits(&vec_[0], count)); + c.rehash(BucketTraits(&vec_[0], count)); return; } // Resize must happen after rehash otherwise // we might destroy non-empty buckets. - c.rehash(bucket_traits(&vec_[0], count)); + c.rehash(BucketTraits(&vec_[0], count)); vec_.resize(count); } @@ -492,13 +492,13 @@ private: void resize(size_type n, Container& c) { - size_type const suggested(cont_type::suggested_upper_bucket_count(n)); + size_type const suggested(ContType::suggested_upper_bucket_count(n)); rehash(suggested, c); } private: float maxLoadFactor_; - vec_type vec_; + VecType vec_; }; template @@ -553,13 +553,13 @@ public: // A set iterator (IsMap==false) is always const // because the elements of a set are immutable. - using iterator = beast::detail::AgedContainerIterator; - using const_iterator = beast::detail::AgedContainerIterator; + using iterator = beast::detail::AgedContainerIterator; + using const_iterator = beast::detail::AgedContainerIterator; using local_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using const_local_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; //-------------------------------------------------------------------------- // @@ -575,13 +575,13 @@ public: public: // A set iterator (IsMap==false) is always const // because the elements of a set are immutable. - using iterator = beast::detail::AgedContainerIterator; + using iterator = beast::detail::AgedContainerIterator; using const_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; using const_reverse_iterator = - beast::detail::AgedContainerIterator; + beast::detail::AgedContainerIterator; iterator begin() @@ -679,7 +679,7 @@ public: private: friend class AgedUnorderedContainer; - list_type mutable list_; + ListType mutable list_; } chronological; //-------------------------------------------------------------------------- @@ -690,43 +690,43 @@ public: AgedUnorderedContainer() = delete; - explicit AgedUnorderedContainer(clock_type& clock); + explicit AgedUnorderedContainer(ClockType& clock); - AgedUnorderedContainer(clock_type& clock, Hash const& hash); + AgedUnorderedContainer(ClockType& clock, Hash const& hash); - AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq); + AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq); - AgedUnorderedContainer(clock_type& clock, Allocator const& alloc); + AgedUnorderedContainer(ClockType& clock, Allocator const& alloc); - AgedUnorderedContainer(clock_type& clock, Hash const& hash, KeyEqual const& keyEq); + AgedUnorderedContainer(ClockType& clock, Hash const& hash, KeyEqual const& keyEq); - AgedUnorderedContainer(clock_type& clock, Hash const& hash, Allocator const& alloc); + AgedUnorderedContainer(ClockType& clock, Hash const& hash, Allocator const& alloc); - AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq, Allocator const& alloc); + AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc); AgedUnorderedContainer( - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc); template - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock); + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock); template - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Hash const& hash); + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Hash const& hash); template - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, KeyEqual const& keyEq); + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, KeyEqual const& keyEq); template - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc); + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc); template AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq); @@ -734,7 +734,7 @@ public: AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, Allocator const& alloc); @@ -742,7 +742,7 @@ public: AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc); @@ -750,7 +750,7 @@ public: AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc); @@ -766,44 +766,44 @@ public: AgedUnorderedContainer&& other, Allocator const& alloc); - AgedUnorderedContainer(std::initializer_list init, clock_type& clock); + AgedUnorderedContainer(std::initializer_list init, ClockType& clock); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Allocator const& alloc); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, Allocator const& alloc); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc); AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc); @@ -825,13 +825,13 @@ public: return config_.alloc(); } - clock_type& + ClockType& clock() { return config_.clock; } - clock_type const& + ClockType const& clock() const { return config_.clock; @@ -1399,7 +1399,7 @@ private: void touch( beast::detail::AgedContainerIterator pos, - clock_type::time_point const& now) + ClockType::time_point const& now) { auto& e(*pos.iterator()); e.when = now; @@ -1433,7 +1433,7 @@ private: private: ConfigT config_; Buckets buck_; - cont_type mutable cont_; + ContType mutable cont_; }; //------------------------------------------------------------------------------ @@ -1448,7 +1448,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock) + AgedUnorderedContainer(ClockType& clock) : config_(clock) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1464,7 +1464,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, Hash const& hash) + AgedUnorderedContainer(ClockType& clock, Hash const& hash) : config_(clock, hash) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1480,7 +1480,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq) + AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq) : config_(clock, keyEq) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1496,7 +1496,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, Allocator const& alloc) + AgedUnorderedContainer(ClockType& clock, Allocator const& alloc) : config_(clock, alloc) , buck_(alloc) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1513,7 +1513,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, Hash const& hash, KeyEqual const& keyEq) + AgedUnorderedContainer(ClockType& clock, Hash const& hash, KeyEqual const& keyEq) : config_(clock, hash, keyEq) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1529,7 +1529,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, Hash const& hash, Allocator const& alloc) + AgedUnorderedContainer(ClockType& clock, Hash const& hash, Allocator const& alloc) : config_(clock, hash, alloc) , buck_(alloc) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1546,7 +1546,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(clock_type& clock, KeyEqual const& keyEq, Allocator const& alloc) + AgedUnorderedContainer(ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc) : config_(clock, keyEq, alloc) , buck_(alloc) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1564,7 +1564,7 @@ template < class Allocator> AgedUnorderedContainer:: AgedUnorderedContainer( - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc) @@ -1585,7 +1585,7 @@ template < class Allocator> template AgedUnorderedContainer:: - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock) + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock) : config_(clock) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1603,7 +1603,7 @@ template < class Allocator> template AgedUnorderedContainer:: - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Hash const& hash) + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Hash const& hash) : config_(clock, hash) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1621,7 +1621,7 @@ template < class Allocator> template AgedUnorderedContainer:: - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, KeyEqual const& keyEq) + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, KeyEqual const& keyEq) : config_(clock, keyEq) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1639,7 +1639,7 @@ template < class Allocator> template AgedUnorderedContainer:: - AgedUnorderedContainer(InputIt first, InputIt last, clock_type& clock, Allocator const& alloc) + AgedUnorderedContainer(InputIt first, InputIt last, ClockType& clock, Allocator const& alloc) : config_(clock, alloc) , buck_(alloc) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1661,7 +1661,7 @@ AgedUnorderedContainer AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq) : config_(clock, hash, keyEq) @@ -1684,7 +1684,7 @@ AgedUnorderedContainer AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, Allocator const& alloc) : config_(clock, hash, alloc) @@ -1708,7 +1708,7 @@ AgedUnorderedContainer AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc) : config_(clock, keyEq, alloc) @@ -1732,7 +1732,7 @@ AgedUnorderedContainer AgedUnorderedContainer( InputIt first, InputIt last, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc) @@ -1829,7 +1829,7 @@ template < class KeyEqual, class Allocator> AgedUnorderedContainer:: - AgedUnorderedContainer(std::initializer_list init, clock_type& clock) + AgedUnorderedContainer(std::initializer_list init, ClockType& clock) : config_(clock) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) { @@ -1848,7 +1848,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash) : config_(clock, hash) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1868,7 +1868,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq) : config_(clock, keyEq) , cont_(buck_, std::cref(config_.valueHash()), std::cref(config_.keyValueEqual())) @@ -1888,7 +1888,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Allocator const& alloc) : config_(clock, alloc) , buck_(alloc) @@ -1909,7 +1909,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq) : config_(clock, hash, keyEq) @@ -1930,7 +1930,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, Allocator const& alloc) : config_(clock, hash, alloc) @@ -1952,7 +1952,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, KeyEqual const& keyEq, Allocator const& alloc) : config_(clock, keyEq, alloc) @@ -1974,7 +1974,7 @@ template < AgedUnorderedContainer:: AgedUnorderedContainer( std::initializer_list init, - clock_type& clock, + ClockType& clock, Hash const& hash, KeyEqual const& keyEq, Allocator const& alloc) @@ -2127,7 +2127,7 @@ AgedUnorderedContainer requires(MaybeMap && !MaybeMulti) { maybeRehash(1); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( key, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d)); if (result.second) @@ -2157,7 +2157,7 @@ AgedUnorderedContainer requires(MaybeMap && !MaybeMulti) { maybeRehash(1); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( key, std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d)); if (result.second) @@ -2211,7 +2211,7 @@ AgedUnorderedContainer requires(!MaybeMulti) { maybeRehash(1); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d)); if (result.second) @@ -2264,7 +2264,7 @@ AgedUnorderedContainer requires(!MaybeMulti && !MaybeMap) { maybeRehash(1); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d)); if (result.second) @@ -2374,7 +2374,7 @@ AgedUnorderedContainer // VFALCO NOTE Its unfortunate that we need to // construct element here Element* const p(newElement(std::forward(args)...)); - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( extract(p->value), std::cref(config_.hashFunction()), @@ -2611,7 +2611,7 @@ AgedUnorderedContainer value_type const& value) -> std::pair requires(!MaybeMulti) { - typename cont_type::insert_commit_data d; + typename ContType::insert_commit_data d; auto const result(cont_.insert_check( extract(value), std::cref(config_.hashFunction()), std::cref(config_.keyValueEqual()), d)); if (result.second) diff --git a/include/xrpl/beast/insight/Collector.h b/include/xrpl/beast/insight/Collector.h index 9da2a8bb74..25e3b37141 100644 --- a/include/xrpl/beast/insight/Collector.h +++ b/include/xrpl/beast/insight/Collector.h @@ -26,7 +26,7 @@ namespace beast::insight { class Collector { public: - using ptr = std::shared_ptr; + using Ptr = std::shared_ptr; virtual ~Collector() = 0; diff --git a/include/xrpl/beast/insight/Group.h b/include/xrpl/beast/insight/Group.h index ecf7709546..41f55c704e 100644 --- a/include/xrpl/beast/insight/Group.h +++ b/include/xrpl/beast/insight/Group.h @@ -13,7 +13,7 @@ namespace beast::insight { class Group : public Collector { public: - using ptr = std::shared_ptr; + using Ptr = std::shared_ptr; /** * Returns the name of this group, for diagnostics. diff --git a/include/xrpl/beast/insight/Groups.h b/include/xrpl/beast/insight/Groups.h index 77fc2d3336..8f661e3b68 100644 --- a/include/xrpl/beast/insight/Groups.h +++ b/include/xrpl/beast/insight/Groups.h @@ -20,10 +20,10 @@ public: * Find or create a new collector with a given name. */ /** @{ */ - virtual Group::ptr const& + virtual Group::Ptr const& get(std::string const& name) = 0; - Group::ptr const& + Group::Ptr const& operator[](std::string const& name) { return get(name); @@ -35,6 +35,6 @@ public: * Create a group container that uses the specified collector. */ std::unique_ptr -makeGroups(Collector::ptr const& collector); +makeGroups(Collector::Ptr const& collector); } // namespace beast::insight diff --git a/include/xrpl/beast/rfc2616.h b/include/xrpl/beast/rfc2616.h index 87d63b0260..9b1518cf10 100644 --- a/include/xrpl/beast/rfc2616.h +++ b/include/xrpl/beast/rfc2616.h @@ -108,12 +108,12 @@ Result split(FwdIt first, FwdIt last, Char delim) { using namespace detail; - using string = Result::value_type; + using String = Result::value_type; Result result; FwdIt iter = first; - string e; + String e; while (iter != last) { if (*iter == '"') @@ -205,10 +205,10 @@ splitCommas(std::string_view s) */ class ListIterator { - using iter_type = boost::string_ref::const_iterator; + using IterType = boost::string_ref::const_iterator; - iter_type it_; - iter_type end_; + IterType it_; + IterType end_; boost::string_ref value_; public: @@ -218,7 +218,7 @@ public: using difference_type = std::ptrdiff_t; using iterator_category = std::forward_iterator_tag; - ListIterator(iter_type begin, iter_type end) : it_(begin), end_(end) + ListIterator(IterType begin, IterType end) : it_(begin), end_(end) { if (it_ != end_) increment(); diff --git a/include/xrpl/beast/test/yield_to.h b/include/xrpl/beast/test/yield_to.h index b3aa482dd5..b730354eef 100644 --- a/include/xrpl/beast/test/yield_to.h +++ b/include/xrpl/beast/test/yield_to.h @@ -42,7 +42,7 @@ public: /** * The type of yield context passed to functions. */ - using yield_context = boost::asio::yield_context; + using YieldContext = boost::asio::yield_context; explicit EnableYieldTo(std::size_t concurrency = 1) : work_(boost::asio::make_work_guard(ios_)) { @@ -120,7 +120,7 @@ EnableYieldTo::spawn(F0&& f, FN&&... fn) ios_, boost::allocator_arg, boost::context::fixedsize_stack(2 * 1024 * 1024), - [&](yield_context yield) { + [&](YieldContext yield) { f(yield); std::scoped_lock const lock{m_}; if (--running_ == 0) diff --git a/include/xrpl/beast/unit_test/detail/const_container.h b/include/xrpl/beast/unit_test/detail/const_container.h index 9f4646cbdb..eca8f076fc 100644 --- a/include/xrpl/beast/unit_test/detail/const_container.h +++ b/include/xrpl/beast/unit_test/detail/const_container.h @@ -15,29 +15,29 @@ template class ConstContainer { private: - using cont_type = Container; + using ContType = Container; - cont_type cont_; + ContType cont_; protected: - cont_type& + ContType& cont() { return cont_; } - [[nodiscard]] cont_type const& + [[nodiscard]] ContType const& cont() const { return cont_; } public: - using value_type = cont_type::value_type; - using size_type = cont_type::size_type; - using difference_type = cont_type::difference_type; - using iterator = cont_type::const_iterator; - using const_iterator = cont_type::const_iterator; + using value_type = ContType::value_type; + using size_type = ContType::size_type; + using difference_type = ContType::difference_type; + using iterator = ContType::const_iterator; + using const_iterator = ContType::const_iterator; /** * Returns `true` if the container is empty. diff --git a/include/xrpl/beast/unit_test/reporter.h b/include/xrpl/beast/unit_test/reporter.h index cbd1c7e70d..9fb656a37c 100644 --- a/include/xrpl/beast/unit_test/reporter.h +++ b/include/xrpl/beast/unit_test/reporter.h @@ -32,7 +32,7 @@ template class Reporter : public Runner { private: - using clock_type = std::chrono::steady_clock; + using ClockType = std::chrono::steady_clock; struct CaseResults { @@ -51,7 +51,7 @@ private: std::size_t cases = 0; std::size_t total = 0; std::size_t failed = 0; - clock_type::time_point start = clock_type::now(); + ClockType::time_point start = ClockType::now(); explicit SuiteResults(std::string name = "") : name(std::move(name)) { @@ -63,7 +63,7 @@ private: struct Results { - using run_time = std::pair; + using RunTime = std::pair; static constexpr auto kMaxTop = 10; @@ -71,8 +71,8 @@ private: std::size_t cases = 0; std::size_t total = 0; std::size_t failed = 0; - std::vector top; - clock_type::time_point start = clock_type::now(); + std::vector top; + ClockType::time_point start = ClockType::now(); void add(SuiteResults const& r); @@ -94,7 +94,7 @@ public: private: static std::string - fmtdur(clock_type::duration const& d); + fmtdur(ClockType::duration const& d); void onSuiteBegin(SuiteInfo const& info) override; @@ -137,14 +137,13 @@ Reporter::Results::add(SuiteResults const& r) total += r.total; cases += r.cases; failed += r.failed; - auto const elapsed = clock_type::now() - r.start; + auto const elapsed = ClockType::now() - r.start; if (elapsed >= std::chrono::seconds{1}) { auto const iter = std::lower_bound( - top.begin(), - top.end(), - elapsed, - [](run_time const& t1, clock_type::duration const& t2) { return t1.second > t2; }); + top.begin(), top.end(), elapsed, [](RunTime const& t1, ClockType::duration const& t2) { + return t1.second > t2; + }); if (iter != top.end()) { if (top.size() == kMaxTop) @@ -174,7 +173,7 @@ Reporter::~Reporter() for (auto const& i : results_.top) os_ << std::setw(8) << fmtdur(i.second) << " " << i.first << '\n'; } - auto const elapsed = clock_type::now() - results_.start; + auto const elapsed = ClockType::now() - results_.start; os_ << fmtdur(elapsed) << ", " << Amount{results_.suites, "suite"} << ", " << Amount{results_.cases, "case"} << ", " << Amount{results_.total, "test"} << " total, " << Amount{results_.failed, "failure"} << std::endl; @@ -182,7 +181,7 @@ Reporter::~Reporter() template std::string -Reporter::fmtdur(clock_type::duration const& d) +Reporter::fmtdur(ClockType::duration const& d) { using namespace std::chrono; auto const ms = duration_cast(d); @@ -249,6 +248,10 @@ Reporter::onLog(std::string const& s) } // namespace detail -using reporter = detail::Reporter<>; +using Reporter = detail::Reporter<>; + +// TODO [#8340]: Legacy name still used by external consumers of libxrpl (e.g. validator-keys-tool). +// Do not use in new code; remove once those consumers have migrated. +using reporter = Reporter; // NOLINT(readability-identifier-naming) } // namespace beast::unit_test diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index 2b06fb4e05..29e422c55e 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -643,12 +643,12 @@ Suite::run(Runner& r) * Library Identifies the library. * * The declaration for the class implementing the test should be the same - * as Class ## _test. For example, if Class is aged_ordered_container, the + * as Class ## _test. For example, if Class is AgedOrderedContainer, the * test class must be declared as: * * @code * - * struct aged_ordered_container_test : beast::unit_test::suite + * struct AgedOrderedContainer_test : beast::unit_test::suite * { * //... * }; diff --git a/include/xrpl/beast/unit_test/suite_info.h b/include/xrpl/beast/unit_test/suite_info.h index c4e3496f13..978289bf58 100644 --- a/include/xrpl/beast/unit_test/suite_info.h +++ b/include/xrpl/beast/unit_test/suite_info.h @@ -18,14 +18,14 @@ class Runner; */ class SuiteInfo { - using run_type = std::function; + using RunType = std::function; std::string name_; std::string module_; std::string library_; bool manual_; int priority_; - run_type run_; + RunType run_; public: SuiteInfo( @@ -34,7 +34,7 @@ public: std::string library, bool manual, int priority, - run_type run) + RunType run) : name_(std::move(name)) , module_(std::move(module)) , library_(std::move(library)) diff --git a/include/xrpl/beast/unit_test/thread.h b/include/xrpl/beast/unit_test/thread.h index 5a5a99d149..acd9f15900 100644 --- a/include/xrpl/beast/unit_test/thread.h +++ b/include/xrpl/beast/unit_test/thread.h @@ -24,7 +24,7 @@ private: std::thread t_; public: - using id = std::thread::id; + using Id = std::thread::id; using native_handle_type = std::thread::native_handle_type; Thread() = default; diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 9f0a1ead66..315dd60324 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -471,7 +471,7 @@ public: } }; -using logstream = BasicLogstream; -using logwstream = BasicLogstream; +using LogStream = BasicLogstream; +using LogWStream = BasicLogstream; } // namespace beast diff --git a/include/xrpl/beast/utility/maybe_const.h b/include/xrpl/beast/utility/maybe_const.h index 848ea86cb2..d05795f41c 100644 --- a/include/xrpl/beast/utility/maybe_const.h +++ b/include/xrpl/beast/utility/maybe_const.h @@ -19,6 +19,6 @@ struct MaybeConst * Alias for omitting `typename`. */ template -using maybe_const_t = MaybeConst::type; +using MaybeConstT = MaybeConst::type; } // namespace beast diff --git a/include/xrpl/beast/xor_shift_engine.h b/include/xrpl/beast/xor_shift_engine.h index 6a7272c195..9ea8b564ae 100644 --- a/include/xrpl/beast/xor_shift_engine.h +++ b/include/xrpl/beast/xor_shift_engine.h @@ -94,6 +94,6 @@ XorShiftEngine::murmurhash3(result_type x) -> result_type * http://xorshift.di.unimi.it/xorshift128plus.c * does not accept seed==0 */ -using xor_shift_engine = detail::XorShiftEngine<>; +using XorShiftEngine = detail::XorShiftEngine<>; } // namespace beast diff --git a/include/xrpl/conditions/detail/PreimageSha256.h b/include/xrpl/conditions/detail/PreimageSha256.h index 007588a0b5..29bb7fe50a 100644 --- a/include/xrpl/conditions/detail/PreimageSha256.h +++ b/include/xrpl/conditions/detail/PreimageSha256.h @@ -105,9 +105,9 @@ public: [[nodiscard]] Buffer fingerprint() const override { - sha256_hasher h; + Sha256Hasher h; h(payload_.data(), payload_.size()); - auto const d = static_cast(h); + auto const d = static_cast(h); return {d.data(), d.size()}; } diff --git a/include/xrpl/consensus/Consensus.h b/include/xrpl/consensus/Consensus.h index 4c48e7f268..fe6f3e4f42 100644 --- a/include/xrpl/consensus/Consensus.h +++ b/include/xrpl/consensus/Consensus.h @@ -288,12 +288,12 @@ checkConsensus( template class Consensus { - using Ledger_t = Adaptor::Ledger_t; - using TxSet_t = Adaptor::TxSet_t; - using NodeID_t = Adaptor::NodeID_t; - using Tx_t = TxSet_t::Tx; - using PeerPosition_t = Adaptor::PeerPosition_t; - using Proposal_t = ConsensusProposal; + using LedgerT = Adaptor::LedgerT; + using TxSetT = Adaptor::TxSetT; + using NodeIDT = Adaptor::NodeIDT; + using TxT = TxSetT::Tx; + using PeerPositionT = Adaptor::PeerPositionT; + using ProposalT = ConsensusProposal; using Result = ConsensusResult; @@ -325,7 +325,7 @@ public: /** * Clock type for measuring time within the consensus code */ - using clock_type = beast::AbstractClock; + using ClockType = beast::AbstractClock; Consensus(Consensus&&) noexcept = default; @@ -336,7 +336,7 @@ public: * @param adaptor The instance of the adaptor class * @param j The journal to log debug output */ - Consensus(clock_type const& clock, Adaptor& adaptor, beast::Journal j); + Consensus(ClockType const& clock, Adaptor& adaptor, beast::Journal j); /** * Kick-off the next round of consensus. @@ -357,9 +357,9 @@ public: void startRound( NetClock::time_point const& now, - Ledger_t::ID const& prevLedgerID, - Ledger_t prevLedger, - hash_set const& nowUntrusted, + LedgerT::ID const& prevLedgerID, + LedgerT prevLedger, + HashSet const& nowUntrusted, bool proposing, std::unique_ptr const& clog = {}); @@ -371,7 +371,7 @@ public: * @return Whether we should do delayed relay of this proposal. */ bool - peerProposal(NetClock::time_point const& now, PeerPosition_t const& newProposal); + peerProposal(NetClock::time_point const& now, PeerPositionT const& newProposal); /** * Call periodically to drive consensus forward. @@ -391,7 +391,7 @@ public: * @param txSet the transaction set */ void - gotTxSet(NetClock::time_point const& now, TxSet_t const& txSet); + gotTxSet(NetClock::time_point const& now, TxSetT const& txSet); /** * Simulate the consensus process without any network traffic. @@ -423,7 +423,7 @@ public: * * @return ID of previous ledger */ - Ledger_t::ID + LedgerT::ID prevLedgerID() const { return prevLedgerID_; @@ -450,14 +450,14 @@ private: void startRoundInternal( NetClock::time_point const& now, - Ledger_t::ID const& prevLedgerID, - Ledger_t const& prevLedger, + LedgerT::ID const& prevLedgerID, + LedgerT const& prevLedger, ConsensusMode mode, std::unique_ptr const& clog); // Change our view of the previous ledger void - handleWrongLedger(Ledger_t::ID const& lgrId, std::unique_ptr const& clog); + handleWrongLedger(LedgerT::ID const& lgrId, std::unique_ptr const& clog); /** * Check if our previous ledger matches the network's. @@ -479,7 +479,7 @@ private: * Handle a replayed or a new peer proposal. */ bool - peerProposalInternal(NetClock::time_point const& now, PeerPosition_t const& newProposal); + peerProposalInternal(NetClock::time_point const& now, PeerPositionT const& newProposal); /** * Handle pre-close phase. @@ -542,12 +542,12 @@ private: // Create disputes between our position and the provided one. void - createDisputes(TxSet_t const& o, std::unique_ptr const& clog = {}); + createDisputes(TxSetT const& o, std::unique_ptr const& clog = {}); // Update our disputes given that this node has adopted a new position. // Will call createDisputes as needed. void - updateDisputes(NodeID_t const& node, TxSet_t const& other); + updateDisputes(NodeIDT const& node, TxSetT const& other); // Revoke our outstanding proposal, if any, and cease proposing // until this round ends. @@ -566,7 +566,7 @@ private: bool firstRound_ = true; bool haveCloseTimeConsensus_ = false; - clock_type const& clock_; + ClockType const& clock_; // How long the consensus convergence has taken, expressed as // a percentage of the time that we expected it to take. @@ -594,12 +594,12 @@ private: // Non-peer (self) consensus data // Last validated ledger ID provided to consensus - Ledger_t::ID prevLedgerID_; + LedgerT::ID prevLedgerID_; // Last validated ledger seen by consensus - Ledger_t previousLedger_; + LedgerT previousLedger_; // Transaction Sets, indexed by hash of transaction tree - hash_map acquired_; + HashMap acquired_; std::optional result_; ConsensusCloseTimes rawCloseTimes_; @@ -615,24 +615,24 @@ private: // Peer related consensus data // Peer proposed positions for the current round - hash_map currPeerPositions_; + HashMap currPeerPositions_; // Recently received peer positions, available when transitioning between // ledgers or rounds - hash_map> recentPeerPositions_; + HashMap> recentPeerPositions_; // The number of proposers who participated in the last consensus round std::size_t prevProposers_ = 0; // nodes that have bowed out of this consensus process - hash_set deadNodes_; + HashSet deadNodes_; // Journal for debugging beast::Journal const j_; }; template -Consensus::Consensus(clock_type const& clock, Adaptor& adaptor, beast::Journal journal) +Consensus::Consensus(ClockType const& clock, Adaptor& adaptor, beast::Journal journal) : adaptor_(adaptor), clock_(clock), j_{journal} { JLOG(j_.debug()) << "Creating consensus object"; @@ -642,9 +642,9 @@ template void Consensus::startRound( NetClock::time_point const& now, - Ledger_t::ID const& prevLedgerID, - Ledger_t prevLedger, - hash_set const& nowUntrusted, + LedgerT::ID const& prevLedgerID, + LedgerT prevLedger, + HashSet const& nowUntrusted, bool proposing, std::unique_ptr const& clog) { @@ -660,7 +660,7 @@ Consensus::startRound( prevCloseTime_ = rawCloseTimes_.self; } - for (NodeID_t const& n : nowUntrusted) + for (NodeIDT const& n : nowUntrusted) recentPeerPositions_.erase(n); ConsensusMode startMode = proposing ? ConsensusMode::Proposing : ConsensusMode::Observing; @@ -687,8 +687,8 @@ template void Consensus::startRoundInternal( NetClock::time_point const& now, - Ledger_t::ID const& prevLedgerID, - Ledger_t const& prevLedger, + LedgerT::ID const& prevLedgerID, + LedgerT const& prevLedger, ConsensusMode mode, std::unique_ptr const& clog) { @@ -715,7 +715,7 @@ Consensus::startRoundInternal( closeResolution_ = getNextLedgerTimeResolution( previousLedger_.closeTimeResolution(), previousLedger_.closeAgree(), - previousLedger_.seq() + typename Ledger_t::Seq{1}); + previousLedger_.seq() + typename LedgerT::Seq{1}); playbackProposals(); CLOG(clog) << "number of peer proposals,previous proposers: " << currPeerPositions_.size() @@ -731,7 +731,7 @@ Consensus::startRoundInternal( template bool -Consensus::peerProposal(NetClock::time_point const& now, PeerPosition_t const& newPeerPos) +Consensus::peerProposal(NetClock::time_point const& now, PeerPositionT const& newPeerPos) { JLOG(j_.debug()) << "PROPOSAL " << newPeerPos.render(); auto const& peerID = newPeerPos.proposal().nodeID(); @@ -752,7 +752,7 @@ template bool Consensus::peerProposalInternal( NetClock::time_point const& now, - PeerPosition_t const& newPeerPos) + PeerPositionT const& newPeerPos) { // Nothing to do for now if we are currently working on a ledger if (phase_ == ConsensusPhase::Accepted) @@ -889,7 +889,7 @@ Consensus::timerEntry( template void -Consensus::gotTxSet(NetClock::time_point const& now, TxSet_t const& txSet) +Consensus::gotTxSet(NetClock::time_point const& now, TxSetT const& txSet) { // Nothing to do if we've finished work on a ledger if (phase_ == ConsensusPhase::Accepted) @@ -1053,7 +1053,7 @@ Consensus::getJson(bool full) const template void Consensus::handleWrongLedger( - Ledger_t::ID const& lgrId, + LedgerT::ID const& lgrId, std::unique_ptr const& clog) { CLOG(clog) << "handleWrongLedger. "; @@ -1491,11 +1491,11 @@ Consensus::updateOurPositions(std::unique_ptr const& auto it = currPeerPositions_.begin(); while (it != currPeerPositions_.end()) { - Proposal_t const& peerProp = it->second.proposal(); + ProposalT const& peerProp = it->second.proposal(); if (peerProp.isStale(peerCutoff)) { // peer's proposal is stale, so remove it - NodeID_t const& peerID = peerProp.nodeID(); + NodeIDT const& peerID = peerProp.nodeID(); JLOG(j_.warn()) << "Removing stale proposal from " << peerID; for (auto& dt : result_->disputes) dt.second.unVote(peerID); @@ -1511,11 +1511,11 @@ Consensus::updateOurPositions(std::unique_ptr const& } // This will stay unseated unless there are any changes - std::optional ourNewSet; + std::optional ourNewSet; // Update votes on disputed transactions { - std::optional mutableSet; + std::optional mutableSet; for (auto& [txId, dispute] : result_->disputes) { // Because the threshold for inclusion increases, @@ -1645,7 +1645,7 @@ Consensus::updateOurPositions(std::unique_ptr const& for (auto const& [nodeId, peerPos] : currPeerPositions_) { - Proposal_t const& p = peerPos.proposal(); + ProposalT const& p = peerPos.proposal(); if (p.position() == newID) updateDisputes(nodeId, result_->txns); } @@ -1674,7 +1674,7 @@ Consensus::haveConsensus(std::unique_ptr const& clog // Count number of agreements/disagreements with our position for (auto const& [nodeId, peerPos] : currPeerPositions_) { - Proposal_t const& peerProp = peerPos.proposal(); + ProposalT const& peerProp = peerPos.proposal(); if (peerProp.position() == ourPosition) { ++agree; @@ -1789,7 +1789,7 @@ Consensus::leaveConsensus(std::unique_ptr const& clo template void -Consensus::createDisputes(TxSet_t const& o, std::unique_ptr const& clog) +Consensus::createDisputes(TxSetT const& o, std::unique_ptr const& clog) { // Cannot create disputes without our stance XRPL_ASSERT(result_, "xrpl::Consensus::createDisputes : result is set"); @@ -1825,7 +1825,7 @@ Consensus::createDisputes(TxSet_t const& o, std::unique_ptrtxns.find(txId) && o.find(txId)), "xrpl::Consensus::createDisputes : has disputed transactions"); - Tx_t const tx = inThisSet ? result_->txns.find(txId) : o.find(txId); + TxT const tx = inThisSet ? result_->txns.find(txId) : o.find(txId); auto txID = tx.id(); if (result_->disputes.find(txID) != result_->disputes.end()) @@ -1833,7 +1833,7 @@ Consensus::createDisputes(TxSet_t const& o, std::unique_ptrtxns.exists(txID), std::max(prevProposers_, currPeerPositions_.size()), @@ -1842,7 +1842,7 @@ Consensus::createDisputes(TxSet_t const& o, std::unique_ptrsecond.exists(txID))) peerUnchangedCounter_ = 0; @@ -1858,7 +1858,7 @@ Consensus::createDisputes(TxSet_t const& o, std::unique_ptr void -Consensus::updateDisputes(NodeID_t const& node, TxSet_t const& other) +Consensus::updateDisputes(NodeIDT const& node, TxSetT const& other) { // Cannot updateDisputes without our stance XRPL_ASSERT(result_, "xrpl::Consensus::updateDisputes : result is set"); diff --git a/include/xrpl/consensus/ConsensusProposal.h b/include/xrpl/consensus/ConsensusProposal.h index 4586479286..eed519cdc7 100644 --- a/include/xrpl/consensus/ConsensusProposal.h +++ b/include/xrpl/consensus/ConsensusProposal.h @@ -235,7 +235,7 @@ public: /** * The digest for this proposal, used for signing purposes. */ - uint256 const& + UInt256 const& signingHash() const { if (!signingHash_) @@ -283,7 +283,7 @@ private: /** * The signing hash for this proposal */ - mutable std::optional signingHash_; + mutable std::optional signingHash_; }; template diff --git a/include/xrpl/consensus/ConsensusTypes.h b/include/xrpl/consensus/ConsensusTypes.h index 56739527a1..1c7a006719 100644 --- a/include/xrpl/consensus/ConsensusTypes.h +++ b/include/xrpl/consensus/ConsensusTypes.h @@ -282,15 +282,15 @@ enum class ConsensusState { template struct ConsensusResult { - using Ledger_t = Traits::Ledger_t; - using TxSet_t = Traits::TxSet_t; - using NodeID_t = Traits::NodeID_t; + using LedgerT = Traits::LedgerT; + using TxSetT = Traits::TxSetT; + using NodeIDT = Traits::NodeIDT; - using Tx_t = TxSet_t::Tx; - using Proposal_t = ConsensusProposal; - using Dispute_t = DisputedTx; + using TxT = TxSetT::Tx; + using ProposalT = ConsensusProposal; + using DisputeT = DisputedTx; - ConsensusResult(TxSet_t&& s, Proposal_t&& p) : txns{std::move(s)}, position{std::move(p)} + ConsensusResult(TxSetT&& s, ProposalT&& p) : txns{std::move(s)}, position{std::move(p)} { XRPL_ASSERT(txns.id() == position.position(), "xrpl::ConsensusResult : valid inputs"); } @@ -298,20 +298,20 @@ struct ConsensusResult /** * The set of transactions consensus agrees go in the ledger */ - TxSet_t txns; + TxSetT txns; /** * Our proposed position on transactions/close time */ - Proposal_t position; + ProposalT position; /** * Transactions which are under dispute with our peers */ - hash_map disputes; + HashMap disputes; // Set of TxSet ids we have already compared/created disputes - hash_set compares; + HashSet compares; // Measures the duration of the establish phase for this consensus round ConsensusTimer roundTime; diff --git a/include/xrpl/consensus/DisputedTx.h b/include/xrpl/consensus/DisputedTx.h index c194716d43..4e550824da 100644 --- a/include/xrpl/consensus/DisputedTx.h +++ b/include/xrpl/consensus/DisputedTx.h @@ -34,8 +34,8 @@ namespace xrpl { template class DisputedTx { - using TxID_t = Tx::ID; - using Map_t = boost::container::flat_map; + using TxIDT = Tx::ID; + using MapT = boost::container::flat_map; public: /** @@ -55,7 +55,7 @@ public: /** * The unique id/hash of the disputed transaction. */ - [[nodiscard]] TxID_t const& + [[nodiscard]] TxIDT const& id() const { return tx_.id(); @@ -202,7 +202,7 @@ private: int nays_{0}; //< Number of no votes bool ourVote_; //< Our vote (true is yes) Tx tx_; //< Transaction under dispute - Map_t votes_; //< Map from NodeID to vote + MapT votes_; //< Map from NodeID to vote /** * The number of rounds we've gone without changing our vote */ diff --git a/include/xrpl/consensus/Validations.h b/include/xrpl/consensus/Validations.h index ebb13c5e7c..46d5f3f68f 100644 --- a/include/xrpl/consensus/Validations.h +++ b/include/xrpl/consensus/Validations.h @@ -312,28 +312,25 @@ class Validations mutable Mutex mutex_; // Validations from currently listed and trusted nodes (partial and full) - hash_map current_; + HashMap current_; // Used to enforce the largest validation invariant for the local node SeqEnforcer localSeqEnforcer_; // Sequence of the largest validation received from each node - hash_map> seqEnforcers_; + HashMap> seqEnforcers_; /** * Validations from listed nodes, indexed by ledger id (partial and full) */ - beast::aged_unordered_map< - ID, - hash_map, - std::chrono::steady_clock, - beast::Uhash<>> - byLedger_; + beast:: + AgedUnorderedMap, std::chrono::steady_clock, beast::Uhash<>> + byLedger_; // Partial and full validations indexed by sequence - beast::aged_unordered_map< + beast::AgedUnorderedMap< Seq, - hash_map, + HashMap, std::chrono::steady_clock, beast::Uhash<>> bySequence_; @@ -351,10 +348,10 @@ class Validations // Last (validated) ledger successfully acquired. If in this map, it is // accounted for in the trie. - hash_map lastLedger_; + HashMap lastLedger_; // Set of ledgers being acquired from the network - hash_map, hash_set> acquiring_; + HashMap, HashSet> acquiring_; // Parameters to determine validation staleness ValidationParms const parms_; @@ -794,7 +791,7 @@ public: * @param removed Identifiers of nodes that are no longer trusted */ void - trustChanged(hash_set const& added, hash_set const& removed) + trustChanged(HashSet const& added, HashSet const& removed) { std::scoped_lock const lock{mutex_}; @@ -862,9 +859,9 @@ public: // fall back to majority over acquiring ledgers auto it = std::ranges::max_element(acquiring_, [](auto const& a, auto const& b) { std::pair const& aKey = a.first; - typename hash_set::size_type const& aSize = a.second.size(); + typename HashSet::size_type const& aSize = a.second.size(); std::pair const& bKey = b.first; - typename hash_set::size_type const& bSize = b.second.size(); + typename HashSet::size_type const& bSize = b.second.size(); // order by number of trusted peers validating that ledger // break ties with ledger ID return std::tie(aSize, aKey.second) < std::tie(bSize, bKey.second); @@ -930,7 +927,7 @@ public: * does not know their sequence number */ ID - getPreferredLCL(Ledger const& lcl, Seq minSeq, hash_map const& peerCounts) + getPreferredLCL(Ledger const& lcl, Seq minSeq, HashMap const& peerCounts) { std::optional> preferred = getPreferred(lcl); @@ -1009,9 +1006,9 @@ public: * @return The set of node ids for active, listed validators */ auto - getCurrentNodeIDs() -> hash_set + getCurrentNodeIDs() -> HashSet { - hash_set ret; + HashSet ret; std::scoped_lock const lock{mutex_}; current( lock, @@ -1127,7 +1124,7 @@ public: * @return Quantity of laggards. */ std::size_t - laggards(Seq const seq, hash_set& trustedKeys) + laggards(Seq const seq, HashSet& trustedKeys) { std::size_t laggards = 0; diff --git a/include/xrpl/core/HashRouter.h b/include/xrpl/core/HashRouter.h index 25e4df3d0d..6e01058463 100644 --- a/include/xrpl/core/HashRouter.h +++ b/include/xrpl/core/HashRouter.h @@ -88,7 +88,7 @@ class Config; class HashRouter { public: - // The type here *MUST* match the type of Peer::id_t + // The type here *MUST* match the type of Peer::ID using PeerShortID = std::uint32_t; /** @@ -107,17 +107,17 @@ public: */ explicit Setup() = default; - using seconds = std::chrono::seconds; + using Seconds = std::chrono::seconds; /** * Expiration time for a hash entry */ - seconds holdTime{300}; + Seconds holdTime{300}; /** * Amount of time required before a relayed item will be relayed again. */ - seconds relayTime{30}; + Seconds relayTime{30}; }; private: @@ -213,10 +213,10 @@ public: // VFALCO TODO Replace "Suppression" terminology with something more // semantically meaningful. void - addSuppression(uint256 const& key); + addSuppression(UInt256 const& key); bool - addSuppressionPeer(uint256 const& key, PeerShortID peer); + addSuppressionPeer(UInt256 const& key, PeerShortID peer); /** * Add a suppression peer and get message's relay status. @@ -226,15 +226,15 @@ public: * is unseated if has not relayed yet. */ std::pair> - addSuppressionPeerWithStatus(uint256 const& key, PeerShortID peer); + addSuppressionPeerWithStatus(UInt256 const& key, PeerShortID peer); bool - addSuppressionPeer(uint256 const& key, PeerShortID peer, HashRouterFlags& flags); + addSuppressionPeer(UInt256 const& key, PeerShortID peer, HashRouterFlags& flags); // Add a peer suppression and return whether the entry should be processed bool shouldProcess( - uint256 const& key, + UInt256 const& key, PeerShortID peer, HashRouterFlags& flags, std::chrono::seconds txInterval); @@ -245,10 +245,10 @@ public: * @return `true` if the flags were changed. `false` if unchanged. */ bool - setFlags(uint256 const& key, HashRouterFlags flags); + setFlags(UInt256 const& key, HashRouterFlags flags); HashRouterFlags - getFlags(uint256 const& key); + getFlags(UInt256 const& key); /** * Determines whether the hashed item should be relayed. @@ -264,12 +264,12 @@ public: * _not_ be relayed. */ std::optional> - shouldRelay(uint256 const& key); + shouldRelay(UInt256 const& key); private: // pair.second indicates whether the entry was created std::pair - emplace(uint256 const&); + emplace(UInt256 const&); std::mutex mutable mutex_; @@ -277,7 +277,7 @@ private: Setup const setup_; // Stores all suppressed hashes and their expiration time - beast::aged_unordered_map> + beast::AgedUnorderedMap> suppressionMap_; }; diff --git a/include/xrpl/core/Job.h b/include/xrpl/core/Job.h index 93b39701be..a5d719c22a 100644 --- a/include/xrpl/core/Job.h +++ b/include/xrpl/core/Job.h @@ -81,7 +81,7 @@ enum JobType { class Job : public CountedObject { public: - using clock_type = std::chrono::steady_clock; + using ClockType = std::chrono::steady_clock; /** * Default constructor. @@ -112,7 +112,7 @@ public: /** * Returns the time when the job was queued. */ - [[nodiscard]] clock_type::time_point const& + [[nodiscard]] ClockType::time_point const& queueTime() const; void @@ -135,7 +135,7 @@ private: std::function job_; std::shared_ptr loadEvent_; std::string name_; - clock_type::time_point queueTime_; + ClockType::time_point queueTime_; }; using JobCounter = ClosureCounter; diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index 0c9fc76357..749339988c 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -156,7 +156,7 @@ public: JobQueue( int threadCount, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, beast::Journal journal, Logs& logs, perf::PerfLog& perfLog); @@ -280,7 +280,7 @@ private: // Statistics tracking perf::PerfLog& perfLog_; - beast::insight::Collector::ptr collector_; + beast::insight::Collector::Ptr collector_; beast::insight::Gauge jobCount_; beast::insight::Hook hook_; diff --git a/include/xrpl/core/JobTypeData.h b/include/xrpl/core/JobTypeData.h index d53440e1ca..0644057103 100644 --- a/include/xrpl/core/JobTypeData.h +++ b/include/xrpl/core/JobTypeData.h @@ -17,7 +17,7 @@ private: LoadMonitor load_; /* Support for insight */ - beast::insight::Collector::ptr collector_; + beast::insight::Collector::Ptr collector_; public: /* The job category which we represent */ @@ -38,7 +38,7 @@ public: JobTypeData( JobTypeInfo const& info, - beast::insight::Collector::ptr collector, + beast::insight::Collector::Ptr collector, Logs& logs) noexcept : load_(logs.journal("LoadMonitor")), collector_(std::move(collector)), info(info) diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index 0c544c9aa5..277c4f0317 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -32,13 +32,13 @@ namespace perf { class PerfLog { public: - using steady_clock = std::chrono::steady_clock; - using system_clock = std::chrono::system_clock; - using steady_time_point = std::chrono::time_point; - using system_time_point = std::chrono::time_point; - using seconds = std::chrono::seconds; - using milliseconds = std::chrono::milliseconds; - using microseconds = std::chrono::microseconds; + using SteadyClock = std::chrono::steady_clock; + using SystemClock = std::chrono::system_clock; + using SteadyTimePoint = std::chrono::time_point; + using SystemTimePoint = std::chrono::time_point; + using Seconds = std::chrono::seconds; + using Milliseconds = std::chrono::milliseconds; + using Microseconds = std::chrono::microseconds; /** * Configuration from [perf] section of xrpld.cfg. @@ -47,7 +47,7 @@ public: { std::filesystem::path perfLog; // log_interval is in milliseconds to support faster testing. - milliseconds logInterval{seconds(1)}; + Milliseconds logInterval{Seconds(1)}; }; virtual ~PerfLog() = default; @@ -106,7 +106,7 @@ public: * @param instance JobQueue worker thread instance */ virtual void - jobStart(JobType const type, microseconds dur, steady_time_point startTime, int instance) = 0; + jobStart(JobType const type, Microseconds dur, SteadyTimePoint startTime, int instance) = 0; /** * Log job finishing @@ -116,7 +116,7 @@ public: * @param instance Jobqueue worker thread instance */ virtual void - jobFinish(JobType const type, microseconds dur, int instance) = 0; + jobFinish(JobType const type, Microseconds dur, int instance) = 0; /** * Render performance counters in Json diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index 000bdaa7fa..c9d04f7f7b 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -40,7 +40,7 @@ template < class TaggedCache; class STLedgerEntry; using SLE = STLedgerEntry; -using CachedSLEs = TaggedCache; +using CachedSLEs = TaggedCache; // Forward declarations class AcceptedLedger; @@ -180,7 +180,7 @@ public: virtual InboundTransactions& getInboundTransactions() = 0; - virtual TaggedCache& + virtual TaggedCache& getAcceptedLedgerCache() = 0; virtual LedgerMaster& @@ -237,7 +237,7 @@ public: virtual Logs& getLogs() = 0; - [[nodiscard]] virtual std::optional const& + [[nodiscard]] virtual std::optional const& getTrapTxID() const = 0; /** diff --git a/include/xrpl/core/detail/Workers.h b/include/xrpl/core/detail/Workers.h index 6829d5a14b..96d7eadfc6 100644 --- a/include/xrpl/core/detail/Workers.h +++ b/include/xrpl/core/detail/Workers.h @@ -207,7 +207,7 @@ private: std::condition_variable cv_; // signaled when all threads paused std::mutex mut_; bool allPaused_{true}; - semaphore semaphore_; // each pending task is 1 resource + Semaphore semaphore_; // each pending task is 1 resource int numberOfThreads_{0}; // how many we want active now std::atomic activeCount_; // to know when all are paused std::atomic pauseCount_; // how many threads need to pause now diff --git a/include/xrpl/core/detail/semaphore.h b/include/xrpl/core/detail/semaphore.h index abf6705097..ef92a21bed 100644 --- a/include/xrpl/core/detail/semaphore.h +++ b/include/xrpl/core/detail/semaphore.h @@ -91,6 +91,6 @@ public: } }; -using semaphore = BasicSemaphore; +using Semaphore = BasicSemaphore; } // namespace xrpl diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index 57936a774f..a60739d594 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -526,7 +526,7 @@ class ValueIteratorBase { public: using iterator_category = std::bidirectional_iterator_tag; - using size_t = unsigned int; + using SizeT = unsigned int; using difference_type = int; using SelfType = ValueIteratorBase; @@ -593,7 +593,7 @@ class ValueConstIterator : public ValueIteratorBase friend class Value; public: - using size_t = unsigned int; + using SizeT = unsigned int; using difference_type = int; using value_type = Value const; using reference = Value const&; @@ -658,7 +658,7 @@ class ValueIterator : public ValueIteratorBase friend class Value; public: - using size_t = unsigned int; + using SizeT = unsigned int; using difference_type = int; using value_type = Value; using reference = Value&; diff --git a/include/xrpl/ledger/AmendmentTable.h b/include/xrpl/ledger/AmendmentTable.h index c3ef779eb1..108a28678a 100644 --- a/include/xrpl/ledger/AmendmentTable.h +++ b/include/xrpl/ledger/AmendmentTable.h @@ -48,33 +48,33 @@ public: struct FeatureInfo { FeatureInfo() = delete; - FeatureInfo(std::string n, uint256 const& f, VoteBehavior v) + FeatureInfo(std::string n, UInt256 const& f, VoteBehavior v) : name(std::move(n)), feature(f), vote(v) { } std::string const name; - uint256 const feature; + UInt256 const feature; VoteBehavior const vote; }; virtual ~AmendmentTable() = default; - [[nodiscard]] virtual uint256 + [[nodiscard]] virtual UInt256 find(std::string const& name) const = 0; virtual bool - veto(uint256 const& amendment) = 0; + veto(UInt256 const& amendment) = 0; virtual bool - unVeto(uint256 const& amendment) = 0; + unVeto(UInt256 const& amendment) = 0; virtual bool - enable(uint256 const& amendment) = 0; + enable(UInt256 const& amendment) = 0; [[nodiscard]] virtual bool - isEnabled(uint256 const& amendment) const = 0; + isEnabled(UInt256 const& amendment) const = 0; [[nodiscard]] virtual bool - isSupported(uint256 const& amendment) const = 0; + isSupported(UInt256 const& amendment) const = 0; /** * @brief returns true if one or more amendments on the network @@ -95,7 +95,7 @@ public: * Returns a json::ValueType::Object. */ [[nodiscard]] virtual json::Value - getJson(uint256 const& amendment, bool isAdmin) const = 0; + getJson(UInt256 const& amendment, bool isAdmin) const = 0; /** * Called when a new fully-validated ledger is accepted. @@ -122,33 +122,33 @@ public: virtual void doValidatedLedger( LedgerIndex ledgerSeq, - std::set const& enabled, - majorityAmendments_t const& majority) = 0; + std::set const& enabled, + MajorityAmendmentsT const& majority) = 0; // Called when the set of trusted validators changes. virtual void - trustChanged(hash_set const& allTrusted) = 0; + trustChanged(HashSet const& allTrusted) = 0; // Called by the consensus code when we need to // inject pseudo-transactions - virtual std::map + virtual std::map doVoting( Rules const& rules, NetClock::time_point closeTime, - std::set const& enabledAmendments, - majorityAmendments_t const& majorityAmendments, + std::set const& enabledAmendments, + MajorityAmendmentsT const& majorityAmendments, std::vector> const& valSet) = 0; // Called by the consensus code when we need to // add feature entries to a validation - [[nodiscard]] virtual std::vector - doValidation(std::set const& enabled) const = 0; + [[nodiscard]] virtual std::vector + doValidation(std::set const& enabled) const = 0; // The set of amendments to enable in the genesis ledger // This will return all known, non-vetoed amendments. // If we ever have two amendments that should not both be // enabled at the same time, we should ensure one is vetoed. - [[nodiscard]] virtual std::vector + [[nodiscard]] virtual std::vector getDesired() const = 0; // The function below adapts the API callers expect to the diff --git a/include/xrpl/ledger/ApplyView.h b/include/xrpl/ledger/ApplyView.h index f33dc67dcb..5490c9045a 100644 --- a/include/xrpl/ledger/ApplyView.h +++ b/include/xrpl/ledger/ApplyView.h @@ -147,8 +147,8 @@ private: dirAdd( bool preserveOrder, Keylet const& directory, - uint256 const& key, - std::function const& describe); + UInt256 const& key, + std::function const& describe); public: ApplyView() = default; @@ -196,7 +196,7 @@ public: * The key is no longer associated with the SLE. */ virtual void - erase(SLE::ref sle) = 0; + erase(SLE::Ref sle) = 0; /** * Insert a new state SLE @@ -218,7 +218,7 @@ public: * @note The key is taken from the SLE */ virtual void - insert(SLE::ref sle) = 0; + insert(SLE::Ref sle) = 0; /** * Indicate changes to a peeked SLE @@ -238,7 +238,7 @@ public: */ /** @{ */ virtual void - update(SLE::ref sle) = 0; + update(SLE::Ref sle) = 0; //-------------------------------------------------------------------------- @@ -333,7 +333,7 @@ public: dirAppend( Keylet const& directory, Keylet const& key, - std::function const& describe) + std::function const& describe) { if (key.type != ltOFFER) { @@ -372,8 +372,8 @@ public: std::optional dirInsert( Keylet const& directory, - uint256 const& key, - std::function const& describe) + UInt256 const& key, + std::function const& describe) { return dirAdd(false, directory, key, describe); } @@ -382,7 +382,7 @@ public: dirInsert( Keylet const& directory, Keylet const& key, - std::function const& describe) + std::function const& describe) { return dirAdd(false, directory, key.key, describe); } @@ -406,7 +406,7 @@ public: */ /** @{ */ bool - dirRemove(Keylet const& directory, std::uint64_t page, uint256 const& key, bool keepRoot); + dirRemove(Keylet const& directory, std::uint64_t page, UInt256 const& key, bool keepRoot); bool dirRemove(Keylet const& directory, std::uint64_t page, Keylet const& key, bool keepRoot) @@ -419,7 +419,7 @@ public: * Remove the specified directory, invoking the callback for every node. */ bool - dirDelete(Keylet const& directory, std::function const&); + dirDelete(Keylet const& directory, std::function const&); /** * Remove the specified directory, if it is empty. @@ -466,20 +466,20 @@ std::uint64_t createRoot( ApplyView& view, Keylet const& directory, - uint256 const& key, - std::function const& describe); + UInt256 const& key, + std::function const& describe); auto -findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start); +findPreviousPage(ApplyView& view, Keylet const& directory, SLE::Ref start); std::uint64_t insertKey( ApplyView& view, - SLE::ref node, + SLE::Ref node, std::uint64_t page, bool preserveOrder, STVector256& indexes, - uint256 const& key); + UInt256 const& key); std::optional insertPage( @@ -487,10 +487,10 @@ insertPage( std::uint64_t page, SLE::pointer node, std::uint64_t nextPage, - SLE::ref next, - uint256 const& key, + SLE::Ref next, + UInt256 const& key, Keylet const& directory, - std::function const& describe); + std::function const& describe); } // namespace directory } // namespace xrpl diff --git a/include/xrpl/ledger/ApplyViewImpl.h b/include/xrpl/ledger/ApplyViewImpl.h index 630153f90a..0717b25aff 100644 --- a/include/xrpl/ledger/ApplyViewImpl.h +++ b/include/xrpl/ledger/ApplyViewImpl.h @@ -50,7 +50,7 @@ public: OpenView& to, STTx const& tx, TER ter, - std::optional parentBatchId, + std::optional parentBatchId, bool isDryRun, beast::Journal j); @@ -81,10 +81,10 @@ public: visit( OpenView& target, std::function const& func); + SLE::ConstRef before, + SLE::ConstRef after)> const& func); private: std::optional deliver_; diff --git a/include/xrpl/ledger/BookDirs.h b/include/xrpl/ledger/BookDirs.h index b9aa87ae52..3b43e8b246 100644 --- a/include/xrpl/ledger/BookDirs.h +++ b/include/xrpl/ledger/BookDirs.h @@ -15,12 +15,12 @@ class BookDirs { private: ReadView const* view_ = nullptr; - uint256 const root_; - uint256 const nextQuality_; - uint256 const key_; + UInt256 const root_; + UInt256 const nextQuality_; + UInt256 const key_; SLE::const_pointer sle_ = nullptr; unsigned int entry_ = 0; - uint256 index_; + UInt256 index_; public: class const_iterator; // NOLINT(readability-identifier-naming) @@ -67,19 +67,19 @@ public: private: friend class BookDirs; - const_iterator(ReadView const& view, uint256 const& root, uint256 const& dirKey) + const_iterator(ReadView const& view, UInt256 const& root, UInt256 const& dirKey) : view_(&view), root_(root), key_(dirKey), curKey_(dirKey) { } ReadView const* view_ = nullptr; - uint256 root_; - uint256 nextQuality_; - uint256 key_; - uint256 curKey_; + UInt256 root_; + UInt256 nextQuality_; + UInt256 key_; + UInt256 curKey_; SLE::const_pointer sle_; unsigned int entry_ = 0; - uint256 index_; + UInt256 index_; std::optional mutable cache_; }; diff --git a/include/xrpl/ledger/CachedSLEs.h b/include/xrpl/ledger/CachedSLEs.h index c05aab8856..ddb0392447 100644 --- a/include/xrpl/ledger/CachedSLEs.h +++ b/include/xrpl/ledger/CachedSLEs.h @@ -5,5 +5,5 @@ #include namespace xrpl { -using CachedSLEs = TaggedCache; +using CachedSLEs = TaggedCache; } // namespace xrpl diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index b9e2cf8d66..bc6daded3a 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -26,7 +26,7 @@ private: DigestAwareReadView const& base_; CachedSLEs& cache_; std::mutex mutable mutex_; - std::unordered_map> mutable map_; + std::unordered_map> mutable map_; public: CachedViewImpl() = delete; @@ -78,31 +78,31 @@ public: return base_.succ(key, last); } - std::unique_ptr + std::unique_ptr slesBegin() const override { return base_.slesBegin(); } - std::unique_ptr + std::unique_ptr slesEnd() const override { return base_.slesEnd(); } - std::unique_ptr - slesUpperBound(uint256 const& key) const override + std::unique_ptr + slesUpperBound(UInt256 const& key) const override { return base_.slesUpperBound(key); } - std::unique_ptr + std::unique_ptr txsBegin() const override { return base_.txsBegin(); } - std::unique_ptr + std::unique_ptr txsEnd() const override { return base_.txsEnd(); @@ -114,7 +114,7 @@ public: return base_.txExists(key); } - tx_type + TxType txRead(key_type const& key) const override { return base_.txRead(key); @@ -124,7 +124,7 @@ public: // DigestAwareReadView // - std::optional + std::optional digest(key_type const& key) const override { return base_.digest(key); @@ -147,7 +147,7 @@ private: std::shared_ptr sp_; public: - using base_type = Base; + using BaseType = Base; CachedView() = delete; CachedView(CachedView const&) = delete; diff --git a/include/xrpl/ledger/CanonicalTXSet.h b/include/xrpl/ledger/CanonicalTXSet.h index 3fe17d6eef..90d5769ad5 100644 --- a/include/xrpl/ledger/CanonicalTXSet.h +++ b/include/xrpl/ledger/CanonicalTXSet.h @@ -27,7 +27,7 @@ private: class Key { public: - Key(uint256 const& account, SeqProxy seqProx, uint256 const& id) + Key(UInt256 const& account, SeqProxy seqProx, UInt256 const& id) : account_(account), txId_(id), seqProxy_(seqProx) { } @@ -59,21 +59,21 @@ private: return lhs.txId_ == rhs.txId_; } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getAccount() const { return account_; } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getTXID() const { return txId_; } private: - uint256 account_; - uint256 txId_; + UInt256 account_; + UInt256 txId_; SeqProxy seqProxy_; }; @@ -81,7 +81,7 @@ private: operator<(Key const& lhs, Key const& rhs); // Calculate the salted key for the given account - uint256 + UInt256 accountKey(AccountID const& account); public: @@ -141,7 +141,7 @@ public: return map_.empty(); } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& key() const { return salt_; @@ -151,7 +151,7 @@ private: std::map> map_; // Used to salt the accounts so people can't mine for low account numbers - uint256 salt_; + UInt256 salt_; }; } // namespace xrpl diff --git a/include/xrpl/ledger/Dir.h b/include/xrpl/ledger/Dir.h index eb70b3b6a3..4ffa83506d 100644 --- a/include/xrpl/ledger/Dir.h +++ b/include/xrpl/ledger/Dir.h @@ -17,7 +17,7 @@ namespace xrpl { * A class that simplifies iterating ledger directory pages * * The Dir class provides a forward iterator for walking through - * the uint256 values contained in ledger directories. + * the UInt256 values contained in ledger directories. * * The Dir class also allows accelerated directory walking by * stepping directly from one page to the next using the next_page() @@ -86,7 +86,7 @@ public: return page_; } - uint256 + UInt256 index() const { return index_; @@ -103,11 +103,11 @@ private: ReadView const* view_ = nullptr; Keylet root_; Keylet page_; - uint256 index_; + UInt256 index_; std::optional mutable cache_; SLE::const_pointer sle_; STVector256 const* indexes_ = nullptr; - std::vector::const_iterator it_; + std::vector::const_iterator it_; }; } // namespace xrpl diff --git a/include/xrpl/ledger/Ledger.h b/include/xrpl/ledger/Ledger.h index e1dd2c422e..2e5ab816b4 100644 --- a/include/xrpl/ledger/Ledger.h +++ b/include/xrpl/ledger/Ledger.h @@ -102,7 +102,7 @@ public: CreateGenesisT, Rules rules, Fees const& fees, - std::vector const& amendments, + std::vector const& amendments, Family& family); Ledger(LedgerHeader const& info, Rules rules, Family& family); @@ -181,40 +181,40 @@ public: exists(Keylet const& k) const override; bool - exists(uint256 const& key) const; + exists(UInt256 const& key) const; - std::optional - succ(uint256 const& key, std::optional const& last = std::nullopt) const override; + std::optional + succ(UInt256 const& key, std::optional const& last = std::nullopt) const override; SLE::const_pointer read(Keylet const& k) const override; - std::unique_ptr + std::unique_ptr slesBegin() const override; - std::unique_ptr + std::unique_ptr slesEnd() const override; - std::unique_ptr - slesUpperBound(uint256 const& key) const override; + std::unique_ptr + slesUpperBound(UInt256 const& key) const override; - std::unique_ptr + std::unique_ptr txsBegin() const override; - std::unique_ptr + std::unique_ptr txsEnd() const override; bool - txExists(uint256 const& key) const override; + txExists(UInt256 const& key) const override; - tx_type + TxType txRead(key_type const& key) const override; // // DigestAwareReadView // - std::optional + std::optional digest(key_type const& key) const override; // @@ -222,16 +222,16 @@ public: // void - rawErase(SLE::ref sle) override; + rawErase(SLE::Ref sle) override; void - rawInsert(SLE::ref sle) override; + rawInsert(SLE::Ref sle) override; void - rawErase(uint256 const& key); + rawErase(UInt256 const& key); void - rawReplace(SLE::ref sle) override; + rawReplace(SLE::Ref sle) override; void rawDestroyXRP(XRPAmount const& fee) override @@ -245,7 +245,7 @@ public: void rawTxInsert( - uint256 const& key, + UInt256 const& key, std::shared_ptr const& txn, std::shared_ptr const& metaData) override; @@ -346,7 +346,7 @@ public: * * @return the public keys */ - hash_set + HashSet negativeUNL() const; /** diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index 3f8e950b02..6ffd9e985a 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -82,7 +82,7 @@ private: // List of tx, key order // Use boost::pmr functionality instead of std::pmr // functions b/c clang does not support pmr yet (as-of 9/2020) - using txs_map = std::map< + using TxsMap = std::map< key_type, TxData, std::less<>, @@ -91,7 +91,7 @@ private: // monotonic_resource_ must outlive `items_`. Make a pointer so it may be // easily moved. std::unique_ptr monotonicResource_; - txs_map txs_; + TxsMap txs_; Rules rules_; LedgerHeader header_; ReadView const* base_; @@ -224,37 +224,37 @@ public: SLE::const_pointer read(Keylet const& k) const override; - std::unique_ptr + std::unique_ptr slesBegin() const override; - std::unique_ptr + std::unique_ptr slesEnd() const override; - std::unique_ptr - slesUpperBound(uint256 const& key) const override; + std::unique_ptr + slesUpperBound(UInt256 const& key) const override; - std::unique_ptr + std::unique_ptr txsBegin() const override; - std::unique_ptr + std::unique_ptr txsEnd() const override; bool txExists(key_type const& key) const override; - tx_type + TxType txRead(key_type const& key) const override; // RawView void - rawErase(SLE::ref sle) override; + rawErase(SLE::Ref sle) override; void - rawInsert(SLE::ref sle) override; + rawInsert(SLE::Ref sle) override; void - rawReplace(SLE::ref sle) override; + rawReplace(SLE::Ref sle) override; void rawDestroyXRP(XRPAmount const& fee) override; diff --git a/include/xrpl/ledger/OrderBookDB.h b/include/xrpl/ledger/OrderBookDB.h index 96dc94b1f4..355a8fb7f5 100644 --- a/include/xrpl/ledger/OrderBookDB.h +++ b/include/xrpl/ledger/OrderBookDB.h @@ -101,7 +101,7 @@ public: * @return The set of books whose offers were created, modified, or * deleted. May be empty for non-offer transactions. */ -hash_set +HashSet affectedBooks(AcceptedLedgerTx const& alTx, beast::Journal const& j); } // namespace xrpl diff --git a/include/xrpl/ledger/OwnerCounts.h b/include/xrpl/ledger/OwnerCounts.h index 74d60014b5..dfa09d1945 100644 --- a/include/xrpl/ledger/OwnerCounts.h +++ b/include/xrpl/ledger/OwnerCounts.h @@ -18,7 +18,7 @@ struct OwnerCounts std::uint32_t sponsoring = 0; OwnerCounts() = default; - OwnerCounts(SLE::const_ref sle) + OwnerCounts(SLE::ConstRef sle) : owner(sle->at(sfOwnerCount)) , sponsored(sle->at(sfSponsoredOwnerCount)) , sponsoring(sle->at(sfSponsoringOwnerCount)) diff --git a/include/xrpl/ledger/RawView.h b/include/xrpl/ledger/RawView.h index b94a7aab27..b185f8cd89 100644 --- a/include/xrpl/ledger/RawView.h +++ b/include/xrpl/ledger/RawView.h @@ -30,7 +30,7 @@ public: * can calculate metadata. */ virtual void - rawErase(SLE::ref sle) = 0; + rawErase(SLE::Ref sle) = 0; /** * Unconditionally insert a state item. @@ -45,7 +45,7 @@ public: * @note The key is taken from the SLE */ virtual void - rawInsert(SLE::ref sle) = 0; + rawInsert(SLE::Ref sle) = 0; /** * Unconditionally replace a state item. @@ -61,7 +61,7 @@ public: * @note The key is taken from the SLE */ virtual void - rawReplace(SLE::ref sle) = 0; + rawReplace(SLE::Ref sle) = 0; /** * Destroy XRP. diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index d0010b6030..c9609e4ca9 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -40,9 +40,9 @@ namespace xrpl { class ReadView { public: - using tx_type = std::pair, std::shared_ptr>; + using TxType = std::pair, std::shared_ptr>; - using key_type = uint256; + using key_type = UInt256; using mapped_type = SLE::const_pointer; @@ -57,7 +57,7 @@ public: upperBound(key_type const& key) const; }; - struct TxsType : detail::ReadViewFwdRange + struct TxsType : detail::ReadViewFwdRange { explicit TxsType(ReadView const& view); [[nodiscard]] bool @@ -214,23 +214,23 @@ public: } // used by the implementation - [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] virtual std::unique_ptr slesBegin() const = 0; // used by the implementation - [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] virtual std::unique_ptr slesEnd() const = 0; // used by the implementation - [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] virtual std::unique_ptr slesUpperBound(key_type const& key) const = 0; // used by the implementation - [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] virtual std::unique_ptr txsBegin() const = 0; // used by the implementation - [[nodiscard]] virtual std::unique_ptr + [[nodiscard]] virtual std::unique_ptr txsEnd() const = 0; /** @@ -251,7 +251,7 @@ public: * @return A pair of nullptr if the * key is not found in the tx map. */ - [[nodiscard]] virtual tx_type + [[nodiscard]] virtual TxType txRead(key_type const& key) const = 0; // @@ -278,7 +278,7 @@ public: class DigestAwareReadView : public ReadView { public: - using digest_type = uint256; + using DigestType = UInt256; DigestAwareReadView() = default; DigestAwareReadView(DigestAwareReadView const&) = default; @@ -288,7 +288,7 @@ public: * * @return std::nullopt if the item does not exist. */ - [[nodiscard]] virtual std::optional + [[nodiscard]] virtual std::optional digest(key_type const& key) const = 0; }; @@ -300,7 +300,7 @@ makeRulesGivenLedger(DigestAwareReadView const& ledger, Rules const& current); Rules makeRulesGivenLedger( DigestAwareReadView const& ledger, - std::unordered_set> const& presets); + std::unordered_set> const& presets); } // namespace xrpl diff --git a/include/xrpl/ledger/View.h b/include/xrpl/ledger/View.h index bb0817673c..f72172993a 100644 --- a/include/xrpl/ledger/View.h +++ b/include/xrpl/ledger/View.h @@ -114,12 +114,12 @@ canTransferLPToken( AccountID const& lpTokenIssuer); // Return the list of enabled amendments -[[nodiscard]] std::set +[[nodiscard]] std::set getEnabledAmendments(ReadView const& view); // Return a map of amendments that have achieved majority -using majorityAmendments_t = std::map; -[[nodiscard]] majorityAmendments_t +using MajorityAmendmentsT = std::map; +[[nodiscard]] MajorityAmendmentsT getMajorityAmendments(ReadView const& view); /** @@ -132,7 +132,7 @@ getMajorityAmendments(ReadView const& view); * @return The hash of the ledger with the * given sequence number or std::nullopt. */ -[[nodiscard]] std::optional +[[nodiscard]] std::optional hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal); /** @@ -169,7 +169,7 @@ areCompatible( [[nodiscard]] bool areCompatible( - uint256 const& validHash, + UInt256 const& validHash, LedgerIndex validIndex, ReadView const& testLedger, beast::Journal::Stream& s, @@ -211,10 +211,10 @@ canWithdraw( ReadView const& view, AccountID const& from, AccountID const& to, - SLE::const_ref toSle, + SLE::ConstRef toSle, STAmount const& amount, bool hasDestinationTag, - std::optional> const& credentialIDs = std::nullopt); + std::optional> const& credentialIDs = std::nullopt); /** * Checks that can withdraw funds from an object to itself or a destination. @@ -241,7 +241,7 @@ canWithdraw( AccountID const& to, STAmount const& amount, bool hasDestinationTag, - std::optional> const& credentialIDs = std::nullopt); + std::optional> const& credentialIDs = std::nullopt); /** * Checks that can withdraw funds from an object to itself or a destination. @@ -281,7 +281,7 @@ doWithdraw( * is always tesSUCCESS if the entry should be skipped. */ using EntryDeleter = - std::function(LedgerEntryType, uint256 const&, SLE::pointer&)>; + std::function(LedgerEntryType, UInt256 const&, SLE::pointer&)>; /** * Cleanup owner directory entries on account delete. * Used for a regular and AMM accounts deletion. The caller diff --git a/include/xrpl/ledger/detail/ApplyStateTable.h b/include/xrpl/ledger/detail/ApplyStateTable.h index 752c87d588..5dc5373a26 100644 --- a/include/xrpl/ledger/detail/ApplyStateTable.h +++ b/include/xrpl/ledger/detail/ApplyStateTable.h @@ -37,9 +37,9 @@ private: Modify, }; - using items_t = std::map>; + using ItemsT = std::map>; - items_t items_; + ItemsT items_; XRPAmount dropsDestroyed_{0}; public: @@ -61,7 +61,7 @@ public: STTx const& tx, TER ter, std::optional const& deliver, - std::optional const& parentBatchId, + std::optional const& parentBatchId, bool isDryRun, beast::Journal j); @@ -84,25 +84,25 @@ public: visit( ReadView const& base, std::function const& func) const; + SLE::ConstRef before, + SLE::ConstRef after)> const& func) const; void - erase(ReadView const& base, SLE::ref sle); + erase(ReadView const& base, SLE::Ref sle); void - rawErase(ReadView const& base, SLE::ref sle); + rawErase(ReadView const& base, SLE::Ref sle); void - insert(ReadView const& base, SLE::ref sle); + insert(ReadView const& base, SLE::Ref sle); void - update(ReadView const& base, SLE::ref sle); + update(ReadView const& base, SLE::Ref sle); void - replace(ReadView const& base, SLE::ref sle); + replace(ReadView const& base, SLE::Ref sle); void destroyXRP(XRPAmount const& fee); @@ -115,10 +115,10 @@ public: } private: - using Mods = hash_map; + using Mods = HashMap; static void - threadItem(TxMeta& meta, SLE::ref to); + threadItem(TxMeta& meta, SLE::Ref to); SLE::pointer getForMod(ReadView const& base, key_type const& key, Mods& mods, beast::Journal j); @@ -130,7 +130,7 @@ private: threadOwners( ReadView const& base, TxMeta& meta, - SLE::const_ref sle, + SLE::ConstRef sle, Mods& mods, beast::Journal j); }; diff --git a/include/xrpl/ledger/detail/ApplyViewBase.h b/include/xrpl/ledger/detail/ApplyViewBase.h index b5b01de277..732d955e51 100644 --- a/include/xrpl/ledger/detail/ApplyViewBase.h +++ b/include/xrpl/ledger/detail/ApplyViewBase.h @@ -53,25 +53,25 @@ public: [[nodiscard]] SLE::const_pointer read(Keylet const& k) const override; - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr slesBegin() const override; - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr slesEnd() const override; - [[nodiscard]] std::unique_ptr - slesUpperBound(uint256 const& key) const override; + [[nodiscard]] std::unique_ptr + slesUpperBound(UInt256 const& key) const override; - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr txsBegin() const override; - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr txsEnd() const override; [[nodiscard]] bool txExists(key_type const& key) const override; - [[nodiscard]] tx_type + [[nodiscard]] TxType txRead(key_type const& key) const override; // ApplyView @@ -83,24 +83,24 @@ public: peek(Keylet const& k) override; void - erase(SLE::ref sle) override; + erase(SLE::Ref sle) override; void - insert(SLE::ref sle) override; + insert(SLE::Ref sle) override; void - update(SLE::ref sle) override; + update(SLE::Ref sle) override; // RawView void - rawErase(SLE::ref sle) override; + rawErase(SLE::Ref sle) override; void - rawInsert(SLE::ref sle) override; + rawInsert(SLE::Ref sle) override; void - rawReplace(SLE::ref sle) override; + rawReplace(SLE::Ref sle) override; void rawDestroyXRP(XRPAmount const& feeDrops) override; diff --git a/include/xrpl/ledger/detail/RawStateTable.h b/include/xrpl/ledger/detail/RawStateTable.h index 2e36a42eaf..3558dd5e85 100644 --- a/include/xrpl/ledger/detail/RawStateTable.h +++ b/include/xrpl/ledger/detail/RawStateTable.h @@ -57,13 +57,13 @@ public: succ(ReadView const& base, key_type const& key, std::optional const& last) const; void - erase(SLE::ref sle); + erase(SLE::Ref sle); void - insert(SLE::ref sle); + insert(SLE::Ref sle); void - replace(SLE::ref sle); + replace(SLE::Ref sle); [[nodiscard]] SLE::const_pointer read(ReadView const& base, Keylet const& k) const; @@ -71,14 +71,14 @@ public: void destroyXRP(XRPAmount const& fee); - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr slesBegin(ReadView const& base) const; - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr slesEnd(ReadView const& base) const; - [[nodiscard]] std::unique_ptr - slesUpperBound(ReadView const& base, uint256 const& key) const; + [[nodiscard]] std::unique_ptr + slesUpperBound(ReadView const& base, UInt256 const& key) const; private: enum class Action { @@ -102,7 +102,7 @@ private: // Use boost::pmr functionality instead of the std::pmr // functions b/c clang does not support pmr yet (as-of 9/2020) - using items_t = std::map< + using ItemsT = std::map< key_type, SleAction, std::less<>, @@ -110,7 +110,7 @@ private: // monotonic_resource_ must outlive `items_`. Make a pointer so it may be // easily moved. std::unique_ptr monotonicResource_; - items_t items_; + ItemsT items_; XRPAmount dropsDestroyed_{0}; }; diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.h b/include/xrpl/ledger/detail/ReadViewFwdRange.h index bfa2527bbd..7155815b5c 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.h +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.h @@ -18,7 +18,7 @@ template class ReadViewFwdIter { public: - using base_type = ReadViewFwdIter; + using BaseType = ReadViewFwdIter; using value_type = ValueType; @@ -48,7 +48,7 @@ template class ReadViewFwdRange { public: - using iter_base = ReadViewFwdIter; + using IterBase = ReadViewFwdIter; static_assert( std::is_nothrow_move_constructible{}, @@ -74,7 +74,7 @@ public: Iterator(Iterator&& other) noexcept; // Used by the implementation - explicit Iterator(ReadView const* view, std::unique_ptr impl); + explicit Iterator(ReadView const* view, std::unique_ptr impl); Iterator& operator=(Iterator const& other); @@ -101,7 +101,7 @@ public: private: ReadView const* view_ = nullptr; - std::unique_ptr impl_{}; + std::unique_ptr impl_{}; std::optional mutable cache_; }; diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp index 2003280ea6..d2267a65f1 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp @@ -17,7 +17,7 @@ ReadViewFwdRange::Iterator::Iterator(Iterator&& other) noexcept template ReadViewFwdRange::Iterator::Iterator( ReadView const* view, - std::unique_ptr impl) + std::unique_ptr impl) : view_(view), impl_(std::move(impl)) { } diff --git a/include/xrpl/ledger/entries/AMMEntry.h b/include/xrpl/ledger/entries/AMMEntry.h index 0c1c0fe629..61e7562921 100644 --- a/include/xrpl/ledger/entries/AMMEntry.h +++ b/include/xrpl/ledger/entries/AMMEntry.h @@ -31,7 +31,7 @@ public: } explicit AMMEntry( - uint256 const& ammID, + UInt256 const& ammID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::amm(ammID), view, j) diff --git a/include/xrpl/ledger/entries/CheckEntry.h b/include/xrpl/ledger/entries/CheckEntry.h index bf6a188ff5..b50c807327 100644 --- a/include/xrpl/ledger/entries/CheckEntry.h +++ b/include/xrpl/ledger/entries/CheckEntry.h @@ -32,7 +32,7 @@ public: } explicit CheckEntry( - uint256 const& checkID, + UInt256 const& checkID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::check(checkID), view, j) diff --git a/include/xrpl/ledger/entries/CredentialEntry.h b/include/xrpl/ledger/entries/CredentialEntry.h index 4b6a3386a1..d9e9d917e3 100644 --- a/include/xrpl/ledger/entries/CredentialEntry.h +++ b/include/xrpl/ledger/entries/CredentialEntry.h @@ -33,7 +33,7 @@ public: } explicit CredentialEntry( - uint256 const& credentialID, + UInt256 const& credentialID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::credential(credentialID), view, j) diff --git a/include/xrpl/ledger/entries/DepositPreauthEntry.h b/include/xrpl/ledger/entries/DepositPreauthEntry.h index 783363084d..e1d019a965 100644 --- a/include/xrpl/ledger/entries/DepositPreauthEntry.h +++ b/include/xrpl/ledger/entries/DepositPreauthEntry.h @@ -44,7 +44,7 @@ public: } explicit DepositPreauthEntry( - uint256 const& preauthID, + UInt256 const& preauthID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::depositPreauth(preauthID), view, j) diff --git a/include/xrpl/ledger/entries/DirectoryNodeEntry.h b/include/xrpl/ledger/entries/DirectoryNodeEntry.h index b57bec7348..6bcfaba2a1 100644 --- a/include/xrpl/ledger/entries/DirectoryNodeEntry.h +++ b/include/xrpl/ledger/entries/DirectoryNodeEntry.h @@ -35,7 +35,7 @@ public: * Resolve a specific page of the directory rooted at @p root. */ explicit DirectoryNodeEntry( - uint256 const& root, + UInt256 const& root, std::uint64_t index, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) diff --git a/include/xrpl/ledger/entries/LoanBrokerEntry.h b/include/xrpl/ledger/entries/LoanBrokerEntry.h index 77e6b660ed..5401ba6ab9 100644 --- a/include/xrpl/ledger/entries/LoanBrokerEntry.h +++ b/include/xrpl/ledger/entries/LoanBrokerEntry.h @@ -32,7 +32,7 @@ public: } explicit LoanBrokerEntry( - uint256 const& loanBrokerID, + UInt256 const& loanBrokerID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::loanBroker(loanBrokerID), view, j) diff --git a/include/xrpl/ledger/entries/LoanEntry.h b/include/xrpl/ledger/entries/LoanEntry.h index 124c5915fc..97e30c6455 100644 --- a/include/xrpl/ledger/entries/LoanEntry.h +++ b/include/xrpl/ledger/entries/LoanEntry.h @@ -22,7 +22,7 @@ public: using Base::Base; explicit LoanEntry( - uint256 const& loanBrokerID, + UInt256 const& loanBrokerID, SeqProxy const& loanSeq, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) @@ -31,7 +31,7 @@ public: } explicit LoanEntry( - uint256 const& loanID, + UInt256 const& loanID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::loan(loanID), view, j) diff --git a/include/xrpl/ledger/entries/MPTokenEntry.h b/include/xrpl/ledger/entries/MPTokenEntry.h index dcd6c5adb1..4397a75afc 100644 --- a/include/xrpl/ledger/entries/MPTokenEntry.h +++ b/include/xrpl/ledger/entries/MPTokenEntry.h @@ -32,7 +32,7 @@ public: } explicit MPTokenEntry( - uint256 const& issuanceKey, + UInt256 const& issuanceKey, AccountID const& holder, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) @@ -41,7 +41,7 @@ public: } explicit MPTokenEntry( - uint256 const& mptokenKey, + UInt256 const& mptokenKey, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::mptoken(mptokenKey), view, j) diff --git a/include/xrpl/ledger/entries/MPTokenIssuanceEntry.h b/include/xrpl/ledger/entries/MPTokenIssuanceEntry.h index 52dac53217..434430f52c 100644 --- a/include/xrpl/ledger/entries/MPTokenIssuanceEntry.h +++ b/include/xrpl/ledger/entries/MPTokenIssuanceEntry.h @@ -42,7 +42,7 @@ public: } explicit MPTokenIssuanceEntry( - uint256 const& issuanceKey, + UInt256 const& issuanceKey, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::mptokenIssuance(issuanceKey), view, j) diff --git a/include/xrpl/ledger/entries/NFTokenOfferEntry.h b/include/xrpl/ledger/entries/NFTokenOfferEntry.h index a2e71652cd..137a8f0517 100644 --- a/include/xrpl/ledger/entries/NFTokenOfferEntry.h +++ b/include/xrpl/ledger/entries/NFTokenOfferEntry.h @@ -32,7 +32,7 @@ public: } explicit NFTokenOfferEntry( - uint256 const& offerID, + UInt256 const& offerID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::nftokenOffer(offerID), view, j) diff --git a/include/xrpl/ledger/entries/NFTokenPageEntry.h b/include/xrpl/ledger/entries/NFTokenPageEntry.h index 11701f17ea..f6e1b232ea 100644 --- a/include/xrpl/ledger/entries/NFTokenPageEntry.h +++ b/include/xrpl/ledger/entries/NFTokenPageEntry.h @@ -23,7 +23,7 @@ public: explicit NFTokenPageEntry( Keylet const& page, - uint256 const& token, + UInt256 const& token, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::nftokenPage(page, token), view, j) diff --git a/include/xrpl/ledger/entries/OfferEntry.h b/include/xrpl/ledger/entries/OfferEntry.h index 2180d3c89c..3449b28874 100644 --- a/include/xrpl/ledger/entries/OfferEntry.h +++ b/include/xrpl/ledger/entries/OfferEntry.h @@ -32,7 +32,7 @@ public: } explicit OfferEntry( - uint256 const& offerID, + UInt256 const& offerID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::offer(offerID), view, j) diff --git a/include/xrpl/ledger/entries/PermissionedDomainEntry.h b/include/xrpl/ledger/entries/PermissionedDomainEntry.h index 0668a8f8b6..e485be23bb 100644 --- a/include/xrpl/ledger/entries/PermissionedDomainEntry.h +++ b/include/xrpl/ledger/entries/PermissionedDomainEntry.h @@ -32,7 +32,7 @@ public: } explicit PermissionedDomainEntry( - uint256 const& domainID, + UInt256 const& domainID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::permissionedDomain(domainID), view, j) diff --git a/include/xrpl/ledger/entries/SLEBase.h b/include/xrpl/ledger/entries/SLEBase.h index 182e03b55d..f38f3a9397 100644 --- a/include/xrpl/ledger/entries/SLEBase.h +++ b/include/xrpl/ledger/entries/SLEBase.h @@ -309,7 +309,7 @@ public: * @throws std::logic_error same as keylet(): for read-only entries, * if exists() is false. */ - [[nodiscard]] uint256 + [[nodiscard]] UInt256 key() const { return keylet().key; @@ -490,8 +490,8 @@ protected: * otherwise prefer the per-type entries (e.g. AccountRootEntry.h), which * additionally enforce the entry type at compile time. * - * SLE::const_pointer / SLE::const_ref -> ReadOnlySLE - * SLE::pointer / SLE::ref -> WritableSLE + * SLE::const_pointer / SLE::ConstRef -> ReadOnlySLE + * SLE::pointer / SLE::Ref -> WritableSLE */ using ReadOnlySLE = SLEBase; using WritableSLE = SLEBase; diff --git a/include/xrpl/ledger/entries/TicketEntry.h b/include/xrpl/ledger/entries/TicketEntry.h index 16d9a9f3d9..66a4072dba 100644 --- a/include/xrpl/ledger/entries/TicketEntry.h +++ b/include/xrpl/ledger/entries/TicketEntry.h @@ -32,7 +32,7 @@ public: } explicit TicketEntry( - uint256 const& ticketID, + UInt256 const& ticketID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::ticket(ticketID), view, j) diff --git a/include/xrpl/ledger/entries/VaultEntry.h b/include/xrpl/ledger/entries/VaultEntry.h index 897a9117b1..396d10a8fe 100644 --- a/include/xrpl/ledger/entries/VaultEntry.h +++ b/include/xrpl/ledger/entries/VaultEntry.h @@ -32,7 +32,7 @@ public: } explicit VaultEntry( - uint256 const& vaultID, + UInt256 const& vaultID, Base::ViewRefType view, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : Base(keylet::vault(vaultID), view, j) diff --git a/include/xrpl/ledger/helpers/AccountRootHelpers.h b/include/xrpl/ledger/helpers/AccountRootHelpers.h index 452d402d14..19db879fe3 100644 --- a/include/xrpl/ledger/helpers/AccountRootHelpers.h +++ b/include/xrpl/ledger/helpers/AccountRootHelpers.h @@ -69,7 +69,7 @@ struct Adjustment * @return The account reserve amount in drops */ [[nodiscard]] XRPAmount -accountReserve(ReadView const& view, SLE::const_ref sle, beast::Journal j, Adjustment adj = {}); +accountReserve(ReadView const& view, SLE::ConstRef sle, beast::Journal j, Adjustment adj = {}); /** * Convenience overload that accepts AccountID instead of SLE. @@ -105,9 +105,9 @@ accountReserve(ReadView const& view, AccountID const& id, beast::Journal j, Adju [[nodiscard]] TER checkReserve( ApplyViewContext ctx, - SLE::const_ref accSle, + SLE::ConstRef accSle, XRPAmount accBalance, - SLE::const_ref sponsorSle, + SLE::ConstRef sponsorSle, Adjustment adj, beast::Journal j, TER insufReserveCode = tecINSUFFICIENT_RESERVE); @@ -132,7 +132,7 @@ checkReserve( [[nodiscard]] TER checkReserve( ApplyViewContext ctx, - SLE::const_ref accSle, + SLE::ConstRef accSle, XRPAmount accBalance, Adjustment adj, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}); @@ -147,7 +147,7 @@ checkReserve( * @return The adjusted owner count */ std::uint32_t -ownerCount(SLE::const_ref sle, beast::Journal j, std::int32_t ownerCountAdj = 0); +ownerCount(SLE::ConstRef sle, beast::Journal j, std::int32_t ownerCountAdj = 0); /** * Increase owner-count fields when the caller supplies the sponsor. @@ -166,8 +166,8 @@ ownerCount(SLE::const_ref sle, beast::Journal j, std::int32_t ownerCountAdj = 0) void increaseOwnerCount( ApplyView& view, - SLE::ref accountSle, - SLE::ref sponsorSle, + SLE::Ref accountSle, + SLE::Ref sponsorSle, std::uint32_t count, beast::Journal j); @@ -188,7 +188,7 @@ increaseOwnerCount( void increaseOwnerCount( ApplyViewContext ctx, - SLE::ref accountSle, + SLE::Ref accountSle, std::uint32_t count, beast::Journal j); @@ -234,8 +234,8 @@ increaseOwnerCount( void decreaseOwnerCount( ApplyView& view, - SLE::ref accountSle, - SLE::ref sponsorSle, + SLE::Ref accountSle, + SLE::Ref sponsorSle, std::uint32_t count, beast::Journal j); @@ -281,8 +281,8 @@ decreaseOwnerCount( void decreaseOwnerCountForObject( ApplyView& view, - SLE::ref accountSle, - SLE::ref objectSle, + SLE::Ref accountSle, + SLE::Ref objectSle, std::uint32_t count, beast::Journal j); @@ -299,11 +299,11 @@ inline void decreaseOwnerCountForObject( ApplyView& view, AccountID const& account, - SLE::ref objectSle, + SLE::Ref objectSle, std::uint32_t count, beast::Journal j) { - SLE::ref accountSle = view.peek(keylet::account(account)); + SLE::Ref accountSle = view.peek(keylet::account(account)); decreaseOwnerCountForObject(view, accountSle, objectSle, count, j); } @@ -325,7 +325,7 @@ decreaseOwnerCountForObject( void adjustLoanBrokerOwnerCount( ApplyView& view, - SLE::ref brokerSle, + SLE::Ref brokerSle, std::int32_t delta, beast::Journal j); @@ -344,7 +344,7 @@ transferRate(ReadView const& view, AccountID const& issuer); * @return The generated account ID */ AccountID -pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey); +pseudoAccountAddress(ReadView const& view, UInt256 const& pseudoOwnerKey); /** * Returns the list of fields that define an ACCOUNT_ROOT as a pseudo-account @@ -387,7 +387,7 @@ isPseudoAccount(ReadView const& view, AccountID const& accountId) * createPseudoAccount. */ [[nodiscard]] std::expected -createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const& ownerField); +createPseudoAccount(ApplyView& view, UInt256 const& pseudoOwnerKey, SField const& ownerField); /** * Checks the destination and tag. @@ -396,6 +396,6 @@ createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const * - If the SLE requires a destination tag, checks that there is a tag. */ [[nodiscard]] TER -checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag); +checkDestinationAndTag(SLE::ConstRef toSle, bool hasDestinationTag); } // namespace xrpl diff --git a/include/xrpl/ledger/helpers/CredentialHelpers.h b/include/xrpl/ledger/helpers/CredentialHelpers.h index 8b1c819bf4..cccd5b1a43 100644 --- a/include/xrpl/ledger/helpers/CredentialHelpers.h +++ b/include/xrpl/ledger/helpers/CredentialHelpers.h @@ -31,7 +31,7 @@ checkExpired(SLE const& sleCredential, NetClock::time_point const& closed); // Actually remove a credentials object from the ledger [[nodiscard]] TER -deleteSLE(ApplyView& view, SLE::ref sleCredential, beast::Journal j); +deleteSLE(ApplyView& view, SLE::Ref sleCredential, beast::Journal j); // Amendment and parameters checks for sfCredentialIDs field NotTEC @@ -48,7 +48,7 @@ valid(STTx const& tx, ReadView const& view, AccountID const& src, beast::Journal // in preclaim and it returns tecEXPIRED, you should call verifyValidDomain in // doApply. This will ensure that expired credentials are deleted. TER -validDomain(ReadView const& view, uint256 domainID, AccountID const& subject); +validDomain(ReadView const& view, UInt256 domainID, AccountID const& subject); // This function is only called when we are about to return tecNO_PERMISSION // because all the checks for the DepositPreauth authorization failed. @@ -69,7 +69,7 @@ checkArray(STArray const& credentials, unsigned maxSize, beast::Journal j); // Check expired credentials and for credentials matching DomainID of the ledger // object TER -verifyValidDomain(ApplyView& view, AccountID const& account, uint256 domainID, beast::Journal j); +verifyValidDomain(ApplyView& view, AccountID const& account, UInt256 domainID, beast::Journal j); /** * @brief Check whether src is authorized to deposit to dst. @@ -111,7 +111,7 @@ verifyDepositPreauth( ApplyView& view, AccountID const& src, AccountID const& dst, - SLE::const_ref sleDst, + SLE::ConstRef sleDst, beast::Journal j); } // namespace xrpl diff --git a/include/xrpl/ledger/helpers/DelegateHelpers.h b/include/xrpl/ledger/helpers/DelegateHelpers.h index 3c277cb4f7..f602bec22e 100644 --- a/include/xrpl/ledger/helpers/DelegateHelpers.h +++ b/include/xrpl/ledger/helpers/DelegateHelpers.h @@ -18,7 +18,7 @@ namespace xrpl { * if not. */ NotTEC -checkTxPermission(SLE::const_ref delegate, STTx const& tx); +checkTxPermission(SLE::ConstRef delegate, STTx const& tx); /** * Load the granular permissions granted to the delegate account for the @@ -29,6 +29,6 @@ checkTxPermission(SLE::const_ref delegate, STTx const& tx); * @return the granted granular permissions tied to the transaction type. */ std::unordered_set -getGranularPermission(SLE::const_ref delegate, TxType const& type); +getGranularPermission(SLE::ConstRef delegate, TxType const& type); } // namespace xrpl diff --git a/include/xrpl/ledger/helpers/DirectoryHelpers.h b/include/xrpl/ledger/helpers/DirectoryHelpers.h index 25085c4252..85fc285f12 100644 --- a/include/xrpl/ledger/helpers/DirectoryHelpers.h +++ b/include/xrpl/ledger/helpers/DirectoryHelpers.h @@ -23,10 +23,10 @@ template bool internalDirNext( V& view, - uint256 const& root, + UInt256 const& root, std::shared_ptr& page, unsigned int& index, - uint256& entry) + UInt256& entry) requires(std::is_same_v, SLE> && std::is_base_of_v) { auto const& svIndexes = page->getFieldV256(sfIndexes); @@ -69,10 +69,10 @@ template bool internalDirFirst( V& view, - uint256 const& root, + UInt256 const& root, std::shared_ptr& page, unsigned int& index, - uint256& entry) + UInt256& entry) requires(std::is_same_v, SLE> && std::is_base_of_v) { if constexpr (std::is_const_v) @@ -113,18 +113,18 @@ internalDirFirst( bool cdirFirst( ReadView const& view, - uint256 const& root, + UInt256 const& root, SLE::const_pointer& page, unsigned int& index, - uint256& entry); + UInt256& entry); bool dirFirst( ApplyView& view, - uint256 const& root, + UInt256 const& root, SLE::pointer& page, unsigned int& index, - uint256& entry); + UInt256& entry); /** @} */ /** @{ */ @@ -146,25 +146,25 @@ dirFirst( bool cdirNext( ReadView const& view, - uint256 const& root, + UInt256 const& root, SLE::const_pointer& page, unsigned int& index, - uint256& entry); + UInt256& entry); bool dirNext( ApplyView& view, - uint256 const& root, + UInt256 const& root, SLE::pointer& page, unsigned int& index, - uint256& entry); + UInt256& entry); /** @} */ /** * Iterate all items in the given directory. */ void -forEachItem(ReadView const& view, Keylet const& root, std::function const& f); +forEachItem(ReadView const& view, Keylet const& root, std::function const& f); /** * Iterate all items after an item in the given directory. @@ -177,16 +177,16 @@ bool forEachItemAfter( ReadView const& view, Keylet const& root, - uint256 const& after, + UInt256 const& after, std::uint64_t const hint, unsigned int limit, - std::function const& f); + std::function const& f); /** * Iterate all items in an account's owner directory. */ inline void -forEachItem(ReadView const& view, AccountID const& id, std::function const& f) +forEachItem(ReadView const& view, AccountID const& id, std::function const& f) { forEachItem(view, keylet::ownerDir(id), f); } @@ -202,10 +202,10 @@ inline bool forEachItemAfter( ReadView const& view, AccountID const& id, - uint256 const& after, + UInt256 const& after, std::uint64_t const hint, unsigned int limit, - std::function const& f) + std::function const& f) { return forEachItemAfter(view, keylet::ownerDir(id), after, hint, limit, f); } @@ -220,7 +220,7 @@ dirIsEmpty(ReadView const& view, Keylet const& k); /** * Returns a function that sets the owner on a directory SLE */ -[[nodiscard]] std::function +[[nodiscard]] std::function describeOwnerDir(AccountID const& account); } // namespace xrpl diff --git a/include/xrpl/ledger/helpers/EscrowHelpers.h b/include/xrpl/ledger/helpers/EscrowHelpers.h index 062443cd92..54d96f7435 100644 --- a/include/xrpl/ledger/helpers/EscrowHelpers.h +++ b/include/xrpl/ledger/helpers/EscrowHelpers.h @@ -32,7 +32,7 @@ TER escrowUnlockApplyHelper( ApplyViewContext ctx, Rate lockedRate, - SLE::ref sleDest, + SLE::Ref sleDest, XRPAmount xrpBalance, STAmount const& amount, AccountID const& issuer, @@ -46,7 +46,7 @@ inline TER escrowUnlockApplyHelper( ApplyViewContext ctx, Rate lockedRate, - SLE::ref sleDest, + SLE::Ref sleDest, XRPAmount xrpBalance, STAmount const& amount, AccountID const& issuer, @@ -187,7 +187,7 @@ inline TER escrowUnlockApplyHelper( ApplyViewContext ctx, Rate lockedRate, - SLE::ref sleDest, + SLE::Ref sleDest, XRPAmount xrpBalance, STAmount const& amount, AccountID const& issuer, diff --git a/include/xrpl/ledger/helpers/LendingHelpers.h b/include/xrpl/ledger/helpers/LendingHelpers.h index 3887b10120..d0b5de4fd1 100644 --- a/include/xrpl/ledger/helpers/LendingHelpers.h +++ b/include/xrpl/ledger/helpers/LendingHelpers.h @@ -50,7 +50,7 @@ namespace xrpl { [[nodiscard]] TER canApplyToBrokerCover( ReadView const& view, - SLE::const_ref sleBroker, + SLE::ConstRef sleBroker, Asset const& vaultAsset, STAmount const& amount, beast::Journal j, @@ -255,7 +255,7 @@ adjustImpreciseNumber( } inline int -getAssetsTotalScale(SLE::const_ref vaultSle) +getAssetsTotalScale(SLE::ConstRef vaultSle) { if (!vaultSle) return Number::kMinExponent - 1; // LCOV_EXCL_LINE @@ -266,7 +266,7 @@ getAssetsTotalScale(SLE::const_ref vaultSle) // DebtTotal is a broker-level aggregate maintained at vault scale, so the // rounding must also use vault scale — never an individual loan's scale. inline Number -minimumBrokerCover(Number const& debtTotal, TenthBips32 coverRateMinimum, SLE::const_ref vaultSle) +minimumBrokerCover(Number const& debtTotal, TenthBips32 coverRateMinimum, SLE::ConstRef vaultSle) { XRPL_ASSERT( vaultSle && vaultSle->getType() == ltVAULT, "xrpl::minimumBrokerCover : valid Vault sle"); @@ -305,7 +305,7 @@ constructLoanState( // directly from a Loan ledger object, which always holds rounded values, // rather than taking them as separate Number arguments. LoanState -constructLoanState(SLE::const_ref loan); +constructLoanState(SLE::ConstRef loan); Number computeManagementFee( @@ -328,7 +328,7 @@ computeFullPaymentInterest( // boundary is amendment-gated: with fixCleanup3_4_0 the due date must be // strictly in the past, otherwise the exact due-date instant counts as late. [[nodiscard]] bool -isPaymentLate(ReadView const& view, SLE::const_ref loanSle); +isPaymentLate(ReadView const& view, SLE::ConstRef loanSle); // Deltas applied to Vault.AssetsTotal and LoanBroker.DebtTotal at a single // accounting touch point (origination, payment, impair/unimpair/default). @@ -356,7 +356,7 @@ loanOriginationExceedsVaultMaximum( // LoanManage impair/unimpair/default: the vault's exposure to this loan Number -loanVaultExposure(SLE::const_ref loanSle); +loanVaultExposure(SLE::ConstRef loanSle); // LoanPay: what's added to Vault.AssetsTotal and subtracted from LoanBroker.DebtTotal for a payment AccountingDeltas @@ -372,7 +372,7 @@ AccountingDeltas loanOriginationDeltas(Number const& principalRequested); Number -loanVaultExposure(SLE::const_ref loanSle); +loanVaultExposure(SLE::ConstRef loanSle); AccountingDeltas loanPaymentDeltas(LoanPaymentParts const& parts); @@ -385,21 +385,21 @@ loanPaymentDeltas(LoanPaymentParts const& parts); // transactors call. AccountingDeltas loanOriginationDeltas( - SLE::const_ref vaultSle, + SLE::ConstRef vaultSle, Number const& principalRequested, Number const& interestDue); bool loanOriginationExceedsVaultMaximum( - SLE::const_ref vaultSle, + SLE::ConstRef vaultSle, Number const& vaultTotal, Number const& interestDue); Number -loanVaultExposure(SLE::const_ref vaultSle, SLE::const_ref loanSle); +loanVaultExposure(SLE::ConstRef vaultSle, SLE::ConstRef loanSle); AccountingDeltas -loanPaymentDeltas(SLE::const_ref vaultSle, LoanPaymentParts const& parts); +loanPaymentDeltas(SLE::ConstRef vaultSle, LoanPaymentParts const& parts); namespace detail { // These classes and functions should only be accessed by LendingHelper @@ -667,8 +667,8 @@ std::expected loanMakePayment( Asset const& asset, ApplyView& view, - SLE::ref loan, - SLE::const_ref brokerSle, + SLE::Ref loan, + SLE::ConstRef brokerSle, STAmount const& amount, LoanPaymentType const paymentType, beast::Journal j); diff --git a/include/xrpl/ledger/helpers/MPTokenHelpers.h b/include/xrpl/ledger/helpers/MPTokenHelpers.h index 6d26cf3cbc..0c34b3a0f3 100644 --- a/include/xrpl/ledger/helpers/MPTokenHelpers.h +++ b/include/xrpl/ledger/helpers/MPTokenHelpers.h @@ -287,7 +287,7 @@ createMPToken( ApplyView& view, MPTID const& mptIssuanceID, AccountID const& account, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, std::uint32_t const flags); TER @@ -295,7 +295,7 @@ checkCreateMPT( xrpl::ApplyView& view, xrpl::MPTIssue const& mptIssue, xrpl::AccountID const& holder, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, std::uint32_t flags, beast::Journal j); diff --git a/include/xrpl/ledger/helpers/NFTokenHelpers.h b/include/xrpl/ledger/helpers/NFTokenHelpers.h index d9d195c559..079cd2908f 100644 --- a/include/xrpl/ledger/helpers/NFTokenHelpers.h +++ b/include/xrpl/ledger/helpers/NFTokenHelpers.h @@ -38,7 +38,7 @@ removeTokenOffersWithLimit( * Finds the specified token in the owner's token directory. */ std::optional -findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID); +findToken(ReadView const& view, AccountID const& owner, UInt256 const& nftokenID); /** * Finds the token in the owner's token directory. Returns token and page. @@ -53,7 +53,7 @@ struct TokenAndPage } }; std::optional -findTokenAndPage(ApplyView& view, AccountID const& owner, uint256 const& nftokenID); +findTokenAndPage(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID); /** * Insert the token in the owner's token directory. @@ -65,10 +65,10 @@ insertToken(ApplyView& view, AccountID owner, STObject&& nft); * Remove the token from the owner's token directory. */ TER -removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID); +removeToken(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID); TER -removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, SLE::ref page); +removeToken(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID, SLE::Ref page); /** * Deletes the given token offer. @@ -81,7 +81,7 @@ removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, S * The offer also consumes one incremental reserve. */ bool -deleteTokenOffer(ApplyView& view, SLE::ref offer); +deleteTokenOffer(ApplyView& view, SLE::Ref offer); /** * Repairs the links in an NFTokenPage directory. @@ -92,13 +92,13 @@ bool repairNFTokenDirectoryLinks(ApplyView& view, AccountID const& owner); bool -compareTokens(uint256 const& a, uint256 const& b); +compareTokens(UInt256 const& a, UInt256 const& b); TER changeTokenURI( ApplyView& view, AccountID const& owner, - uint256 const& nftokenID, + UInt256 const& nftokenID, std::optional const& uri); /** @@ -142,7 +142,7 @@ tokenOfferCreateApply( std::optional const& dest, std::optional const& expiration, SeqProxy seqProxy, - uint256 const& nftokenID, + UInt256 const& nftokenID, XRPAmount const& priorBalance, beast::Journal j, std::uint32_t txFlags = tfSellNFToken); diff --git a/include/xrpl/ledger/helpers/OfferHelpers.h b/include/xrpl/ledger/helpers/OfferHelpers.h index 524288ea33..2748ebfc7a 100644 --- a/include/xrpl/ledger/helpers/OfferHelpers.h +++ b/include/xrpl/ledger/helpers/OfferHelpers.h @@ -22,6 +22,6 @@ namespace xrpl { */ // [[nodiscard]] // nodiscard commented out so Flow, BookTip and others compile. TER -offerDelete(ApplyView& view, SLE::ref sle, beast::Journal j); +offerDelete(ApplyView& view, SLE::Ref sle, beast::Journal j); } // namespace xrpl diff --git a/include/xrpl/ledger/helpers/OracleHelpers.h b/include/xrpl/ledger/helpers/OracleHelpers.h index da04618e46..bedc25f0a3 100644 --- a/include/xrpl/ledger/helpers/OracleHelpers.h +++ b/include/xrpl/ledger/helpers/OracleHelpers.h @@ -23,7 +23,7 @@ calculateOracleReserve(T const& priceDataSeries) } inline std::uint32_t -calculateOracleReserve(SLE::const_ref oracleSle) +calculateOracleReserve(SLE::ConstRef oracleSle) { return calculateOracleReserve(oracleSle->getFieldArray(sfPriceDataSeries)); } diff --git a/include/xrpl/ledger/helpers/PaymentChannelHelpers.h b/include/xrpl/ledger/helpers/PaymentChannelHelpers.h index 5e1f590c58..a1dab62b2d 100644 --- a/include/xrpl/ledger/helpers/PaymentChannelHelpers.h +++ b/include/xrpl/ledger/helpers/PaymentChannelHelpers.h @@ -23,7 +23,7 @@ namespace xrpl { * fails; tefINTERNAL if the source account SLE cannot be found. */ TER -closeChannel(SLE::ref slep, ApplyView& view, uint256 const& key, beast::Journal j); +closeChannel(SLE::Ref slep, ApplyView& view, UInt256 const& key, beast::Journal j); /** * Add two uint32_t values with saturation at UINT32_MAX. diff --git a/include/xrpl/ledger/helpers/PermissionedDEXHelpers.h b/include/xrpl/ledger/helpers/PermissionedDEXHelpers.h index 12681257aa..7da778c1e8 100644 --- a/include/xrpl/ledger/helpers/PermissionedDEXHelpers.h +++ b/include/xrpl/ledger/helpers/PermissionedDEXHelpers.h @@ -16,7 +16,7 @@ accountInDomain(ReadView const& view, AccountID const& account, Domain const& do [[nodiscard]] bool offerInDomain( ReadView const& view, - uint256 const& offerID, + UInt256 const& offerID, Domain const& domainID, beast::Journal j); diff --git a/include/xrpl/ledger/helpers/RippleStateHelpers.h b/include/xrpl/ledger/helpers/RippleStateHelpers.h index 1a0f92a94b..3a2d5224ec 100644 --- a/include/xrpl/ledger/helpers/RippleStateHelpers.h +++ b/include/xrpl/ledger/helpers/RippleStateHelpers.h @@ -147,8 +147,8 @@ trustCreate( bool const bSrcHigh, AccountID const& uSrcAccountID, AccountID const& uDstAccountID, - uint256 const& uIndex, // --> ripple state entry - SLE::ref sleAccount, // --> the account being set. + UInt256 const& uIndex, // --> ripple state entry + SLE::Ref sleAccount, // --> the account being set. bool const bAuth, // --> authorize account. bool const bNoRipple, // --> others cannot ripple through bool const bFreeze, // --> funds cannot leave @@ -159,13 +159,13 @@ trustCreate( // Issuer should be the account being set. std::uint32_t uQualityIn, std::uint32_t uQualityOut, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, beast::Journal j); [[nodiscard]] TER trustDelete( ApplyView& view, - SLE::ref sleRippleState, + SLE::Ref sleRippleState, AccountID const& uLowAccountID, AccountID const& uHighAccountID, beast::Journal j); @@ -182,7 +182,7 @@ issueIOU( AccountID const& account, STAmount const& amount, Issue const& issue, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, beast::Journal j); [[nodiscard]] TER diff --git a/include/xrpl/ledger/helpers/SponsorHelpers.h b/include/xrpl/ledger/helpers/SponsorHelpers.h index 98bf419140..bcadb12e65 100644 --- a/include/xrpl/ledger/helpers/SponsorHelpers.h +++ b/include/xrpl/ledger/helpers/SponsorHelpers.h @@ -88,13 +88,13 @@ getTxReserveSponsor(ReadView const& view, STTx const& tx); * sponsor account cannot be loaded (an already-checked invariant) */ [[nodiscard]] std::expected -getEffectiveTxReserveSponsor(ApplyViewContext ctx, SLE::const_ref accountSle); +getEffectiveTxReserveSponsor(ApplyViewContext ctx, SLE::ConstRef accountSle); /** * Return the AccountID stored in the given sponsor field of a ledger entry, or nullopt if absent. */ std::optional -getLedgerEntryReserveSponsorID(SLE::const_ref sle, SF_ACCOUNT const& field = sfSponsor); +getLedgerEntryReserveSponsorID(SLE::ConstRef sle, SF_ACCOUNT const& field = sfSponsor); /** * Return a mutable SLE for the reserve sponsor recorded on a ledger entry. @@ -110,7 +110,7 @@ getLedgerEntryReserveSponsorID(SLE::const_ref sle, SF_ACCOUNT const& field = sfS SLE::pointer getLedgerEntryReserveSponsor( ApplyView& view, - SLE::const_ref sle, + SLE::ConstRef sle, SF_ACCOUNT const& field = sfSponsor); /** @@ -127,8 +127,8 @@ getLedgerEntryReserveSponsor( */ void addSponsorToLedgerEntry( - SLE::ref sle, - SLE::const_ref sponsorSle, + SLE::Ref sle, + SLE::ConstRef sponsorSle, SF_ACCOUNT const& field = sfSponsor); /** @@ -141,7 +141,7 @@ addSponsorToLedgerEntry( * can cover. */ void -addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::ref sle, SF_ACCOUNT const& field = sfSponsor); +addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::Ref sle, SF_ACCOUNT const& field = sfSponsor); /** * Remove the reserve sponsor field from a ledger entry. @@ -154,7 +154,7 @@ addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::ref sle, SF_ACCOUNT const& fi * @param field The sponsor field to clear (defaults to sfSponsor) */ void -removeSponsorFromLedgerEntry(SLE::ref sle, SF_ACCOUNT const& field = sfSponsor); +removeSponsorFromLedgerEntry(SLE::Ref sle, SF_ACCOUNT const& field = sfSponsor); /** * Whether @p account is the owner of a ledger entry for sponsorship purposes. diff --git a/include/xrpl/ledger/helpers/TokenHelpers.h b/include/xrpl/ledger/helpers/TokenHelpers.h index 12fa8a105e..79af88c2cf 100644 --- a/include/xrpl/ledger/helpers/TokenHelpers.h +++ b/include/xrpl/ledger/helpers/TokenHelpers.h @@ -404,7 +404,7 @@ accountSend( AccountID const& to, STAmount const& saAmount, beast::Journal j, - SLE::ref sponsorSle = {}, + SLE::Ref sponsorSle = {}, WaiveTransferFee waiveFee = WaiveTransferFee::No, AllowMPTOverflow allowOverflow = AllowMPTOverflow::No); diff --git a/include/xrpl/ledger/helpers/VaultHelpers.h b/include/xrpl/ledger/helpers/VaultHelpers.h index acbcb8ec04..6bfe3a02e8 100644 --- a/include/xrpl/ledger/helpers/VaultHelpers.h +++ b/include/xrpl/ledger/helpers/VaultHelpers.h @@ -29,7 +29,7 @@ class STTx; * @return The number of shares, or nullopt on error. */ [[nodiscard]] std::optional -assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& assets); +assetsToSharesDeposit(SLE::ConstRef vault, SLE::ConstRef issuance, STAmount const& assets); /** * From the perspective of a vault, return the number of assets to take from @@ -43,7 +43,7 @@ assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount co * @return The number of assets, or nullopt on error. */ [[nodiscard]] std::optional -sharesToAssetsDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& shares); +sharesToAssetsDeposit(SLE::ConstRef vault, SLE::ConstRef issuance, STAmount const& shares); /** * Adjusts a requested asset change (`delta`) to match the decimal scale of the @@ -69,7 +69,7 @@ sharesToAssetsDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount co * change is below representable precision. */ [[nodiscard]] std::expected -clampToAssetsTotalScale(SLE::const_ref vault, STAmount const& delta); +clampToAssetsTotalScale(SLE::ConstRef vault, STAmount const& delta); /** * Controls whether to truncate shares instead of rounding. @@ -95,7 +95,7 @@ enum class WaiveUnrealizedLoss : bool { No = false, Yes = true }; * @param waive Whether to skip subtracting the unrealized loss. */ [[nodiscard]] Number -assetsTotalForWithdrawal(SLE::const_ref vault, WaiveUnrealizedLoss waive); +assetsTotalForWithdrawal(SLE::ConstRef vault, WaiveUnrealizedLoss waive); /** * Returns true if debiting `amount` from `total` (the current value of a @@ -131,8 +131,8 @@ debitIsNonZeroDust(Asset const& asset, Number const& total, Number const& amount */ [[nodiscard]] std::optional assetsToSharesWithdraw( - SLE::const_ref vault, - SLE::const_ref issuance, + SLE::ConstRef vault, + SLE::ConstRef issuance, STAmount const& assets, TruncateShares truncate = TruncateShares::No, WaiveUnrealizedLoss waive = WaiveUnrealizedLoss::No); @@ -152,8 +152,8 @@ assetsToSharesWithdraw( */ [[nodiscard]] std::optional sharesToAssetsWithdraw( - SLE::const_ref vault, - SLE::const_ref issuance, + SLE::ConstRef vault, + SLE::ConstRef issuance, STAmount const& shares, WaiveUnrealizedLoss waive = WaiveUnrealizedLoss::No); @@ -168,7 +168,7 @@ sharesToAssetsWithdraw( * both the share MPTID and the outstanding-amount total. */ [[nodiscard]] bool -isSoleShareholder(ReadView const& view, AccountID const& account, SLE::const_ref issuance); +isSoleShareholder(ReadView const& view, AccountID const& account, SLE::ConstRef issuance); /** * Resolves a Vault's LEVersion, the single point every accounting touch @@ -183,7 +183,7 @@ isSoleShareholder(ReadView const& view, AccountID const& account, SLE::const_ref * absent. */ [[nodiscard]] VaultVersion -getVaultVersion(SLE::const_ref vault); +getVaultVersion(SLE::ConstRef vault); /** * Resolves the VaultKind of a vault SLE. Returns VaultKind::ClosedEnded when @@ -193,7 +193,7 @@ getVaultVersion(SLE::const_ref vault); * @param vault The vault SLE. */ [[nodiscard]] VaultKind -getVaultKind(SLE::const_ref vault); +getVaultKind(SLE::ConstRef vault); /** * Reads sfVaultKind from a transaction. An absent field resolves to @@ -240,7 +240,7 @@ isValidClosedEndedGap(std::uint32_t sub, std::uint32_t red); * @param vault The vault SLE. */ [[nodiscard]] VaultPhase -getVaultPhase(ReadView const& view, SLE::const_ref vault); +getVaultPhase(ReadView const& view, SLE::ConstRef vault); /** * Raw-fields overload of getVaultPhase. Derives the phase from an already @@ -295,7 +295,7 @@ enum class SuppressExpired : bool { No = false, Yes = true }; [[nodiscard]] TER checkVaultDomain( ReadView const& view, - SLE::const_ref issuance, + SLE::ConstRef issuance, AccountID const& subject, SuppressExpired suppressExpired); diff --git a/include/xrpl/net/AutoSocket.h b/include/xrpl/net/AutoSocket.h index d090247388..280f72b213 100644 --- a/include/xrpl/net/AutoSocket.h +++ b/include/xrpl/net/AutoSocket.h @@ -24,14 +24,15 @@ class AutoSocket { public: - using ssl_socket = boost::asio::ssl::stream; - using endpoint_type = boost::asio::ip::tcp::socket::endpoint_type; - using socket_ptr = std::unique_ptr; - using plain_socket = ssl_socket::next_layer_type; - using lowest_layer_type = ssl_socket::lowest_layer_type; - using handshake_type = ssl_socket::handshake_type; - using error_code = boost::system::error_code; - using callback = std::function; + using SslSocket = boost::asio::ssl::stream; + using EndpointType = boost::asio::ip::tcp::socket::endpoint_type; + using SocketPtr = std::unique_ptr; + using PlainSocket = SslSocket::next_layer_type; + // NOLINTNEXTLINE(readability-identifier-naming) -- asio stream layer concept name + using lowest_layer_type = SslSocket::lowest_layer_type; + using HandshakeType = SslSocket::handshake_type; + using ErrorCode = boost::system::error_code; + using Callback = std::function; public: AutoSocket( @@ -43,7 +44,7 @@ public: , buffer_((plainOnly || secureOnly) ? 0 : 4) , j_{beast::Journal::getNullSink()} { - socket_ = std::make_unique(s, c); + socket_ = std::make_unique(s, c); } AutoSocket(boost::asio::io_context& s, boost::asio::ssl::context& c) @@ -56,12 +57,12 @@ public: { return secure_; } - ssl_socket& + SslSocket& sslSocket() { return *socket_; } - plain_socket& + PlainSocket& plainSocket() { return socket_->next_layer(); @@ -100,9 +101,9 @@ public: } void - asyncHandshake(handshake_type type, callback cbFunc) + asyncHandshake(HandshakeType type, Callback cbFunc) { - if ((type == ssl_socket::client) || (secure_)) + if ((type == SslSocket::client) || (secure_)) { // must be ssl secure_ = true; @@ -112,7 +113,7 @@ public: { // must be plain secure_ = false; - post(socket_->get_executor(), boost::beast::bind_handler(cbFunc, error_code())); + post(socket_->get_executor(), boost::beast::bind_handler(cbFunc, ErrorCode())); } else { @@ -120,7 +121,7 @@ public: socket_->next_layer().async_receive( boost::asio::buffer(buffer_), boost::asio::socket_base::message_peek, - [this, cbFunc](error_code const& ec, size_t bytesTransferred) { + [this, cbFunc](ErrorCode const& ec, size_t bytesTransferred) { handleAutodetect(cbFunc, ec, bytesTransferred); }); } @@ -136,10 +137,10 @@ public: } else { - error_code ec; + ErrorCode ec; try { - lowestLayer().shutdown(plain_socket::shutdown_both); + lowestLayer().shutdown(PlainSocket::shutdown_both); } catch (boost::system::system_error const& e) { @@ -297,7 +298,7 @@ public: protected: void - handleAutodetect(callback cbFunc, error_code const& ec, size_t bytesTransferred) + handleAutodetect(Callback cbFunc, ErrorCode const& ec, size_t bytesTransferred) { using namespace xrpl; @@ -322,12 +323,12 @@ protected: // ssl JLOG(j_.trace()) << "SSL"; secure_ = true; - socket_->async_handshake(ssl_socket::server, cbFunc); + socket_->async_handshake(SslSocket::server, cbFunc); } } private: - socket_ptr socket_; + SocketPtr socket_; bool secure_; std::vector buffer_; beast::Journal j_; diff --git a/include/xrpl/nodestore/Backend.h b/include/xrpl/nodestore/Backend.h index 85d076bcfb..65c23f0ff4 100644 --- a/include/xrpl/nodestore/Backend.h +++ b/include/xrpl/nodestore/Backend.h @@ -99,7 +99,7 @@ public: * @return The result of the operation. */ virtual Status - fetch(uint256 const& hash, std::shared_ptr* pObject) = 0; + fetch(UInt256 const& hash, std::shared_ptr* pObject) = 0; /** * Store a single object. diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index 902cfc9e03..6f5042e5e3 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -98,7 +98,7 @@ public: * @return `true` if the object was stored? */ virtual void - store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t ledgerSeq) = 0; + store(NodeObjectType type, Blob&& data, UInt256 const& hash, std::uint32_t ledgerSeq) = 0; /** * Check if two ledgers are in the same database @@ -132,7 +132,7 @@ public: */ std::shared_ptr fetchNodeObject( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq = 0, FetchType fetchType = FetchType::Synchronous, bool duplicate = false); @@ -152,7 +152,7 @@ public: */ virtual void asyncFetch( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, std::function const&)>&& callback); @@ -277,7 +277,7 @@ private: // reads to do std::map< - uint256, + UInt256, std::vector< std::pair const&)>>>> read_; @@ -288,7 +288,7 @@ private: virtual std::shared_ptr fetchNodeObject( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, FetchReport& fetchReport, bool duplicate) = 0; diff --git a/include/xrpl/nodestore/NodeObject.h b/include/xrpl/nodestore/NodeObject.h index db139b9aa8..9b138903d7 100644 --- a/include/xrpl/nodestore/NodeObject.h +++ b/include/xrpl/nodestore/NodeObject.h @@ -49,7 +49,7 @@ private: public: // This constructor is private, use createObject instead. - NodeObject(NodeObjectType type, Blob&& data, uint256 const& hash, PrivateAccess); + NodeObject(NodeObjectType type, Blob&& data, UInt256 const& hash, PrivateAccess); /** * Create an object from fields. @@ -64,7 +64,7 @@ public: * @param hash The 256-bit hash of the payload data. */ static std::shared_ptr - createObject(NodeObjectType type, Blob&& data, uint256 const& hash); + createObject(NodeObjectType type, Blob&& data, UInt256 const& hash); /** * Returns the type of this object. @@ -75,7 +75,7 @@ public: /** * Returns the hash of the data. */ - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getHash() const; /** @@ -86,7 +86,7 @@ public: private: NodeObjectType const type_; - uint256 const hash_; + UInt256 const hash_; Blob const data_; }; diff --git a/include/xrpl/nodestore/detail/DatabaseNodeImp.h b/include/xrpl/nodestore/detail/DatabaseNodeImp.h index 9ba81a7323..82fd0985c0 100644 --- a/include/xrpl/nodestore/detail/DatabaseNodeImp.h +++ b/include/xrpl/nodestore/detail/DatabaseNodeImp.h @@ -58,7 +58,7 @@ public: if (cacheSize.has_value() || cacheAge.has_value()) { - cache_ = std::make_shared>( + cache_ = std::make_shared>( "DatabaseNodeImp", cacheSize.value_or(0), std::chrono::minutes(cacheAge.value_or(0)), @@ -96,7 +96,7 @@ public: } void - store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) override; + store(NodeObjectType type, Blob&& data, UInt256 const& hash, std::uint32_t) override; bool isSameDB(std::uint32_t, std::uint32_t) override @@ -113,7 +113,7 @@ public: void asyncFetch( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, std::function const&)>&& callback) override; @@ -123,12 +123,12 @@ public: private: // Cache for database objects. This cache is not always initialized. Check // for null before using. - std::shared_ptr> cache_; + std::shared_ptr> cache_; // Persistent key/value storage std::shared_ptr backend_; std::shared_ptr - fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) + fetchNodeObject(UInt256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) override; void diff --git a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h index 9b566195ef..d342311d61 100644 --- a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h +++ b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h @@ -62,7 +62,7 @@ public: } void - store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) override; + store(NodeObjectType type, Blob&& data, UInt256 const& hash, std::uint32_t) override; void sync() override; @@ -87,7 +87,7 @@ private: std::atomic copyForwardCount_{0}; std::shared_ptr - fetchNodeObject(uint256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) + fetchNodeObject(UInt256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) override; void diff --git a/include/xrpl/peerfinder/.clang-tidy b/include/xrpl/peerfinder/.clang-tidy new file mode 100644 index 0000000000..6051a4c532 --- /dev/null +++ b/include/xrpl/peerfinder/.clang-tidy @@ -0,0 +1,10 @@ +# peerfinder's bootcache and livecache containers model std concepts, which mandate +# snake_case member type names. +# +# clang-tidy replaces rather than merges this option, so the list is the +# top-level one restated plus the 4 name(s) needed only here: +# allocator_type const_reverse_iterator first_argument_type reverse_iterator +InheritParentConfig: true +CheckOptions: + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(allocator_type|const_iterator|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(allocator_type|const_iterator|const_reference|const_reverse_iterator|difference_type|duration|first_argument_type|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" diff --git a/include/xrpl/peerfinder/Slot.h b/include/xrpl/peerfinder/Slot.h index 58e094afc4..9f2b235b39 100644 --- a/include/xrpl/peerfinder/Slot.h +++ b/include/xrpl/peerfinder/Slot.h @@ -15,7 +15,7 @@ namespace xrpl::peer_finder { class Slot { public: - using ptr = std::shared_ptr; + using Ptr = std::shared_ptr; enum class State { Accept, Connect, Connected, Active, Closing }; diff --git a/include/xrpl/peerfinder/Types.h b/include/xrpl/peerfinder/Types.h index 1327f2564f..29f20a3394 100644 --- a/include/xrpl/peerfinder/Types.h +++ b/include/xrpl/peerfinder/Types.h @@ -10,7 +10,7 @@ namespace xrpl::peer_finder { -using clock_type = beast::AbstractClock; +using ClockType = beast::AbstractClock; /** * Represents a set of addresses. diff --git a/include/xrpl/peerfinder/detail/Bootcache.h b/include/xrpl/peerfinder/detail/Bootcache.h index 453d9c22d2..9fd023f49a 100644 --- a/include/xrpl/peerfinder/detail/Bootcache.h +++ b/include/xrpl/peerfinder/detail/Bootcache.h @@ -64,35 +64,35 @@ private: int valence_; }; - using left_t = boost::bimaps:: + using LeftT = boost::bimaps:: unordered_set_of, std::equal_to<>>; - using right_t = boost::bimaps::multiset_of>; - using map_type = boost::bimap; - using value_type = map_type::value_type; + using RightT = boost::bimaps::multiset_of>; + using MapType = boost::bimap; + using value_type = MapType::value_type; struct Transform { - using first_argument_type = map_type::right_map::const_iterator::value_type const&; + using first_argument_type = MapType::right_map::const_iterator::value_type const&; using result_type = beast::ip::Endpoint const&; explicit Transform() = default; beast::ip::Endpoint const& - operator()(map_type::right_map::const_iterator::value_type const& v) const + operator()(MapType::right_map::const_iterator::value_type const& v) const { return v.get_left(); } }; private: - map_type map_; + MapType map_; Store& store_; - clock_type& clock_; + ClockType& clock_; beast::Journal journal_; // Time after which we can update the database again - clock_type::time_point whenUpdate_; + ClockType::time_point whenUpdate_; // Set to true when a database update is needed bool needsUpdate_{false}; @@ -100,11 +100,11 @@ private: public: static constexpr int kStaticValence = 32; - using iterator = boost::transform_iterator; + using iterator = boost::transform_iterator; using const_iterator = iterator; - Bootcache(Store& store, clock_type& clock, beast::Journal journal); + Bootcache(Store& store, ClockType& clock, beast::Journal journal); ~Bootcache(); @@ -117,7 +117,7 @@ public: /** * Returns the number of entries in the cache. */ - [[nodiscard]] map_type::size_type + [[nodiscard]] MapType::size_type size() const; /** diff --git a/include/xrpl/peerfinder/detail/Checker.h b/include/xrpl/peerfinder/detail/Checker.h index e1ac1d44e0..bc86a7f367 100644 --- a/include/xrpl/peerfinder/detail/Checker.h +++ b/include/xrpl/peerfinder/detail/Checker.h @@ -20,7 +20,7 @@ template class Checker { private: - using error_code = boost::system::error_code; + using ErrorCode = boost::system::error_code; struct BasicAsyncOp : boost::intrusive::list_base_hook< boost::intrusive::link_mode> @@ -31,17 +31,17 @@ private: stop() = 0; virtual void - operator()(error_code const& ec) = 0; + operator()(ErrorCode const& ec) = 0; }; template struct AsyncOp : BasicAsyncOp { - using socket_type = Protocol::socket; - using endpoint_type = Protocol::endpoint; + using SocketType = Protocol::socket; + using EndpointType = Protocol::endpoint; Checker& checker; - socket_type socket; + SocketType socket; Handler handler; AsyncOp(Checker& owner, boost::asio::io_context& ioContext, Handler&& handler); @@ -55,18 +55,18 @@ private: stop() override; void - operator()(error_code const& ec) override; // NOLINT(readability-identifier-naming) + operator()(ErrorCode const& ec) override; // NOLINT(readability-identifier-naming) }; //-------------------------------------------------------------------------- - using list_type = + using ListType = boost::intrusive::make_list>::type; std::mutex mutex_; std::condition_variable cond_; boost::asio::io_context& ioContext_; - list_type list_; + ListType list_; bool stop_ = false; public: @@ -129,14 +129,14 @@ template void Checker::AsyncOp::stop() { - error_code ec; + ErrorCode ec; socket.cancel(ec); } template template void -Checker::AsyncOp::operator()(error_code const& ec) +Checker::AsyncOp::operator()(ErrorCode const& ec) { handler(ec); } @@ -189,7 +189,7 @@ Checker::asyncConnect(beast::ip::Endpoint const& endpoint, Handler&& h } op->socket.async_connect( beast::IPAddressConversion::toAsioEndpoint(endpoint), - [op](error_code const& ec) { (*op)(ec); }); + [op](ErrorCode const& ec) { (*op)(ec); }); } template diff --git a/include/xrpl/peerfinder/detail/Fixed.h b/include/xrpl/peerfinder/detail/Fixed.h index 5a52fd7c3e..0aa606a74f 100644 --- a/include/xrpl/peerfinder/detail/Fixed.h +++ b/include/xrpl/peerfinder/detail/Fixed.h @@ -15,7 +15,7 @@ namespace xrpl::peer_finder { class Fixed { public: - explicit Fixed(clock_type& clock) : when_(clock.now()) + explicit Fixed(ClockType& clock) : when_(clock.now()) { } @@ -24,7 +24,7 @@ public: /** * Returns the time after which we should allow a connection attempt. */ - [[nodiscard]] clock_type::time_point const& + [[nodiscard]] ClockType::time_point const& when() const { return when_; @@ -34,7 +34,7 @@ public: * Updates metadata to reflect a failed connection. */ void - failure(clock_type::time_point const& now) + failure(ClockType::time_point const& now) { failures_ = std::min(failures_ + 1, tuning::kConnectionBackoff.size() - 1); when_ = now + std::chrono::minutes(tuning::kConnectionBackoff[failures_]); @@ -44,14 +44,14 @@ public: * Updates metadata to reflect a successful connection. */ void - success(clock_type::time_point const& now) + success(ClockType::time_point const& now) { failures_ = 0; when_ = now; } private: - clock_type::time_point when_; + ClockType::time_point when_; std::size_t failures_{0}; }; diff --git a/include/xrpl/peerfinder/detail/Handouts.h b/include/xrpl/peerfinder/detail/Handouts.h index c20d4b2139..ac1a84dd76 100644 --- a/include/xrpl/peerfinder/detail/Handouts.h +++ b/include/xrpl/peerfinder/detail/Handouts.h @@ -86,7 +86,7 @@ class RedirectHandouts { public: template - explicit RedirectHandouts(SlotImp::ptr slot); + explicit RedirectHandouts(SlotImp::Ptr slot); template bool @@ -98,7 +98,7 @@ public: return list_.size() >= tuning::kRedirectEndpointCount; } - [[nodiscard]] SlotImp::ptr const& + [[nodiscard]] SlotImp::Ptr const& slot() const { return slot_; @@ -117,12 +117,12 @@ public: } private: - SlotImp::ptr slot_; + SlotImp::Ptr slot_; std::vector list_; }; template -RedirectHandouts::RedirectHandouts(SlotImp::ptr slot) : slot_(std::move(slot)) +RedirectHandouts::RedirectHandouts(SlotImp::Ptr slot) : slot_(std::move(slot)) { list_.reserve(tuning::kRedirectEndpointCount); } @@ -172,7 +172,7 @@ class SlotHandouts { public: template - explicit SlotHandouts(SlotImp::ptr slot); + explicit SlotHandouts(SlotImp::Ptr slot); template bool @@ -190,7 +190,7 @@ public: list_.push_back(ep); } - [[nodiscard]] SlotImp::ptr const& + [[nodiscard]] SlotImp::Ptr const& slot() const { return slot_; @@ -203,12 +203,12 @@ public: } private: - SlotImp::ptr slot_; + SlotImp::Ptr slot_; std::vector list_; }; template -SlotHandouts::SlotHandouts(SlotImp::ptr slot) : slot_(std::move(slot)) +SlotHandouts::SlotHandouts(SlotImp::Ptr slot) : slot_(std::move(slot)) { list_.reserve(tuning::kNumberOfEndpoints); } @@ -259,14 +259,14 @@ class ConnectHandouts public: // Keeps track of addresses we have made outgoing connections // to, for the purposes of not connecting to them too frequently. - using Squelches = beast::aged_set; + using Squelches = beast::AgedSet; - using list_type = std::vector; + using ListType = std::vector; private: std::size_t needed_; Squelches& squelches_; - list_type list_; + ListType list_; public: template @@ -294,13 +294,13 @@ public: return tryInsert(endpoint.address); } - list_type& + ListType& list() { return list_; } - [[nodiscard]] list_type const& + [[nodiscard]] ListType const& list() const { return list_; diff --git a/include/xrpl/peerfinder/detail/Livecache.h b/include/xrpl/peerfinder/detail/Livecache.h index ec797065e5..30c9aa8c69 100644 --- a/include/xrpl/peerfinder/detail/Livecache.h +++ b/include/xrpl/peerfinder/detail/Livecache.h @@ -51,7 +51,7 @@ protected: Endpoint endpoint; }; - using list_type = + using ListType = boost::intrusive::make_list>::type; public: @@ -67,7 +67,7 @@ public: // Iterator transformation to extract the endpoint from Element struct Transform { - using first_argument = Element; + using FirstArgument = Element; using result_type = Endpoint; explicit Transform() = default; @@ -80,12 +80,12 @@ public: }; public: - using iterator = boost::transform_iterator; + using iterator = boost::transform_iterator; using const_iterator = iterator; using reverse_iterator = - boost::transform_iterator; + boost::transform_iterator; using const_reverse_iterator = reverse_iterator; @@ -147,20 +147,20 @@ public: } private: - explicit Hop(beast::MaybeConst::type& list) : list_(list) + explicit Hop(beast::MaybeConst::type& list) : list_(list) { } friend class LivecacheBase; - std::reference_wrapper::type> list_; + std::reference_wrapper::type> list_; }; protected: // Work-around to call Hop's private constructor from Livecache template static Hop - makeHop(beast::MaybeConst::type& list) + makeHop(beast::MaybeConst::type& list) { return Hop(list); } @@ -187,7 +187,7 @@ template > class Livecache : protected detail::LivecacheBase { private: - using cache_type = beast::aged_map< + using CacheType = beast::AgedMap< beast::ip::Endpoint, Element, std::chrono::steady_clock, @@ -195,7 +195,7 @@ private: Allocator>; beast::Journal journal_; - cache_type cache_; + CacheType cache_; public: using allocator_type = Allocator; @@ -203,12 +203,12 @@ public: /** * Create the cache. */ - Livecache(clock_type& clock, beast::Journal journal, Allocator alloc = Allocator()); + Livecache(ClockType& clock, beast::Journal journal, Allocator alloc = Allocator()); // // Iteration by hops // - // The range [begin, end) provides a sequence of list_type + // The range [begin, end) provides a sequence of ListType // where each list contains endpoints at a given hops. // @@ -221,34 +221,34 @@ public: // are used for automatic connection attempts. // using Histogram = std::array; - using lists_type = std::array; + using ListsType = std::array; template struct Transform { - using first_argument = lists_type::value_type; + using FirstArgument = ListsType::value_type; using result_type = Hop; explicit Transform() = default; Hop - operator()(beast::MaybeConst::type& list) const + operator()(beast::MaybeConst::type& list) const { return makeHop(list); } }; public: - using iterator = boost::transform_iterator, lists_type::iterator>; + using iterator = boost::transform_iterator, ListsType::iterator>; using const_iterator = - boost::transform_iterator, lists_type::const_iterator>; + boost::transform_iterator, ListsType::const_iterator>; using reverse_iterator = - boost::transform_iterator, lists_type::reverse_iterator>; + boost::transform_iterator, ListsType::reverse_iterator>; using const_reverse_iterator = - boost::transform_iterator, lists_type::const_reverse_iterator>; + boost::transform_iterator, ListsType::const_reverse_iterator>; iterator begin() @@ -345,7 +345,7 @@ public: remove(Element& e); friend class Livecache; - lists_type lists_; + ListsType lists_; Histogram hist_{}; } hops; @@ -361,7 +361,7 @@ public: /** * Returns the number of entries in the cache. */ - cache_type::size_type + CacheType::size_type size() const { return cache_.size(); @@ -389,7 +389,7 @@ public: //------------------------------------------------------------------------------ template -Livecache::Livecache(clock_type& clock, beast::Journal journal, Allocator alloc) +Livecache::Livecache(ClockType& clock, beast::Journal journal, Allocator alloc) : journal_(journal), cache_(clock, alloc), hops(alloc) { } @@ -399,7 +399,7 @@ void Livecache::expire() { std::size_t n(0); - typename cache_type::time_point const expired( + typename CacheType::time_point const expired( cache_.clock().now() - tuning::kLiveCacheSecondsToLive); for (auto iter(cache_.chronological.begin()); iter != cache_.chronological.end() && iter.when() <= expired;) @@ -467,7 +467,7 @@ template void Livecache::onWrite(beast::PropertyStream::Map& map) { - typename cache_type::time_point const expired( + typename CacheType::time_point const expired( cache_.clock().now() - tuning::kLiveCacheSecondsToLive); map["size"] = size(); map["hist"] = hops.histogram(); diff --git a/include/xrpl/peerfinder/detail/Logic.h b/include/xrpl/peerfinder/detail/Logic.h index 4821054280..48be968972 100644 --- a/include/xrpl/peerfinder/detail/Logic.h +++ b/include/xrpl/peerfinder/detail/Logic.h @@ -60,7 +60,7 @@ public: using Slots = std::map>; beast::Journal journal; - clock_type& clock; + ClockType& clock; Store& store; Checker& checker; @@ -104,13 +104,13 @@ public: // A list of dynamic sources to consult as a fallback std::vector> sources; - clock_type::time_point whenBroadcast; + ClockType::time_point whenBroadcast; ConnectHandouts::Squelches squelches; //-------------------------------------------------------------------------- public: - Logic(clock_type& clock, Store& store, Checker& checker, beast::Journal journal) + Logic(ClockType& clock, Store& store, Checker& checker, beast::Journal journal) : journal(journal) , clock(clock) , store(store) @@ -254,7 +254,7 @@ public: //-------------------------------------------------------------------------- - std::pair + std::pair newInboundSlot( beast::ip::Endpoint const& localEndpoint, beast::ip::Endpoint const& remoteEndpoint) @@ -272,7 +272,7 @@ public: { JLOG(journal.debug()) << std::left << std::setw(18) << "Logic dropping inbound " << remoteEndpoint << " because of ip limits."; - return {SlotImp::ptr(), Result::IpLimitExceeded}; + return {SlotImp::Ptr(), Result::IpLimitExceeded}; } } @@ -281,11 +281,11 @@ public: { JLOG(journal.debug()) << std::left << std::setw(18) << "Logic dropping " << remoteEndpoint << " as duplicate incoming"; - return {SlotImp::ptr(), Result::DuplicatePeer}; + return {SlotImp::Ptr(), Result::DuplicatePeer}; } // Create the slot - SlotImp::ptr const slot( + SlotImp::Ptr const slot( std::make_shared( localEndpoint, remoteEndpoint, fixed(remoteEndpoint.address()), clock)); // Add slot to table @@ -305,7 +305,7 @@ public: } // Can't check for self-connect because we don't know the local endpoint - std::pair + std::pair newOutboundSlot(beast::ip::Endpoint const& remoteEndpoint) { JLOG(journal.debug()) << std::left << std::setw(18) << "Logic connect " << remoteEndpoint; @@ -317,11 +317,11 @@ public: { JLOG(journal.debug()) << std::left << std::setw(18) << "Logic dropping " << remoteEndpoint << " as duplicate connect"; - return {SlotImp::ptr(), Result::DuplicatePeer}; + return {SlotImp::Ptr(), Result::DuplicatePeer}; } // Create the slot - SlotImp::ptr const slot( + SlotImp::Ptr const slot( std::make_shared(remoteEndpoint, fixed(remoteEndpoint), clock)); // Add slot to table @@ -342,7 +342,7 @@ public: } bool - onConnected(SlotImp::ptr const& slot, beast::ip::Endpoint const& localEndpoint) + onConnected(SlotImp::Ptr const& slot, beast::ip::Endpoint const& localEndpoint) { beast::WrappedSink sink{journal.sink(), slot->prefix()}; beast::Journal const journal{sink}; @@ -380,7 +380,7 @@ public: } Result - activate(SlotImp::ptr const& slot, PublicKey const& key, bool reserved) + activate(SlotImp::Ptr const& slot, PublicKey const& key, bool reserved) { beast::WrappedSink sink{journal.sink(), slot->prefix()}; beast::Journal const journal{sink}; @@ -460,7 +460,7 @@ public: * the HTTP handshake and not via TMEndpoints. */ std::vector - redirect(SlotImp::ptr const& slot) + redirect(SlotImp::Ptr const& slot) { std::scoped_lock const _(lock); RedirectHandouts h(slot); @@ -589,14 +589,14 @@ public: std::scoped_lock const _(lock); - clock_type::time_point const now = clock.now(); + ClockType::time_point const now = clock.now(); if (whenBroadcast <= now) { std::vector targets; { // build list of active slots - std::vector activeSlots; + std::vector activeSlots; activeSlots.reserve(slots.size()); std::ranges::for_each(slots, [&activeSlots](Slots::value_type const& value) { if (value.second->state() == Slot::State::Active) @@ -606,7 +606,7 @@ public: // build target vector targets.reserve(activeSlots.size()); - std::ranges::for_each(activeSlots, [&targets](SlotImp::ptr const& slot) { + std::ranges::for_each(activeSlots, [&targets](SlotImp::Ptr const& slot) { targets.emplace_back(slot); }); } @@ -647,7 +647,7 @@ public: // broadcast for (auto const& t : targets) { - SlotImp::ptr const& slot = t.slot(); + SlotImp::Ptr const& slot = t.slot(); auto const& list = t.list(); beast::WrappedSink sink{journal.sink(), slot->prefix()}; beast::Journal const journal{sink}; @@ -684,7 +684,7 @@ public: // Validate and clean up the list that we received from the slot. void - preprocess(SlotImp::ptr const& slot, Endpoints& list) + preprocess(SlotImp::Ptr const& slot, Endpoints& list) { bool neighbor(false); for (auto iter = list.begin(); iter != list.end();) @@ -748,7 +748,7 @@ public: } void - onEndpoints(SlotImp::ptr const& slot, Endpoints list) + onEndpoints(SlotImp::Ptr const& slot, Endpoints list) { beast::WrappedSink sink{journal.sink(), slot->prefix()}; beast::Journal const journal{sink}; @@ -775,7 +775,7 @@ public: slot->state() == Slot::State::Active, "xrpl::peer_finder::Logic::onEndpoints : valid slot state"); - clock_type::time_point const now(clock.now()); + ClockType::time_point const now(clock.now()); // Limit how often we accept new endpoints if (slot->whenAcceptEndpoints > now) @@ -843,7 +843,7 @@ public: //-------------------------------------------------------------------------- void - remove(SlotImp::ptr const& slot) + remove(SlotImp::Ptr const& slot) { { auto const iter = slots.find(slot->remoteEndpoint()); @@ -891,7 +891,7 @@ public: } void - onClosed(SlotImp::ptr const& slot) + onClosed(SlotImp::Ptr const& slot) { std::scoped_lock const _(lock); @@ -951,7 +951,7 @@ public: } void - onFailure(SlotImp::ptr const& slot) + onFailure(SlotImp::Ptr const& slot) { std::scoped_lock const _(lock); diff --git a/include/xrpl/peerfinder/detail/SlotImp.h b/include/xrpl/peerfinder/detail/SlotImp.h index db86183f64..e792ee2c17 100644 --- a/include/xrpl/peerfinder/detail/SlotImp.h +++ b/include/xrpl/peerfinder/detail/SlotImp.h @@ -17,17 +17,17 @@ namespace xrpl::peer_finder { class SlotImp : public Slot { public: - using ptr = std::shared_ptr; + using Ptr = std::shared_ptr; // inbound SlotImp( beast::ip::Endpoint const& localEndpoint, beast::ip::Endpoint remoteEndpoint, bool fixed, - clock_type& clock); + ClockType& clock); // outbound - SlotImp(beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type& clock); + SlotImp(beast::ip::Endpoint remoteEndpoint, bool fixed, ClockType& clock); bool inbound() const override @@ -122,7 +122,7 @@ public: state(State state); void - activate(clock_type::time_point const& now); + activate(ClockType::time_point const& now); // "Memberspace" // @@ -132,7 +132,7 @@ public: class RecentT { public: - explicit RecentT(clock_type& clock); + explicit RecentT(ClockType& clock); /** * Called for each valid endpoint received for a slot. @@ -153,7 +153,7 @@ public: expire(); friend class SlotImp; - beast::aged_unordered_map cache_; + beast::AgedUnorderedMap cache_; } recent; void @@ -193,7 +193,7 @@ public: // This is to prevent flooding or spamming. Receipt of mtENDPOINTS // sooner than the allotted time should impose a load charge. // - clock_type::time_point whenAcceptEndpoints; + ClockType::time_point whenAcceptEndpoints; }; } // namespace xrpl::peer_finder diff --git a/include/xrpl/peerfinder/detail/Store.h b/include/xrpl/peerfinder/detail/Store.h index 1f9352c6ec..776b778ccc 100644 --- a/include/xrpl/peerfinder/detail/Store.h +++ b/include/xrpl/peerfinder/detail/Store.h @@ -17,9 +17,9 @@ public: virtual ~Store() = default; // load the bootstrap cache - using load_callback = std::function; + using LoadCallback = std::function; virtual std::size_t - load(load_callback const& cb) = 0; + load(LoadCallback const& cb) = 0; // save the bootstrap cache struct Entry diff --git a/include/xrpl/peerfinder/make_Manager.h b/include/xrpl/peerfinder/make_Manager.h index e514734d8b..aff0c4e181 100644 --- a/include/xrpl/peerfinder/make_Manager.h +++ b/include/xrpl/peerfinder/make_Manager.h @@ -28,9 +28,9 @@ namespace xrpl::peer_finder { std::unique_ptr makeManager( boost::asio::io_context& ioContext, - clock_type& clock, + ClockType& clock, beast::Journal journal, Store& store, - beast::insight::Collector::ptr const& collector); + beast::insight::Collector::Ptr const& collector); } // namespace xrpl::peer_finder diff --git a/include/xrpl/protocol/.clang-tidy b/include/xrpl/protocol/.clang-tidy new file mode 100644 index 0000000000..24d289a644 --- /dev/null +++ b/include/xrpl/protocol/.clang-tidy @@ -0,0 +1,10 @@ +# protocol's hashers and iterable STObject/STArray types model std concepts, which mandate +# snake_case member type names. +# +# clang-tidy replaces rather than merges this option, so the list is the +# top-level one restated plus the 3 name(s) needed only here: +# argument_type const_pointer type +InheritParentConfig: true +CheckOptions: + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(argument_type|const_iterator|const_pointer|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|type|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(argument_type|const_iterator|const_pointer|const_reference|difference_type|duration|iterator|iterator_category|key_type|mapped_type|period|pointer|reference|rep|result_type|size_type|time_point|type|value_type)$" diff --git a/include/xrpl/protocol/Asset.h b/include/xrpl/protocol/Asset.h index 8e9c09eb89..3bda31813b 100644 --- a/include/xrpl/protocol/Asset.h +++ b/include/xrpl/protocol/Asset.h @@ -26,7 +26,7 @@ template std::is_same_v) struct AmountType { - using amount_type = T; + using Amount = T; }; /* Used to check for an asset with either badCurrency() @@ -52,7 +52,7 @@ class Asset { public: using value_type = std::variant; - using token_type = std::variant; + using TokenType = std::variant; using AmtType = std::variant, AmountType, AmountType>; @@ -99,7 +99,7 @@ public: [[nodiscard]] constexpr value_type const& value() const; - [[nodiscard]] constexpr token_type + [[nodiscard]] constexpr TokenType token() const; void @@ -203,12 +203,12 @@ Asset::value() const return issue_; } -constexpr Asset::token_type +constexpr Asset::TokenType Asset::token() const { return visit( - [&](Issue const& issue) -> Asset::token_type { return issue.currency; }, - [&](MPTIssue const& issue) -> Asset::token_type { return issue.getMptID(); }); + [&](Issue const& issue) -> Asset::TokenType { return issue.currency; }, + [&](MPTIssue const& issue) -> Asset::TokenType { return issue.getMptID(); }); } constexpr Asset::AmtType diff --git a/include/xrpl/protocol/Batch.h b/include/xrpl/protocol/Batch.h index 1e4f811fa9..11659b120f 100644 --- a/include/xrpl/protocol/Batch.h +++ b/include/xrpl/protocol/Batch.h @@ -16,7 +16,7 @@ serializeBatch( AccountID const& outerAccount, std::uint32_t outerSeqValue, std::uint32_t const& flags, - std::vector const& txids) + std::vector const& txids) { msg.add32(HashPrefix::Batch); msg.addBitString(outerAccount); diff --git a/include/xrpl/protocol/Book.h b/include/xrpl/protocol/Book.h index e6ed3729dd..983c3c61ef 100644 --- a/include/xrpl/protocol/Book.h +++ b/include/xrpl/protocol/Book.h @@ -29,11 +29,11 @@ class Book final : public CountedObject public: Asset in; Asset out; - std::optional domain; + std::optional domain; Book() = default; - Book(Asset const& in, Asset const& out, std::optional const& domain) + Book(Asset const& in, Asset const& out, std::optional const& domain) : in(in), out(out), domain(domain) { } @@ -107,8 +107,8 @@ struct hash : private boost::base_from_member, 1> { private: - using currency_hash_type = boost::base_from_member, 0>; - using issuer_hash_type = boost::base_from_member, 1>; + using CurrencyHashType = boost::base_from_member, 0>; + using IssuerHashType = boost::base_from_member, 1>; public: hash() = default; @@ -119,9 +119,9 @@ public: value_type operator()(argument_type const& value) const { - value_type result(currency_hash_type::member(value.currency)); + value_type result(CurrencyHashType::member(value.currency)); if (!isXRP(value.currency)) - boost::hash_combine(result, issuer_hash_type::member(value.account)); + boost::hash_combine(result, IssuerHashType::member(value.account)); return result; } }; @@ -130,7 +130,7 @@ template <> struct hash : private boost::base_from_member, 0> { private: - using id_hash_type = boost::base_from_member, 0>; + using IdHashType = boost::base_from_member, 0>; public: hash() = default; @@ -141,7 +141,7 @@ public: value_type operator()(argument_type const& value) const { - value_type const result(id_hash_type::member(value.getMptID())); + value_type const result(IdHashType::member(value.getMptID())); return result; } }; @@ -153,11 +153,11 @@ private: using value_type = std::size_t; using argument_type = xrpl::Asset; - using issue_hasher = std::hash; - using mptissue_hasher = std::hash; + using IssueHasher = std::hash; + using MptissueHasher = std::hash; - issue_hasher mIssueHasher_; - mptissue_hasher mMptissueHasher_; + IssueHasher mIssueHasher_; + MptissueHasher mMptissueHasher_; public: hash() = default; @@ -183,11 +183,11 @@ template <> struct hash { private: - using asset_hasher = std::hash; - using uint256_hasher = xrpl::uint256::hasher; + using AssetHasher = std::hash; + using UInt256Hasher = xrpl::UInt256::hasher; - asset_hasher issueHasher_; - uint256_hasher uint256Hasher_; + AssetHasher issueHasher_; + UInt256Hasher uint256Hasher_; public: hash() = default; diff --git a/include/xrpl/protocol/ConfidentialTransfer.h b/include/xrpl/protocol/ConfidentialTransfer.h index 5c52fb0ba3..1b8dca2c12 100644 --- a/include/xrpl/protocol/ConfidentialTransfer.h +++ b/include/xrpl/protocol/ConfidentialTransfer.h @@ -91,10 +91,10 @@ incrementConfidentialVersion(STObject& mptoken) * @param version The sender's confidential balance version. * @return A 256-bit context hash unique to this transaction. */ -uint256 +UInt256 getSendContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, AccountID const& destination, std::uint32_t version); @@ -111,10 +111,10 @@ getSendContextHash( * @param holder The holder's account ID being clawed back from. * @return A 256-bit context hash unique to this transaction. */ -uint256 +UInt256 getClawbackContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, AccountID const& holder); @@ -129,8 +129,8 @@ getClawbackContextHash( * @param sequence The transaction sequence number or a ticket number. * @return A 256-bit context hash unique to this transaction. */ -uint256 -getConvertContextHash(AccountID const& account, uint192 const& issuanceID, std::uint32_t sequence); +UInt256 +getConvertContextHash(AccountID const& account, UInt192 const& issuanceID, std::uint32_t sequence); /** * @brief Generates the context hash for ConfidentialMPTConvertBack transactions. @@ -144,10 +144,10 @@ getConvertContextHash(AccountID const& account, uint192 const& issuanceID, std:: * @param version The holder's confidential balance version. * @return A 256-bit context hash unique to this transaction. */ -uint256 +UInt256 getConvertBackContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, std::uint32_t version); @@ -286,7 +286,7 @@ encryptCanonicalZeroAmount(Slice const& pubKeySlice, AccountID const& account, M * @return tesSUCCESS if valid, or an error code otherwise. */ TER -verifySchnorrProof(Slice const& pubKeySlice, Slice const& proofSlice, uint256 const& contextHash); +verifySchnorrProof(Slice const& pubKeySlice, Slice const& proofSlice, UInt256 const& contextHash); /** * @brief Validates the format of encrypted amount fields in a transaction. @@ -441,7 +441,7 @@ verifyClawbackProof( Slice const& proof, Slice const& pubKeySlice, Slice const& ciphertext, - uint256 const& contextHash); + UInt256 const& contextHash); /** * @brief Generates a cryptographically secure blinding factor @@ -488,7 +488,7 @@ verifySendProof( Slice const& spendingBalance, Slice const& amountCommitment, Slice const& balanceCommitment, - uint256 const& contextHash); + UInt256 const& contextHash); /** * @brief Verifies all zero-knowledge proofs for a ConfidentialMPTConvertBack transaction. @@ -513,6 +513,6 @@ verifyConvertBackProof( Slice const& spendingBalance, Slice const& balanceCommitment, uint64_t amount, - uint256 const& contextHash); + UInt256 const& contextHash); } // namespace xrpl diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index f15b7e2d3f..1d274b42b1 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -69,7 +69,7 @@ namespace xrpl { // Feature names must not exceed this length (in characters, excluding the null terminator). static constexpr std::size_t kMaxFeatureNameSize = 63; // Reserve this exact feature-name length (in characters/bytes, excluding the null terminator) -// so that a 32-byte uint256 (for example, in WASM or other interop contexts) can be used +// so that a 32-byte UInt256 (for example, in WASM or other interop contexts) can be used // as a compact, fixed-size feature selector without conflicting with human-readable names. static constexpr std::size_t kReservedFeatureNameSize = 32; @@ -180,25 +180,25 @@ numUpVotedAmendments(); } // namespace detail -std::optional +std::optional getRegisteredFeature(std::string const& name); size_t -featureToBitsetIndex(uint256 const& f); +featureToBitsetIndex(UInt256 const& f); -uint256 +UInt256 bitsetIndexToFeature(size_t i); std::string -featureToName(uint256 const& f); +featureToName(UInt256 const& f); class FeatureBitset : private std::bitset { - using base = std::bitset; + using Base = std::bitset; template void - initFromFeatures(uint256 const& f, Fs&&... fs) + initFromFeatures(UInt256 const& f, Fs&&... fs) { set(f); if constexpr (sizeof...(fs) > 0) @@ -206,37 +206,37 @@ class FeatureBitset : private std::bitset } public: - using base::bitset; - using base::operator==; + using Base::bitset; + using Base::operator==; - using base::all; - using base::any; - using base::count; - using base::flip; - using base::none; - using base::reset; - using base::set; - using base::size; - using base::test; - using base::operator[]; - using base::to_string; - using base::to_ullong; - using base::to_ulong; + using Base::all; + using Base::any; + using Base::count; + using Base::flip; + using Base::none; + using Base::reset; + using Base::set; + using Base::size; + using Base::test; + using Base::operator[]; + using Base::to_string; + using Base::to_ullong; + using Base::to_ulong; FeatureBitset() = default; - explicit FeatureBitset(base const& b) : base(b) + explicit FeatureBitset(Base const& b) : Base(b) { XRPL_ASSERT(b.count() == count(), "xrpl::FeatureBitset::FeatureBitset(base) : count match"); } template - explicit FeatureBitset(uint256 const& f, Fs&&... fs) + explicit FeatureBitset(UInt256 const& f, Fs&&... fs) { initFromFeatures(f, std::forward(fs)...); XRPL_ASSERT( count() == (sizeof...(fs) + 1), - "xrpl::FeatureBitset::FeatureBitset(uint256) : count and " + "xrpl::FeatureBitset::FeatureBitset(UInt256) : count and " "sizeof... do match"); } @@ -252,72 +252,72 @@ public: } auto - operator[](uint256 const& f) + operator[](UInt256 const& f) { - return base::operator[](featureToBitsetIndex(f)); + return Base::operator[](featureToBitsetIndex(f)); } auto - operator[](uint256 const& f) const + operator[](UInt256 const& f) const { - return base::operator[](featureToBitsetIndex(f)); + return Base::operator[](featureToBitsetIndex(f)); } FeatureBitset& - set(uint256 const& f, bool value = true) + set(UInt256 const& f, bool value = true) { - base::set(featureToBitsetIndex(f), value); + Base::set(featureToBitsetIndex(f), value); return *this; } FeatureBitset& - reset(uint256 const& f) + reset(UInt256 const& f) { - base::reset(featureToBitsetIndex(f)); + Base::reset(featureToBitsetIndex(f)); return *this; } FeatureBitset& - flip(uint256 const& f) + flip(UInt256 const& f) { - base::flip(featureToBitsetIndex(f)); + Base::flip(featureToBitsetIndex(f)); return *this; } FeatureBitset& operator&=(FeatureBitset const& rhs) { - base::operator&=(rhs); + Base::operator&=(rhs); return *this; } FeatureBitset& operator|=(FeatureBitset const& rhs) { - base::operator|=(rhs); + Base::operator|=(rhs); return *this; } FeatureBitset operator~() const { - return FeatureBitset{base::operator~()}; + return FeatureBitset{Base::operator~()}; } friend FeatureBitset operator&(FeatureBitset const& lhs, FeatureBitset const& rhs) { - return FeatureBitset{static_cast(lhs) & static_cast(rhs)}; + return FeatureBitset{static_cast(lhs) & static_cast(rhs)}; } friend FeatureBitset - operator&(FeatureBitset const& lhs, uint256 const& rhs) + operator&(FeatureBitset const& lhs, UInt256 const& rhs) { return lhs & FeatureBitset{rhs}; } friend FeatureBitset - operator&(uint256 const& lhs, FeatureBitset const& rhs) + operator&(UInt256 const& lhs, FeatureBitset const& rhs) { return FeatureBitset{lhs} & rhs; } @@ -325,17 +325,17 @@ public: friend FeatureBitset operator|(FeatureBitset const& lhs, FeatureBitset const& rhs) { - return FeatureBitset{static_cast(lhs) | static_cast(rhs)}; + return FeatureBitset{static_cast(lhs) | static_cast(rhs)}; } friend FeatureBitset - operator|(FeatureBitset const& lhs, uint256 const& rhs) + operator|(FeatureBitset const& lhs, UInt256 const& rhs) { return lhs | FeatureBitset{rhs}; } friend FeatureBitset - operator|(uint256 const& lhs, FeatureBitset const& rhs) + operator|(UInt256 const& lhs, FeatureBitset const& rhs) { return FeatureBitset{lhs} | rhs; } @@ -343,17 +343,17 @@ public: friend FeatureBitset operator^(FeatureBitset const& lhs, FeatureBitset const& rhs) { - return FeatureBitset{static_cast(lhs) ^ static_cast(rhs)}; + return FeatureBitset{static_cast(lhs) ^ static_cast(rhs)}; } friend FeatureBitset - operator^(FeatureBitset const& lhs, uint256 const& rhs) + operator^(FeatureBitset const& lhs, UInt256 const& rhs) { return lhs ^ FeatureBitset{rhs}; } friend FeatureBitset - operator^(uint256 const& lhs, FeatureBitset const& rhs) + operator^(UInt256 const& lhs, FeatureBitset const& rhs) { return FeatureBitset{lhs} ^ rhs; } @@ -366,13 +366,13 @@ public: } friend FeatureBitset - operator-(FeatureBitset const& lhs, uint256 const& rhs) + operator-(FeatureBitset const& lhs, UInt256 const& rhs) { return lhs - FeatureBitset{rhs}; } friend FeatureBitset - operator-(uint256 const& lhs, FeatureBitset const& rhs) + operator-(UInt256 const& lhs, FeatureBitset const& rhs) { return FeatureBitset{lhs} - rhs; } @@ -398,8 +398,8 @@ foreachFeature(FeatureBitset bs, F&& f) #pragma push_macro("XRPL_RETIRE_FIX") #undef XRPL_RETIRE_FIX -#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name; -#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name; +#define XRPL_FEATURE(name, supported, vote) extern UInt256 const feature##name; +#define XRPL_FIX(name, supported, vote) extern UInt256 const fix##name; #define XRPL_RETIRE_FEATURE(name) #define XRPL_RETIRE_FIX(name) diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index 060ad3d828..028d4e2dcc 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -25,10 +25,10 @@ namespace xrpl { class IOUAmount : private boost::totally_ordered, private boost::additive { private: - using mantissa_type = std::int64_t; - using exponent_type = int; - mantissa_type mantissa_{}; - exponent_type exponent_{}; + using MantissaType = std::int64_t; + using ExponentType = int; + MantissaType mantissa_{}; + ExponentType exponent_{}; /** * Adjusts the mantissa and exponent to the proper range. @@ -47,7 +47,7 @@ public: IOUAmount() = default; explicit IOUAmount(Number const& other); IOUAmount(beast::Zero); - IOUAmount(mantissa_type mantissa, exponent_type exponent); + IOUAmount(MantissaType mantissa, ExponentType exponent); IOUAmount& operator=(beast::Zero); @@ -80,10 +80,10 @@ public: [[nodiscard]] int signum() const noexcept; - [[nodiscard]] exponent_type + [[nodiscard]] ExponentType exponent() const noexcept; - [[nodiscard]] mantissa_type + [[nodiscard]] MantissaType mantissa() const noexcept; static IOUAmount @@ -101,7 +101,7 @@ inline IOUAmount::IOUAmount(beast::Zero) *this = beast::kZero; } -inline IOUAmount::IOUAmount(mantissa_type mantissa, exponent_type exponent) +inline IOUAmount::IOUAmount(MantissaType mantissa, ExponentType exponent) : mantissa_(mantissa), exponent_(exponent) { normalize(); @@ -162,13 +162,13 @@ IOUAmount::signum() const noexcept return (mantissa_ != 0) ? 1 : 0; } -inline IOUAmount::exponent_type +inline IOUAmount::ExponentType IOUAmount::exponent() const noexcept { return exponent_; } -inline IOUAmount::mantissa_type +inline IOUAmount::MantissaType IOUAmount::mantissa() const noexcept { return mantissa_; diff --git a/include/xrpl/protocol/Indexes.h b/include/xrpl/protocol/Indexes.h index abb039a4ef..0903946564 100644 --- a/include/xrpl/protocol/Indexes.h +++ b/include/xrpl/protocol/Indexes.h @@ -55,7 +55,7 @@ amendments() noexcept; * Any item that can be in an owner dir. */ Keylet -child(uint256 const& key) noexcept; +child(UInt256 const& key) noexcept; /** * The index of the "short" skip list @@ -125,7 +125,7 @@ Keylet offer(AccountID const& id, SeqProxy const& seq) noexcept; inline Keylet -offer(uint256 const& key) noexcept +offer(UInt256 const& key) noexcept { return {ltOFFER, key}; } @@ -151,7 +151,7 @@ Keylet ticket(AccountID const& id, SeqProxy const& ticketSeq); inline Keylet -ticket(uint256 const& key) +ticket(UInt256 const& key) { return {ltTICKET, key}; } @@ -177,7 +177,7 @@ Keylet check(AccountID const& id, SeqProxy const& seq) noexcept; inline Keylet -check(uint256 const& key) noexcept +check(UInt256 const& key) noexcept { return {ltCHECK, key}; } @@ -191,7 +191,7 @@ Keylet txProposal(AccountID const& target, std::uint32_t ticketSequence) noexcept; inline Keylet -txProposal(uint256 const& key) noexcept +txProposal(UInt256 const& key) noexcept { return {ltTRANSACTION_PROPOSAL, key}; } @@ -210,7 +210,7 @@ depositPreauth( std::set> const& authCreds) noexcept; inline Keylet -depositPreauth(uint256 const& key) noexcept +depositPreauth(UInt256 const& key) noexcept { return {ltDEPOSIT_PREAUTH, key}; } @@ -222,7 +222,7 @@ depositPreauth(uint256 const& key) noexcept * Any ledger entry */ Keylet -unchecked(uint256 const& key) noexcept; +unchecked(UInt256 const& key) noexcept; /** * The root page of an account's directory @@ -235,7 +235,7 @@ ownerDir(AccountID const& id) noexcept; */ /** @{ */ Keylet -page(uint256 const& root, std::uint64_t const index = 0) noexcept; +page(UInt256 const& root, std::uint64_t const index = 0) noexcept; inline Keylet page(Keylet const& root, std::uint64_t const index = 0) noexcept @@ -279,7 +279,7 @@ Keylet nftokenPageMax(AccountID const& owner); Keylet -nftokenPage(Keylet const& k, uint256 const& token); +nftokenPage(Keylet const& k, UInt256 const& token); /** @} */ /** @@ -289,7 +289,7 @@ Keylet nftokenOffer(AccountID const& owner, SeqProxy const& seq); inline Keylet -nftokenOffer(uint256 const& offer) +nftokenOffer(UInt256 const& offer) { return {ltNFTOKEN_OFFER, offer}; } @@ -298,13 +298,13 @@ nftokenOffer(uint256 const& offer) * The directory of buy offers for the specified NFT */ Keylet -nftBuys(uint256 const& id) noexcept; +nftBuys(UInt256 const& id) noexcept; /** * The directory of sell offers for the specified NFT */ Keylet -nftSells(uint256 const& id) noexcept; +nftSells(UInt256 const& id) noexcept; /** * AMM entry @@ -313,7 +313,7 @@ Keylet amm(Asset const& issue1, Asset const& issue2) noexcept; Keylet -amm(uint256 const& amm) noexcept; +amm(UInt256 const& amm) noexcept; /** * A keylet for Delegate object @@ -342,7 +342,7 @@ Keylet credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept; inline Keylet -credential(uint256 const& key) noexcept +credential(UInt256 const& key) noexcept { return {ltCREDENTIAL, key}; } @@ -351,7 +351,7 @@ Keylet mptokenIssuance(MPTID const& issuanceID) noexcept; inline Keylet -mptokenIssuance(uint256 const& issuanceKey) +mptokenIssuance(UInt256 const& issuanceKey) { return {ltMPTOKEN_ISSUANCE, issuanceKey}; } @@ -360,19 +360,19 @@ Keylet mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept; inline Keylet -mptoken(uint256 const& mptokenKey) +mptoken(UInt256 const& mptokenKey) { return {ltMPTOKEN, mptokenKey}; } Keylet -mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept; +mptoken(UInt256 const& issuanceKey, AccountID const& holder) noexcept; Keylet vault(AccountID const& owner, SeqProxy const& seq) noexcept; inline Keylet -vault(uint256 const& vaultKey) +vault(UInt256 const& vaultKey) { return {ltVAULT, vaultKey}; } @@ -381,16 +381,16 @@ Keylet loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept; inline Keylet -loanBroker(uint256 const& key) +loanBroker(UInt256 const& key) { return {ltLOAN_BROKER, key}; } Keylet -loan(uint256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept; +loan(UInt256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept; inline Keylet -loan(uint256 const& key) +loan(UInt256 const& key) { return {ltLOAN, key}; } @@ -399,20 +399,20 @@ Keylet permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept; Keylet -permissionedDomain(uint256 const& domainID) noexcept; +permissionedDomain(UInt256 const& domainID) noexcept; } // namespace keylet // Everything below is deprecated and should be removed in favor of keylets: -uint256 +UInt256 getBookBase(Book const& book); -uint256 -getQualityNext(uint256 const& uBase); +UInt256 +getQualityNext(UInt256 const& uBase); // VFALCO This name could be better std::uint64_t -getQuality(uint256 const& uBase); +getQuality(UInt256 const& uBase); template // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) diff --git a/include/xrpl/protocol/Keylet.h b/include/xrpl/protocol/Keylet.h index 48d494f564..7a8f839bc1 100644 --- a/include/xrpl/protocol/Keylet.h +++ b/include/xrpl/protocol/Keylet.h @@ -18,10 +18,10 @@ class STLedgerEntry; */ struct Keylet { - uint256 key; + UInt256 key; LedgerEntryType type; - Keylet(LedgerEntryType type, uint256 const& key) : key(key), type(type) + Keylet(LedgerEntryType type, UInt256 const& key) : key(key), type(type) { } diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index d169e53e2c..436d2dafe6 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -31,10 +31,10 @@ struct LedgerHeader // // Closed means "tx set already determined" - uint256 hash = beast::kZero; - uint256 txHash = beast::kZero; - uint256 accountHash = beast::kZero; - uint256 parentHash = beast::kZero; + UInt256 hash = beast::kZero; + UInt256 txHash = beast::kZero; + UInt256 accountHash = beast::kZero; + UInt256 parentHash = beast::kZero; XRPAmount drops = beast::kZero; @@ -84,7 +84,7 @@ deserializePrefixedHeader(Slice data, bool hasHash = false); /** * Calculate the hash of a ledger header. */ -uint256 +UInt256 calculateLedgerHash(LedgerHeader const& info); } // namespace xrpl diff --git a/include/xrpl/protocol/NFTokenID.h b/include/xrpl/protocol/NFTokenID.h index b1b994eabd..3f876d4a29 100644 --- a/include/xrpl/protocol/NFTokenID.h +++ b/include/xrpl/protocol/NFTokenID.h @@ -22,10 +22,10 @@ namespace xrpl { bool canHaveNFTokenID(std::shared_ptr const& serializedTx, TxMeta const& transactionMeta); -std::optional +std::optional getNFTokenIDFromPage(TxMeta const& transactionMeta); -std::vector +std::vector getNFTokenIDFromDeletedOffer(TxMeta const& transactionMeta); void diff --git a/include/xrpl/protocol/NFTokenOfferID.h b/include/xrpl/protocol/NFTokenOfferID.h index 4810f7932a..3e252993b0 100644 --- a/include/xrpl/protocol/NFTokenOfferID.h +++ b/include/xrpl/protocol/NFTokenOfferID.h @@ -22,7 +22,7 @@ canHaveNFTokenOfferID( std::shared_ptr const& serializedTx, TxMeta const& transactionMeta); -std::optional +std::optional getOfferIDFromCreatedOffer(TxMeta const& transactionMeta); void diff --git a/include/xrpl/protocol/PayChan.h b/include/xrpl/protocol/PayChan.h index d8f4e0f527..8e929276bb 100644 --- a/include/xrpl/protocol/PayChan.h +++ b/include/xrpl/protocol/PayChan.h @@ -8,7 +8,7 @@ namespace xrpl { inline void -serializePayChanAuthorization(Serializer& msg, uint256 const& key, XRPAmount const& amt) +serializePayChanAuthorization(Serializer& msg, UInt256 const& key, XRPAmount const& amt) { msg.add32(HashPrefix::PaymentChannelClaim); msg.addBitString(key); diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 2a3f561a10..81ea0e26c8 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -60,7 +60,7 @@ private: struct TxDelegationEntry { - uint256 amendment; + UInt256 amendment; Delegation delegable{Delegation::NotDelegable}; }; @@ -89,9 +89,9 @@ public: [[nodiscard]] std::optional getGranularTxType(GranularPermissionType gpType) const; - // Returns a reference to avoid copying uint256 - 32 bytes. std::optional + // Returns a reference to avoid copying UInt256 - 32 bytes. std::optional // cannot hold references directly, so std::reference_wrapper is used. - [[nodiscard]] std::optional> + [[nodiscard]] std::optional> getTxFeature(TxType txType) const; [[nodiscard]] bool diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 61f246c752..2d7d5b5d45 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -400,7 +400,7 @@ isFlagLedger(LedgerIndex seq); * The value is computed as the hash of the * canonicalized, serialized transaction object. */ -using TxID = uint256; +using TxID = UInt256; /** * The maximum number of trustlines to delete as part of AMM account diff --git a/include/xrpl/protocol/PublicKey.h b/include/xrpl/protocol/PublicKey.h index 833078d741..2318d61634 100644 --- a/include/xrpl/protocol/PublicKey.h +++ b/include/xrpl/protocol/PublicKey.h @@ -235,7 +235,7 @@ publicKeyType(PublicKey const& publicKey) [[nodiscard]] bool verifyDigest( PublicKey const& publicKey, - uint256 const& digest, + UInt256 const& digest, Slice const& sig, bool mustBeFullyCanonical = true) noexcept; diff --git a/include/xrpl/protocol/RippleLedgerHash.h b/include/xrpl/protocol/RippleLedgerHash.h index 9dab644663..63fc420c99 100644 --- a/include/xrpl/protocol/RippleLedgerHash.h +++ b/include/xrpl/protocol/RippleLedgerHash.h @@ -4,6 +4,6 @@ namespace xrpl { -using LedgerHash = uint256; +using LedgerHash = UInt256; } // namespace xrpl diff --git a/include/xrpl/protocol/Rules.h b/include/xrpl/protocol/Rules.h index d67e0d8654..41b7f8b0c8 100644 --- a/include/xrpl/protocol/Rules.h +++ b/include/xrpl/protocol/Rules.h @@ -18,7 +18,7 @@ namespace xrpl { * @param resultIfNoRules What to return if called from outside a Transactor context. */ bool -isFeatureEnabled(uint256 const& feature, bool resultIfNoRules); +isFeatureEnabled(UInt256 const& feature, bool resultIfNoRules); /** * Check whether a feature is enabled in the current ledger rules @@ -29,7 +29,7 @@ isFeatureEnabled(uint256 const& feature, bool resultIfNoRules); * a Transactor context */ bool -isFeatureEnabled(uint256 const& feature); +isFeatureEnabled(UInt256 const& feature); class DigestAwareReadView; @@ -64,7 +64,7 @@ public: * These are the rules reflected by * the genesis ledger. */ - explicit Rules(std::unordered_set> const& presets); + explicit Rules(std::unordered_set> const& presets); private: // Allow a friend function to construct Rules. @@ -74,14 +74,14 @@ private: friend Rules makeRulesGivenLedger( DigestAwareReadView const& ledger, - std::unordered_set> const& presets); + std::unordered_set> const& presets); Rules( - std::unordered_set> const& presets, - std::optional const& digest, + std::unordered_set> const& presets, + std::optional const& digest, STVector256 const& amendments); - [[nodiscard]] std::unordered_set> const& + [[nodiscard]] std::unordered_set> const& presets() const; public: @@ -89,7 +89,7 @@ public: * Returns `true` if a feature is enabled. */ [[nodiscard]] bool - enabled(uint256 const& feature) const; + enabled(UInt256 const& feature) const; /** * Returns `true` if two rule sets are identical. diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 21ab7813f9..23fadf316a 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -336,6 +336,9 @@ operator~(TypedField const& f) //------------------------------------------------------------------------------ +// TYPED_SFIELD below pastes these names together as SF_##stiSuffix, so the +// spelling is fixed by the macro and cannot be CamelCase. +// NOLINTBEGIN(readability-identifier-naming) using SF_UINT8 = TypedField>; using SF_UINT16 = TypedField>; using SF_UINT32 = TypedField>; @@ -359,6 +362,7 @@ using SF_NUMBER = TypedField; using SF_VL = TypedField; using SF_VECTOR256 = TypedField; using SF_XCHAIN_BRIDGE = TypedField; +// NOLINTEND(readability-identifier-naming) //------------------------------------------------------------------------------ diff --git a/include/xrpl/protocol/STAccount.h b/include/xrpl/protocol/STAccount.h index 17d3affc57..9d5de2c654 100644 --- a/include/xrpl/protocol/STAccount.h +++ b/include/xrpl/protocol/STAccount.h @@ -17,7 +17,7 @@ class STAccount final : public STBase, public CountedObject private: // The original implementation of STAccount kept the value in an STBlob. // But an STAccount is always 160 bits, so we can store it with less - // overhead in an xrpl::uint160. However, so the serialized format of the + // overhead in an xrpl::UInt160. However, so the serialized format of the // STAccount stays unchanged, we serialize and deserialize like an STBlob. AccountID value_; bool default_; diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 4b2f1cc9fb..90b954af78 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -45,14 +45,14 @@ namespace xrpl { class STAmount final : public STBase, public CountedObject { public: - using mantissa_type = std::uint64_t; - using exponent_type = int; - using rep = std::pair; + using MantissaType = std::uint64_t; + using ExponentType = int; + using rep = std::pair; private: Asset asset_; - mantissa_type value_{}; - exponent_type offset_; + MantissaType value_{}; + ExponentType offset_; bool isNegative_{}; public: @@ -90,16 +90,16 @@ public: STAmount( SField const& name, A const& asset, - mantissa_type mantissa, - exponent_type exponent, + MantissaType mantissa, + ExponentType exponent, bool negative, Unchecked); template STAmount( A const& asset, - mantissa_type mantissa, - exponent_type exponent, + MantissaType mantissa, + ExponentType exponent, bool negative, Unchecked); @@ -108,8 +108,8 @@ public: STAmount( SField const& name, A const& asset, - mantissa_type mantissa = 0, - exponent_type exponent = 0, + MantissaType mantissa = 0, + ExponentType exponent = 0, bool negative = false); STAmount(SField const& name, std::int64_t mantissa); @@ -327,8 +327,8 @@ template STAmount::STAmount( SField const& name, A const& asset, - mantissa_type mantissa, - exponent_type exponent, + MantissaType mantissa, + ExponentType exponent, bool negative, Unchecked) : STBase(name), asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative) @@ -338,8 +338,8 @@ STAmount::STAmount( template STAmount::STAmount( A const& asset, - mantissa_type mantissa, - exponent_type exponent, + MantissaType mantissa, + ExponentType exponent, bool negative, Unchecked) : asset_(asset), value_(mantissa), offset_(exponent), isNegative_(negative) diff --git a/include/xrpl/protocol/STArray.h b/include/xrpl/protocol/STArray.h index e88563fb1a..5189e9097c 100644 --- a/include/xrpl/protocol/STArray.h +++ b/include/xrpl/protocol/STArray.h @@ -19,15 +19,15 @@ namespace xrpl { class STArray final : public STBase, public CountedObject { private: - using list_type = std::vector; + using ListType = std::vector; - list_type v_; + ListType v_; public: using value_type = STObject; - using size_type = list_type::size_type; - using iterator = list_type::iterator; - using const_iterator = list_type::const_iterator; + using size_type = ListType::size_type; + using iterator = ListType::iterator; + using const_iterator = ListType::const_iterator; STArray() = default; STArray(STArray const&) = default; diff --git a/include/xrpl/protocol/STBase.h b/include/xrpl/protocol/STBase.h index a8bda8f614..3057df2acd 100644 --- a/include/xrpl/protocol/STBase.h +++ b/include/xrpl/protocol/STBase.h @@ -20,10 +20,10 @@ namespace xrpl { */ struct JsonOptions { - using underlying_t = unsigned int; - underlying_t value; + using UnderlyingT = unsigned int; + UnderlyingT value; - enum class Values : underlying_t { + enum class Values : UnderlyingT { None = 0b0000'0000, IncludeDate = 0b0000'0001, DisableApiPriorV2 = 0b0000'0010, @@ -32,16 +32,16 @@ struct JsonOptions All = IncludeDate | DisableApiPriorV2 // 0b0000'0011 }; - constexpr JsonOptions(underlying_t v) noexcept : value(v) + constexpr JsonOptions(UnderlyingT v) noexcept : value(v) { } - constexpr JsonOptions(Values v) noexcept : value(static_cast(v)) + constexpr JsonOptions(Values v) noexcept : value(static_cast(v)) { } [[nodiscard]] constexpr explicit - operator underlying_t() const noexcept + operator UnderlyingT() const noexcept { return value; } @@ -80,7 +80,7 @@ struct JsonOptions [[nodiscard]] constexpr JsonOptions friend operator~(JsonOptions v) noexcept { - return {~v.value & static_cast(Values::All)}; + return {~v.value & static_cast(Values::All)}; } }; diff --git a/include/xrpl/protocol/STLedgerEntry.h b/include/xrpl/protocol/STLedgerEntry.h index c296918dd0..fc2fd77ee1 100644 --- a/include/xrpl/protocol/STLedgerEntry.h +++ b/include/xrpl/protocol/STLedgerEntry.h @@ -27,23 +27,23 @@ class InvariantsMisc_test; */ class STLedgerEntry final : public STObject, public CountedObject { - uint256 key_; + UInt256 key_; LedgerEntryType type_; public: using pointer = std::shared_ptr; - using ref = std::shared_ptr const&; + using Ref = std::shared_ptr const&; using const_pointer = std::shared_ptr; - using const_ref = std::shared_ptr const&; + using ConstRef = std::shared_ptr const&; /** * Create an empty object with the given key and type. */ explicit STLedgerEntry(Keylet const& k); - STLedgerEntry(LedgerEntryType type, uint256 const& key); - STLedgerEntry(SerialIter& sit, uint256 const& index); - STLedgerEntry(SerialIter&& sit, uint256 const& index); - STLedgerEntry(STObject const& object, uint256 const& index); + STLedgerEntry(LedgerEntryType type, UInt256 const& key); + STLedgerEntry(SerialIter& sit, UInt256 const& index); + STLedgerEntry(SerialIter&& sit, UInt256 const& index); + STLedgerEntry(STObject const& object, UInt256 const& index); [[nodiscard]] SerializedTypeID getSType() const override; @@ -62,7 +62,7 @@ public: * The key identifies this entry's position in * the SHAMap associative container. */ - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& key() const; [[nodiscard]] LedgerEntryType @@ -74,9 +74,9 @@ public: bool thread( - uint256 const& txID, + UInt256 const& txID, std::uint32_t ledgerSeq, - uint256& prevTxID, + UInt256& prevTxID, std::uint32_t& prevLedgerID); private: @@ -99,14 +99,14 @@ private: using SLE = STLedgerEntry; -inline STLedgerEntry::STLedgerEntry(LedgerEntryType type, uint256 const& key) +inline STLedgerEntry::STLedgerEntry(LedgerEntryType type, UInt256 const& key) : STLedgerEntry(Keylet(type, key)) { } inline STLedgerEntry::STLedgerEntry( SerialIter&& sit, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) - uint256 const& index) + UInt256 const& index) : STLedgerEntry(sit, index) { } @@ -116,7 +116,7 @@ inline STLedgerEntry::STLedgerEntry( * The key identifies this entry's position in * the SHAMap associative container. */ -inline uint256 const& +inline UInt256 const& STLedgerEntry::key() const { return key_; diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index dcbd08170e..3b010eac4b 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -66,13 +66,13 @@ class STObject : public STBase, public CountedObject operator()(detail::STVar const& e) const; }; - using list_type = std::vector; + using ListType = std::vector; - list_type v_; + ListType v_; SOTemplate const* type_{}; public: - using iterator = boost::transform_iterator; + using iterator = boost::transform_iterator; ~STObject() override = default; STObject(STObject const&) = default; @@ -173,10 +173,10 @@ public: [[nodiscard]] std::uint32_t getFlags() const; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getHash(HashPrefix prefix) const; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getSigningHash(HashPrefix prefix) const; [[nodiscard]] STBase const& @@ -219,14 +219,14 @@ public: getFieldU32(SField const& field) const; [[nodiscard]] std::uint64_t getFieldU64(SField const& field) const; - [[nodiscard]] uint128 + [[nodiscard]] UInt128 getFieldH128(SField const& field) const; - [[nodiscard]] uint160 + [[nodiscard]] UInt160 getFieldH160(SField const& field) const; - [[nodiscard]] uint192 + [[nodiscard]] UInt192 getFieldH192(SField const& field) const; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getFieldH256(SField const& field) const; [[nodiscard]] std::int32_t getFieldI32(SField const& field) const; @@ -372,11 +372,11 @@ public: void setFieldU64(SField const& field, std::uint64_t); void - setFieldH128(SField const& field, uint128 const&); + setFieldH128(SField const& field, UInt128 const&); void - setFieldH192(SField const& field, uint192 const&); + setFieldH192(SField const& field, UInt192 const&); void - setFieldH256(SField const& field, uint256 const&); + setFieldH256(SField const& field, UInt256 const&); void setFieldI32(SField const& field, std::int32_t); void @@ -538,7 +538,7 @@ protected: template concept IsArithmeticNumber = std::is_arithmetic_v || std::is_same_v || std::is_same_v; -template +template concept IsArithmeticValueUnit = std::is_same_v> && IsArithmeticNumber && std::is_class_v; template @@ -605,7 +605,7 @@ class STObject::OptionalProxy : public Proxy private: using value_type = T::value_type; - using optional_type = std::optional>; + using OptionalType = std::optional>; public: OptionalProxy(OptionalProxy const&) = default; @@ -621,12 +621,12 @@ public: explicit operator bool() const noexcept; - operator optional_type() const; + operator OptionalType() const; /** * Explicit conversion to std::optional */ - optional_type + OptionalType operator~() const; friend bool @@ -642,7 +642,7 @@ public: } friend bool - operator==(OptionalProxy const& lhs, optional_type const& rhs) noexcept + operator==(OptionalProxy const& lhs, OptionalType const& rhs) noexcept { if (!lhs.engaged()) return !rhs; @@ -652,7 +652,7 @@ public: } friend bool - operator==(optional_type const& lhs, OptionalProxy const& rhs) noexcept + operator==(OptionalType const& lhs, OptionalProxy const& rhs) noexcept { return rhs == lhs; } @@ -672,9 +672,9 @@ public: OptionalProxy& operator=(std::nullopt_t const&); OptionalProxy& - operator=(optional_type&& v); // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) + operator=(OptionalType&& v); // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) OptionalProxy& - operator=(optional_type const& v); + operator=(OptionalType const& v); template OptionalProxy& @@ -692,7 +692,7 @@ private: void disengage(); - [[nodiscard]] optional_type + [[nodiscard]] OptionalType optionalValue() const; }; @@ -839,13 +839,13 @@ operator bool() const noexcept template STObject::OptionalProxy:: -operator typename STObject::OptionalProxy::optional_type() const +operator typename STObject::OptionalProxy::OptionalType() const { return optionalValue(); } template -STObject::OptionalProxy::optional_type +STObject::OptionalProxy::OptionalType STObject::OptionalProxy::operator~() const { return optionalValue(); @@ -862,7 +862,7 @@ STObject::OptionalProxy::operator=(std::nullopt_t const&) -> OptionalProxy& template auto STObject::OptionalProxy::operator=( - optional_type&& v) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) + OptionalType&& v) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) -> OptionalProxy& { if (v) @@ -878,7 +878,7 @@ STObject::OptionalProxy::operator=( template auto -STObject::OptionalProxy::operator=(optional_type const& v) -> OptionalProxy& +STObject::OptionalProxy::operator=(OptionalType const& v) -> OptionalProxy& { if (v) { @@ -931,7 +931,7 @@ STObject::OptionalProxy::disengage() template auto -STObject::OptionalProxy::optionalValue() const -> optional_type +STObject::OptionalProxy::optionalValue() const -> OptionalType { if (!engaged()) return std::nullopt; diff --git a/include/xrpl/protocol/STPathSet.h b/include/xrpl/protocol/STPathSet.h index b91d899071..fdec9a0165 100644 --- a/include/xrpl/protocol/STPathSet.h +++ b/include/xrpl/protocol/STPathSet.h @@ -207,7 +207,7 @@ class STPathSet final : public STBase, public CountedObject * as opposed to 64 bytes with an optional. This keeps the size * of the STPathSet to within the `STVar::kMaxSize` limit of 72 bytes. */ - std::unique_ptr> seen_; + std::unique_ptr> seen_; public: struct DeduplicationTag @@ -215,6 +215,7 @@ public: }; STPathSet() = default; + /** * Deduplication tagged constructor. * Use when you want to ensure that the STPathSet does not contain duplicate paths. diff --git a/include/xrpl/protocol/STTx.h b/include/xrpl/protocol/STTx.h index e6291ae950..08efc56517 100644 --- a/include/xrpl/protocol/STTx.h +++ b/include/xrpl/protocol/STTx.h @@ -41,7 +41,7 @@ enum class TxnSql : char { class STTx final : public STObject, public CountedObject { - uint256 tid_; + UInt256 tid_; TxType txType_; public: @@ -83,7 +83,7 @@ public: return getSignature(*this); } - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getSigningHash() const; [[nodiscard]] TxType @@ -98,7 +98,7 @@ public: [[nodiscard]] boost::container::flat_set getMentionedAccounts() const; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getTransactionID() const; [[nodiscard]] json::Value @@ -163,7 +163,7 @@ public: /** * The IDs of the inner transactions of a Batch. */ - [[nodiscard]] std::vector + [[nodiscard]] std::vector getBatchTransactionIDs() const; /** @@ -204,10 +204,10 @@ private: checkMultiSign(STObject const& sigObject, HashPrefix prefix) const; [[nodiscard]] std::expected - checkBatchSingleSign(STObject const& batchSigner, std::vector const& txIds) const; + checkBatchSingleSign(STObject const& batchSigner, std::vector const& txIds) const; [[nodiscard]] std::expected - checkBatchMultiSign(STObject const& batchSigner, std::vector const& txIds) const; + checkBatchMultiSign(STObject const& batchSigner, std::vector const& txIds) const; void buildBatchTxns(); @@ -258,7 +258,7 @@ STTx::getSigningPubKey() const return getFieldVL(sfSigningPubKey); } -inline uint256 +inline UInt256 STTx::getTransactionID() const { return tid_; diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index f70e971f87..4c00be6594 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -105,11 +105,11 @@ public: F&& f); // Hash of the validated ledger - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getLedgerHash() const; // Hash of consensus transaction set used to generate ledger - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getConsensusHash() const; [[nodiscard]] NetClock::time_point @@ -140,7 +140,7 @@ public: [[nodiscard]] bool isTrusted() const noexcept; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getSigningHash() const; void diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index 5a8418fef5..66a196e7d4 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -15,16 +15,16 @@ namespace xrpl { class STVector256 : public STBase, public CountedObject { - std::vector value_; + std::vector value_; public: - using value_type = std::vector const&; + using value_type = std::vector const&; STVector256() = default; explicit STVector256(SField const& n); - explicit STVector256(std::vector vector); - STVector256(SField const& n, std::vector vector); + explicit STVector256(std::vector vector); + STVector256(SField const& n, std::vector vector); STVector256(SerialIter& sit, SField const& name); [[nodiscard]] SerializedTypeID @@ -42,10 +42,10 @@ public: isDefault() const override; STVector256& - operator=(std::vector const& v); + operator=(std::vector const& v); STVector256& - operator=(std::vector&& v); + operator=(std::vector&& v); void setValue(STVector256 const& v); @@ -54,7 +54,7 @@ public: * Retrieve a copy of the vector we contain */ explicit - operator std::vector() const; + operator std::vector() const; [[nodiscard]] std::size_t size() const; @@ -65,35 +65,35 @@ public: [[nodiscard]] bool empty() const; - std::vector::reference - operator[](std::vector::size_type n); + std::vector::reference + operator[](std::vector::size_type n); - std::vector::const_reference - operator[](std::vector::size_type n) const; + std::vector::const_reference + operator[](std::vector::size_type n) const; - [[nodiscard]] std::vector const& + [[nodiscard]] std::vector const& value() const; - std::vector::iterator - insert(std::vector::const_iterator pos, uint256 const& value); + std::vector::iterator + insert(std::vector::const_iterator pos, UInt256 const& value); void - pushBack(uint256 const& v); + pushBack(UInt256 const& v); - std::vector::iterator + std::vector::iterator begin(); - [[nodiscard]] std::vector::const_iterator + [[nodiscard]] std::vector::const_iterator begin() const; - std::vector::iterator + std::vector::iterator end(); - [[nodiscard]] std::vector::const_iterator + [[nodiscard]] std::vector::const_iterator end() const; - std::vector::iterator - erase(std::vector::iterator position); + std::vector::iterator + erase(std::vector::iterator position); void clear() noexcept; @@ -111,24 +111,24 @@ inline STVector256::STVector256(SField const& n) : STBase(n) { } -inline STVector256::STVector256(std::vector vector) : value_(std::move(vector)) +inline STVector256::STVector256(std::vector vector) : value_(std::move(vector)) { } -inline STVector256::STVector256(SField const& n, std::vector vector) +inline STVector256::STVector256(SField const& n, std::vector vector) : STBase(n), value_(std::move(vector)) { } inline STVector256& -STVector256::operator=(std::vector const& v) +STVector256::operator=(std::vector const& v) { value_ = v; return *this; } inline STVector256& -STVector256::operator=(std::vector&& v) +STVector256::operator=(std::vector&& v) { value_ = std::move(v); return *this; @@ -144,7 +144,7 @@ STVector256::setValue(STVector256 const& v) * Retrieve a copy of the vector we contain */ inline STVector256:: -operator std::vector() const +operator std::vector() const { return value_; } @@ -167,62 +167,62 @@ STVector256::empty() const return value_.empty(); } -inline std::vector::reference -STVector256::operator[](std::vector::size_type n) +inline std::vector::reference +STVector256::operator[](std::vector::size_type n) { return value_[n]; } -inline std::vector::const_reference -STVector256::operator[](std::vector::size_type n) const +inline std::vector::const_reference +STVector256::operator[](std::vector::size_type n) const { return value_[n]; } -inline std::vector const& +inline std::vector const& STVector256::value() const { return value_; } -inline std::vector::iterator -STVector256::insert(std::vector::const_iterator pos, uint256 const& value) +inline std::vector::iterator +STVector256::insert(std::vector::const_iterator pos, UInt256 const& value) { return value_.insert(pos, value); } inline void -STVector256::pushBack(uint256 const& v) +STVector256::pushBack(UInt256 const& v) { value_.push_back(v); } -inline std::vector::iterator +inline std::vector::iterator STVector256::begin() { return value_.begin(); } -inline std::vector::const_iterator +inline std::vector::const_iterator STVector256::begin() const { return value_.begin(); } -inline std::vector::iterator +inline std::vector::iterator STVector256::end() { return value_.end(); } -inline std::vector::const_iterator +inline std::vector::const_iterator STVector256::end() const { return value_.end(); } -inline std::vector::iterator -STVector256::erase(std::vector::iterator position) +inline std::vector::iterator +STVector256::erase(std::vector::iterator position) { return value_.erase(position); } diff --git a/include/xrpl/protocol/SecretKey.h b/include/xrpl/protocol/SecretKey.h index 6d353acac0..9699550733 100644 --- a/include/xrpl/protocol/SecretKey.h +++ b/include/xrpl/protocol/SecretKey.h @@ -157,10 +157,10 @@ randomKeyPair(KeyType type); */ /** @{ */ Buffer -signDigest(PublicKey const& pk, SecretKey const& sk, uint256 const& digest); +signDigest(PublicKey const& pk, SecretKey const& sk, UInt256 const& digest); inline Buffer -signDigest(KeyType type, SecretKey const& sk, uint256 const& digest) +signDigest(KeyType type, SecretKey const& sk, UInt256 const& digest) { return signDigest(derivePublicKey(type, sk), sk, digest); } diff --git a/include/xrpl/protocol/Seed.h b/include/xrpl/protocol/Seed.h index 4ccdd6707f..2d90178edd 100644 --- a/include/xrpl/protocol/Seed.h +++ b/include/xrpl/protocol/Seed.h @@ -40,7 +40,7 @@ public: */ /** @{ */ explicit Seed(Slice const& slice); - explicit Seed(uint128 const& seed); + explicit Seed(UInt128 const& seed); /** @} */ [[nodiscard]] std::uint8_t const* diff --git a/include/xrpl/protocol/Serializer.h b/include/xrpl/protocol/Serializer.h index 997199629a..b208c1e324 100644 --- a/include/xrpl/protocol/Serializer.h +++ b/include/xrpl/protocol/Serializer.h @@ -265,7 +265,7 @@ public: } // DEPRECATED - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getSHA512Half() const; // totality functions @@ -531,25 +531,25 @@ public: BaseUInt getBitString(); - uint128 + UInt128 get128() { return getBitString<128>(); } - uint160 + UInt160 get160() { return getBitString<160>(); } - uint192 + UInt192 get192() { return getBitString<192>(); } - uint256 + UInt256 get256() { return getBitString<256>(); diff --git a/include/xrpl/protocol/SystemParameters.h b/include/xrpl/protocol/SystemParameters.h index 6ca36c8d9a..40b89c9774 100644 --- a/include/xrpl/protocol/SystemParameters.h +++ b/include/xrpl/protocol/SystemParameters.h @@ -78,7 +78,7 @@ constexpr std::ratio<80, 100> kAmendmentMajorityCalcThreshold; /** * The minimum amount of time an amendment must hold a majority */ -constexpr std::chrono::seconds const kDefaultAmendmentMajorityTime = weeks{2}; +constexpr std::chrono::seconds const kDefaultAmendmentMajorityTime = Weeks{2}; } // namespace xrpl diff --git a/include/xrpl/protocol/TxMeta.h b/include/xrpl/protocol/TxMeta.h index 88652afba9..3cbbd7c9d2 100644 --- a/include/xrpl/protocol/TxMeta.h +++ b/include/xrpl/protocol/TxMeta.h @@ -23,11 +23,11 @@ namespace xrpl { class TxMeta { public: - TxMeta(uint256 const& transactionID, std::uint32_t ledger); - TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&); - TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&); + TxMeta(UInt256 const& transactionID, std::uint32_t ledger); + TxMeta(UInt256 const& txID, std::uint32_t ledger, Blob const&); + TxMeta(UInt256 const& txID, std::uint32_t ledger, STObject const&); - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getTxID() const { return transactionID_; @@ -54,11 +54,11 @@ public: } void - setAffectedNode(uint256 const&, SField const& type, std::uint16_t nodeType); + setAffectedNode(UInt256 const&, SField const& type, std::uint16_t nodeType); STObject& - getAffectedNode(SLE::ref node, SField const& type); // create if needed + getAffectedNode(SLE::Ref node, SField const& type); // create if needed STObject& - getAffectedNode(uint256 const&); + getAffectedNode(UInt256 const&); /** * Return a list of accounts affected by this transaction @@ -110,19 +110,19 @@ public: } void - setParentBatchID(std::optional const& id) + setParentBatchID(std::optional const& id) { parentBatchID_ = id; } private: - uint256 transactionID_; + UInt256 transactionID_; std::uint32_t ledgerSeq_; std::uint32_t index_; int result_; std::optional deliveredAmount_; - std::optional parentBatchID_; + std::optional parentBatchID_; STArray nodes_; }; diff --git a/include/xrpl/protocol/TxSettings.h b/include/xrpl/protocol/TxSettings.h index 8ea249856a..060351167a 100644 --- a/include/xrpl/protocol/TxSettings.h +++ b/include/xrpl/protocol/TxSettings.h @@ -66,7 +66,7 @@ operator&(Privilege lhs, Privilege rhs) * transactions.macro for the authoring syntax. * * This is deliberately not a constexpr-friendly type: amendment identifiers are - * runtime-initialized `extern uint256 const` globals (see Feature.h), so a + * runtime-initialized `extern UInt256 const` globals (see Feature.h), so a * TxSettings can only be built at runtime. */ struct TxSettings @@ -77,7 +77,7 @@ struct TxSettings Delegation delegable{Delegation::NotDelegable}; /** - * The amendment gating this transaction, or uint256{} if always available. + * The amendment gating this transaction, or UInt256{} if always available. */ // The `{}` looks redundant, because BaseUInt's default constructor already // zeroes the value. It is not: without a default member initializer here, @@ -85,7 +85,7 @@ struct TxSettings // missing-designated-field-initializers warning, which the build treats as // an error. // NOLINTNEXTLINE(readability-redundant-member-init) - uint256 amendment{}; + UInt256 amendment{}; /** * Operations this transaction is permitted to perform. diff --git a/include/xrpl/protocol/UintTypes.h b/include/xrpl/protocol/UintTypes.h index 25b0d1ffc9..ead434ce97 100644 --- a/include/xrpl/protocol/UintTypes.h +++ b/include/xrpl/protocol/UintTypes.h @@ -140,7 +140,7 @@ struct hash : xrpl::Directory::hasher }; template <> -struct hash : xrpl::uint256::hasher +struct hash : xrpl::UInt256::hasher { hash() = default; }; diff --git a/include/xrpl/protocol/Units.h b/include/xrpl/protocol/Units.h index 94afd72f53..c75b1ba980 100644 --- a/include/xrpl/protocol/Units.h +++ b/include/xrpl/protocol/Units.h @@ -47,7 +47,7 @@ class TenthBipsTag; // namespace. template -concept Valid = std::is_class_v && std::is_object_v && +concept Valid = std::is_class_v && std::is_object_v && std::is_object_v; /** @@ -60,11 +60,11 @@ concept Valid = std::is_class_v && std::is_object_v && */ template concept Usable = Valid && - (std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v); + (std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v); template concept Compatible = @@ -79,7 +79,7 @@ concept IntegralValue = Integral; template concept CastableValue = IntegralValue && IntegralValue && - std::is_same_v; + std::is_same_v; template class ValueUnit : private boost::totally_ordered>, @@ -90,7 +90,7 @@ class ValueUnit : private boost::totally_ordered>, private boost::unit_steppable> { public: - using unit_type = UnitTag; + using UnitType = UnitTag; using value_type = T; private: @@ -130,7 +130,7 @@ public: * implicitly */ template Other> - constexpr ValueUnit(ValueUnit const& value) + constexpr ValueUnit(ValueUnit const& value) requires SafeToCast : ValueUnit(safeCast(value.value())) { @@ -247,7 +247,7 @@ public: template Other> constexpr bool - operator==(ValueUnit const& other) const + operator==(ValueUnit const& other) const { return value_ == other.value(); } @@ -296,7 +296,7 @@ public: template [[nodiscard]] constexpr double - decimalFromReference(ValueUnit reference) const + decimalFromReference(ValueUnit reference) const { return static_cast(value_) / reference.value(); } @@ -311,17 +311,17 @@ public: { if constexpr (std::is_integral_v) { - using jsontype = + using JsonType = std::conditional_t, json::Int, json::UInt>; - constexpr auto kMin = std::numeric_limits::min(); - constexpr auto kMax = std::numeric_limits::max(); + constexpr auto kMin = std::numeric_limits::min(); + constexpr auto kMax = std::numeric_limits::max(); if (value_ < kMin) return kMin; if (value_ > kMax) return kMax; - return static_cast(value_); + return static_cast(value_); } else { @@ -374,7 +374,7 @@ concept muldivDest = muldivSource && // Dest is also a source template concept muldivSources = muldivSource && muldivSource && - std::is_same_v; + std::is_same_v; template concept muldivable = muldivSources && muldivDest; @@ -382,7 +382,7 @@ concept muldivable = muldivSources && muldivDest; template concept muldivCommutable = muldivable && - !std::is_same_v; + !std::is_same_v; template ValueUnit @@ -406,8 +406,8 @@ mulDivU(Source1 value, Dest mul, Source2 div) return std::nullopt; } - using desttype = Dest::value_type; - constexpr auto kMax = std::numeric_limits::max(); + using DestType = Dest::value_type; + constexpr auto kMax = std::numeric_limits::max(); // Shortcuts, since these happen a lot in the real world if (value == div) @@ -416,7 +416,7 @@ mulDivU(Source1 value, Dest mul, Source2 div) { if (value.value() > kMax) return std::nullopt; - return Dest{static_cast(value.value())}; + return Dest{static_cast(value.value())}; } using namespace boost::multiprecision; @@ -432,7 +432,7 @@ mulDivU(Source1 value, Dest mul, Source2 div) if (quotient > kMax) return std::nullopt; - return Dest{static_cast(quotient)}; + return Dest{static_cast(quotient)}; } } // namespace unit diff --git a/include/xrpl/protocol/XRPAmount.h b/include/xrpl/protocol/XRPAmount.h index 26e10929df..dc42af5cc6 100644 --- a/include/xrpl/protocol/XRPAmount.h +++ b/include/xrpl/protocol/XRPAmount.h @@ -27,7 +27,7 @@ class XRPAmount : private boost::totally_ordered, private boost::additive { public: - using unit_type = unit::dropTag; + using UnitType = unit::dropTag; using value_type = std::int64_t; private: diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index 72ea19309b..cc57af8d08 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -21,7 +21,7 @@ * struct TxSettings * { * Delegation delegable{Delegation::NotDelegable}; - * uint256 amendment{}; + * UInt256 amendment{}; * Privilege privileges{Privilege::NoPriv}; * }; * diff --git a/include/xrpl/protocol/digest.h b/include/xrpl/protocol/digest.h index 44fca3d1ea..72b79e6cda 100644 --- a/include/xrpl/protocol/digest.h +++ b/include/xrpl/protocol/digest.h @@ -98,9 +98,9 @@ private: //------------------------------------------------------------------------------ -using ripemd160_hasher = OpensslRipemd160Hasher; -using sha256_hasher = OpensslSha256Hasher; -using sha512_hasher = OpensslSha512Hasher; +using Ripemd160Hasher = OpensslRipemd160Hasher; +using Sha256Hasher = OpensslSha256Hasher; +using Sha512Hasher = OpensslSha512Hasher; //------------------------------------------------------------------------------ @@ -123,7 +123,7 @@ using sha512_hasher = OpensslSha512Hasher; struct RipeshaHasher { private: - sha256_hasher h_; + Sha256Hasher h_; public: static constexpr auto kEndian = boost::endian::order::native; @@ -139,10 +139,10 @@ public: explicit operator result_type() noexcept { - auto const d0 = sha256_hasher::result_type(h_); - ripemd160_hasher rh; + auto const d0 = Sha256Hasher::result_type(h_); + Ripemd160Hasher rh; rh(d0.data(), d0.size()); - return ripemd160_hasher::result_type(rh); + return Ripemd160Hasher::result_type(rh); } }; @@ -160,12 +160,12 @@ template struct BasicSha512HalfHasher { private: - sha512_hasher h_; + Sha512Hasher h_; public: static constexpr auto kEndian = boost::endian::order::big; - using result_type = uint256; + using result_type = UInt256; ~BasicSha512HalfHasher() { @@ -181,7 +181,7 @@ public: explicit operator result_type() noexcept { - auto const digest = sha512_hasher::result_type(h_); + auto const digest = Sha512Hasher::result_type(h_); return result_type::fromVoid(digest.data()); } @@ -200,10 +200,10 @@ private: } // namespace detail -using sha512_half_hasher = detail::BasicSha512HalfHasher; +using Sha512HalfHasher = detail::BasicSha512HalfHasher; // secure version -using sha512_half_hasher_s = detail::BasicSha512HalfHasher; +using Sha512HalfHasherS = detail::BasicSha512HalfHasher; //------------------------------------------------------------------------------ @@ -211,13 +211,13 @@ using sha512_half_hasher_s = detail::BasicSha512HalfHasher; * Returns the SHA512-Half of a series of objects. */ template -sha512_half_hasher::result_type +Sha512HalfHasher::result_type sha512Half(Args const&... args) { - sha512_half_hasher h; + Sha512HalfHasher h; using beast::hash_append; hash_append(h, args...); - return static_cast(h); + return static_cast(h); } /** @@ -228,13 +228,13 @@ sha512Half(Args const&... args) * input messages will be cleared. */ template -sha512_half_hasher_s::result_type +Sha512HalfHasherS::result_type sha512HalfS(Args const&... args) { - sha512_half_hasher_s h; + Sha512HalfHasherS h; using beast::hash_append; hash_append(h, args...); - return static_cast(h); + return static_cast(h); } } // namespace xrpl diff --git a/include/xrpl/protocol/nft.h b/include/xrpl/protocol/nft.h index 54227dd1ea..8e6e55fd2c 100644 --- a/include/xrpl/protocol/nft.h +++ b/include/xrpl/protocol/nft.h @@ -36,7 +36,7 @@ constexpr std::uint16_t const kFlagTransferable = 0x0008; constexpr std::uint16_t const kFlagMutable = 0x0010; inline std::uint16_t -getFlags(uint256 const& id) +getFlags(UInt256 const& id) { std::uint16_t flags = 0; memcpy(&flags, id.begin(), 2); @@ -44,7 +44,7 @@ getFlags(uint256 const& id) } inline std::uint16_t -getTransferFee(uint256 const& id) +getTransferFee(UInt256 const& id) { std::uint16_t fee = 0; memcpy(&fee, id.begin() + 2, 2); @@ -52,7 +52,7 @@ getTransferFee(uint256 const& id) } inline std::uint32_t -getSequence(uint256 const& id) +getSequence(UInt256 const& id) { std::uint32_t seq = 0; memcpy(&seq, id.begin() + 28, 4); @@ -84,7 +84,7 @@ cipheredTaxon(std::uint32_t tokenSeq, Taxon taxon) } inline Taxon -getTaxon(uint256 const& id) +getTaxon(UInt256 const& id) { std::uint32_t taxon = 0; memcpy(&taxon, id.begin() + 24, 4); @@ -96,7 +96,7 @@ getTaxon(uint256 const& id) } inline AccountID -getIssuer(uint256 const& id) +getIssuer(UInt256 const& id) { return AccountID::fromVoid(id.data() + 4); } diff --git a/include/xrpl/protocol/nftPageMask.h b/include/xrpl/protocol/nftPageMask.h index 827df34cf3..cffccf1731 100644 --- a/include/xrpl/protocol/nftPageMask.h +++ b/include/xrpl/protocol/nftPageMask.h @@ -8,7 +8,7 @@ namespace xrpl::nft { // NFT directory pages order their contents based only on the low 96 bits of // the NFToken value. This mask provides easy access to the necessary mask. -constexpr uint256 kPageMask( +constexpr UInt256 kPageMask( std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff")); } // namespace xrpl::nft diff --git a/include/xrpl/protocol_autogen/LedgerEntryBase.h b/include/xrpl/protocol_autogen/LedgerEntryBase.h index 7902055b85..716793e53b 100644 --- a/include/xrpl/protocol_autogen/LedgerEntryBase.h +++ b/include/xrpl/protocol_autogen/LedgerEntryBase.h @@ -66,7 +66,7 @@ public: * @return A constant reference to the 256-bit key */ [[nodiscard]] - uint256 const& + UInt256 const& getKey() const { return sle_->key(); @@ -81,7 +81,7 @@ public: * @return The ledger index if present, std::nullopt otherwise */ [[nodiscard]] - std::optional + std::optional getLedgerIndex() const { if (sle_->isFieldPresent(sfLedgerIndex)) diff --git a/include/xrpl/protocol_autogen/LedgerEntryBuilderBase.h b/include/xrpl/protocol_autogen/LedgerEntryBuilderBase.h index e2f05c31ab..c18211c43d 100644 --- a/include/xrpl/protocol_autogen/LedgerEntryBuilderBase.h +++ b/include/xrpl/protocol_autogen/LedgerEntryBuilderBase.h @@ -59,7 +59,7 @@ public: * @return Reference to the derived builder for method chaining. */ Derived& - setLedgerIndex(uint256 const& value) + setLedgerIndex(UInt256 const& value) { object_[sfLedgerIndex] = value; return static_cast(*this); diff --git a/include/xrpl/protocol_autogen/TransactionBase.h b/include/xrpl/protocol_autogen/TransactionBase.h index a135709576..c5f9aa81d6 100644 --- a/include/xrpl/protocol_autogen/TransactionBase.h +++ b/include/xrpl/protocol_autogen/TransactionBase.h @@ -179,7 +179,7 @@ public: * @return The previous transaction ID if present, std::nullopt otherwise */ [[nodiscard]] - std::optional + std::optional getPreviousTxnID() const { if (tx_->isFieldPresent(sfPreviousTxnID)) @@ -232,7 +232,7 @@ public: * @return The account transaction ID if present, std::nullopt otherwise */ [[nodiscard]] - std::optional + std::optional getAccountTxnID() const { if (tx_->isFieldPresent(sfAccountTxnID)) diff --git a/include/xrpl/protocol_autogen/TransactionBuilderBase.h b/include/xrpl/protocol_autogen/TransactionBuilderBase.h index 14975b152e..767167ea11 100644 --- a/include/xrpl/protocol_autogen/TransactionBuilderBase.h +++ b/include/xrpl/protocol_autogen/TransactionBuilderBase.h @@ -145,7 +145,7 @@ public: * @return Reference to the derived builder for method chaining. */ Derived& - setAccountTxnID(uint256 const& value) + setAccountTxnID(UInt256 const& value) { object_[sfAccountTxnID] = value; return static_cast(*this); @@ -158,7 +158,7 @@ public: * @return Reference to the derived builder for method chaining. */ Derived& - setPreviousTxnID(uint256 const& value) + setPreviousTxnID(UInt256 const& value) { object_[sfPreviousTxnID] = value; return static_cast(*this); diff --git a/include/xrpl/protocol_autogen/ledger_entries/AMM.h b/include/xrpl/protocol_autogen/ledger_entries/AMM.h index e6daaf0043..fe3eeefb26 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/AMM.h +++ b/include/xrpl/protocol_autogen/ledger_entries/AMM.h @@ -385,7 +385,7 @@ public: * @return The constructed ledger entry wrapper. */ AMM - build(uint256 const& index) + build(UInt256 const& index) { return AMM{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/AccountRoot.h b/include/xrpl/protocol_autogen/ledger_entries/AccountRoot.h index 04249b4e04..64a8bdfa6e 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/AccountRoot.h +++ b/include/xrpl/protocol_autogen/ledger_entries/AccountRoot.h @@ -932,7 +932,7 @@ public: * @return The constructed ledger entry wrapper. */ AccountRoot - build(uint256 const& index) + build(UInt256 const& index) { return AccountRoot{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Amendments.h b/include/xrpl/protocol_autogen/ledger_entries/Amendments.h index c8b6c2d524..52d881ac00 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Amendments.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Amendments.h @@ -229,7 +229,7 @@ public: * @return The constructed ledger entry wrapper. */ Amendments - build(uint256 const& index) + build(UInt256 const& index) { return Amendments{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Bridge.h b/include/xrpl/protocol_autogen/ledger_entries/Bridge.h index 31d0e50c02..4c8eacb384 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Bridge.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Bridge.h @@ -339,7 +339,7 @@ public: * @return The constructed ledger entry wrapper. */ Bridge - build(uint256 const& index) + build(UInt256 const& index) { return Bridge{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Check.h b/include/xrpl/protocol_autogen/ledger_entries/Check.h index d354425c39..72d3d6c166 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Check.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Check.h @@ -420,7 +420,7 @@ public: * @return The constructed ledger entry wrapper. */ Check - build(uint256 const& index) + build(UInt256 const& index) { return Check{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Credential.h b/include/xrpl/protocol_autogen/ledger_entries/Credential.h index f4d243aea8..64d3f8620a 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Credential.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Credential.h @@ -337,7 +337,7 @@ public: * @return The constructed ledger entry wrapper. */ Credential - build(uint256 const& index) + build(UInt256 const& index) { return Credential{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/DID.h b/include/xrpl/protocol_autogen/ledger_entries/DID.h index 71113862c5..9d18e96fd2 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/DID.h +++ b/include/xrpl/protocol_autogen/ledger_entries/DID.h @@ -289,7 +289,7 @@ public: * @return The constructed ledger entry wrapper. */ DID - build(uint256 const& index) + build(UInt256 const& index) { return DID{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Delegate.h b/include/xrpl/protocol_autogen/ledger_entries/Delegate.h index 84a33ea2be..406657628d 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Delegate.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Delegate.h @@ -268,7 +268,7 @@ public: * @return The constructed ledger entry wrapper. */ Delegate - build(uint256 const& index) + build(UInt256 const& index) { return Delegate{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/DepositPreauth.h b/include/xrpl/protocol_autogen/ledger_entries/DepositPreauth.h index c4c4434251..21feedfb20 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/DepositPreauth.h +++ b/include/xrpl/protocol_autogen/ledger_entries/DepositPreauth.h @@ -255,7 +255,7 @@ public: * @return The constructed ledger entry wrapper. */ DepositPreauth - build(uint256 const& index) + build(UInt256 const& index) { return DepositPreauth{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/DirectoryNode.h b/include/xrpl/protocol_autogen/ledger_entries/DirectoryNode.h index 7879f104af..2d41af9faf 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/DirectoryNode.h +++ b/include/xrpl/protocol_autogen/ledger_entries/DirectoryNode.h @@ -626,7 +626,7 @@ public: * @return The constructed ledger entry wrapper. */ DirectoryNode - build(uint256 const& index) + build(UInt256 const& index) { return DirectoryNode{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Escrow.h b/include/xrpl/protocol_autogen/ledger_entries/Escrow.h index fc01c8b858..9707f4cd09 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Escrow.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Escrow.h @@ -617,7 +617,7 @@ public: * @return The constructed ledger entry wrapper. */ Escrow - build(uint256 const& index) + build(UInt256 const& index) { return Escrow{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/FeeSettings.h b/include/xrpl/protocol_autogen/ledger_entries/FeeSettings.h index 826ad6983e..9b8fa877a5 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/FeeSettings.h +++ b/include/xrpl/protocol_autogen/ledger_entries/FeeSettings.h @@ -508,7 +508,7 @@ public: * @return The constructed ledger entry wrapper. */ FeeSettings - build(uint256 const& index) + build(UInt256 const& index) { return FeeSettings{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/LedgerHashes.h b/include/xrpl/protocol_autogen/ledger_entries/LedgerHashes.h index 2c6747b07b..5af336b306 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/LedgerHashes.h +++ b/include/xrpl/protocol_autogen/ledger_entries/LedgerHashes.h @@ -182,7 +182,7 @@ public: * @return The constructed ledger entry wrapper. */ LedgerHashes - build(uint256 const& index) + build(UInt256 const& index) { return LedgerHashes{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Loan.h b/include/xrpl/protocol_autogen/ledger_entries/Loan.h index a0abf9bd97..4d0c902cbe 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Loan.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Loan.h @@ -923,7 +923,7 @@ public: * @return The constructed ledger entry wrapper. */ Loan - build(uint256 const& index) + build(UInt256 const& index) { return Loan{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/LoanBroker.h b/include/xrpl/protocol_autogen/ledger_entries/LoanBroker.h index 281af2cfeb..2edd5f0db0 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/LoanBroker.h +++ b/include/xrpl/protocol_autogen/ledger_entries/LoanBroker.h @@ -584,7 +584,7 @@ public: * @return The constructed ledger entry wrapper. */ LoanBroker - build(uint256 const& index) + build(UInt256 const& index) { return LoanBroker{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/MPToken.h b/include/xrpl/protocol_autogen/ledger_entries/MPToken.h index c1601fc2fa..1e0d5f8ab1 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/MPToken.h +++ b/include/xrpl/protocol_autogen/ledger_entries/MPToken.h @@ -558,7 +558,7 @@ public: * @return The constructed ledger entry wrapper. */ MPToken - build(uint256 const& index) + build(UInt256 const& index) { return MPToken{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/MPTokenIssuance.h b/include/xrpl/protocol_autogen/ledger_entries/MPTokenIssuance.h index 74b5e3c4eb..c155d635ab 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/MPTokenIssuance.h +++ b/include/xrpl/protocol_autogen/ledger_entries/MPTokenIssuance.h @@ -687,7 +687,7 @@ public: * @return The constructed ledger entry wrapper. */ MPTokenIssuance - build(uint256 const& index) + build(UInt256 const& index) { return MPTokenIssuance{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/NFTokenOffer.h b/include/xrpl/protocol_autogen/ledger_entries/NFTokenOffer.h index 61aaccacdc..50e8ed9870 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/NFTokenOffer.h +++ b/include/xrpl/protocol_autogen/ledger_entries/NFTokenOffer.h @@ -326,7 +326,7 @@ public: * @return The constructed ledger entry wrapper. */ NFTokenOffer - build(uint256 const& index) + build(UInt256 const& index) { return NFTokenOffer{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/NFTokenPage.h b/include/xrpl/protocol_autogen/ledger_entries/NFTokenPage.h index 1aea6d6b01..116618d718 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/NFTokenPage.h +++ b/include/xrpl/protocol_autogen/ledger_entries/NFTokenPage.h @@ -231,7 +231,7 @@ public: * @return The constructed ledger entry wrapper. */ NFTokenPage - build(uint256 const& index) + build(UInt256 const& index) { return NFTokenPage{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/NegativeUNL.h b/include/xrpl/protocol_autogen/ledger_entries/NegativeUNL.h index a35865202d..74994f290a 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/NegativeUNL.h +++ b/include/xrpl/protocol_autogen/ledger_entries/NegativeUNL.h @@ -264,7 +264,7 @@ public: * @return The constructed ledger entry wrapper. */ NegativeUNL - build(uint256 const& index) + build(UInt256 const& index) { return NegativeUNL{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Offer.h b/include/xrpl/protocol_autogen/ledger_entries/Offer.h index e3539fc1fc..f2da61d742 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Offer.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Offer.h @@ -410,7 +410,7 @@ public: * @return The constructed ledger entry wrapper. */ Offer - build(uint256 const& index) + build(UInt256 const& index) { return Offer{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Oracle.h b/include/xrpl/protocol_autogen/ledger_entries/Oracle.h index 727e63ea84..09ef0a8855 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Oracle.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Oracle.h @@ -351,7 +351,7 @@ public: * @return The constructed ledger entry wrapper. */ Oracle - build(uint256 const& index) + build(UInt256 const& index) { return Oracle{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/PayChannel.h b/include/xrpl/protocol_autogen/ledger_entries/PayChannel.h index 4d00fbb7e5..6c4a208717 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/PayChannel.h +++ b/include/xrpl/protocol_autogen/ledger_entries/PayChannel.h @@ -514,7 +514,7 @@ public: * @return The constructed ledger entry wrapper. */ PayChannel - build(uint256 const& index) + build(UInt256 const& index) { return PayChannel{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/PermissionedDomain.h b/include/xrpl/protocol_autogen/ledger_entries/PermissionedDomain.h index e793e2d658..8736faece5 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/PermissionedDomain.h +++ b/include/xrpl/protocol_autogen/ledger_entries/PermissionedDomain.h @@ -233,7 +233,7 @@ public: * @return The constructed ledger entry wrapper. */ PermissionedDomain - build(uint256 const& index) + build(UInt256 const& index) { return PermissionedDomain{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/RippleState.h b/include/xrpl/protocol_autogen/ledger_entries/RippleState.h index dda1b78e66..25b05cdc22 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/RippleState.h +++ b/include/xrpl/protocol_autogen/ledger_entries/RippleState.h @@ -488,7 +488,7 @@ public: * @return The constructed ledger entry wrapper. */ RippleState - build(uint256 const& index) + build(UInt256 const& index) { return RippleState{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/SignerList.h b/include/xrpl/protocol_autogen/ledger_entries/SignerList.h index 3aff8fa51b..1abe8c10fa 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/SignerList.h +++ b/include/xrpl/protocol_autogen/ledger_entries/SignerList.h @@ -268,7 +268,7 @@ public: * @return The constructed ledger entry wrapper. */ SignerList - build(uint256 const& index) + build(UInt256 const& index) { return SignerList{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Sponsorship.h b/include/xrpl/protocol_autogen/ledger_entries/Sponsorship.h index 065e655682..f7a3cef6fe 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Sponsorship.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Sponsorship.h @@ -337,7 +337,7 @@ public: * @return The constructed ledger entry wrapper. */ Sponsorship - build(uint256 const& index) + build(UInt256 const& index) { return Sponsorship{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Ticket.h b/include/xrpl/protocol_autogen/ledger_entries/Ticket.h index e1205bdb67..ee39142eb8 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Ticket.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Ticket.h @@ -208,7 +208,7 @@ public: * @return The constructed ledger entry wrapper. */ Ticket - build(uint256 const& index) + build(UInt256 const& index) { return Ticket{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/TransactionProposal.h b/include/xrpl/protocol_autogen/ledger_entries/TransactionProposal.h index 905139bf37..35fdc507a5 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/TransactionProposal.h +++ b/include/xrpl/protocol_autogen/ledger_entries/TransactionProposal.h @@ -233,7 +233,7 @@ public: * @return The constructed ledger entry wrapper. */ TransactionProposal - build(uint256 const& index) + build(UInt256 const& index) { return TransactionProposal{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/Vault.h b/include/xrpl/protocol_autogen/ledger_entries/Vault.h index 389ffb4c46..bc7568769a 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/Vault.h +++ b/include/xrpl/protocol_autogen/ledger_entries/Vault.h @@ -654,7 +654,7 @@ public: * @return The constructed ledger entry wrapper. */ Vault - build(uint256 const& index) + build(UInt256 const& index) { return Vault{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedClaimID.h b/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedClaimID.h index bfd7a0a8b8..959a969808 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedClaimID.h +++ b/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedClaimID.h @@ -305,7 +305,7 @@ public: * @return The constructed ledger entry wrapper. */ XChainOwnedClaimID - build(uint256 const& index) + build(UInt256 const& index) { return XChainOwnedClaimID{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimID.h b/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimID.h index 4872d4063e..72f4ad7188 100644 --- a/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimID.h +++ b/include/xrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimID.h @@ -257,7 +257,7 @@ public: * @return The constructed ledger entry wrapper. */ XChainOwnedCreateAccountClaimID - build(uint256 const& index) + build(UInt256 const& index) { return XChainOwnedCreateAccountClaimID{std::make_shared(std::move(object_), index)}; } diff --git a/include/xrpl/protocol_autogen/transactions/AccountDelete.h b/include/xrpl/protocol_autogen/transactions/AccountDelete.h index 87ecab0c7b..8c289f4786 100644 --- a/include/xrpl/protocol_autogen/transactions/AccountDelete.h +++ b/include/xrpl/protocol_autogen/transactions/AccountDelete.h @@ -20,7 +20,7 @@ class AccountDeleteBuilder; * * Type: ttACCOUNT_DELETE (21) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::MustDeleteAcct * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/AccountSet.h b/include/xrpl/protocol_autogen/transactions/AccountSet.h index 9f85603e22..2abd3b8d0b 100644 --- a/include/xrpl/protocol_autogen/transactions/AccountSet.h +++ b/include/xrpl/protocol_autogen/transactions/AccountSet.h @@ -20,7 +20,7 @@ class AccountSetBuilder; * * Type: ttACCOUNT_SET (3) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/CheckCancel.h b/include/xrpl/protocol_autogen/transactions/CheckCancel.h index cf300d3b9b..7a548bc6d6 100644 --- a/include/xrpl/protocol_autogen/transactions/CheckCancel.h +++ b/include/xrpl/protocol_autogen/transactions/CheckCancel.h @@ -20,7 +20,7 @@ class CheckCancelBuilder; * * Type: ttCHECK_CANCEL (18) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/CheckCash.h b/include/xrpl/protocol_autogen/transactions/CheckCash.h index b80429875f..83dcfe922b 100644 --- a/include/xrpl/protocol_autogen/transactions/CheckCash.h +++ b/include/xrpl/protocol_autogen/transactions/CheckCash.h @@ -20,7 +20,7 @@ class CheckCashBuilder; * * Type: ttCHECK_CASH (17) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::MayCreateMpt * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/CheckCreate.h b/include/xrpl/protocol_autogen/transactions/CheckCreate.h index db51b5eb5f..de627da8dd 100644 --- a/include/xrpl/protocol_autogen/transactions/CheckCreate.h +++ b/include/xrpl/protocol_autogen/transactions/CheckCreate.h @@ -20,7 +20,7 @@ class CheckCreateBuilder; * * Type: ttCHECK_CREATE (16) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/Clawback.h b/include/xrpl/protocol_autogen/transactions/Clawback.h index ad79f1d1fe..e516b62aa8 100644 --- a/include/xrpl/protocol_autogen/transactions/Clawback.h +++ b/include/xrpl/protocol_autogen/transactions/Clawback.h @@ -20,7 +20,7 @@ class ClawbackBuilder; * * Type: ttCLAWBACK (30) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/DepositPreauth.h b/include/xrpl/protocol_autogen/transactions/DepositPreauth.h index 66c5b390e6..1384171f44 100644 --- a/include/xrpl/protocol_autogen/transactions/DepositPreauth.h +++ b/include/xrpl/protocol_autogen/transactions/DepositPreauth.h @@ -20,7 +20,7 @@ class DepositPreauthBuilder; * * Type: ttDEPOSIT_PREAUTH (19) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/EnableAmendment.h b/include/xrpl/protocol_autogen/transactions/EnableAmendment.h index 08a57540ec..34ba0acca6 100644 --- a/include/xrpl/protocol_autogen/transactions/EnableAmendment.h +++ b/include/xrpl/protocol_autogen/transactions/EnableAmendment.h @@ -20,7 +20,7 @@ class EnableAmendmentBuilder; * * Type: ttAMENDMENT (100) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/EscrowCancel.h b/include/xrpl/protocol_autogen/transactions/EscrowCancel.h index 3727bbaa2a..ccc9fd51fe 100644 --- a/include/xrpl/protocol_autogen/transactions/EscrowCancel.h +++ b/include/xrpl/protocol_autogen/transactions/EscrowCancel.h @@ -20,7 +20,7 @@ class EscrowCancelBuilder; * * Type: ttESCROW_CANCEL (4) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/EscrowCreate.h b/include/xrpl/protocol_autogen/transactions/EscrowCreate.h index 78f9f00033..7c9dcc208d 100644 --- a/include/xrpl/protocol_autogen/transactions/EscrowCreate.h +++ b/include/xrpl/protocol_autogen/transactions/EscrowCreate.h @@ -20,7 +20,7 @@ class EscrowCreateBuilder; * * Type: ttESCROW_CREATE (1) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/EscrowFinish.h b/include/xrpl/protocol_autogen/transactions/EscrowFinish.h index 9c24c7671b..ad8d9732e9 100644 --- a/include/xrpl/protocol_autogen/transactions/EscrowFinish.h +++ b/include/xrpl/protocol_autogen/transactions/EscrowFinish.h @@ -20,7 +20,7 @@ class EscrowFinishBuilder; * * Type: ttESCROW_FINISH (2) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/NFTokenAcceptOffer.h b/include/xrpl/protocol_autogen/transactions/NFTokenAcceptOffer.h index 6c858be721..627f1e050b 100644 --- a/include/xrpl/protocol_autogen/transactions/NFTokenAcceptOffer.h +++ b/include/xrpl/protocol_autogen/transactions/NFTokenAcceptOffer.h @@ -20,7 +20,7 @@ class NFTokenAcceptOfferBuilder; * * Type: ttNFTOKEN_ACCEPT_OFFER (29) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/NFTokenBurn.h b/include/xrpl/protocol_autogen/transactions/NFTokenBurn.h index ac831bf45e..ab3c589422 100644 --- a/include/xrpl/protocol_autogen/transactions/NFTokenBurn.h +++ b/include/xrpl/protocol_autogen/transactions/NFTokenBurn.h @@ -20,7 +20,7 @@ class NFTokenBurnBuilder; * * Type: ttNFTOKEN_BURN (26) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::ChangeNftCounts * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/NFTokenCancelOffer.h b/include/xrpl/protocol_autogen/transactions/NFTokenCancelOffer.h index 81f4f3a848..82d0537c33 100644 --- a/include/xrpl/protocol_autogen/transactions/NFTokenCancelOffer.h +++ b/include/xrpl/protocol_autogen/transactions/NFTokenCancelOffer.h @@ -20,7 +20,7 @@ class NFTokenCancelOfferBuilder; * * Type: ttNFTOKEN_CANCEL_OFFER (28) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/NFTokenCreateOffer.h b/include/xrpl/protocol_autogen/transactions/NFTokenCreateOffer.h index 683436f4fd..520a27eef5 100644 --- a/include/xrpl/protocol_autogen/transactions/NFTokenCreateOffer.h +++ b/include/xrpl/protocol_autogen/transactions/NFTokenCreateOffer.h @@ -20,7 +20,7 @@ class NFTokenCreateOfferBuilder; * * Type: ttNFTOKEN_CREATE_OFFER (27) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/NFTokenMint.h b/include/xrpl/protocol_autogen/transactions/NFTokenMint.h index 5a4e3b5b1c..82b2163180 100644 --- a/include/xrpl/protocol_autogen/transactions/NFTokenMint.h +++ b/include/xrpl/protocol_autogen/transactions/NFTokenMint.h @@ -20,7 +20,7 @@ class NFTokenMintBuilder; * * Type: ttNFTOKEN_MINT (25) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::ChangeNftCounts * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/OfferCancel.h b/include/xrpl/protocol_autogen/transactions/OfferCancel.h index 3e52ebf24b..2decd16460 100644 --- a/include/xrpl/protocol_autogen/transactions/OfferCancel.h +++ b/include/xrpl/protocol_autogen/transactions/OfferCancel.h @@ -20,7 +20,7 @@ class OfferCancelBuilder; * * Type: ttOFFER_CANCEL (8) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/OfferCreate.h b/include/xrpl/protocol_autogen/transactions/OfferCreate.h index 774921d87a..c94fd566b8 100644 --- a/include/xrpl/protocol_autogen/transactions/OfferCreate.h +++ b/include/xrpl/protocol_autogen/transactions/OfferCreate.h @@ -20,7 +20,7 @@ class OfferCreateBuilder; * * Type: ttOFFER_CREATE (7) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::MayCreateMpt * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/Payment.h b/include/xrpl/protocol_autogen/transactions/Payment.h index cb177a8d08..b66184a43a 100644 --- a/include/xrpl/protocol_autogen/transactions/Payment.h +++ b/include/xrpl/protocol_autogen/transactions/Payment.h @@ -20,7 +20,7 @@ class PaymentBuilder; * * Type: ttPAYMENT (0) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::CreateAcct | Privilege::MayCreateMpt * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/PaymentChannelClaim.h b/include/xrpl/protocol_autogen/transactions/PaymentChannelClaim.h index 06892955db..ee398bcdc1 100644 --- a/include/xrpl/protocol_autogen/transactions/PaymentChannelClaim.h +++ b/include/xrpl/protocol_autogen/transactions/PaymentChannelClaim.h @@ -20,7 +20,7 @@ class PaymentChannelClaimBuilder; * * Type: ttPAYCHAN_CLAIM (15) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/PaymentChannelCreate.h b/include/xrpl/protocol_autogen/transactions/PaymentChannelCreate.h index 2a3aebca4c..df388d7e07 100644 --- a/include/xrpl/protocol_autogen/transactions/PaymentChannelCreate.h +++ b/include/xrpl/protocol_autogen/transactions/PaymentChannelCreate.h @@ -20,7 +20,7 @@ class PaymentChannelCreateBuilder; * * Type: ttPAYCHAN_CREATE (13) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/PaymentChannelFund.h b/include/xrpl/protocol_autogen/transactions/PaymentChannelFund.h index 9a8c452b0b..94746ae1d2 100644 --- a/include/xrpl/protocol_autogen/transactions/PaymentChannelFund.h +++ b/include/xrpl/protocol_autogen/transactions/PaymentChannelFund.h @@ -20,7 +20,7 @@ class PaymentChannelFundBuilder; * * Type: ttPAYCHAN_FUND (14) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/SetFee.h b/include/xrpl/protocol_autogen/transactions/SetFee.h index edcea7b734..2794a40195 100644 --- a/include/xrpl/protocol_autogen/transactions/SetFee.h +++ b/include/xrpl/protocol_autogen/transactions/SetFee.h @@ -20,7 +20,7 @@ class SetFeeBuilder; * * Type: ttFEE (101) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/SetRegularKey.h b/include/xrpl/protocol_autogen/transactions/SetRegularKey.h index 042676251b..3ffee940b7 100644 --- a/include/xrpl/protocol_autogen/transactions/SetRegularKey.h +++ b/include/xrpl/protocol_autogen/transactions/SetRegularKey.h @@ -20,7 +20,7 @@ class SetRegularKeyBuilder; * * Type: ttREGULAR_KEY_SET (5) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/SignerListSet.h b/include/xrpl/protocol_autogen/transactions/SignerListSet.h index 253bcccc1a..7d64357661 100644 --- a/include/xrpl/protocol_autogen/transactions/SignerListSet.h +++ b/include/xrpl/protocol_autogen/transactions/SignerListSet.h @@ -20,7 +20,7 @@ class SignerListSetBuilder; * * Type: ttSIGNER_LIST_SET (12) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/TicketCreate.h b/include/xrpl/protocol_autogen/transactions/TicketCreate.h index 4cb109b8f2..20cb05eca9 100644 --- a/include/xrpl/protocol_autogen/transactions/TicketCreate.h +++ b/include/xrpl/protocol_autogen/transactions/TicketCreate.h @@ -20,7 +20,7 @@ class TicketCreateBuilder; * * Type: ttTICKET_CREATE (10) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/TrustSet.h b/include/xrpl/protocol_autogen/transactions/TrustSet.h index 9d939eb1d0..5ab54dbbf4 100644 --- a/include/xrpl/protocol_autogen/transactions/TrustSet.h +++ b/include/xrpl/protocol_autogen/transactions/TrustSet.h @@ -20,7 +20,7 @@ class TrustSetBuilder; * * Type: ttTRUST_SET (20) * Delegable: Delegation::Delegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/protocol_autogen/transactions/UNLModify.h b/include/xrpl/protocol_autogen/transactions/UNLModify.h index f5c94071d7..51a1131a6e 100644 --- a/include/xrpl/protocol_autogen/transactions/UNLModify.h +++ b/include/xrpl/protocol_autogen/transactions/UNLModify.h @@ -20,7 +20,7 @@ class UNLModifyBuilder; * * Type: ttUNL_MODIFY (102) * Delegable: Delegation::NotDelegable - * Amendment: uint256{} + * Amendment: UInt256{} * Privileges: Privilege::NoPriv * * Immutable wrapper around STTx providing type-safe field access. diff --git a/include/xrpl/rdb/DatabaseCon.h b/include/xrpl/rdb/DatabaseCon.h index 5c20f65784..f1d9cf22ab 100644 --- a/include/xrpl/rdb/DatabaseCon.h +++ b/include/xrpl/rdb/DatabaseCon.h @@ -28,14 +28,14 @@ namespace xrpl { class LockedSociSession { public: - using mutex = std::recursive_mutex; + using Mutex = std::recursive_mutex; private: std::shared_ptr session_; - std::unique_lock lock_; + std::unique_lock lock_; public: - LockedSociSession(std::shared_ptr it, mutex& m) + LockedSociSession(std::shared_ptr it, Mutex& m) : session_(std::move(it)), lock_(m) { } @@ -220,7 +220,7 @@ private: } } - LockedSociSession::mutex lock_; + LockedSociSession::Mutex lock_; // checkpointer may outlive the DatabaseCon when the checkpointer jobQueue // callback locks a weak pointer and the DatabaseCon is then destroyed. In diff --git a/include/xrpl/rdb/RelationalDatabase.h b/include/xrpl/rdb/RelationalDatabase.h index e858f578f8..3e96c36356 100644 --- a/include/xrpl/rdb/RelationalDatabase.h +++ b/include/xrpl/rdb/RelationalDatabase.h @@ -35,8 +35,8 @@ class Ledger; struct LedgerHashPair { - uint256 ledgerHash; - uint256 parentHash; + UInt256 ledgerHash; + UInt256 parentHash; }; struct LedgerRange @@ -102,11 +102,11 @@ public: using AccountTx = std::pair, std::shared_ptr>; using AccountTxs = std::vector; - using txnMetaLedgerType = std::tuple; - using MetaTxsList = std::vector; + using TxnMetaLedgerType = std::tuple; + using MetaTxsList = std::vector; using LedgerSequence = uint32_t; - using LedgerHash = uint256; + using LedgerHash = UInt256; using LedgerSpecifier = std::variant; struct AccountTxArgs @@ -169,7 +169,7 @@ public: * @return Ledger if found, otherwise no value. */ virtual std::optional - getLedgerInfoByHash(uint256 const& ledgerHash) = 0; + getLedgerInfoByHash(UInt256 const& ledgerHash) = 0; /** * @brief getHashByIndex Returns the hash of the ledger with the given @@ -177,7 +177,7 @@ public: * @param ledgerIndex Ledger sequence. * @return Hash of the ledger. */ - virtual uint256 + virtual UInt256 getHashByIndex(LedgerIndex ledgerIndex) = 0; /** @@ -451,7 +451,7 @@ public: */ virtual std::variant getTransaction( - uint256 const& id, + UInt256 const& id, std::optional> const& range, ErrorCodeI& ec) = 0; diff --git a/include/xrpl/resource/ResourceManager.h b/include/xrpl/resource/ResourceManager.h index 267cfb16e3..f18251116c 100644 --- a/include/xrpl/resource/ResourceManager.h +++ b/include/xrpl/resource/ResourceManager.h @@ -76,6 +76,6 @@ public: //------------------------------------------------------------------------------ std::unique_ptr -makeManager(beast::insight::Collector::ptr const& collector, beast::Journal journal); +makeManager(beast::insight::Collector::Ptr const& collector, beast::Journal journal); } // namespace xrpl::resource diff --git a/include/xrpl/resource/detail/Entry.h b/include/xrpl/resource/detail/Entry.h index ec5a328b8b..aabc76096f 100644 --- a/include/xrpl/resource/detail/Entry.h +++ b/include/xrpl/resource/detail/Entry.h @@ -14,7 +14,7 @@ namespace xrpl::resource { -using clock_type = beast::AbstractClock; +using ClockType = beast::AbstractClock; // An entry in the table // VFALCO DEPRECATED using boost::intrusive list @@ -25,7 +25,7 @@ struct Entry : public beast::List::Node /** * @param now Construction time of Entry. */ - explicit Entry(clock_type::time_point const now) + explicit Entry(ClockType::time_point const now) : refcount(0), localBalance(now), remoteBalance(0) { } @@ -49,7 +49,7 @@ struct Entry : public beast::List::Node // Balance including remote contributions int - balance(clock_type::time_point const now) + balance(ClockType::time_point const now) { return localBalance.value(now) + remoteBalance; } @@ -57,7 +57,7 @@ struct Entry : public beast::List::Node // Add a charge and return normalized balance // including contributions from imports. int - add(int charge, clock_type::time_point const now) + add(int charge, ClockType::time_point const now) { return localBalance.add(charge, now) + remoteBalance; } @@ -72,16 +72,16 @@ struct Entry : public beast::List::Node int refcount; // Exponentially decaying balance of resource consumption - DecayingSample localBalance; + DecayingSample localBalance; // Normalized balance contribution from imports int remoteBalance; // Time of the last warning - clock_type::time_point lastWarningTime; + ClockType::time_point lastWarningTime; // For inactive entries, time after which this entry will be erased - clock_type::time_point whenExpires; + ClockType::time_point whenExpires; }; inline std::ostream& diff --git a/include/xrpl/resource/detail/Import.h b/include/xrpl/resource/detail/Import.h index c5366146c1..10c71a1f32 100644 --- a/include/xrpl/resource/detail/Import.h +++ b/include/xrpl/resource/detail/Import.h @@ -26,7 +26,7 @@ struct Import } // When the imported data expires - clock_type::time_point whenExpires; + ClockType::time_point whenExpires; // List of remote entries std::vector items; diff --git a/include/xrpl/resource/detail/Logic.h b/include/xrpl/resource/detail/Logic.h index aaaeb4fdd1..be81b615f8 100644 --- a/include/xrpl/resource/detail/Logic.h +++ b/include/xrpl/resource/detail/Logic.h @@ -29,14 +29,14 @@ namespace xrpl::resource { class Logic { private: - using clock_type = Stopwatch; - using Imports = hash_map; - using Table = hash_map; + using ClockType = Stopwatch; + using Imports = HashMap; + using Table = HashMap; using EntryIntrusiveList = beast::List; struct Stats { - Stats(beast::insight::Collector::ptr const& collector) + Stats(beast::insight::Collector::Ptr const& collector) { warn = collector->makeMeter("warn"); drop = collector->makeMeter("drop"); @@ -76,10 +76,7 @@ private: //-------------------------------------------------------------------------- public: - Logic( - beast::insight::Collector::ptr const& collector, - clock_type& clock, - beast::Journal journal) + Logic(beast::insight::Collector::Ptr const& collector, ClockType& clock, beast::Journal journal) : stats_(collector), clock_(clock), journal_(journal) { } @@ -198,7 +195,7 @@ public: json::Value getJson(int threshold) { - clock_type::time_point const now(clock_.now()); + ClockType::time_point const now(clock_.now()); json::Value ret(json::ValueType::Object); std::scoped_lock const _(lock_); @@ -243,7 +240,7 @@ public: Gossip exportConsumers() { - clock_type::time_point const now(clock_.now()); + ClockType::time_point const now(clock_.now()); Gossip gossip; std::scoped_lock const _(lock_); @@ -454,7 +451,7 @@ public: context = " (" + context + ")"; std::scoped_lock const _(lock_); - clock_type::time_point const now(clock_.now()); + ClockType::time_point const now(clock_.now()); int const balance(entry.add(fee.cost(), now)); JLOG(kGetStream(fee.cost(), journal_)) << "Charging " << entry << " for " << fee << context; return disposition(balance); @@ -491,7 +488,7 @@ public: std::scoped_lock const _(lock_); bool drop(false); - clock_type::time_point const now(clock_.now()); + ClockType::time_point const now(clock_.now()); int const balance(entry.balance(now)); if (balance >= kDropThreshold) { @@ -519,7 +516,7 @@ public: static void writeList( - clock_type::time_point const now, + ClockType::time_point const now, beast::PropertyStream::Set& items, EntryIntrusiveList& list) { @@ -538,7 +535,7 @@ public: void onWrite(beast::PropertyStream::Map& map) { - clock_type::time_point const now(clock_.now()); + ClockType::time_point const now(clock_.now()); std::scoped_lock const _(lock_); diff --git a/include/xrpl/server/Handoff.h b/include/xrpl/server/Handoff.h index 6dc547467b..bc9f0086b2 100644 --- a/include/xrpl/server/Handoff.h +++ b/include/xrpl/server/Handoff.h @@ -9,9 +9,9 @@ namespace xrpl { -using http_request_type = boost::beast::http::request; +using HttpRequestType = boost::beast::http::request; -using http_response_type = boost::beast::http::response; +using HttpResponseType = boost::beast::http::response; /** * Used to indicate the result of a server connection handoff. diff --git a/include/xrpl/server/InfoSub.h b/include/xrpl/server/InfoSub.h index db76396dc2..76c72d3c15 100644 --- a/include/xrpl/server/InfoSub.h +++ b/include/xrpl/server/InfoSub.h @@ -92,9 +92,9 @@ public: // VFALCO TODO Standardize on the names of weak / strong pointer type // aliases. - using wptr = std::weak_ptr; + using Wptr = std::weak_ptr; - using ref = std::shared_ptr const&; + using Ref = std::shared_ptr const&; using Consumer = resource::Consumer; @@ -112,18 +112,18 @@ public: // you get transactions as they occur or once their // results are confirmed virtual void - subAccount(ref ispListener, hash_set const& vnaAccountIDs, bool realTime) = 0; + subAccount(Ref ispListener, HashSet const& vnaAccountIDs, bool realTime) = 0; // for normal use, removes from InfoSub and server virtual void - unsubAccount(ref isplistener, hash_set const& vnaAccountIDs, bool realTime) = 0; + unsubAccount(Ref isplistener, HashSet const& vnaAccountIDs, bool realTime) = 0; // for use during InfoSub destruction // Removes only from the server virtual void unsubAccountInternal( std::uint64_t uListener, - hash_set const& vnaAccountIDs, + HashSet const& vnaAccountIDs, bool realTime) = 0; /** @@ -132,7 +132,7 @@ public: * @return rpcSUCCESS if successful, otherwise an error code */ virtual ErrorCodeI - subAccountHistory(ref ispListener, AccountID const& account) = 0; + subAccountHistory(Ref ispListener, AccountID const& account) = 0; /** * unsubscribe an account's transactions @@ -143,7 +143,7 @@ public: * transactions. */ virtual void - unsubAccountHistory(ref ispListener, AccountID const& account, bool historyOnly) = 0; + unsubAccountHistory(Ref ispListener, AccountID const& account, bool historyOnly) = 0; virtual void unsubAccountHistoryInternal( @@ -175,35 +175,35 @@ public: virtual void scheduleAccountCleanup( std::uint64_t seq, - hash_set rtAccounts, - hash_set normalAccounts, - hash_set historyAccounts) = 0; + HashSet rtAccounts, + HashSet normalAccounts, + HashSet historyAccounts) = 0; // VFALCO TODO Document the bool return value virtual bool - subLedger(ref ispListener, json::Value& jvResult) = 0; + subLedger(Ref ispListener, json::Value& jvResult) = 0; virtual bool unsubLedger(std::uint64_t uListener) = 0; virtual bool - subBookChanges(ref ispListener) = 0; + subBookChanges(Ref ispListener) = 0; virtual bool unsubBookChanges(std::uint64_t uListener) = 0; virtual bool - subManifests(ref ispListener) = 0; + subManifests(Ref ispListener) = 0; virtual bool unsubManifests(std::uint64_t uListener) = 0; virtual void pubManifest(Manifest const&) = 0; virtual bool - subServer(ref ispListener, json::Value& jvResult, bool admin) = 0; + subServer(Ref ispListener, json::Value& jvResult, bool admin) = 0; virtual bool unsubServer(std::uint64_t uListener) = 0; virtual bool - subBook(ref ispListener, Book const&) = 0; + subBook(Ref ispListener, Book const&) = 0; /** * Remove a book subscription for a live subscriber. @@ -223,7 +223,7 @@ public: * partially-destroyed object. */ virtual bool - unsubBook(ref ispListener, Book const&) = 0; + unsubBook(Ref ispListener, Book const&) = 0; /** * Remove a book subscription during InfoSub teardown. @@ -243,22 +243,22 @@ public: unsubBookInternal(std::uint64_t uListener, Book const&) = 0; virtual bool - subTransactions(ref ispListener) = 0; + subTransactions(Ref ispListener) = 0; virtual bool unsubTransactions(std::uint64_t uListener) = 0; virtual bool - subRTTransactions(ref ispListener) = 0; + subRTTransactions(Ref ispListener) = 0; virtual bool unsubRTTransactions(std::uint64_t uListener) = 0; virtual bool - subValidations(ref ispListener) = 0; + subValidations(Ref ispListener) = 0; virtual bool unsubValidations(std::uint64_t uListener) = 0; virtual bool - subPeerStatus(ref ispListener) = 0; + subPeerStatus(Ref ispListener) = 0; virtual bool unsubPeerStatus(std::uint64_t uListener) = 0; @@ -266,7 +266,7 @@ public: pubPeerStatus(std::function const&) = 0; virtual bool - subConsensus(ref ispListener) = 0; + subConsensus(Ref ispListener) = 0; virtual bool unsubConsensus(std::uint64_t uListener) = 0; @@ -277,7 +277,7 @@ public: virtual pointer findRpcSub(std::string const& strUrl) = 0; virtual pointer - addRpcSub(std::string const& strUrl, ref rspEntry) = 0; + addRpcSub(std::string const& strUrl, Ref rspEntry) = 0; virtual bool tryRemoveRpcSub(std::string const& strUrl) = 0; @@ -338,8 +338,8 @@ public: */ [[nodiscard]] bool tryReserveAccountSubscriptions( - hash_set const& proposedAccounts, - hash_set const& normalAccounts, + HashSet const& proposedAccounts, + HashSet const& normalAccounts, std::size_t cap); /** @@ -421,12 +421,12 @@ protected: private: Consumer consumer_; Source& source_; - hash_set realTimeSubscriptions_; - hash_set normalSubscriptions_; + HashSet realTimeSubscriptions_; + HashSet normalSubscriptions_; std::shared_ptr request_; std::uint64_t seq_; - hash_set accountHistorySubscriptions_; - hash_set bookSubscriptions_; + HashSet accountHistorySubscriptions_; + HashSet bookSubscriptions_; unsigned int apiVersion_ = 0; static int diff --git a/include/xrpl/server/Manifest.h b/include/xrpl/server/Manifest.h index 1b726f2c0c..6ca34a1755 100644 --- a/include/xrpl/server/Manifest.h +++ b/include/xrpl/server/Manifest.h @@ -133,7 +133,7 @@ struct Manifest /** * Returns hash of serialized manifest data */ - [[nodiscard]] uint256 + [[nodiscard]] UInt256 hash() const; /** @@ -379,12 +379,12 @@ private: /** * Active manifests stored by master public key. */ - hash_map map_; + HashMap map_; /** * Master public keys stored by current ephemeral public key. */ - hash_map signingToMasterKeys_; + HashMap signingToMasterKeys_; std::atomic seq_{0}; @@ -396,7 +396,7 @@ private: * becomes listed (see `promoteToTrusted`) or an `Uncapped` update arrives, * never re-added on de-listing. Uncapped keys are not tracked here. */ - hash_set untrustedKeys_; + HashSet untrustedKeys_; /** * Maximum number of untrusted master keys kept in the cache. diff --git a/include/xrpl/server/NetworkOPs.h b/include/xrpl/server/NetworkOPs.h index d3d3bb9f70..d4d99af978 100644 --- a/include/xrpl/server/NetworkOPs.h +++ b/include/xrpl/server/NetworkOPs.h @@ -81,7 +81,7 @@ enum class OperatingMode { class NetworkOPs : public InfoSub::Source { public: - using clock_type = beast::AbstractClock; + using ClockType = beast::AbstractClock; enum class FailHard : unsigned char { No, Yes }; static FailHard @@ -179,7 +179,7 @@ public: // network state machine virtual bool - beginConsensus(uint256 const& netLCL, std::unique_ptr const& clog) = 0; + beginConsensus(UInt256 const& netLCL, std::unique_ptr const& clog) = 0; virtual void endConsensus(std::unique_ptr const& clog) = 0; virtual void diff --git a/include/xrpl/server/Session.h b/include/xrpl/server/Session.h index 03ac767c25..35a496c4cf 100644 --- a/include/xrpl/server/Session.h +++ b/include/xrpl/server/Session.h @@ -58,7 +58,7 @@ public: /** * Returns the current HTTP request. */ - virtual http_request_type& + virtual HttpRequestType& request() = 0; /** diff --git a/include/xrpl/server/WSSession.h b/include/xrpl/server/WSSession.h index 69f7decdb3..afa9d7c5d8 100644 --- a/include/xrpl/server/WSSession.h +++ b/include/xrpl/server/WSSession.h @@ -101,7 +101,7 @@ struct WSSession [[nodiscard]] virtual Port const& port() const = 0; - [[nodiscard]] virtual http_request_type const& + [[nodiscard]] virtual HttpRequestType const& request() const = 0; [[nodiscard]] virtual boost::asio::ip::tcp::endpoint const& diff --git a/include/xrpl/server/Wallet.h b/include/xrpl/server/Wallet.h index 95486cc468..cc2e0ae3eb 100644 --- a/include/xrpl/server/Wallet.h +++ b/include/xrpl/server/Wallet.h @@ -70,7 +70,7 @@ saveManifests( soci::session& session, std::string const& dbTable, std::function const& isTrusted, - hash_map const& map, + HashMap const& map, beast::Journal j); /** @@ -168,7 +168,7 @@ readAmendments( void voteAmendment( soci::session& session, - uint256 const& amendment, + UInt256 const& amendment, std::string const& name, AmendmentVote vote); diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index 6020d3cc65..4cd020e086 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -42,10 +42,10 @@ template class BaseHTTPPeer : public IOList::Work, public Session { protected: - using clock_type = std::chrono::system_clock; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using yield_context = boost::asio::yield_context; + using ClockType = std::chrono::system_clock; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using YieldContext = boost::asio::yield_context; static constexpr auto kBufferSize = 4 * 1024; // size of read/write buffer static constexpr auto kTimeoutSeconds = 30; // max seconds without completing a message @@ -67,14 +67,14 @@ protected: Handler& handler_; boost::asio::executor_work_guard work_; boost::asio::strand strand_; - endpoint_type remoteAddress_; + EndpointType remoteAddress_; beast::Journal const journal_; std::string id_; std::size_t nid_; boost::asio::streambuf readBuf_; - http_request_type message_; + HttpRequestType message_; std::vector wq_; std::vector wq2_; std::mutex mutex_; @@ -95,7 +95,7 @@ public: Handler& handler, boost::asio::executor const& executor, beast::Journal journal, - endpoint_type remoteAddress, + EndpointType remoteAddress, ConstBufferSequence const& buffers); ~BaseHTTPPeer() override; @@ -117,7 +117,7 @@ protected: } void - fail(error_code ec, char const* what); + fail(ErrorCode ec, char const* what); void startTimer(); @@ -129,13 +129,13 @@ protected: onTimer(); void - doRead(yield_context doYield); + doRead(YieldContext doYield); void - onWrite(error_code const& ec, std::size_t bytesTransferred); + onWrite(ErrorCode const& ec, std::size_t bytesTransferred); void - doWriter(std::shared_ptr const& writer, bool keepAlive, yield_context doYield); + doWriter(std::shared_ptr const& writer, bool keepAlive, YieldContext doYield); virtual void doRequest() = 0; @@ -163,7 +163,7 @@ protected: return beast::IPAddressConversion::fromAsio(remoteAddress_); } - http_request_type& + HttpRequestType& request() override { return message_; @@ -194,7 +194,7 @@ BaseHTTPPeer::BaseHTTPPeer( Handler& handler, boost::asio::executor const& executor, beast::Journal journal, - endpoint_type remoteAddress, + EndpointType remoteAddress, ConstBufferSequence const& buffers) : port_(port) , handler_(handler) @@ -234,7 +234,7 @@ BaseHTTPPeer::close() template void -BaseHTTPPeer::fail(error_code ec, char const* what) +BaseHTTPPeer::fail(ErrorCode ec, char const* what) { if (!ec_ && ec != boost::asio::error::operation_aborted) { @@ -275,10 +275,10 @@ BaseHTTPPeer::onTimer() template void -BaseHTTPPeer::doRead(yield_context doYield) +BaseHTTPPeer::doRead(YieldContext doYield) { complete_ = false; - error_code ec; + ErrorCode ec; startTimer(); boost::beast::http::async_read(impl().stream_, readBuf_, message_, doYield[ec]); cancelTimer(); @@ -295,7 +295,7 @@ BaseHTTPPeer::doRead(yield_context doYield) // The write queue must not be empty upon entry. template void -BaseHTTPPeer::onWrite(error_code const& ec, std::size_t bytesTransferred) +BaseHTTPPeer::onWrite(ErrorCode const& ec, std::size_t bytesTransferred) { cancelTimer(); if (ec == boost::beast::error::timeout) @@ -322,7 +322,7 @@ BaseHTTPPeer::onWrite(error_code const& ec, std::size_t bytesTran bind_executor( strand_, [self = impl().shared_from_this()]( - error_code const& ec, std::size_t bytesTransferred) { + ErrorCode const& ec, std::size_t bytesTransferred) { self->onWrite(ec, bytesTransferred); })); } @@ -330,7 +330,7 @@ BaseHTTPPeer::onWrite(error_code const& ec, std::size_t bytesTran return; if (graceful_) return doClose(); - util::spawn(strand_, [self = impl().shared_from_this()](yield_context doYield) { + util::spawn(strand_, [self = impl().shared_from_this()](YieldContext doYield) { self->doRead(doYield); }); } @@ -340,13 +340,13 @@ void BaseHTTPPeer::doWriter( std::shared_ptr const& writer, bool keepAlive, - yield_context doYield) + YieldContext doYield) { std::function resume; { auto const p = impl().shared_from_this(); resume = std::function([this, p, writer, keepAlive]() { - util::spawn(strand_, [p, writer, keepAlive](yield_context doYield) { + util::spawn(strand_, [p, writer, keepAlive](YieldContext doYield) { p->doWriter(writer, keepAlive, doYield); }); }); @@ -356,7 +356,7 @@ BaseHTTPPeer::doWriter( { if (!writer->prepare(kBufferSize, resume)) return; - error_code ec; + ErrorCode ec; auto const bytesTransferred = boost::asio::async_write( impl().stream_, writer->data(), boost::asio::transfer_at_least(1), doYield[ec]); if (ec) @@ -369,7 +369,7 @@ BaseHTTPPeer::doWriter( if (!keepAlive) return doClose(); - util::spawn(strand_, [self = impl().shared_from_this()](yield_context doYield) { + util::spawn(strand_, [self = impl().shared_from_this()](YieldContext doYield) { self->doRead(doYield); }); } @@ -392,9 +392,9 @@ BaseHTTPPeer::write(void const* buf, std::size_t bytes) if (!strand_.running_in_this_thread()) { return post( - strand_, [self = impl().shared_from_this()] { self->onWrite(error_code{}, 0); }); + strand_, [self = impl().shared_from_this()] { self->onWrite(ErrorCode{}, 0); }); } - return onWrite(error_code{}, 0); + return onWrite(ErrorCode{}, 0); } } @@ -403,7 +403,7 @@ void BaseHTTPPeer::write(std::shared_ptr const& writer, bool keepAlive) { util::spawn( - strand_, [self = impl().shared_from_this(), writer, keepAlive](yield_context doYield) { + strand_, [self = impl().shared_from_this(), writer, keepAlive](YieldContext doYield) { self->doWriter(writer, keepAlive, doYield); }); } @@ -438,7 +438,7 @@ BaseHTTPPeer::complete() } // keep-alive - util::spawn(strand_, [self = impl().shared_from_this()](yield_context doYield) { + util::spawn(strand_, [self = impl().shared_from_this()](YieldContext doYield) { self->doRead(doYield); }); } diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index 84aa1e0da9..093a69a644 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -20,14 +20,14 @@ template class BasePeer : public IOList::Work { protected: - using clock_type = std::chrono::system_clock; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using waitable_timer = boost::asio::basic_waitable_timer; + using ClockType = std::chrono::system_clock; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using WaitableTimer = boost::asio::basic_waitable_timer; Port const& port_; Handler& handler_; - endpoint_type remoteAddress_; + EndpointType remoteAddress_; beast::WrappedSink sink_; beast::Journal const j_; @@ -40,7 +40,7 @@ public: Port const& port, Handler& handler, boost::asio::executor const& executor, - endpoint_type remoteAddress, + EndpointType remoteAddress, beast::Journal journal); void @@ -61,7 +61,7 @@ BasePeer::BasePeer( Port const& port, Handler& handler, boost::asio::executor const& executor, - endpoint_type remoteAddress, + EndpointType remoteAddress, beast::Journal journal) : port_(port) , handler_(handler) @@ -84,7 +84,7 @@ BasePeer::close() { if (!strand_.running_in_this_thread()) return post(strand_, [self = impl().shared_from_this()] { self->close(); }); - error_code ec; + ErrorCode ec; xrpl::getLowestLayer(impl().ws_).socket().close(ec); } diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index 403d7f92ee..c9fb599f83 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -38,16 +38,16 @@ template class BaseWSPeer : public BasePeer, public WSSession { protected: - using clock_type = std::chrono::system_clock; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using waitable_timer = boost::asio::basic_waitable_timer; + using ClockType = std::chrono::system_clock; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using WaitableTimer = boost::asio::basic_waitable_timer; using BasePeer::strand_; private: friend class BasePeer; - http_request_type request_; + HttpRequestType request_; boost::beast::multi_buffer rb_; boost::beast::multi_buffer wb_; std::list> wq_; @@ -58,11 +58,11 @@ private: */ bool doClose_ = false; boost::beast::websocket::close_reason cr_; - waitable_timer timer_; + WaitableTimer timer_; bool closeOnTimer_ = false; bool pingActive_ = false; boost::beast::websocket::ping_data payload_; - error_code ec_; + ErrorCode ec_; std::function controlCallback_; public: @@ -71,8 +71,8 @@ public: Port const& port, Handler& handler, boost::asio::executor const& executor, - waitable_timer timer, - endpoint_type remoteAddress, + WaitableTimer timer, + EndpointType remoteAddress, boost::beast::http::request&& request, beast::Journal journal); @@ -89,7 +89,7 @@ public: return this->port_; } - [[nodiscard]] http_request_type const& + [[nodiscard]] HttpRequestType const& request() const override { return this->request_; @@ -121,25 +121,25 @@ protected: } void - onWsHandshake(error_code const& ec); + onWsHandshake(ErrorCode const& ec); void doWrite(); void - onWrite(error_code const& ec); + onWrite(ErrorCode const& ec); void - onWriteFin(error_code const& ec); + onWriteFin(ErrorCode const& ec); void doRead(); void - onRead(error_code const& ec); + onRead(ErrorCode const& ec); void - onClose(error_code const& ec); + onClose(ErrorCode const& ec); void startTimer(); @@ -148,17 +148,17 @@ protected: cancelTimer(); void - onPing(error_code const& ec); + onPing(ErrorCode const& ec); void onPingPong(boost::beast::websocket::frame_type kind, std::string_view payload); void - onTimer(error_code ec); + onTimer(ErrorCode ec); template void - fail(error_code ec, String const& what); + fail(ErrorCode ec, String const& what); }; //------------------------------------------------------------------------------ @@ -169,8 +169,8 @@ BaseWSPeer::BaseWSPeer( Port const& port, Handler& handler, boost::asio::executor const& executor, - waitable_timer timer, - endpoint_type remoteAddress, + WaitableTimer timer, + EndpointType remoteAddress, boost::beast::http::request&& request, beast::Journal journal) : BasePeer(port, handler, executor, remoteAddress, journal) @@ -199,7 +199,7 @@ BaseWSPeer::run() res.set(boost::beast::http::field::server, build_info::getFullVersionString()); })); impl().ws_.async_accept( - request_, bind_executor(strand_, [self = impl().shared_from_this()](error_code const& ec) { + request_, bind_executor(strand_, [self = impl().shared_from_this()](ErrorCode const& ec) { self->onWsHandshake(ec); })); } @@ -271,7 +271,7 @@ BaseWSPeer::complete() template void -BaseWSPeer::onWsHandshake(error_code const& ec) +BaseWSPeer::onWsHandshake(ErrorCode const& ec) { if (ec) return fail(ec, "on_ws_handshake"); @@ -290,7 +290,7 @@ BaseWSPeer::doWrite() template void -BaseWSPeer::onWrite(error_code const& ec) +BaseWSPeer::onWrite(ErrorCode const& ec) { if (ec) return fail(ec, "write"); @@ -305,7 +305,7 @@ BaseWSPeer::onWrite(error_code const& ec) static_cast(result.first), result.second, bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec, std::size_t) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, std::size_t) { self->onWrite(ec); })); } @@ -315,7 +315,7 @@ BaseWSPeer::onWrite(error_code const& ec) static_cast(result.first), result.second, bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec, std::size_t) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, std::size_t) { self->onWriteFin(ec); })); } @@ -323,7 +323,7 @@ BaseWSPeer::onWrite(error_code const& ec) template void -BaseWSPeer::onWriteFin(error_code const& ec) +BaseWSPeer::onWriteFin(ErrorCode const& ec) { if (ec) return fail(ec, "write_fin"); @@ -331,7 +331,7 @@ BaseWSPeer::onWriteFin(error_code const& ec) if (doClose_) { impl().ws_.async_close( - cr_, bind_executor(strand_, [self = impl().shared_from_this()](error_code const& ec) { + cr_, bind_executor(strand_, [self = impl().shared_from_this()](ErrorCode const& ec) { self->onClose(ec); })); } @@ -350,14 +350,14 @@ BaseWSPeer::doRead() impl().ws_.async_read( rb_, bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec, std::size_t) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, std::size_t) { self->onRead(ec); })); } template void -BaseWSPeer::onRead(error_code const& ec) +BaseWSPeer::onRead(ErrorCode const& ec) { if (ec == boost::beast::websocket::error::closed) return onClose({}); @@ -373,7 +373,7 @@ BaseWSPeer::onRead(error_code const& ec) template void -BaseWSPeer::onClose(error_code const& ec) +BaseWSPeer::onClose(ErrorCode const& ec) { cancelTimer(); } @@ -396,7 +396,7 @@ BaseWSPeer::startTimer() } timer_.async_wait(bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + strand_, [self = impl().shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); } // Convenience for discarding the error code @@ -416,7 +416,7 @@ BaseWSPeer::cancelTimer() template void -BaseWSPeer::onPing(error_code const& ec) +BaseWSPeer::onPing(ErrorCode const& ec) { if (ec == boost::asio::error::operation_aborted) return; @@ -449,7 +449,7 @@ BaseWSPeer::onPingPong( template void -BaseWSPeer::onTimer(error_code ec) +BaseWSPeer::onTimer(ErrorCode ec) { if (ec == boost::asio::error::operation_aborted) return; @@ -464,7 +464,7 @@ BaseWSPeer::onTimer(error_code ec) beast::rngfill(payload_.begin(), payload_.size(), cryptoPrng()); impl().ws_.async_ping( payload_, - bind_executor(strand_, [self = impl().shared_from_this()](error_code const& ec) { + bind_executor(strand_, [self = impl().shared_from_this()](ErrorCode const& ec) { self->onPing(ec); })); JLOG(this->j_.trace()) << "sent ping"; @@ -478,7 +478,7 @@ BaseWSPeer::onTimer(error_code ec) template template void -BaseWSPeer::fail(error_code ec, String const& what) +BaseWSPeer::fail(ErrorCode ec, String const& what) { XRPL_ASSERT(strand_.running_in_this_thread(), "xrpl::BaseWSPeer::fail : strand in this thread"); diff --git a/include/xrpl/server/detail/Door.h b/include/xrpl/server/detail/Door.h index 285bde14ac..5da35b277c 100644 --- a/include/xrpl/server/detail/Door.h +++ b/include/xrpl/server/detail/Door.h @@ -47,15 +47,15 @@ template class Door : public IOList::Work, public std::enable_shared_from_this> { private: - using clock_type = std::chrono::steady_clock; - using timer_type = boost::asio::basic_waitable_timer; - using error_code = boost::system::error_code; - using yield_context = boost::asio::yield_context; - using protocol_type = boost::asio::ip::tcp; - using acceptor_type = protocol_type::acceptor; - using endpoint_type = protocol_type::endpoint; - using socket_type = boost::asio::ip::tcp::socket; - using stream_type = boost::beast::tcp_stream; + using ClockType = std::chrono::steady_clock; + using TimerType = boost::asio::basic_waitable_timer; + using ErrorCode = boost::system::error_code; + using YieldContext = boost::asio::yield_context; + using ProtocolType = boost::asio::ip::tcp; + using AcceptorType = ProtocolType::acceptor; + using EndpointType = ProtocolType::endpoint; + using SocketType = boost::asio::ip::tcp::socket; + using StreamType = boost::beast::tcp_stream; // Detects SSL on a socket class Detector : public IOList::Work, public std::enable_shared_from_this @@ -64,9 +64,9 @@ private: Port const& port_; Handler& handler_; boost::asio::io_context& ioc_; - stream_type stream_; - socket_type& socket_; - endpoint_type remoteAddress_; + StreamType stream_; + SocketType& socket_; + EndpointType remoteAddress_; boost::asio::strand strand_; beast::Journal const j_; @@ -75,8 +75,8 @@ private: Port const& port, Handler& handler, boost::asio::io_context& ioc, - stream_type&& stream, - endpoint_type remoteAddress, + StreamType&& stream, + EndpointType remoteAddress, beast::Journal j); void run(); @@ -85,14 +85,14 @@ private: private: void - doDetect(yield_context yield); + doDetect(YieldContext yield); }; beast::Journal const j_; Port const& port_; Handler& handler_; boost::asio::io_context& ioc_; - acceptor_type acceptor_; + AcceptorType acceptor_; boost::asio::strand strand_; bool ssl_{ port_.protocol.contains("https") || port_.protocol.contains("wss") || @@ -106,7 +106,7 @@ private: boost::asio::steady_timer backoffTimer_; static constexpr std::uint64_t kMaxUsedFdPercent = 70; static constexpr std::chrono::milliseconds kFdSampleInterval{250}; - clock_type::time_point fdSampleAt_; + ClockType::time_point fdSampleAt_; bool cachedThrottle_{false}; struct FDStats @@ -141,7 +141,7 @@ public: void close() override; - [[nodiscard]] endpoint_type + [[nodiscard]] EndpointType getEndpoint() const { return acceptor_.local_endpoint(); @@ -153,11 +153,11 @@ private: create( bool ssl, ConstBufferSequence const& buffers, - stream_type&& stream, - endpoint_type remoteAddress); + StreamType&& stream, + EndpointType remoteAddress); void - doAccept(yield_context yield); + doAccept(YieldContext yield); }; template @@ -165,8 +165,8 @@ Door::Detector::Detector( Port const& port, Handler& handler, boost::asio::io_context& ioc, - stream_type&& stream, - endpoint_type remoteAddress, + StreamType&& stream, + EndpointType remoteAddress, beast::Journal j) : port_(port) , handler_(handler) @@ -184,7 +184,7 @@ void Door::Detector::run() { util::spawn( - strand_, [self = this->shared_from_this()](yield_context yield) { self->doDetect(yield); }); + strand_, [self = this->shared_from_this()](YieldContext yield) { self->doDetect(yield); }); } template @@ -229,7 +229,7 @@ template void Door::reOpen() { - error_code ec; + ErrorCode ec; if (acceptor_.is_open()) { @@ -243,7 +243,7 @@ Door::reOpen() } } - endpoint_type const localAddress = endpoint_type(port_.ip, port_.port); + EndpointType const localAddress = EndpointType(port_.ip, port_.port); acceptor_.open(localAddress.protocol(), ec); if (ec) @@ -289,7 +289,7 @@ Door::Door( , acceptor_(ioContext) , strand_(boost::asio::make_strand(ioContext)) , backoffTimer_(ioContext) - , fdSampleAt_(clock_type::now() - kFdSampleInterval) + , fdSampleAt_(ClockType::now() - kFdSampleInterval) { reOpen(); } @@ -299,7 +299,7 @@ void Door::run() { util::spawn( - strand_, [self = this->shared_from_this()](yield_context yield) { self->doAccept(yield); }); + strand_, [self = this->shared_from_this()](YieldContext yield) { self->doAccept(yield); }); } template @@ -311,7 +311,7 @@ Door::close() return boost::asio::post(strand_, [self = this->shared_from_this()] { self->close(); }); } backoffTimer_.cancel(); - error_code ec; + ErrorCode ec; acceptor_.close(ec); } @@ -323,8 +323,8 @@ void Door::create( bool ssl, ConstBufferSequence const& buffers, - stream_type&& stream, - endpoint_type remoteAddress) + StreamType&& stream, + EndpointType remoteAddress) { if (ssl) { @@ -354,10 +354,10 @@ Door::doAccept(boost::asio::yield_context doYield) continue; } - error_code ec; - endpoint_type remoteAddress; - stream_type stream(ioc_); - socket_type& socket = stream.socket(); + ErrorCode ec; + EndpointType remoteAddress; + StreamType stream(ioc_); + SocketType& socket = stream.socket(); acceptor_.async_accept(socket, remoteAddress, doYield[ec]); if (ec) { @@ -439,7 +439,7 @@ Door::shouldThrottleForFds() #if BOOST_OS_WINDOWS return false; #else - auto const now = clock_type::now(); + auto const now = ClockType::now(); if (now - fdSampleAt_ < kFdSampleInterval) return cachedThrottle_; diff --git a/include/xrpl/server/detail/PlainHTTPPeer.h b/include/xrpl/server/detail/PlainHTTPPeer.h index 688fbbd425..fc417485c7 100644 --- a/include/xrpl/server/detail/PlainHTTPPeer.h +++ b/include/xrpl/server/detail/PlainHTTPPeer.h @@ -20,12 +20,12 @@ class PlainHTTPPeer : public BaseHTTPPeer>, { private: friend class BaseHTTPPeer; - using socket_type = boost::asio::ip::tcp::socket; - using stream_type = boost::beast::tcp_stream; - using endpoint_type = boost::asio::ip::tcp::endpoint; + using SocketType = boost::asio::ip::tcp::socket; + using StreamType = boost::beast::tcp_stream; + using EndpointType = boost::asio::ip::tcp::endpoint; - stream_type stream_; - socket_type& socket_; + StreamType stream_; + SocketType& socket_; public: template @@ -34,9 +34,9 @@ public: Handler& handler, boost::asio::io_context& ioc, beast::Journal journal, - endpoint_type remoteAddress, + EndpointType remoteAddress, ConstBufferSequence const& buffers, - stream_type&& stream); + StreamType&& stream); void run(); @@ -61,9 +61,9 @@ PlainHTTPPeer::PlainHTTPPeer( Handler& handler, boost::asio::io_context& ioc, beast::Journal journal, - endpoint_type remoteEndpoint, + EndpointType remoteEndpoint, ConstBufferSequence const& buffers, - stream_type&& stream) + StreamType&& stream) : BaseHTTPPeer( port, handler, @@ -131,7 +131,7 @@ PlainHTTPPeer::doRequest() { // half-close on Connection: close if (!what.keepAlive) - socket_.shutdown(socket_type::shutdown_receive, ec); + socket_.shutdown(SocketType::shutdown_receive, ec); if (ec) return this->fail(ec, "request"); return this->write(what.response, what.keepAlive); @@ -139,7 +139,7 @@ PlainHTTPPeer::doRequest() // Perform half-close when Connection: close and not SSL if (!beast::rfc2616::isKeepAlive(this->message_)) - socket_.shutdown(socket_type::shutdown_receive, ec); + socket_.shutdown(SocketType::shutdown_receive, ec); if (ec) return this->fail(ec, "request"); // legacy @@ -151,7 +151,7 @@ void PlainHTTPPeer::doClose() { boost::system::error_code ec; - socket_.shutdown(socket_type::shutdown_send, ec); + socket_.shutdown(SocketType::shutdown_send, ec); } } // namespace xrpl diff --git a/include/xrpl/server/detail/PlainWSPeer.h b/include/xrpl/server/detail/PlainWSPeer.h index 279e256f51..b627f89993 100644 --- a/include/xrpl/server/detail/PlainWSPeer.h +++ b/include/xrpl/server/detail/PlainWSPeer.h @@ -19,22 +19,22 @@ class PlainWSPeer : public BaseWSPeer>, friend class BasePeer; friend class BaseWSPeer; - using clock_type = std::chrono::system_clock; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using waitable_timer = boost::asio::basic_waitable_timer; - using socket_type = boost::beast::tcp_stream; + using ClockType = std::chrono::system_clock; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using WaitableTimer = boost::asio::basic_waitable_timer; + using SocketType = boost::beast::tcp_stream; - boost::beast::websocket::stream ws_; + boost::beast::websocket::stream ws_; public: template PlainWSPeer( Port const& port, Handler& handler, - endpoint_type remoteAddress, + EndpointType remoteAddress, boost::beast::http::request&& request, - socket_type&& socket, + SocketType&& socket, beast::Journal journal); }; @@ -45,15 +45,15 @@ template PlainWSPeer::PlainWSPeer( Port const& port, Handler& handler, - endpoint_type remoteAddress, + EndpointType remoteAddress, boost::beast::http::request&& request, - socket_type&& socket, + SocketType&& socket, beast::Journal journal) : BaseWSPeer( port, handler, socket.get_executor(), - waitable_timer{socket.get_executor()}, + WaitableTimer{socket.get_executor()}, remoteAddress, std::move(request), journal) diff --git a/include/xrpl/server/detail/SSLHTTPPeer.h b/include/xrpl/server/detail/SSLHTTPPeer.h index 7fe21ed6b5..6ff884ed9d 100644 --- a/include/xrpl/server/detail/SSLHTTPPeer.h +++ b/include/xrpl/server/detail/SSLHTTPPeer.h @@ -24,16 +24,16 @@ class SSLHTTPPeer : public BaseHTTPPeer>, { private: friend class BaseHTTPPeer; - using socket_type = boost::asio::ip::tcp::socket; - using middle_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using yield_context = boost::asio::yield_context; - using error_code = boost::system::error_code; + using SocketType = boost::asio::ip::tcp::socket; + using MiddleType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; + using EndpointType = boost::asio::ip::tcp::endpoint; + using YieldContext = boost::asio::yield_context; + using ErrorCode = boost::system::error_code; - std::unique_ptr streamPtr_; - stream_type& stream_; - socket_type& socket_; + std::unique_ptr streamPtr_; + StreamType& stream_; + SocketType& socket_; public: template @@ -42,9 +42,9 @@ public: Handler& handler, boost::asio::io_context& ioc, beast::Journal journal, - endpoint_type remoteAddress, + EndpointType remoteAddress, ConstBufferSequence const& buffers, - middle_type&& stream); + MiddleType&& stream); void run(); @@ -54,7 +54,7 @@ public: private: void - doHandshake(yield_context doYield); + doHandshake(YieldContext doYield); void doRequest() override; @@ -63,7 +63,7 @@ private: doClose() override; void - onShutdown(error_code ec); + onShutdown(ErrorCode ec); }; //------------------------------------------------------------------------------ @@ -75,9 +75,9 @@ SSLHTTPPeer::SSLHTTPPeer( Handler& handler, boost::asio::io_context& ioc, beast::Journal journal, - endpoint_type remoteAddress, + EndpointType remoteAddress, ConstBufferSequence const& buffers, - middle_type&& stream) + MiddleType&& stream) : BaseHTTPPeer( port, handler, @@ -85,7 +85,7 @@ SSLHTTPPeer::SSLHTTPPeer( journal, remoteAddress, buffers) - , streamPtr_(std::make_unique(middle_type(std::move(stream)), *port.context)) + , streamPtr_(std::make_unique(MiddleType(std::move(stream)), *port.context)) , stream_(*streamPtr_) , socket_(stream_.next_layer().socket()) { @@ -99,12 +99,12 @@ SSLHTTPPeer::run() if (!this->handler_.onAccept(this->session(), this->remoteAddress_)) { util::spawn( - this->strand_, [self = this->shared_from_this()](yield_context) { self->doClose(); }); + this->strand_, [self = this->shared_from_this()](YieldContext) { self->doClose(); }); return; } if (!socket_.is_open()) return; - util::spawn(this->strand_, [self = this->shared_from_this()](yield_context doYield) { + util::spawn(this->strand_, [self = this->shared_from_this()](YieldContext doYield) { self->doHandshake(doYield); }); } @@ -125,13 +125,13 @@ SSLHTTPPeer::websocketUpgrade() template void -SSLHTTPPeer::doHandshake(yield_context doYield) +SSLHTTPPeer::doHandshake(YieldContext doYield) { boost::system::error_code ec; stream_.set_verify_mode(boost::asio::ssl::verify_none); this->startTimer(); this->readBuf_.consume( - stream_.async_handshake(stream_type::server, this->readBuf_.data(), doYield[ec])); + stream_.async_handshake(StreamType::server, this->readBuf_.data(), doYield[ec])); this->cancelTimer(); if (ec == boost::beast::error::timeout) return this->onTimer(); @@ -142,7 +142,7 @@ SSLHTTPPeer::doHandshake(yield_context doYield) this->port().protocol.count("https") > 0; if (http) { - util::spawn(this->strand_, [self = this->shared_from_this()](yield_context doYield) { + util::spawn(this->strand_, [self = this->shared_from_this()](YieldContext doYield) { self->doRead(doYield); }); return; @@ -172,12 +172,12 @@ SSLHTTPPeer::doClose() this->startTimer(); stream_.async_shutdown(bind_executor( this->strand_, - [self = this->shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + [self = this->shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); } template void -SSLHTTPPeer::onShutdown(error_code ec) +SSLHTTPPeer::onShutdown(ErrorCode ec) { this->cancelTimer(); diff --git a/include/xrpl/server/detail/SSLWSPeer.h b/include/xrpl/server/detail/SSLWSPeer.h index fe522e3c9a..ad8fc90370 100644 --- a/include/xrpl/server/detail/SSLWSPeer.h +++ b/include/xrpl/server/detail/SSLWSPeer.h @@ -26,24 +26,24 @@ class SSLWSPeer : public BaseWSPeer>, friend class BasePeer; friend class BaseWSPeer; - using clock_type = std::chrono::system_clock; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using socket_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; - using waitable_timer = boost::asio::basic_waitable_timer; + using ClockType = std::chrono::system_clock; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using SocketType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; + using WaitableTimer = boost::asio::basic_waitable_timer; - std::unique_ptr streamPtr_; - boost::beast::websocket::stream ws_; + std::unique_ptr streamPtr_; + boost::beast::websocket::stream ws_; public: template SSLWSPeer( Port const& port, Handler& handler, - endpoint_type remoteEndpoint, + EndpointType remoteEndpoint, boost::beast::http::request&& request, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, beast::Journal journal); }; @@ -54,15 +54,15 @@ template SSLWSPeer::SSLWSPeer( Port const& port, Handler& handler, - endpoint_type remoteEndpoint, + EndpointType remoteEndpoint, boost::beast::http::request&& request, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, beast::Journal journal) : BaseWSPeer( port, handler, streamPtr->get_executor(), - waitable_timer{streamPtr->get_executor()}, + WaitableTimer{streamPtr->get_executor()}, remoteEndpoint, std::move(request), journal) diff --git a/include/xrpl/server/detail/ServerImpl.h b/include/xrpl/server/detail/ServerImpl.h index c2e411cf9b..4b02c5a631 100644 --- a/include/xrpl/server/detail/ServerImpl.h +++ b/include/xrpl/server/detail/ServerImpl.h @@ -73,7 +73,7 @@ template class ServerImpl : public Server { private: - using clock_type = std::chrono::system_clock; + using ClockType = std::chrono::system_clock; static constexpr auto kHistorySize = 100; diff --git a/include/xrpl/shamap/Family.h b/include/xrpl/shamap/Family.h index 467d41e4cc..cf5c9ab4ea 100644 --- a/include/xrpl/shamap/Family.h +++ b/include/xrpl/shamap/Family.h @@ -57,7 +57,7 @@ public: * @param nodeHash Hash of missing node to report in throw. */ virtual void - missingNodeAcquireBySeq(std::uint32_t refNum, uint256 const& nodeHash) = 0; + missingNodeAcquireBySeq(std::uint32_t refNum, UInt256 const& nodeHash) = 0; /** * Acquire ledger that has a missing node by ledger hash @@ -66,7 +66,7 @@ public: * @param refNum Ledger sequence with missing node. */ virtual void - missingNodeAcquireByHash(uint256 const& refHash, std::uint32_t refNum) = 0; + missingNodeAcquireByHash(UInt256 const& refHash, std::uint32_t refNum) = 0; virtual void reset() = 0; diff --git a/include/xrpl/shamap/FullBelowCache.h b/include/xrpl/shamap/FullBelowCache.h index 1bb67c7453..5d56a83562 100644 --- a/include/xrpl/shamap/FullBelowCache.h +++ b/include/xrpl/shamap/FullBelowCache.h @@ -29,8 +29,8 @@ private: public: static constexpr auto kDefaultCacheTargetSize = 0; - using key_type = uint256; - using clock_type = CacheType::clock_type; + using key_type = UInt256; + using ClockType = CacheType::ClockType; /** * Construct the cache. @@ -42,9 +42,9 @@ public: */ BasicFullBelowCache( std::string const& name, - clock_type& clock, + ClockType& clock, beast::Journal j, - beast::insight::Collector::ptr const& collector = beast::insight::NullCollector::make(), + beast::insight::Collector::Ptr const& collector = beast::insight::NullCollector::make(), std::size_t targetSize = kDefaultCacheTargetSize, std::chrono::seconds expiration = std::chrono::minutes{2}) : cache_(name, targetSize, expiration, clock, j, collector), gen_(1) @@ -54,7 +54,7 @@ public: /** * Return the clock associated with the cache. */ - clock_type& + ClockType& clock() { return cache_.clock(); diff --git a/include/xrpl/shamap/README.md b/include/xrpl/shamap/README.md index 8931a1b50c..b52f8769e1 100644 --- a/include/xrpl/shamap/README.md +++ b/include/xrpl/shamap/README.md @@ -168,7 +168,7 @@ a `SHAMap`, and the various functions that call `walkTowardsKey` are good exampl of _why_ one would want to walk a `SHAMap` (e.g. `SHAMap::findKey`). `walkTowardsKey` always starts at the root of the `SHAMap` and traverses down through the inner nodes, looking for a leaf node along a path in the trie -designated by a `uint256`. +designated by a `UInt256`. As one walks the trie, one can _optionally_ keep a stack of nodes that one has passed through. This isn't necessary for walking the trie, but many clients @@ -180,7 +180,7 @@ To assist in walking the trie, `SHAMap::walkTowardsKey` uses a `SHAMapNodeID` that identifies a node by its path from the root and its depth in the trie. The path is just a "list" of numbers, each in the range [0 .. 15], depicting which child was chosen at each node starting from the root. Each choice is represented -by 4 bits, and then packed in sequence into a `uint256` (such that the longest +by 4 bits, and then packed in sequence into a `UInt256` (such that the longest path possible has 256 / 4 = 64 steps). The high 4 bits of the first byte identify which child of the root is chosen, the lower 4 bits of the first byte identify the child of that node, and so on. The `SHAMapNodeID` identifying the @@ -332,5 +332,5 @@ associated with this transaction in a state map. This holds the following data: -1. uint256. The hash of the data. +1. UInt256. The hash of the data. 2. vector. The data (transactions, account info). diff --git a/include/xrpl/shamap/SHAMap.h b/include/xrpl/shamap/SHAMap.h index 6d4f719b5a..56bdba633e 100644 --- a/include/xrpl/shamap/SHAMap.h +++ b/include/xrpl/shamap/SHAMap.h @@ -145,7 +145,7 @@ public: using DeltaItem = std::pair, boost::intrusive_ptr>; - using Delta = std::map; + using Delta = std::map; SHAMap() = delete; SHAMap(SHAMap const&) = delete; @@ -158,7 +158,7 @@ public: // build new map SHAMap(SHAMapType t, Family& f); - SHAMap(SHAMapType t, uint256 const& hash, Family& f); + SHAMap(SHAMapType t, UInt256 const& hash, Family& f); ~SHAMap() = default; @@ -214,10 +214,10 @@ public: * Does the tree have an item with the given ID? */ bool - hasItem(uint256 const& id) const; + hasItem(UInt256 const& id) const; bool - delItem(uint256 const& id); + delItem(UInt256 const& id); bool addItem(SHAMapNodeType type, boost::intrusive_ptr item); @@ -235,9 +235,9 @@ public: // Save a copy if you need to extend the life // of the SHAMapItem beyond this SHAMap boost::intrusive_ptr const& - peekItem(uint256 const& id) const; + peekItem(UInt256 const& id) const; boost::intrusive_ptr const& - peekItem(uint256 const& id, SHAMapHash& hash) const; + peekItem(UInt256 const& id, SHAMapHash& hash) const; // traverse functions /** @@ -248,7 +248,7 @@ public: * @note The item does not need to exist. */ ConstIterator - upperBound(uint256 const& id) const; + upperBound(UInt256 const& id) const; /** * Find the object with the greatest object id smaller than the input id. @@ -258,7 +258,7 @@ public: * @note The item does not need to exist. */ ConstIterator - lowerBound(uint256 const& id) const; + lowerBound(UInt256 const& id) const; /** * Visit every node in this SHAMap @@ -300,7 +300,7 @@ public: * @param filter The filter to use when retrieving nodes * @param return The nodes known to be missing */ - std::vector> + std::vector> getMissingNodes(int maxNodes, SHAMapSyncFilter const* filter); [[nodiscard]] bool @@ -317,7 +317,7 @@ public: * @return the proof path if found */ std::optional> - getProofPath(uint256 const& key) const; + getProofPath(UInt256 const& key) const; /** * Verify the proof path @@ -327,7 +327,7 @@ public: * @return true if verified successfully */ static bool - verifyProofPath(uint256 const& rootHash, uint256 const& key, std::vector const& path); + verifyProofPath(UInt256 const& rootHash, UInt256 const& key, std::vector const& path); /** * Serializes the root in a format appropriate for sending over the wire @@ -505,7 +505,7 @@ private: * heading for, or the node is newly created. Either way `target` selects the branch. */ void - pushNode(SHAMapTreeNodePtr node, uint256 const& target) + pushNode(SHAMapTreeNodePtr node, UInt256 const& target) { if (stack_.empty()) { @@ -547,7 +547,7 @@ private: * Update hashes up to the root */ void - dirtyUp(NodePathStack& stack, uint256 const& target, SHAMapTreeNodePtr terminal); + dirtyUp(NodePathStack& stack, UInt256 const& target, SHAMapTreeNodePtr terminal); /** * Walk towards the specified id, returning the node. Caller must check @@ -555,12 +555,12 @@ private: * id */ SHAMapLeafNode* - walkTowardsKey(uint256 const& id, NodePathStack* stack = nullptr) const; + walkTowardsKey(UInt256 const& id, NodePathStack* stack = nullptr) const; /** * Return nullptr if key not found */ SHAMapLeafNode* - findKey(uint256 const& id) const; + findKey(UInt256 const& id) const; /** * Unshare the node, allowing it to be modified @@ -604,7 +604,7 @@ private: * @return An iterator to the item found, or end() if no item lies on that side of `id`. */ ConstIterator - boundHelper(uint256 const& id, BelowDirection direction) const; + boundHelper(UInt256 const& id, BelowDirection direction) const; // Simple descent // Get a child of the specified node @@ -619,14 +619,14 @@ private: // Descend with filter // If pending, callback is called as if it called fetchNodeNT - using descendCallback = std::function; + using DescendCallback = std::function; SHAMapTreeNode* descendAsync( SHAMapInnerNode* parent, unsigned int branch, SHAMapSyncFilter const* filter, bool& pending, - descendCallback&&) const; + DescendCallback&&) const; std::pair descend( @@ -649,12 +649,12 @@ private: bool hasInnerNode(SHAMapNodeID const& nodeID, SHAMapHash const& hash) const; bool - hasLeafNode(uint256 const& tag, SHAMapHash const& hash) const; + hasLeafNode(UInt256 const& tag, SHAMapHash const& hash) const; SHAMapLeafNode const* peekFirstItem(NodePathStack& stack) const; SHAMapLeafNode const* - peekNextItem(uint256 const& id, NodePathStack& stack) const; + peekNextItem(UInt256 const& id, NodePathStack& stack) const; bool walkBranch( SHAMapTreeNode* node, @@ -681,7 +681,7 @@ private: std::uint32_t generation; // nodes we have discovered to be missing - std::vector> missingNodes; + std::vector> missingNodes; std::set missingHashes; // nodes we are in the process of traversing diff --git a/include/xrpl/shamap/SHAMapItem.h b/include/xrpl/shamap/SHAMapItem.h index d45d75a942..a903e7cccf 100644 --- a/include/xrpl/shamap/SHAMapItem.h +++ b/include/xrpl/shamap/SHAMapItem.h @@ -33,10 +33,10 @@ class SHAMapItem : public CountedObject // This is the interface for creating new instances of this class. friend boost::intrusive_ptr - makeShamapitem(uint256 const& tag, Slice data); + makeShamapitem(UInt256 const& tag, Slice data); private: - uint256 const tag_; + UInt256 const tag_; // We use std::uint32_t to minimize the size; there's no SHAMapItem whose // size exceeds 4GB and there won't ever be (famous last words?), so this @@ -50,7 +50,7 @@ private: // the only way to properly create one is to first allocate enough memory // so we limit this constructor to codepaths that do this right and limit // arbitrary construction. - SHAMapItem(uint256 const& tag, Slice data) + SHAMapItem(UInt256 const& tag, Slice data) : tag_(tag), size_(static_cast(data.size())) { std::memcpy( @@ -70,7 +70,7 @@ public: SHAMapItem& operator=(SHAMapItem&&) = delete; - uint256 const& + UInt256 const& key() const { return tag_; @@ -145,7 +145,7 @@ intrusive_ptr_release(SHAMapItem const* x) } inline boost::intrusive_ptr -makeShamapitem(uint256 const& tag, Slice data) +makeShamapitem(UInt256 const& tag, Slice data) { XRPL_ASSERT( data.size() <= megabytes(16), "xrpl::makeShamapitem : maximum input size"); diff --git a/include/xrpl/shamap/SHAMapLeafNode.h b/include/xrpl/shamap/SHAMapLeafNode.h index ab5bd574ed..977082ef15 100644 --- a/include/xrpl/shamap/SHAMapLeafNode.h +++ b/include/xrpl/shamap/SHAMapLeafNode.h @@ -68,7 +68,7 @@ public: * * @param node a node known to be a leaf (see SHAMapTreeNode::isLeaf). */ -inline uint256 const& +inline UInt256 const& leafKey(SHAMapTreeNode const& node) { XRPL_ASSERT(node.isLeaf(), "xrpl::leafKey : node is a leaf"); diff --git a/include/xrpl/shamap/SHAMapMissingNode.h b/include/xrpl/shamap/SHAMapMissingNode.h index 3168d0eff1..8f211d8347 100644 --- a/include/xrpl/shamap/SHAMapMissingNode.h +++ b/include/xrpl/shamap/SHAMapMissingNode.h @@ -40,7 +40,7 @@ public: { } - SHAMapMissingNode(SHAMapType t, uint256 const& id) + SHAMapMissingNode(SHAMapType t, UInt256 const& id) : std::runtime_error("Missing Node: " + to_string(t) + ": id " + to_string(id)) { } diff --git a/include/xrpl/shamap/SHAMapNodeID.h b/include/xrpl/shamap/SHAMapNodeID.h index f35ba2d2a7..f5c00a8710 100644 --- a/include/xrpl/shamap/SHAMapNodeID.h +++ b/include/xrpl/shamap/SHAMapNodeID.h @@ -19,13 +19,13 @@ namespace xrpl { class SHAMapNodeID : public CountedObject { private: - uint256 id_; + UInt256 id_; unsigned int depth_ = 0; public: SHAMapNodeID() = default; SHAMapNodeID(SHAMapNodeID const& other) = default; - SHAMapNodeID(unsigned int depth, uint256 const& hash); + SHAMapNodeID(unsigned int depth, UInt256 const& hash); SHAMapNodeID& operator=(SHAMapNodeID const& other) = default; @@ -46,7 +46,7 @@ public: return depth_; } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getNodeID() const { return id_; @@ -67,7 +67,7 @@ public: * @return whether this node ID is a prefix of the leaf key */ [[nodiscard]] bool - isPrefixOf(uint256 const& key) const; + isPrefixOf(UInt256 const& key) const; /** * Create a SHAMapNodeID of a node with the depth of the node and @@ -78,7 +78,7 @@ public: * @return SHAMapNodeID of the node */ static SHAMapNodeID - createID(unsigned int depth, uint256 const& key); + createID(unsigned int depth, UInt256 const& key); /** * Comparison operators @@ -147,6 +147,6 @@ deserializeSHAMapNodeID(std::string_view s) * Returns the branch that would contain the given hash */ [[nodiscard]] unsigned int -selectBranch(SHAMapNodeID const& id, uint256 const& hash); +selectBranch(SHAMapNodeID const& id, UInt256 const& hash); } // namespace xrpl diff --git a/include/xrpl/shamap/TreeNodeCache.h b/include/xrpl/shamap/TreeNodeCache.h index bff03a76e2..691d2130c2 100644 --- a/include/xrpl/shamap/TreeNodeCache.h +++ b/include/xrpl/shamap/TreeNodeCache.h @@ -8,7 +8,7 @@ namespace xrpl { using TreeNodeCache = TaggedCache< - uint256, + UInt256, SHAMapTreeNode, /*IsKeyCache*/ false, intr_ptr::SharedWeakUnionPtr, diff --git a/include/xrpl/tx/ApplyContext.h b/include/xrpl/tx/ApplyContext.h index 7be7f34b0b..29e0b073d5 100644 --- a/include/xrpl/tx/ApplyContext.h +++ b/include/xrpl/tx/ApplyContext.h @@ -30,7 +30,7 @@ public: explicit ApplyContext( ServiceRegistry& registry, OpenView& base, - std::optional const& parentBatchId, + std::optional const& parentBatchId, STTx const& tx, TER preclaimResult, XRPAmount baseFee, @@ -118,10 +118,10 @@ public: void visit( std::function const& func); + SLE::ConstRef before, + SLE::ConstRef after)> const& func); void destroyXRP(XRPAmount const& fee) @@ -153,7 +153,7 @@ private: std::optional view_; // The ID of the batch transaction we are executing under, if set. - std::optional parentBatchId_; + std::optional parentBatchId_; }; } // namespace xrpl diff --git a/include/xrpl/tx/SignerEntries.h b/include/xrpl/tx/SignerEntries.h index c8481f6062..47479b93ab 100644 --- a/include/xrpl/tx/SignerEntries.h +++ b/include/xrpl/tx/SignerEntries.h @@ -33,12 +33,12 @@ public: { AccountID account; std::uint16_t weight; - std::optional tag; + std::optional tag; SignerEntry( AccountID const& inAccount, std::uint16_t inWeight, - std::optional inTag) + std::optional inTag) : account(inAccount), weight(inWeight), tag(inTag) { } diff --git a/include/xrpl/tx/Transactor.h b/include/xrpl/tx/Transactor.h index 1a983ce27a..c060836eec 100644 --- a/include/xrpl/tx/Transactor.h +++ b/include/xrpl/tx/Transactor.h @@ -42,13 +42,13 @@ public: STTx const& tx; Rules const rules; ApplyFlags flags; - std::optional parentBatchId; + std::optional parentBatchId; beast::Journal const j; PreflightContext( ServiceRegistry& registry, STTx const& tx, - uint256 parentBatchId, + UInt256 parentBatchId, Rules rules, ApplyFlags flags, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) @@ -96,7 +96,7 @@ public: TER preflightResult; ApplyFlags flags; STTx const& tx; - std::optional const parentBatchId; + std::optional const parentBatchId; beast::Journal const j; PreclaimContext( @@ -105,7 +105,7 @@ public: TER preflightResult, STTx const& tx, ApplyFlags flags, - std::optional parentBatchId, + std::optional parentBatchId, beast::Journal j = beast::Journal{beast::Journal::getNullSink()}) : registry(registry) , view(view) @@ -379,7 +379,7 @@ public: ticketDelete( ApplyView& view, AccountID const& account, - uint256 const& ticketIndex, + UInt256 const& ticketIndex, beast::Journal j); protected: @@ -412,7 +412,7 @@ protected: * to detect deletions. */ virtual void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) = 0; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) = 0; /** * Check transaction-specific post-conditions after all entries have @@ -460,7 +460,7 @@ protected: checkSign( ReadView const& view, ApplyFlags flags, - std::optional const& parentBatchId, + std::optional const& parentBatchId, AccountID const& idAccount, STObject const& sigObject, beast::Journal const j, @@ -548,7 +548,7 @@ private: std::tuple processPersistentChanges(TER result, XRPAmount fee); - void trapTransaction(uint256) const; + void trapTransaction(UInt256) const; /** * Performs early sanity checks on the account and fee fields. @@ -590,7 +590,7 @@ private: * ordering is enforced. */ void - visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) final + visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) final { visitInvariantEntry(isDelete, before, after); } diff --git a/include/xrpl/tx/apply.h b/include/xrpl/tx/apply.h index 8c11d870f1..958301171d 100644 --- a/include/xrpl/tx/apply.h +++ b/include/xrpl/tx/apply.h @@ -64,7 +64,7 @@ checkValidity(HashRouter& router, STTx const& tx, Rules const& rules); * @see checkValidity, Validity */ void -forceValidity(HashRouter& router, uint256 const& txid, Validity validity); +forceValidity(HashRouter& router, UInt256 const& txid, Validity validity); /** * Apply a transaction to an `OpenView`. diff --git a/include/xrpl/tx/applySteps.h b/include/xrpl/tx/applySteps.h index f4137f29d3..f057c98ec8 100644 --- a/include/xrpl/tx/applySteps.h +++ b/include/xrpl/tx/applySteps.h @@ -207,7 +207,7 @@ public: /** * From the input - the batch identifier, if part of a batch */ - std::optional const parentBatchId; + std::optional const parentBatchId; /** * From the input - the rules */ @@ -274,7 +274,7 @@ public: /** * From the input - the batch identifier, if part of a batch */ - std::optional const parentBatchId; + std::optional const parentBatchId; /** * From the input - the flags */ @@ -348,7 +348,7 @@ PreflightResult preflight( ServiceRegistry& registry, Rules const& rules, - uint256 const& parentBatchId, + UInt256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j); diff --git a/include/xrpl/tx/invariants/AMMInvariant.h b/include/xrpl/tx/invariants/AMMInvariant.h index 29d962fb79..613e833dc0 100644 --- a/include/xrpl/tx/invariants/AMMInvariant.h +++ b/include/xrpl/tx/invariants/AMMInvariant.h @@ -27,7 +27,7 @@ public: ValidAMM() = default; void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/invariants/DirectoryInvariant.h b/include/xrpl/tx/invariants/DirectoryInvariant.h index d18ac539cc..7d23ded409 100644 --- a/include/xrpl/tx/invariants/DirectoryInvariant.h +++ b/include/xrpl/tx/invariants/DirectoryInvariant.h @@ -16,7 +16,7 @@ namespace xrpl { class ValidBookDirectory { bool badBookDirectory_ = false; - hash_set rootIndexes_; + HashSet rootIndexes_; public: void diff --git a/include/xrpl/tx/invariants/FreezeInvariant.h b/include/xrpl/tx/invariants/FreezeInvariant.h index 301e464daf..e089832c44 100644 --- a/include/xrpl/tx/invariants/FreezeInvariant.h +++ b/include/xrpl/tx/invariants/FreezeInvariant.h @@ -44,30 +44,30 @@ class TransfersNotFrozen public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); private: bool - isValidEntry(SLE::const_ref before, SLE::const_ref after); + isValidEntry(SLE::ConstRef before, SLE::ConstRef after); static STAmount - calculateBalanceChange(SLE::const_ref before, SLE::const_ref after, bool isDelete); + calculateBalanceChange(SLE::ConstRef before, SLE::ConstRef after, bool isDelete); void recordBalance(Issue const& issue, BalanceChange change); void - recordBalanceChanges(SLE::const_ref after, STAmount const& balanceChange); + recordBalanceChanges(SLE::ConstRef after, STAmount const& balanceChange); SLE::const_pointer findIssuer(AccountID const& issuerID, ReadView const& view); static bool validateIssuerChanges( - SLE::const_ref issuer, + SLE::ConstRef issuer, IssuerChanges const& changes, STTx const& tx, beast::Journal const& j, diff --git a/include/xrpl/tx/invariants/InvariantCheck.h b/include/xrpl/tx/invariants/InvariantCheck.h index e8dafbd301..ceb778d8e6 100644 --- a/include/xrpl/tx/invariants/InvariantCheck.h +++ b/include/xrpl/tx/invariants/InvariantCheck.h @@ -85,7 +85,7 @@ public: * preferred for new invariants. */ void - visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after); + visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after); /** * @brief called after all ledger entries have been visited to determine @@ -123,7 +123,7 @@ class TransactionFeeCheck { public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); static bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); @@ -143,7 +143,7 @@ class XRPNotCreated public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -163,7 +163,7 @@ class AccountRootsNotDeleted public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -190,7 +190,7 @@ class AccountRootsDeletedClean public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); @@ -209,7 +209,7 @@ class XRPBalanceChecks public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -226,7 +226,7 @@ class LedgerEntryTypesMatch public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -244,7 +244,7 @@ class NoXRPTrustLines public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -263,7 +263,7 @@ class NoDeepFreezeTrustLinesWithoutFreeze public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -282,7 +282,7 @@ class NoBadOffers public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -298,7 +298,7 @@ class NoZeroEscrow public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -318,7 +318,7 @@ class ValidNewAccountRoot public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -348,7 +348,7 @@ class ValidClawback public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -368,7 +368,7 @@ class ValidPseudoAccounts public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); @@ -388,7 +388,7 @@ class NoModifiedUnmodifiableFields public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); @@ -404,7 +404,7 @@ class ValidAmounts public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -421,7 +421,7 @@ class ObjectHasPseudoAccount { public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; diff --git a/include/xrpl/tx/invariants/InvariantRunner.h b/include/xrpl/tx/invariants/InvariantRunner.h index 29a9dc09b2..111e216f39 100644 --- a/include/xrpl/tx/invariants/InvariantRunner.h +++ b/include/xrpl/tx/invariants/InvariantRunner.h @@ -75,7 +75,7 @@ public: * never null. */ virtual void - visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) = 0; + visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) = 0; /** * @brief Called after all entries have been visited. diff --git a/include/xrpl/tx/invariants/LoanBrokerInvariant.h b/include/xrpl/tx/invariants/LoanBrokerInvariant.h index 2b8713fb90..21915d16e0 100644 --- a/include/xrpl/tx/invariants/LoanBrokerInvariant.h +++ b/include/xrpl/tx/invariants/LoanBrokerInvariant.h @@ -40,7 +40,7 @@ class ValidLoanBroker // Collect all the LoanBrokers found directly or indirectly through // pseudo-accounts. Key is the brokerID / index. It will be used to find the // LoanBroker object if brokerBefore and brokerAfter are nullptr - std::map brokers_; + std::map brokers_; // The broker whose ledger entry was deleted by this transaction, if any. // Only ttLOAN_BROKER_DELETE removes a broker, and it removes exactly one. // This is the pre-transaction state, which is what LoanBrokerDelete::preclaim @@ -58,11 +58,11 @@ class ValidLoanBroker std::vector mpts_; static bool - goodZeroDirectory(ReadView const& view, SLE::const_ref dir, beast::Journal const& j); + goodZeroDirectory(ReadView const& view, SLE::ConstRef dir, beast::Journal const& j); public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/invariants/LoanInvariant.h b/include/xrpl/tx/invariants/LoanInvariant.h index 8cbdefc911..904cc500ea 100644 --- a/include/xrpl/tx/invariants/LoanInvariant.h +++ b/include/xrpl/tx/invariants/LoanInvariant.h @@ -57,7 +57,7 @@ class ValidLoan public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/invariants/MPTInvariant.h b/include/xrpl/tx/invariants/MPTInvariant.h index ddda348d2e..f5f91d5616 100644 --- a/include/xrpl/tx/invariants/MPTInvariant.h +++ b/include/xrpl/tx/invariants/MPTInvariant.h @@ -59,7 +59,7 @@ public: * @param after The ledger entry after transaction application. */ void - visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after); + visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after); /** * @brief Verify MPT issuance invariants after transaction application. @@ -100,7 +100,7 @@ class ValidMPTBalanceChanges // true if OutstandingAmount > MaximumAmount in after for any MPT bool overflow_{false}; // mptid:MPTData - hash_map data_; + HashMap data_; public: /** @@ -111,7 +111,7 @@ public: * @param after The ledger entry after transaction application. */ void - visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after); + visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after); /** * @brief Verify public MPT payment accounting invariants. @@ -167,7 +167,7 @@ class ValidConfidentialMPToken bool changesConfidentialFields = false; bool badVersion = false; }; - std::map changes_; + std::map changes_; public: /** @@ -211,17 +211,17 @@ class ValidMPTTransfer std::optional amtAfter; }; // MPTID: {holder: Value} - hash_map> amount_; + HashMap> amount_; // Deleted MPToken // MPToken key: true if MPTAuthorized is set - hash_map deletedAuthorized_; + HashMap deletedAuthorized_; // Every touched AccountRoot (not only pseudos): // AccountID -> whether it was a pseudo-account BEFORE this transaction // applied. Needed because a transaction may erase a pseudo-account and // move MPT out of it in the same transaction; by finalize() time the // view no longer shows it as a pseudo-account (or as existing at all). // False entries freeze the pre-tx classification for touched non-pseudos. - hash_map pseudoAccountsBefore_; + HashMap pseudoAccountsBefore_; public: /** diff --git a/include/xrpl/tx/invariants/NFTInvariant.h b/include/xrpl/tx/invariants/NFTInvariant.h index 11bdf5a569..346f2d5aa3 100644 --- a/include/xrpl/tx/invariants/NFTInvariant.h +++ b/include/xrpl/tx/invariants/NFTInvariant.h @@ -34,7 +34,7 @@ class ValidNFTokenPage public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -62,7 +62,7 @@ class NFTokenCountTracking public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; diff --git a/include/xrpl/tx/invariants/PermissionedDEXInvariant.h b/include/xrpl/tx/invariants/PermissionedDEXInvariant.h index ae0d573385..df5ee7afa0 100644 --- a/include/xrpl/tx/invariants/PermissionedDEXInvariant.h +++ b/include/xrpl/tx/invariants/PermissionedDEXInvariant.h @@ -17,12 +17,12 @@ class ValidPermissionedDEX bool regularOffers_ = false; // post-fixCleanup3_2_0: excludes deleted offers bool badHybridsOld_ = false; // pre-fixCleanup3_1_3: missing field/domain or size > 1 bool badHybrids_ = false; // post-fixCleanup3_1_3: also catches size == 0 (size != 1) - hash_set domainsOld_; // pre-fixCleanup3_4_0: also flags deleted domains - hash_set domains_; // post-fixCleanup3_4_0: excludes deleted domains + HashSet domainsOld_; // pre-fixCleanup3_4_0: also flags deleted domains + HashSet domains_; // post-fixCleanup3_4_0: excludes deleted domains public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/invariants/PermissionedDomainInvariant.h b/include/xrpl/tx/invariants/PermissionedDomainInvariant.h index fae7c24d25..fef0d89efb 100644 --- a/include/xrpl/tx/invariants/PermissionedDomainInvariant.h +++ b/include/xrpl/tx/invariants/PermissionedDomainInvariant.h @@ -35,7 +35,7 @@ class ValidPermissionedDomain public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/invariants/SponsorshipInvariant.h b/include/xrpl/tx/invariants/SponsorshipInvariant.h index e664685c16..757a67a35b 100644 --- a/include/xrpl/tx/invariants/SponsorshipInvariant.h +++ b/include/xrpl/tx/invariants/SponsorshipInvariant.h @@ -31,7 +31,7 @@ class SponsorshipOwnerCountsMatch public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; @@ -52,7 +52,7 @@ class SponsorshipAccountCountMatchesField public: void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); [[nodiscard]] bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&) const; diff --git a/include/xrpl/tx/invariants/VaultInvariant.h b/include/xrpl/tx/invariants/VaultInvariant.h index ee52f4edb3..a9974dcb61 100644 --- a/include/xrpl/tx/invariants/VaultInvariant.h +++ b/include/xrpl/tx/invariants/VaultInvariant.h @@ -59,11 +59,11 @@ class ValidVault struct Vault final { - uint256 key = beast::kZero; + UInt256 key = beast::kZero; Asset asset; AccountID pseudoId; AccountID owner; - uint192 shareMPTID = beast::kZero; + UInt192 shareMPTID = beast::kZero; Number assetsTotal = 0; Number assetsAvailable = 0; Number assetsMaximum = 0; @@ -100,7 +100,7 @@ private: std::vector afterMPTs_; std::vector beforeVault_; std::vector beforeMPTs_; - std::unordered_map deltas_; + std::unordered_map deltas_; /** * @brief Compute the minimum STAmount scale for rounding invariant @@ -223,7 +223,7 @@ public: computeCoarsestScale(std::vector const& numbers); void - visitEntry(bool, SLE::const_ref, SLE::const_ref); + visitEntry(bool, SLE::ConstRef, SLE::ConstRef); bool finalize(STTx const&, TER const, XRPAmount const, ReadView const&, beast::Journal const&); diff --git a/include/xrpl/tx/paths/AMMOffer.h b/include/xrpl/tx/paths/AMMOffer.h index 8e7ffedc10..6ce1dd6088 100644 --- a/include/xrpl/tx/paths/AMMOffer.h +++ b/include/xrpl/tx/paths/AMMOffer.h @@ -70,7 +70,7 @@ public: [[nodiscard]] AccountID const& owner() const; - [[nodiscard]] std::optional + [[nodiscard]] std::optional key() const { return std::nullopt; diff --git a/include/xrpl/tx/paths/BookTip.h b/include/xrpl/tx/paths/BookTip.h index 0a7e3c343e..2cad1cfe04 100644 --- a/include/xrpl/tx/paths/BookTip.h +++ b/include/xrpl/tx/paths/BookTip.h @@ -21,10 +21,10 @@ class BookTip private: ApplyView& view_; bool valid_{false}; - uint256 book_; - uint256 end_; - uint256 dir_; - uint256 index_; + UInt256 book_; + UInt256 end_; + UInt256 dir_; + UInt256 index_; SLE::pointer entry_; Quality quality_{}; @@ -34,13 +34,13 @@ public: */ BookTip(ApplyView& view, Book const& book); - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& dir() const noexcept { return dir_; } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& index() const noexcept { return index_; diff --git a/include/xrpl/tx/paths/Flow.h b/include/xrpl/tx/paths/Flow.h index af056ce2fe..2078b0d1b0 100644 --- a/include/xrpl/tx/paths/Flow.h +++ b/include/xrpl/tx/paths/Flow.h @@ -50,7 +50,7 @@ flow( OfferCrossing offerCrossing, std::optional const& limitQuality, std::optional const& sendMax, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j, path::detail::FlowDebugInfo* flowDebugInfo = nullptr); diff --git a/include/xrpl/tx/paths/Offer.h b/include/xrpl/tx/paths/Offer.h index 7f368fc2dd..c01b176022 100644 --- a/include/xrpl/tx/paths/Offer.h +++ b/include/xrpl/tx/paths/Offer.h @@ -115,7 +115,7 @@ public: return to_string(entry_->key()); } - [[nodiscard]] std::optional + [[nodiscard]] std::optional key() const { return entry_->key(); diff --git a/include/xrpl/tx/paths/OfferStream.h b/include/xrpl/tx/paths/OfferStream.h index 28eefb5d66..650113bae0 100644 --- a/include/xrpl/tx/paths/OfferStream.h +++ b/include/xrpl/tx/paths/OfferStream.h @@ -67,7 +67,7 @@ protected: erase(ApplyView& view); virtual void - permRmOffer(uint256 const& offerIndex) = 0; + permRmOffer(UInt256 const& offerIndex) = 0; template requires ValidTaker @@ -138,7 +138,7 @@ template class FlowOfferStream : public TOfferStreamBase { private: - boost::container::flat_set permToRemove_; + boost::container::flat_set permToRemove_; public: using TOfferStreamBase::TOfferStreamBase; @@ -148,9 +148,9 @@ public: // unintuitive. See the discussion in the comments for // BookOfferCrossingStep::limitSelfCrossQuality(). void - permRmOffer(uint256 const& offerIndex) override; + permRmOffer(UInt256 const& offerIndex) override; - [[nodiscard]] boost::container::flat_set const& + [[nodiscard]] boost::container::flat_set const& permToRemove() const { return permToRemove_; diff --git a/include/xrpl/tx/paths/RippleCalc.h b/include/xrpl/tx/paths/RippleCalc.h index c3ee9165a6..e53ea9740b 100644 --- a/include/xrpl/tx/paths/RippleCalc.h +++ b/include/xrpl/tx/paths/RippleCalc.h @@ -53,7 +53,7 @@ public: // fails, they are not removed. This vector contains the offers that // could have been removed but were not because the payment fails. It is // useful for offer crossing, which does remove the offers. - boost::container::flat_set removableOffers; + boost::container::flat_set removableOffers; private: TER calculationResult_ = temUNKNOWN; @@ -97,7 +97,7 @@ public: // explore for liquidity. STPathSet const& spsPaths, - std::optional const& domainID, + std::optional const& domainID, ServiceRegistry& registry, Input const* const pInputs = nullptr); @@ -108,7 +108,7 @@ public: // unfunded offers in a deterministic order (hence the ordered container). // // Offers that were found unfunded. - boost::container::flat_set permanentlyUnfundedOffers; + boost::container::flat_set permanentlyUnfundedOffers; }; } // namespace path diff --git a/include/xrpl/tx/paths/detail/FlowDebugInfo.h b/include/xrpl/tx/paths/detail/FlowDebugInfo.h index 48066840f5..fe9026a98a 100644 --- a/include/xrpl/tx/paths/detail/FlowDebugInfo.h +++ b/include/xrpl/tx/paths/detail/FlowDebugInfo.h @@ -22,8 +22,8 @@ namespace xrpl::path::detail { // Track performance information of a single payment struct FlowDebugInfo { - using clock = std::chrono::high_resolution_clock; - using time_point = clock::time_point; + using Clock = std::chrono::high_resolution_clock; + using time_point = Clock::time_point; boost::container::flat_map> timePoints; boost::container::flat_map counts; @@ -135,12 +135,12 @@ struct FlowDebugInfo FlowDebugInfo* info; Stopper(std::string name, FlowDebugInfo& pi) : tag(std::move(name)), info(&pi) { - auto const start = FlowDebugInfo::clock::now(); + auto const start = FlowDebugInfo::Clock::now(); info->timePoints.emplace(tag, std::make_pair(start, start)); } ~Stopper() { - auto const end = FlowDebugInfo::clock::now(); + auto const end = FlowDebugInfo::Clock::now(); info->timePoints[tag].second = end; } Stopper(Stopper&&) = default; diff --git a/include/xrpl/tx/paths/detail/Steps.h b/include/xrpl/tx/paths/detail/Steps.h index 1d68860adc..8c6dea35f9 100644 --- a/include/xrpl/tx/paths/detail/Steps.h +++ b/include/xrpl/tx/paths/detail/Steps.h @@ -96,7 +96,7 @@ public: virtual std::pair rev(PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, EitherAmount const& out) = 0; /** @@ -114,7 +114,7 @@ public: virtual std::pair fwd(PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, EitherAmount const& in) = 0; /** @@ -389,7 +389,7 @@ toStrand( bool ownerPaysTransferFee, OfferCrossing offerCrossing, AMMContext& ammContext, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j); /** @@ -431,7 +431,7 @@ toStrands( bool ownerPaysTransferFee, OfferCrossing offerCrossing, AMMContext& ammContext, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j); /** @cond INTERNAL */ @@ -445,7 +445,7 @@ public: std::pair rev(PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, EitherAmount const& out) override { auto const r = static_cast(this)->revImp(sb, afView, ofrsToRm, get(out)); @@ -457,7 +457,7 @@ public: std::pair fwd(PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, EitherAmount const& in) override { auto const r = static_cast(this)->fwdImp(sb, afView, ofrsToRm, get(in)); @@ -552,7 +552,7 @@ struct StrandContext */ boost::container::flat_set& seenBookOuts; AMMContext& ammContext; - std::optional domainID; // the domain the order book will use + std::optional domainID; // the domain the order book will use beast::Journal const j; /** @@ -575,7 +575,7 @@ struct StrandContext seenDirectAssets, ///< For detecting currency loops boost::container::flat_set& seenBookOuts, ///< For detecting book loops AMMContext& ammContext, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j); ///< Journal for logging }; diff --git a/include/xrpl/tx/paths/detail/StrandFlow.h b/include/xrpl/tx/paths/detail/StrandFlow.h index fcca97ecfc..9dfe28b26d 100644 --- a/include/xrpl/tx/paths/detail/StrandFlow.h +++ b/include/xrpl/tx/paths/detail/StrandFlow.h @@ -50,7 +50,7 @@ struct StrandResult TInAmt in = beast::kZero; ///< Currency amount in TOutAmt out = beast::kZero; ///< Currency amount out std::optional sandbox; ///< Resulting Sandbox state - boost::container::flat_set ofrsToRm; ///< Offers to remove + boost::container::flat_set ofrsToRm; ///< Offers to remove // Num offers consumed or partially consumed (includes expired and unfunded // offers) std::uint32_t ofrsUsed = 0; @@ -69,7 +69,7 @@ struct StrandResult TInAmt const& in, TOutAmt const& out, PaymentSandbox&& sandbox, - boost::container::flat_set ofrsToRemoveMember, + boost::container::flat_set ofrsToRemoveMember, bool inactive) : success(true) , in(in) @@ -81,7 +81,7 @@ struct StrandResult { } - StrandResult(Strand const& strand, boost::container::flat_set ofrsToRemoveMember) + StrandResult(Strand const& strand, boost::container::flat_set ofrsToRemoveMember) : ofrsToRm(std::move(ofrsToRemoveMember)), ofrsUsed(offersUsed(strand)) { } @@ -114,7 +114,7 @@ flow( return {}; } - boost::container::flat_set ofrsToRm; + boost::container::flat_set ofrsToRm; if (isDirectXrpToXrp(strand)) { @@ -308,7 +308,7 @@ struct FlowResult TInAmt in = beast::kZero; TOutAmt out = beast::kZero; std::optional sandbox; - boost::container::flat_set removableOffers; + boost::container::flat_set removableOffers; TER ter = temUNKNOWN; FlowResult() = default; @@ -317,7 +317,7 @@ struct FlowResult TInAmt const& in, TOutAmt const& out, PaymentSandbox&& sandbox, - boost::container::flat_set ofrsToRm) + boost::container::flat_set ofrsToRm) : in(in) , out(out) , sandbox(std::move(sandbox)) @@ -326,7 +326,7 @@ struct FlowResult { } - FlowResult(TER ter, boost::container::flat_set ofrsToRm) + FlowResult(TER ter, boost::container::flat_set ofrsToRm) : removableOffers(std::move(ofrsToRm)), ter(ter) { } @@ -335,7 +335,7 @@ struct FlowResult TER ter, TInAmt const& in, TOutAmt const& out, - boost::container::flat_set ofrsToRm) + boost::container::flat_set ofrsToRm) : in(in), out(out), removableOffers(std::move(ofrsToRm)), ter(ter) { } @@ -655,7 +655,7 @@ flow( // These offers only need to be removed if the payment is not // successful - boost::container::flat_set ofrsToRmOnFail; + boost::container::flat_set ofrsToRmOnFail; while (remainingOut > beast::kZero && (!remainingIn || *remainingIn > beast::kZero)) { @@ -680,7 +680,7 @@ flow( }(); auto const adjustedRemOut = limitRemainingOut != remainingOut; - boost::container::flat_set ofrsToRm; + boost::container::flat_set ofrsToRm; std::optional best; if (flowDebugInfo) flowDebugInfo->newLiquidityPass(); diff --git a/include/xrpl/tx/transactors/account/AccountDelete.h b/include/xrpl/tx/transactors/account/AccountDelete.h index e69d948bb8..67cd6d8fad 100644 --- a/include/xrpl/tx/transactors/account/AccountDelete.h +++ b/include/xrpl/tx/transactors/account/AccountDelete.h @@ -36,7 +36,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/account/AccountSet.h b/include/xrpl/tx/transactors/account/AccountSet.h index 4326621f3d..b38b44e6b4 100644 --- a/include/xrpl/tx/transactors/account/AccountSet.h +++ b/include/xrpl/tx/transactors/account/AccountSet.h @@ -38,7 +38,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/account/SetRegularKey.h b/include/xrpl/tx/transactors/account/SetRegularKey.h index 90e4cd96cd..a951f0d06c 100644 --- a/include/xrpl/tx/transactors/account/SetRegularKey.h +++ b/include/xrpl/tx/transactors/account/SetRegularKey.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/account/SignerListSet.h b/include/xrpl/tx/transactors/account/SignerListSet.h index 9f7872a18e..63b275174d 100644 --- a/include/xrpl/tx/transactors/account/SignerListSet.h +++ b/include/xrpl/tx/transactors/account/SignerListSet.h @@ -51,7 +51,7 @@ public: preCompute() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/bridge/XChainBridge.h b/include/xrpl/tx/transactors/bridge/XChainBridge.h index 24f49eb340..bcee1d297a 100644 --- a/include/xrpl/tx/transactors/bridge/XChainBridge.h +++ b/include/xrpl/tx/transactors/bridge/XChainBridge.h @@ -37,7 +37,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -70,7 +70,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -114,7 +114,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -152,7 +152,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -192,7 +192,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -232,7 +232,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -263,7 +263,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -318,7 +318,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/check/CheckCancel.h b/include/xrpl/tx/transactors/check/CheckCancel.h index b54d1e6c84..2691d2d3f7 100644 --- a/include/xrpl/tx/transactors/check/CheckCancel.h +++ b/include/xrpl/tx/transactors/check/CheckCancel.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/check/CheckCash.h b/include/xrpl/tx/transactors/check/CheckCash.h index 4656f941f4..d4ad3d8f72 100644 --- a/include/xrpl/tx/transactors/check/CheckCash.h +++ b/include/xrpl/tx/transactors/check/CheckCash.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/check/CheckCreate.h b/include/xrpl/tx/transactors/check/CheckCreate.h index 50a1f076e0..cce14bb2b1 100644 --- a/include/xrpl/tx/transactors/check/CheckCreate.h +++ b/include/xrpl/tx/transactors/check/CheckCreate.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/credentials/CredentialAccept.h b/include/xrpl/tx/transactors/credentials/CredentialAccept.h index b9dfa684e7..afd9132be6 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialAccept.h +++ b/include/xrpl/tx/transactors/credentials/CredentialAccept.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/credentials/CredentialCreate.h b/include/xrpl/tx/transactors/credentials/CredentialCreate.h index ce9f9305be..952315e6cc 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialCreate.h +++ b/include/xrpl/tx/transactors/credentials/CredentialCreate.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/credentials/CredentialDelete.h b/include/xrpl/tx/transactors/credentials/CredentialDelete.h index 2f151a9fa0..5439bf5ecf 100644 --- a/include/xrpl/tx/transactors/credentials/CredentialDelete.h +++ b/include/xrpl/tx/transactors/credentials/CredentialDelete.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/delegate/DelegateSet.h b/include/xrpl/tx/transactors/delegate/DelegateSet.h index b7141276de..374bd2f6bf 100644 --- a/include/xrpl/tx/transactors/delegate/DelegateSet.h +++ b/include/xrpl/tx/transactors/delegate/DelegateSet.h @@ -31,7 +31,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -43,7 +43,7 @@ public: // Interface used by AccountDelete static TER - deleteDelegate(ApplyView& view, SLE::ref sle, beast::Journal j); + deleteDelegate(ApplyView& view, SLE::Ref sle, beast::Journal j); }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/dex/AMMBid.h b/include/xrpl/tx/transactors/dex/AMMBid.h index 9d8eb8578b..683c37e4e4 100644 --- a/include/xrpl/tx/transactors/dex/AMMBid.h +++ b/include/xrpl/tx/transactors/dex/AMMBid.h @@ -72,7 +72,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMClawback.h b/include/xrpl/tx/transactors/dex/AMMClawback.h index 3f3f2c421a..8d4b11f823 100644 --- a/include/xrpl/tx/transactors/dex/AMMClawback.h +++ b/include/xrpl/tx/transactors/dex/AMMClawback.h @@ -42,7 +42,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMCreate.h b/include/xrpl/tx/transactors/dex/AMMCreate.h index 5260cf31cd..a4d316eede 100644 --- a/include/xrpl/tx/transactors/dex/AMMCreate.h +++ b/include/xrpl/tx/transactors/dex/AMMCreate.h @@ -70,7 +70,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMDelete.h b/include/xrpl/tx/transactors/dex/AMMDelete.h index abf800c4d1..d0221a64a9 100644 --- a/include/xrpl/tx/transactors/dex/AMMDelete.h +++ b/include/xrpl/tx/transactors/dex/AMMDelete.h @@ -40,7 +40,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMDeposit.h b/include/xrpl/tx/transactors/dex/AMMDeposit.h index 2959f1b10a..7c05a7ffd6 100644 --- a/include/xrpl/tx/transactors/dex/AMMDeposit.h +++ b/include/xrpl/tx/transactors/dex/AMMDeposit.h @@ -79,7 +79,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMVote.h b/include/xrpl/tx/transactors/dex/AMMVote.h index 4d63a98534..47922b2dfe 100644 --- a/include/xrpl/tx/transactors/dex/AMMVote.h +++ b/include/xrpl/tx/transactors/dex/AMMVote.h @@ -57,7 +57,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/AMMWithdraw.h b/include/xrpl/tx/transactors/dex/AMMWithdraw.h index ea0ad3b253..8080c4926a 100644 --- a/include/xrpl/tx/transactors/dex/AMMWithdraw.h +++ b/include/xrpl/tx/transactors/dex/AMMWithdraw.h @@ -87,7 +87,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/OfferCancel.h b/include/xrpl/tx/transactors/dex/OfferCancel.h index 974478475c..72b49ebd37 100644 --- a/include/xrpl/tx/transactors/dex/OfferCancel.h +++ b/include/xrpl/tx/transactors/dex/OfferCancel.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/dex/OfferCreate.h b/include/xrpl/tx/transactors/dex/OfferCreate.h index 0ce34646dd..6ed668067f 100644 --- a/include/xrpl/tx/transactors/dex/OfferCreate.h +++ b/include/xrpl/tx/transactors/dex/OfferCreate.h @@ -71,7 +71,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -100,7 +100,7 @@ private: PaymentSandbox& psb, PaymentSandbox& psbCancel, Amounts const& takerAmount, - std::optional const& domainID); + std::optional const& domainID); static std::string formatAmount(STAmount const& amount); @@ -113,7 +113,7 @@ private: STAmount const& saTakerPays, STAmount const& saTakerGets, std::uint64_t openRate, - std::function)> const& setDir); + std::function)> const& setDir); }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/did/DIDDelete.h b/include/xrpl/tx/transactors/did/DIDDelete.h index c119b0348e..4d70e5cf01 100644 --- a/include/xrpl/tx/transactors/did/DIDDelete.h +++ b/include/xrpl/tx/transactors/did/DIDDelete.h @@ -36,7 +36,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/did/DIDSet.h b/include/xrpl/tx/transactors/did/DIDSet.h index 481222243b..fc4f8ba3c2 100644 --- a/include/xrpl/tx/transactors/did/DIDSet.h +++ b/include/xrpl/tx/transactors/did/DIDSet.h @@ -27,7 +27,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/escrow/EscrowCancel.h b/include/xrpl/tx/transactors/escrow/EscrowCancel.h index b52fb2a9fa..a374f2c45d 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowCancel.h +++ b/include/xrpl/tx/transactors/escrow/EscrowCancel.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/escrow/EscrowCreate.h b/include/xrpl/tx/transactors/escrow/EscrowCreate.h index b8e22aa24e..a89bd0eb76 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowCreate.h +++ b/include/xrpl/tx/transactors/escrow/EscrowCreate.h @@ -36,7 +36,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/escrow/EscrowFinish.h b/include/xrpl/tx/transactors/escrow/EscrowFinish.h index 07459bf959..0d571ca76f 100644 --- a/include/xrpl/tx/transactors/escrow/EscrowFinish.h +++ b/include/xrpl/tx/transactors/escrow/EscrowFinish.h @@ -39,7 +39,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h index cd72a01bc3..8cca3d6d4b 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverClawback.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h index 03ed295766..4346b02634 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverDeposit.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h b/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h index 1132211e58..bff185fe87 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h b/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h index 7a9a529510..1a8c01b748 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerDelete.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanBrokerSet.h b/include/xrpl/tx/transactors/lending/LoanBrokerSet.h index e7137c9311..6594054aa2 100644 --- a/include/xrpl/tx/transactors/lending/LoanBrokerSet.h +++ b/include/xrpl/tx/transactors/lending/LoanBrokerSet.h @@ -39,7 +39,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanDelete.h b/include/xrpl/tx/transactors/lending/LoanDelete.h index 604388a2bd..7ee70beb55 100644 --- a/include/xrpl/tx/transactors/lending/LoanDelete.h +++ b/include/xrpl/tx/transactors/lending/LoanDelete.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanManage.h b/include/xrpl/tx/transactors/lending/LoanManage.h index e641e03dd1..4d0567d805 100644 --- a/include/xrpl/tx/transactors/lending/LoanManage.h +++ b/include/xrpl/tx/transactors/lending/LoanManage.h @@ -42,9 +42,9 @@ public: static TER defaultLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref brokerSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref brokerSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j); @@ -54,8 +54,8 @@ public: static TER impairLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j); @@ -65,8 +65,8 @@ public: [[nodiscard]] static TER unimpairLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j); @@ -74,7 +74,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanPay.h b/include/xrpl/tx/transactors/lending/LoanPay.h index 599bea6ae6..20cfccef7d 100644 --- a/include/xrpl/tx/transactors/lending/LoanPay.h +++ b/include/xrpl/tx/transactors/lending/LoanPay.h @@ -41,7 +41,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/lending/LoanSet.h b/include/xrpl/tx/transactors/lending/LoanSet.h index fab489e3db..6e585a7bd4 100644 --- a/include/xrpl/tx/transactors/lending/LoanSet.h +++ b/include/xrpl/tx/transactors/lending/LoanSet.h @@ -50,7 +50,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h b/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h index 28037ae3b9..fc9c4b73a1 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenAcceptOffer.h @@ -21,13 +21,13 @@ private: pay(AccountID const& from, AccountID const& to, STAmount const& amount); TER - acceptOffer(SLE::ref offer); + acceptOffer(SLE::Ref offer); TER - bridgeOffers(SLE::ref buy, SLE::ref sell); + bridgeOffers(SLE::Ref buy, SLE::Ref sell); TER - transferNFToken(AccountID const& buyer, AccountID const& seller, uint256 const& nfTokenID); + transferNFToken(AccountID const& buyer, AccountID const& seller, UInt256 const& nfTokenID); public: static constexpr auto kConsequencesFactory = ConsequencesFactoryType::Normal; @@ -46,7 +46,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/nft/NFTokenBurn.h b/include/xrpl/tx/transactors/nft/NFTokenBurn.h index a9640e3a9e..c530b901c5 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenBurn.h +++ b/include/xrpl/tx/transactors/nft/NFTokenBurn.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h b/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h index 35c9067f63..1504788fb6 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenCancelOffer.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h b/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h index f11ac5c373..1ed4781546 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h +++ b/include/xrpl/tx/transactors/nft/NFTokenCreateOffer.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/nft/NFTokenMint.h b/include/xrpl/tx/transactors/nft/NFTokenMint.h index 9d5874fa60..13db2e697d 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenMint.h +++ b/include/xrpl/tx/transactors/nft/NFTokenMint.h @@ -41,7 +41,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -52,7 +52,7 @@ public: beast::Journal const& j) override; // Public to support unit tests. - static uint256 + static UInt256 createNFTokenID( std::uint16_t flags, std::uint16_t fee, diff --git a/include/xrpl/tx/transactors/nft/NFTokenModify.h b/include/xrpl/tx/transactors/nft/NFTokenModify.h index 970914bbfe..772d665375 100644 --- a/include/xrpl/tx/transactors/nft/NFTokenModify.h +++ b/include/xrpl/tx/transactors/nft/NFTokenModify.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/oracle/OracleDelete.h b/include/xrpl/tx/transactors/oracle/OracleDelete.h index d44065d7bb..abf8db212d 100644 --- a/include/xrpl/tx/transactors/oracle/OracleDelete.h +++ b/include/xrpl/tx/transactors/oracle/OracleDelete.h @@ -41,7 +41,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -52,7 +52,7 @@ public: beast::Journal const& j) override; static TER - deleteOracle(ApplyView& view, SLE::ref sle, AccountID const& account, beast::Journal j); + deleteOracle(ApplyView& view, SLE::Ref sle, AccountID const& account, beast::Journal j); }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/oracle/OracleSet.h b/include/xrpl/tx/transactors/oracle/OracleSet.h index b6aed3f4fc..12fdccfc60 100644 --- a/include/xrpl/tx/transactors/oracle/OracleSet.h +++ b/include/xrpl/tx/transactors/oracle/OracleSet.h @@ -39,7 +39,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/payment/DepositPreauth.h b/include/xrpl/tx/transactors/payment/DepositPreauth.h index b9b42ddac6..7484a7cfe3 100644 --- a/include/xrpl/tx/transactors/payment/DepositPreauth.h +++ b/include/xrpl/tx/transactors/payment/DepositPreauth.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -47,7 +47,7 @@ public: // Interface used by AccountDelete static TER - removeFromLedger(ApplyView& view, uint256 const& delIndex, beast::Journal j); + removeFromLedger(ApplyView& view, UInt256 const& delIndex, beast::Journal j); }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/payment/Payment.h b/include/xrpl/tx/transactors/payment/Payment.h index 1356a368e9..c5a0f55112 100644 --- a/include/xrpl/tx/transactors/payment/Payment.h +++ b/include/xrpl/tx/transactors/payment/Payment.h @@ -56,7 +56,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h index 85df2a02e7..317867aeb2 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelClaim.h @@ -38,7 +38,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h index f0c9da6349..4d4fa2d432 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelCreate.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h b/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h index 377fbe9cf2..c31ba59805 100644 --- a/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h +++ b/include/xrpl/tx/transactors/payment_channel/PaymentChannelFund.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h index 6bd68a0142..6eea5bbd4b 100644 --- a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h +++ b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h index cb5d341c50..ae90eb1549 100644 --- a/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h +++ b/include/xrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.h @@ -36,7 +36,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/proposal/TransactionProposalCreate.h b/include/xrpl/tx/transactors/proposal/TransactionProposalCreate.h index a8c36b5611..1219b20c05 100644 --- a/include/xrpl/tx/transactors/proposal/TransactionProposalCreate.h +++ b/include/xrpl/tx/transactors/proposal/TransactionProposalCreate.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/sponsor/SponsorshipSet.h b/include/xrpl/tx/transactors/sponsor/SponsorshipSet.h index 1100c5352a..1f437ef112 100644 --- a/include/xrpl/tx/transactors/sponsor/SponsorshipSet.h +++ b/include/xrpl/tx/transactors/sponsor/SponsorshipSet.h @@ -40,7 +40,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -56,8 +56,8 @@ private: Keylet const& sponsorshipKeylet, AccountID const& sponsorID, AccountID const& sponseeID, - SLE::ref sponsorAccSle, - SLE::ref reserveSponsorAccSle); + SLE::Ref sponsorAccSle, + SLE::Ref reserveSponsorAccSle); }; } // namespace xrpl diff --git a/include/xrpl/tx/transactors/sponsor/SponsorshipTransfer.h b/include/xrpl/tx/transactors/sponsor/SponsorshipTransfer.h index cf0022ab72..84dfa92ca6 100644 --- a/include/xrpl/tx/transactors/sponsor/SponsorshipTransfer.h +++ b/include/xrpl/tx/transactors/sponsor/SponsorshipTransfer.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/system/Batch.h b/include/xrpl/tx/transactors/system/Batch.h index ceaa42e8e0..cb04594560 100644 --- a/include/xrpl/tx/transactors/system/Batch.h +++ b/include/xrpl/tx/transactors/system/Batch.h @@ -47,7 +47,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/system/Change.h b/include/xrpl/tx/transactors/system/Change.h index b25208f075..f506cefd65 100644 --- a/include/xrpl/tx/transactors/system/Change.h +++ b/include/xrpl/tx/transactors/system/Change.h @@ -26,7 +26,7 @@ public: preCompute() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/system/LedgerStateFix.h b/include/xrpl/tx/transactors/system/LedgerStateFix.h index dd91f6f367..69600a5c38 100644 --- a/include/xrpl/tx/transactors/system/LedgerStateFix.h +++ b/include/xrpl/tx/transactors/system/LedgerStateFix.h @@ -40,7 +40,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/system/TicketCreate.h b/include/xrpl/tx/transactors/system/TicketCreate.h index f249fd7db2..f81a046d6e 100644 --- a/include/xrpl/tx/transactors/system/TicketCreate.h +++ b/include/xrpl/tx/transactors/system/TicketCreate.h @@ -76,7 +76,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/Clawback.h b/include/xrpl/tx/transactors/token/Clawback.h index 5eaa32fe48..d9eb0473bf 100644 --- a/include/xrpl/tx/transactors/token/Clawback.h +++ b/include/xrpl/tx/transactors/token/Clawback.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.h b/include/xrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.h index 12ad5c8f28..00278b26a7 100644 --- a/include/xrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.h +++ b/include/xrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.h @@ -84,7 +84,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/MPTokenAuthorize.h b/include/xrpl/tx/transactors/token/MPTokenAuthorize.h index b9fd48abe3..aa7bf0de03 100644 --- a/include/xrpl/tx/transactors/token/MPTokenAuthorize.h +++ b/include/xrpl/tx/transactors/token/MPTokenAuthorize.h @@ -47,7 +47,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h index 1aa853d6e2..97e5f57a0f 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceCreate.h @@ -31,7 +31,7 @@ struct MPTCreateArgs std::optional assetScale = std::nullopt; std::optional transferFee = std::nullopt; std::optional const& metadata{}; - std::optional domainId = std::nullopt; + std::optional domainId = std::nullopt; std::optional immutableFlags = std::nullopt; // Set only by callers that issue an MPT representing a wrapped asset // (e.g. VaultCreate's share token). The keylet must point to an @@ -39,7 +39,7 @@ struct MPTCreateArgs // the resulting MPTokenIssuance via the optional sfReferenceHolding // field. Used by readers (canTransfer, canTrade, freezing) to // inherit the underlying asset's transferability. - std::optional referenceHolding = std::nullopt; + std::optional referenceHolding = std::nullopt; }; // NOLINTEND(readability-redundant-member-init) @@ -65,7 +65,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h index 743e5a9502..535340290f 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceDestroy.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h b/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h index a2a966009d..db841e9217 100644 --- a/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h +++ b/include/xrpl/tx/transactors/token/MPTokenIssuanceSet.h @@ -72,7 +72,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/token/TrustSet.h b/include/xrpl/tx/transactors/token/TrustSet.h index fbf50f56ee..fb90e38b48 100644 --- a/include/xrpl/tx/transactors/token/TrustSet.h +++ b/include/xrpl/tx/transactors/token/TrustSet.h @@ -43,7 +43,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/vault/VaultClawback.h b/include/xrpl/tx/transactors/vault/VaultClawback.h index ba0eb9f320..dbdd5464b6 100644 --- a/include/xrpl/tx/transactors/vault/VaultClawback.h +++ b/include/xrpl/tx/transactors/vault/VaultClawback.h @@ -35,7 +35,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( @@ -48,8 +48,8 @@ public: private: std::expected, TER> assetsToClawback( - SLE::ref vault, - SLE::const_ref sleShareIssuance, + SLE::Ref vault, + SLE::ConstRef sleShareIssuance, AccountID const& holder, STAmount const& clawbackAmount); }; diff --git a/include/xrpl/tx/transactors/vault/VaultCreate.h b/include/xrpl/tx/transactors/vault/VaultCreate.h index f946a22c3a..102231a966 100644 --- a/include/xrpl/tx/transactors/vault/VaultCreate.h +++ b/include/xrpl/tx/transactors/vault/VaultCreate.h @@ -38,7 +38,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/vault/VaultDelete.h b/include/xrpl/tx/transactors/vault/VaultDelete.h index ca73b1a685..02addaf8af 100644 --- a/include/xrpl/tx/transactors/vault/VaultDelete.h +++ b/include/xrpl/tx/transactors/vault/VaultDelete.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/vault/VaultDeposit.h b/include/xrpl/tx/transactors/vault/VaultDeposit.h index d49f504243..e81419abd9 100644 --- a/include/xrpl/tx/transactors/vault/VaultDeposit.h +++ b/include/xrpl/tx/transactors/vault/VaultDeposit.h @@ -30,7 +30,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/vault/VaultSet.h b/include/xrpl/tx/transactors/vault/VaultSet.h index 835ed69610..b46321c7ee 100644 --- a/include/xrpl/tx/transactors/vault/VaultSet.h +++ b/include/xrpl/tx/transactors/vault/VaultSet.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/include/xrpl/tx/transactors/vault/VaultWithdraw.h b/include/xrpl/tx/transactors/vault/VaultWithdraw.h index b61af8b323..3d9e45d381 100644 --- a/include/xrpl/tx/transactors/vault/VaultWithdraw.h +++ b/include/xrpl/tx/transactors/vault/VaultWithdraw.h @@ -33,7 +33,7 @@ public: doApply() override; void - visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override; + visitInvariantEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) override; [[nodiscard]] bool finalizeInvariants( diff --git a/src/benchmarks/libxrpl/nodestore/Backend.cpp b/src/benchmarks/libxrpl/nodestore/Backend.cpp index 9d5937f869..82b413a44a 100644 --- a/src/benchmarks/libxrpl/nodestore/Backend.cpp +++ b/src/benchmarks/libxrpl/nodestore/Backend.cpp @@ -33,7 +33,7 @@ struct RunState std::unique_ptr harness; ///< backend under test, rebuilt per run Batch present; ///< prefix-1 objects, eligible to be stored Batch recent; ///< prefix-1 objects in the "future" key space - std::vector missing; ///< prefix-2 keys that are never stored + std::vector missing; ///< prefix-2 keys that are never stored std::vector shuffle; ///< [0, poolSize) permutation for random-like access std::size_t avgPayload = 0; ///< mean getData().size() over `present` @@ -43,7 +43,7 @@ struct RunState harness.reset(); present = Batch{}; recent = Batch{}; - missing = std::vector{}; + missing = std::vector{}; shuffle = std::vector{}; avgPayload = 0; } diff --git a/src/benchmarks/libxrpl/nodestore/Database.cpp b/src/benchmarks/libxrpl/nodestore/Database.cpp index cd4337b603..6344e0eec2 100644 --- a/src/benchmarks/libxrpl/nodestore/Database.cpp +++ b/src/benchmarks/libxrpl/nodestore/Database.cpp @@ -36,7 +36,7 @@ struct RunState std::unique_ptr harness; Batch present; // prefix-1 objects, eligible to be stored Batch recent; // prefix-1 objects in the "future" key space - std::vector missing; // prefix-2 keys that are never stored + std::vector missing; // prefix-2 keys that are never stored std::vector shuffle; // [0, poolSize) permutation for random-like access std::size_t avgPayload = 0; // mean getData().size() over `present` }; diff --git a/src/benchmarks/libxrpl/nodestore/NodeStoreBench.h b/src/benchmarks/libxrpl/nodestore/NodeStoreBench.h index a90207f26a..46fe6a6f59 100644 --- a/src/benchmarks/libxrpl/nodestore/NodeStoreBench.h +++ b/src/benchmarks/libxrpl/nodestore/NodeStoreBench.h @@ -67,7 +67,7 @@ private: static constexpr auto kMinSize = 250; static constexpr auto kMaxSize = 1250; - beast::xor_shift_engine gen_; + beast::XorShiftEngine gen_; std::uint8_t prefix_; std::discrete_distribution dType_; std::uniform_int_distribution dSize_; @@ -85,11 +85,11 @@ public: // Returns the n-th key. Used to generate keys that are never stored. // The layout mirrors obj()'s: prefix at byte 0, RNG over the rest, so the // two key spaces stay disjoint by construction (not by coincidence). - uint256 + UInt256 key(std::size_t n) { gen_.seed(n + 1); - uint256 result; + UInt256 result; auto const data = static_cast(&*result.begin()); *data = prefix_; rngcpy(data + 1, result.size() - 1, gen_); @@ -101,7 +101,7 @@ public: obj(std::size_t n) { gen_.seed(n + 1); - uint256 key; + UInt256 key; auto const data = static_cast(&*key.begin()); *data = prefix_; rngcpy(data + 1, key.size() - 1, gen_); @@ -148,11 +148,11 @@ makePool(std::uint8_t prefix, std::size_t count, std::size_t start = 0) // Pre-generate `count` keys disjoint from every `makePool(...)` object, for // measuring fetches that miss. -inline std::vector +inline std::vector makeMissingKeys(std::size_t count) { Sequence seq(2); - std::vector keys; + std::vector keys; keys.reserve(count); for (auto i = 0uz; i < count; ++i) keys.push_back(seq.key(i)); @@ -203,7 +203,7 @@ makeShuffle(std::size_t size, std::uint64_t seed) { std::vector v(size); std::ranges::iota(v, 0uz); - beast::xor_shift_engine gen(seed); + beast::XorShiftEngine gen(seed); std::ranges::shuffle(v, gen); return v; } diff --git a/src/libxrpl/basics/Archive.cpp b/src/libxrpl/basics/Archive.cpp index 5ab0d88c1d..fab3790713 100644 --- a/src/libxrpl/basics/Archive.cpp +++ b/src/libxrpl/basics/Archive.cpp @@ -18,8 +18,8 @@ extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst if (!std::filesystem::is_regular_file(src)) Throw("Invalid source file"); - using archive_ptr = std::unique_ptr; - archive_ptr const ar{archive_read_new(), [](struct archive* a) { archive_read_free(a); }}; + using ArchivePtr = std::unique_ptr; + ArchivePtr const ar{archive_read_new(), [](struct archive* a) { archive_read_free(a); }}; if (!ar) Throw("Failed to allocate archive"); @@ -35,8 +35,7 @@ extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst Throw(archive_error_string(ar.get())); } - archive_ptr const aw{ - archive_write_disk_new(), [](struct archive* a) { archive_write_free(a); }}; + ArchivePtr const aw{archive_write_disk_new(), [](struct archive* a) { archive_write_free(a); }}; if (!aw) Throw("Failed to allocate archive"); diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 0917627073..b4803de95e 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -19,11 +19,11 @@ #ifdef _MSC_VER #pragma message("Using boost::multiprecision::uint128_t and int128_t") #include -using uint128_t = boost::multiprecision::uint128_t; -using int128_t = boost::multiprecision::int128_t; +using UInt128T = boost::multiprecision::uint128_t; +using Int128T = boost::multiprecision::int128_t; #else // !defined(_MSC_VER) -using uint128_t = __uint128_t; -using int128_t = __int128_t; +using UInt128T = __uint128_t; +using Int128T = __int128_t; #endif // !defined(_MSC_VER) namespace xrpl { @@ -162,7 +162,7 @@ Number::setMantissaScale(MantissaRange::MantissaScale scale) // Derived from Hacker's Delight Second Edition Chapter 10 // by Henry S. Warren, Jr. static inline unsigned -divu10(uint128_t& u) +divu10(UInt128T& u) { // q = u * 0.75 auto q = (u >> 1) + (u >> 2); @@ -184,7 +184,7 @@ divu10(uint128_t& u) } template -concept UnsignedMantissa = std::is_unsigned_v || std::is_same_v; +concept UnsignedMantissa = std::is_unsigned_v || std::is_same_v; /** * Guard @@ -223,13 +223,13 @@ class Number::Guard std::uint8_t sbit_ : 1 {0}; // the sign of the guard digits public: - internalrep const minMantissa; - internalrep const maxMantissa; + InternalRep const minMantissa; + InternalRep const maxMantissa; MantissaRange::CuspRoundingFix const cuspRoundingFix; explicit Guard( - internalrep const& minMantissa, - internalrep const& maxMantissa, + InternalRep const& minMantissa, + InternalRep const& maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFix) : minMantissa(minMantissa), maxMantissa(maxMantissa), cuspRoundingFix(cuspRoundingFix) { @@ -414,7 +414,7 @@ Number::Guard::doDropDigit(T& mantissa, int& exponent) noexcept // Use the divu10 optimization for uint128s template <> void -Number::Guard::doDropDigit(uint128_t& mantissa, int& exponent) noexcept +Number::Guard::doDropDigit(UInt128T& mantissa, int& exponent) noexcept { // The following is optimization for: // push(static_cast(mantissa % 10)); @@ -698,7 +698,7 @@ Number::Guard::doRound(rep& drops, std::string location) const { if (drops >= kMaxRep) { - static_assert(sizeof(internalrep) == sizeof(rep)); + static_assert(sizeof(InternalRep) == sizeof(rep)); // This should be impossible, because it's impossible to represent // "kMaxRep + 0.6" in Number, regardless of the scale. There aren't // enough digits available. You'd either get a mantissa of "kMaxRep" @@ -721,7 +721,7 @@ Number::Guard::doRound(rep& drops, std::string location) const // negative, returns the positive value. This takes a little extra work because // converting std::numeric_limits::min() flirts with UB, and can // vary across compilers. -Number::internalrep +Number::InternalRep Number::externalToInternal(rep mantissa) { // If the mantissa is already positive, just return it @@ -736,8 +736,8 @@ Number::externalToInternal(rep mantissa) // int128_t, negate that, and cast it back down to the internalrep // In practice, this is only going to cover the case of // std::numeric_limits::min(). - int128_t const temp = mantissa; - return static_cast(-temp); + Int128T const temp = mantissa; + return static_cast(-temp); } Number @@ -834,12 +834,12 @@ doNormalize( template <> void -Number::normalize( +Number::normalize( bool& negative, - uint128_t& mantissa, + UInt128T& mantissa, int& exponent, - internalrep const& minMantissa, - internalrep const& maxMantissa, + InternalRep const& minMantissa, + InternalRep const& maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFix) { // Not used by every compiler version, and thus not necessarily @@ -855,8 +855,8 @@ Number::normalize( bool& negative, unsigned long long& mantissa, int& exponent, - internalrep const& minMantissa, - internalrep const& maxMantissa, + InternalRep const& minMantissa, + InternalRep const& maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFix) { // Not used by every compiler version, and thus not necessarily @@ -872,8 +872,8 @@ Number::normalize( bool& negative, unsigned long& mantissa, int& exponent, - internalrep const& minMantissa, - internalrep const& maxMantissa, + InternalRep const& minMantissa, + InternalRep const& maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFix) { doNormalize(negative, mantissa, exponent, minMantissa, maxMantissa, cuspRoundingFix, false); @@ -942,11 +942,11 @@ Number::operator+=(Number const& y) // Need to use uint128_t, because large mantissas can overflow when added // together. bool xn = negative_; - uint128_t xm = mantissa_; + UInt128T xm = mantissa_; auto xe = exponent_; bool const yn = y.negative_; - uint128_t ym = y.mantissa_; + UInt128T ym = y.mantissa_; auto ye = y.exponent_; Guard g(kRange); @@ -960,7 +960,7 @@ Number::operator+=(Number const& y) // Bring the exponents of both values into agreement, so the mantissas are on the same scale // and can be added directly together. - auto const upperLimit = static_cast(g.minMantissa) * 1000; + auto const upperLimit = static_cast(g.minMantissa) * 1000; // For the "adjust" lambda // expandM / expandE: The values for which the mantissa will be expanded, and the exponent // decreased to match. Mantissa won't be expanded beyond upperLimit. @@ -968,7 +968,7 @@ Number::operator+=(Number const& y) // shrinkM / shrinkE: The values for which the mantissa will be shrunk, and exponent increased // to match, if necessary. auto const adjust = [&g, &upperLimit]( - uint128_t& expandM, int& expandE, uint128_t& shrinkM, int& shrinkE) { + UInt128T& expandM, int& expandE, UInt128T& shrinkM, int& shrinkE) { XRPL_ASSERT(shrinkE < expandE, "xrpl::Number::operator+= : exponents ordered correctly"); // Adjust up and down until the exponents match if (g.cuspRoundingFix == MantissaRange::CuspRoundingFix::Enabled330) @@ -1122,7 +1122,7 @@ Number::operator+=(Number const& y) cuspRoundingFix, cuspRoundingFix == MantissaRange::CuspRoundingFix::Enabled330 && !g.empty()); negative_ = xn; - mantissa_ = static_cast(xm); + mantissa_ = static_cast(xm); exponent_ = xe; XRPL_ASSERT(isnormal(), "xrpl::Number::operator+= : result is normal"); return *this; @@ -1146,15 +1146,15 @@ Number::operator*=(Number const& y) bool const xn = negative_; int const xs = xn ? -1 : 1; - internalrep xm = mantissa_; + InternalRep xm = mantissa_; auto xe = exponent_; bool const yn = y.negative_; int const ys = yn ? -1 : 1; - internalrep const ym = y.mantissa_; + InternalRep const ym = y.mantissa_; auto ye = y.exponent_; - auto zm = uint128_t(xm) * uint128_t(ym); + auto zm = UInt128T(xm) * UInt128T(ym); auto ze = xe + ye; auto zs = xs * ys; bool zn = (zs == -1); @@ -1171,7 +1171,7 @@ Number::operator*=(Number const& y) g.doDropDigit(zm, ze); } - xm = static_cast(zm); + xm = static_cast(zm); xe = ze; g.doRoundUp(zn, xm, xe, "Number::multiplication overflow : exponent is " + std::to_string(xe)); negative_ = zn; @@ -1208,7 +1208,7 @@ Number::operator/=(Number const& y) int const ds = (dp ? -1 : 1); // Create the denominator as 128-bit unsigned, since that's what we // need to work with. - auto const dm = static_cast(y.mantissa_); + auto const dm = static_cast(y.mantissa_); auto const de = y.exponent_; auto const& range = kRange.get(); @@ -1275,9 +1275,9 @@ Number::operator/=(Number const& y) // Stage 1: Do the initial division with a factor of 10^17. auto constexpr factorExponent = 17; - uint128_t constexpr f = kPowerOfTen[factorExponent]; + UInt128T constexpr f = kPowerOfTen[factorExponent]; - auto const numerator = uint128_t(nm) * f; + auto const numerator = UInt128T(nm) * f; auto zm = numerator / dm; auto ze = ne - de - factorExponent; @@ -1317,7 +1317,7 @@ Number::operator/=(Number const& y) // If remainder is zero, we can skip this stage entirely because // the first stage gave an exact answer. auto constexpr correctionExponent = 5; - uint128_t constexpr correctionFactor = kPowerOfTen[correctionExponent]; + UInt128T constexpr correctionFactor = kPowerOfTen[correctionExponent]; static_assert(factorExponent + correctionExponent == 22); auto const remainder = (numerator % dm); @@ -1355,7 +1355,7 @@ Number::operator/=(Number const& y) } doNormalize(zp, zm, ze, minMantissa, maxMantissa, cuspRoundingFix, dropped); negative_ = zp; - mantissa_ = static_cast(zm); + mantissa_ = static_cast(zm); exponent_ = ze; XRPL_ASSERT_PARTS(isnormal(), "xrpl::Number::operator/=", "result is normalized"); diff --git a/src/libxrpl/beast/insight/Groups.cpp b/src/libxrpl/beast/insight/Groups.cpp index 6a60c75aa2..3f18f388fa 100644 --- a/src/libxrpl/beast/insight/Groups.cpp +++ b/src/libxrpl/beast/insight/Groups.cpp @@ -22,10 +22,10 @@ namespace detail { class GroupImp : public std::enable_shared_from_this, public Group { std::string const name_; - Collector::ptr collector_; + Collector::Ptr collector_; public: - GroupImp(std::string name, Collector::ptr collector) + GroupImp(std::string name, Collector::Ptr collector) : name_(std::move(name)), collector_(std::move(collector)) { } @@ -85,20 +85,20 @@ class GroupsImp : public Groups public: using Items = std::unordered_map, Uhash<>>; - Collector::ptr collector; + Collector::Ptr collector; Items items; - explicit GroupsImp(Collector::ptr collector) : collector(std::move(collector)) + explicit GroupsImp(Collector::Ptr collector) : collector(std::move(collector)) { } ~GroupsImp() override = default; - Group::ptr const& + Group::Ptr const& get(std::string const& name) override { - std::pair const result(items.emplace(name, Group::ptr())); - Group::ptr& group(result.first->second); + std::pair const result(items.emplace(name, Group::Ptr())); + Group::Ptr& group(result.first->second); if (result.second) group = std::make_shared(name, collector); return group; @@ -112,7 +112,7 @@ public: Groups::~Groups() = default; std::unique_ptr -makeGroups(Collector::ptr const& collector) +makeGroups(Collector::Ptr const& collector) { return std::make_unique(collector); } diff --git a/src/libxrpl/core/HashRouter.cpp b/src/libxrpl/core/HashRouter.cpp index a3265bfcfd..3d526641e6 100644 --- a/src/libxrpl/core/HashRouter.cpp +++ b/src/libxrpl/core/HashRouter.cpp @@ -15,7 +15,7 @@ namespace xrpl { auto -HashRouter::emplace(uint256 const& key) -> std::pair +HashRouter::emplace(UInt256 const& key) -> std::pair { auto iter = suppressionMap_.find(key); @@ -32,7 +32,7 @@ HashRouter::emplace(uint256 const& key) -> std::pair } void -HashRouter::addSuppression(uint256 const& key) +HashRouter::addSuppression(UInt256 const& key) { std::scoped_lock const lock(mutex_); @@ -40,13 +40,13 @@ HashRouter::addSuppression(uint256 const& key) } bool -HashRouter::addSuppressionPeer(uint256 const& key, PeerShortID peer) +HashRouter::addSuppressionPeer(UInt256 const& key, PeerShortID peer) { return addSuppressionPeerWithStatus(key, peer).first; } std::pair> -HashRouter::addSuppressionPeerWithStatus(uint256 const& key, PeerShortID peer) +HashRouter::addSuppressionPeerWithStatus(UInt256 const& key, PeerShortID peer) { std::scoped_lock const lock(mutex_); @@ -56,7 +56,7 @@ HashRouter::addSuppressionPeerWithStatus(uint256 const& key, PeerShortID peer) } bool -HashRouter::addSuppressionPeer(uint256 const& key, PeerShortID peer, HashRouterFlags& flags) +HashRouter::addSuppressionPeer(UInt256 const& key, PeerShortID peer, HashRouterFlags& flags) { std::scoped_lock const lock(mutex_); @@ -68,7 +68,7 @@ HashRouter::addSuppressionPeer(uint256 const& key, PeerShortID peer, HashRouterF bool HashRouter::shouldProcess( - uint256 const& key, + UInt256 const& key, PeerShortID peer, HashRouterFlags& flags, std::chrono::seconds txInterval) @@ -83,7 +83,7 @@ HashRouter::shouldProcess( } HashRouterFlags -HashRouter::getFlags(uint256 const& key) +HashRouter::getFlags(UInt256 const& key) { std::scoped_lock const lock(mutex_); @@ -91,7 +91,7 @@ HashRouter::getFlags(uint256 const& key) } bool -HashRouter::setFlags(uint256 const& key, HashRouterFlags flags) +HashRouter::setFlags(UInt256 const& key, HashRouterFlags flags) { XRPL_ASSERT(static_cast(flags), "xrpl::HashRouter::setFlags : valid input"); @@ -107,7 +107,7 @@ HashRouter::setFlags(uint256 const& key, HashRouterFlags flags) } auto -HashRouter::shouldRelay(uint256 const& key) -> std::optional> +HashRouter::shouldRelay(UInt256 const& key) -> std::optional> { std::scoped_lock const lock(mutex_); diff --git a/src/libxrpl/core/detail/Job.cpp b/src/libxrpl/core/detail/Job.cpp index 89fe42db05..bcfb1736dc 100644 --- a/src/libxrpl/core/detail/Job.cpp +++ b/src/libxrpl/core/detail/Job.cpp @@ -25,7 +25,7 @@ Job::Job( std::uint64_t index, LoadMonitor& lm, std::function const& job) - : type_(type), jobIndex_(index), job_(job), name_(name), queueTime_(clock_type::now()) + : type_(type), jobIndex_(index), job_(job), name_(name), queueTime_(ClockType::now()) { loadEvent_ = std::make_shared(std::ref(lm), name, false); } @@ -36,7 +36,7 @@ Job::getType() const return type_; } -Job::clock_type::time_point const& +Job::ClockType::time_point const& Job::queueTime() const { return queueTime_; diff --git a/src/libxrpl/core/detail/JobQueue.cpp b/src/libxrpl/core/detail/JobQueue.cpp index 8f95a8a5fa..649682d523 100644 --- a/src/libxrpl/core/detail/JobQueue.cpp +++ b/src/libxrpl/core/detail/JobQueue.cpp @@ -23,7 +23,7 @@ namespace xrpl { JobQueue::JobQueue( int threadCount, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, beast::Journal journal, Logs& logs, perf::PerfLog& perfLog) @@ -345,7 +345,7 @@ JobQueue::processTask(int instance) { using namespace std::chrono; - Job::clock_type::time_point const startTime(Job::clock_type::now()); + Job::ClockType::time_point const startTime(Job::ClockType::now()); { Job job; { @@ -364,7 +364,7 @@ JobQueue::processTask(int instance) job.doJob(); // The amount of time it took to execute the job - auto const xTime = ceil(Job::clock_type::now() - startTime); + auto const xTime = ceil(Job::ClockType::now() - startTime); if (xTime >= 10ms || qTime >= 10ms) { diff --git a/src/libxrpl/ledger/ApplyStateTable.cpp b/src/libxrpl/ledger/ApplyStateTable.cpp index abcbaac0aa..d8fe04b07d 100644 --- a/src/libxrpl/ledger/ApplyStateTable.cpp +++ b/src/libxrpl/ledger/ApplyStateTable.cpp @@ -81,7 +81,7 @@ void ApplyStateTable::visit( ReadView const& to, std::function< - void(uint256 const& key, bool isDelete, SLE::const_ref before, SLE::const_ref after)> const& + void(UInt256 const& key, bool isDelete, SLE::ConstRef before, SLE::ConstRef after)> const& func) const { for (auto& item : items_) @@ -112,7 +112,7 @@ ApplyStateTable::apply( STTx const& tx, TER ter, std::optional const& deliver, - std::optional const& parentBatchId, + std::optional const& parentBatchId, bool isDryRun, beast::Journal j) { @@ -309,7 +309,7 @@ ApplyStateTable::succ( std::optional const& last) const -> std::optional { std::optional next = key; - items_t::const_iterator iter; + ItemsT::const_iterator iter; // Find base successor that is // not also deleted in our list do @@ -394,7 +394,7 @@ ApplyStateTable::peek(ReadView const& base, Keylet const& k) } void -ApplyStateTable::erase(ReadView const& base, SLE::ref sle) +ApplyStateTable::erase(ReadView const& base, SLE::Ref sle) { auto const iter = items_.find(sle->key()); if (iter == items_.end()) @@ -418,7 +418,7 @@ ApplyStateTable::erase(ReadView const& base, SLE::ref sle) } void -ApplyStateTable::rawErase(ReadView const& base, SLE::ref sle) +ApplyStateTable::rawErase(ReadView const& base, SLE::Ref sle) { using namespace std; auto const result = items_.emplace( @@ -443,7 +443,7 @@ ApplyStateTable::rawErase(ReadView const& base, SLE::ref sle) } void -ApplyStateTable::insert(ReadView const& base, SLE::ref sle) +ApplyStateTable::insert(ReadView const& base, SLE::Ref sle) { auto const iter = items_.lower_bound(sle->key()); if (iter == items_.end() || iter->first != sle->key()) @@ -473,7 +473,7 @@ ApplyStateTable::insert(ReadView const& base, SLE::ref sle) } void -ApplyStateTable::replace(ReadView const& base, SLE::ref sle) +ApplyStateTable::replace(ReadView const& base, SLE::Ref sle) { auto const iter = items_.lower_bound(sle->key()); if (iter == items_.end() || iter->first != sle->key()) @@ -502,7 +502,7 @@ ApplyStateTable::replace(ReadView const& base, SLE::ref sle) } void -ApplyStateTable::update(ReadView const& base, SLE::ref sle) +ApplyStateTable::update(ReadView const& base, SLE::Ref sle) { auto const iter = items_.find(sle->key()); if (iter == items_.end()) @@ -534,7 +534,7 @@ ApplyStateTable::destroyXRP(XRPAmount const& fee) // Insert this transaction to the SLE's threading list void -ApplyStateTable::threadItem(TxMeta& meta, SLE::ref sle) +ApplyStateTable::threadItem(TxMeta& meta, SLE::Ref sle) { key_type prevTxID; LedgerIndex prevLgrID = 0; @@ -638,7 +638,7 @@ void ApplyStateTable::threadOwners( ReadView const& base, TxMeta& meta, - SLE::const_ref sle, + SLE::ConstRef sle, Mods& mods, beast::Journal j) { diff --git a/src/libxrpl/ledger/ApplyView.cpp b/src/libxrpl/ledger/ApplyView.cpp index 8575bc2f52..b90f791edd 100644 --- a/src/libxrpl/ledger/ApplyView.cpp +++ b/src/libxrpl/ledger/ApplyView.cpp @@ -30,8 +30,8 @@ std::uint64_t createRoot( ApplyView& view, Keylet const& directory, - uint256 const& key, - std::function const& describe) + UInt256 const& key, + std::function const& describe) { auto newRoot = std::make_shared(directory); newRoot->setFieldH256(sfRootIndex, directory.key); @@ -46,7 +46,7 @@ createRoot( } auto -findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start) +findPreviousPage(ApplyView& view, Keylet const& directory, SLE::Ref start) { std::uint64_t const page = start->getFieldU64(sfIndexPrevious); @@ -69,11 +69,11 @@ findPreviousPage(ApplyView& view, Keylet const& directory, SLE::ref start) std::uint64_t insertKey( ApplyView& view, - SLE::ref node, + SLE::Ref node, std::uint64_t page, bool preserveOrder, STVector256& indexes, - uint256 const& key) + UInt256 const& key) { if (preserveOrder) { @@ -107,10 +107,10 @@ insertPage( std::uint64_t page, SLE::pointer node, std::uint64_t nextPage, - SLE::ref next, - uint256 const& key, + SLE::Ref next, + UInt256 const& key, Keylet const& directory, - std::function const& describe) + std::function const& describe) { // We rely on modulo arithmetic of unsigned integers (guaranteed in // [basic.fundamental] paragraph 2) to detect page representation overflow. @@ -165,8 +165,8 @@ std::optional ApplyView::dirAdd( bool preserveOrder, Keylet const& directory, - uint256 const& key, - std::function const& describe) + UInt256 const& key, + std::function const& describe) { auto root = peek(directory); @@ -253,7 +253,7 @@ ApplyView::emptyDirDelete(Keylet const& directory) } bool -ApplyView::dirRemove(Keylet const& directory, std::uint64_t page, uint256 const& key, bool keepRoot) +ApplyView::dirRemove(Keylet const& directory, std::uint64_t page, UInt256 const& key, bool keepRoot) { auto node = peek(keylet::page(directory, page)); @@ -393,7 +393,7 @@ ApplyView::dirRemove(Keylet const& directory, std::uint64_t page, uint256 const& } bool -ApplyView::dirDelete(Keylet const& directory, std::function const& callback) +ApplyView::dirDelete(Keylet const& directory, std::function const& callback) { std::optional pi; diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index 1b6ba78046..30a07b7c76 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -65,31 +65,31 @@ ApplyViewBase::read(Keylet const& k) const } auto -ApplyViewBase::slesBegin() const -> std::unique_ptr +ApplyViewBase::slesBegin() const -> std::unique_ptr { return base_->slesBegin(); } auto -ApplyViewBase::slesEnd() const -> std::unique_ptr +ApplyViewBase::slesEnd() const -> std::unique_ptr { return base_->slesEnd(); } auto -ApplyViewBase::slesUpperBound(uint256 const& key) const -> std::unique_ptr +ApplyViewBase::slesUpperBound(UInt256 const& key) const -> std::unique_ptr { return base_->slesUpperBound(key); } auto -ApplyViewBase::txsBegin() const -> std::unique_ptr +ApplyViewBase::txsBegin() const -> std::unique_ptr { return base_->txsBegin(); } auto -ApplyViewBase::txsEnd() const -> std::unique_ptr +ApplyViewBase::txsEnd() const -> std::unique_ptr { return base_->txsEnd(); } @@ -101,7 +101,7 @@ ApplyViewBase::txExists(key_type const& key) const } auto -ApplyViewBase::txRead(key_type const& key) const -> tx_type +ApplyViewBase::txRead(key_type const& key) const -> TxType { return base_->txRead(key); } @@ -121,19 +121,19 @@ ApplyViewBase::peek(Keylet const& k) } void -ApplyViewBase::erase(SLE::ref sle) +ApplyViewBase::erase(SLE::Ref sle) { items_.erase(*base_, sle); } void -ApplyViewBase::insert(SLE::ref sle) +ApplyViewBase::insert(SLE::Ref sle) { items_.insert(*base_, sle); } void -ApplyViewBase::update(SLE::ref sle) +ApplyViewBase::update(SLE::Ref sle) { items_.update(*base_, sle); } @@ -141,19 +141,19 @@ ApplyViewBase::update(SLE::ref sle) //--- void -ApplyViewBase::rawErase(SLE::ref sle) +ApplyViewBase::rawErase(SLE::Ref sle) { items_.rawErase(*base_, sle); } void -ApplyViewBase::rawInsert(SLE::ref sle) +ApplyViewBase::rawInsert(SLE::Ref sle) { items_.insert(*base_, sle); } void -ApplyViewBase::rawReplace(SLE::ref sle) +ApplyViewBase::rawReplace(SLE::Ref sle) { items_.replace(*base_, sle); } diff --git a/src/libxrpl/ledger/ApplyViewImpl.cpp b/src/libxrpl/ledger/ApplyViewImpl.cpp index 66c009cd88..74b07f7fa2 100644 --- a/src/libxrpl/ledger/ApplyViewImpl.cpp +++ b/src/libxrpl/ledger/ApplyViewImpl.cpp @@ -26,7 +26,7 @@ ApplyViewImpl::apply( OpenView& to, STTx const& tx, TER ter, - std::optional parentBatchId, + std::optional parentBatchId, bool isDryRun, beast::Journal j) { @@ -43,7 +43,7 @@ void ApplyViewImpl::visit( OpenView& to, std::function< - void(uint256 const& key, bool isDelete, SLE::const_ref before, SLE::const_ref after)> const& + void(UInt256 const& key, bool isDelete, SLE::ConstRef before, SLE::ConstRef after)> const& func) { items_.visit(to, func); diff --git a/src/libxrpl/ledger/CachedView.cpp b/src/libxrpl/ledger/CachedView.cpp index 1853cc0ac8..d72457df8e 100644 --- a/src/libxrpl/ledger/CachedView.cpp +++ b/src/libxrpl/ledger/CachedView.cpp @@ -27,7 +27,7 @@ CachedViewImpl::read(Keylet const& k) const bool cacheHit = false; bool baseRead = false; - auto const digest = [&]() -> std::optional { + auto const digest = [&]() -> std::optional { { std::scoped_lock const lock(mutex_); auto const iter = map_.find(k.key); diff --git a/src/libxrpl/ledger/CanonicalTXSet.cpp b/src/libxrpl/ledger/CanonicalTXSet.cpp index 12cec5e321..100d3b932e 100644 --- a/src/libxrpl/ledger/CanonicalTXSet.cpp +++ b/src/libxrpl/ledger/CanonicalTXSet.cpp @@ -30,10 +30,10 @@ operator<(CanonicalTXSet::Key const& lhs, CanonicalTXSet::Key const& rhs) return lhs.txId_ < rhs.txId_; } -uint256 +UInt256 CanonicalTXSet::accountKey(AccountID const& account) { - uint256 ret = beast::kZero; + UInt256 ret = beast::kZero; memcpy(ret.begin(), account.begin(), account.size()); ret ^= salt_; return ret; @@ -62,7 +62,7 @@ CanonicalTXSet::popAcctTransaction(std::shared_ptr const& tx) // 3. After handling all transactions with Sequences, return Tickets // with the lowest Ticket ID first. std::shared_ptr result; - uint256 const effectiveAccount{accountKey(tx->getAccountID(sfAccount))}; + UInt256 const effectiveAccount{accountKey(tx->getAccountID(sfAccount))}; auto const seqProxy = tx->getSeqProxy(); Key const after(effectiveAccount, seqProxy, beast::kZero); diff --git a/src/libxrpl/ledger/Ledger.cpp b/src/libxrpl/ledger/Ledger.cpp index 188fb3cd2c..6dfbd88c66 100644 --- a/src/libxrpl/ledger/Ledger.cpp +++ b/src/libxrpl/ledger/Ledger.cpp @@ -50,7 +50,7 @@ CreateGenesisT const kCreateGenesis{}; //------------------------------------------------------------------------------ -class Ledger::SlesIterImpl : public SlesType::iter_base +class Ledger::SlesIterImpl : public SlesType::IterBase { private: SHAMap::ConstIterator iter_; @@ -66,14 +66,14 @@ public: { } - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr copy() const override { return std::make_unique(*this); } [[nodiscard]] bool - equal(base_type const& impl) const override + equal(BaseType const& impl) const override { if (auto const p = dynamic_cast(&impl)) return iter_ == p->iter_; @@ -96,7 +96,7 @@ public: //------------------------------------------------------------------------------ -class Ledger::TxsIterImpl : public TxsType::iter_base +class Ledger::TxsIterImpl : public TxsType::IterBase { private: bool metadata_; @@ -113,14 +113,14 @@ public: { } - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr copy() const override { return std::make_unique(*this); } [[nodiscard]] bool - equal(base_type const& impl) const override + equal(BaseType const& impl) const override { if (auto const p = dynamic_cast(&impl)) return iter_ == p->iter_; @@ -149,7 +149,7 @@ Ledger::Ledger( CreateGenesisT, Rules rules, Fees const& fees, - std::vector const& amendments, + std::vector const& amendments, Family& family) : immutable_(false) , txMap_(SHAMapType::TRANSACTION, family) @@ -261,7 +261,7 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime) { header_.seq = prevLedger.header_.seq + 1; header_.parentCloseTime = prevLedger.header_.closeTime; - header_.hash = prevLedger.header().hash + uint256(1); + header_.hash = prevLedger.header().hash + UInt256(1); header_.drops = prevLedger.header().drops; header_.closeTimeResolution = prevLedger.header_.closeTimeResolution; header_.parentHash = prevLedger.header().hash; @@ -385,13 +385,13 @@ Ledger::exists(Keylet const& k) const } bool -Ledger::exists(uint256 const& key) const +Ledger::exists(UInt256 const& key) const { return stateMap_.hasItem(key); } -std::optional -Ledger::succ(uint256 const& key, std::optional const& last) const +std::optional +Ledger::succ(UInt256 const& key, std::optional const& last) const { auto item = stateMap_.upperBound(key); if (item == stateMap_.end()) @@ -423,43 +423,43 @@ Ledger::read(Keylet const& k) const //------------------------------------------------------------------------------ auto -Ledger::slesBegin() const -> std::unique_ptr +Ledger::slesBegin() const -> std::unique_ptr { return std::make_unique(stateMap_.begin()); } auto -Ledger::slesEnd() const -> std::unique_ptr +Ledger::slesEnd() const -> std::unique_ptr { return std::make_unique(stateMap_.end()); } auto -Ledger::slesUpperBound(uint256 const& key) const -> std::unique_ptr +Ledger::slesUpperBound(UInt256 const& key) const -> std::unique_ptr { return std::make_unique(stateMap_.upperBound(key)); } auto -Ledger::txsBegin() const -> std::unique_ptr +Ledger::txsBegin() const -> std::unique_ptr { return std::make_unique(!open(), txMap_.begin()); } auto -Ledger::txsEnd() const -> std::unique_ptr +Ledger::txsEnd() const -> std::unique_ptr { return std::make_unique(!open(), txMap_.end()); } bool -Ledger::txExists(uint256 const& key) const +Ledger::txExists(UInt256 const& key) const { return txMap_.hasItem(key); } auto -Ledger::txRead(key_type const& key) const -> tx_type +Ledger::txRead(key_type const& key) const -> TxType { auto const& item = txMap_.peekItem(key); if (!item) @@ -473,7 +473,7 @@ Ledger::txRead(key_type const& key) const -> tx_type } auto -Ledger::digest(key_type const& key) const -> std::optional +Ledger::digest(key_type const& key) const -> std::optional { SHAMapHash digest; // VFALCO Unfortunately this loads the item @@ -486,21 +486,21 @@ Ledger::digest(key_type const& key) const -> std::optional //------------------------------------------------------------------------------ void -Ledger::rawErase(SLE::ref sle) +Ledger::rawErase(SLE::Ref sle) { if (!stateMap_.delItem(sle->key())) logicError("Ledger::rawErase: key not found"); } void -Ledger::rawErase(uint256 const& key) +Ledger::rawErase(UInt256 const& key) { if (!stateMap_.delItem(key)) logicError("Ledger::rawErase: key not found"); } void -Ledger::rawInsert(SLE::ref sle) +Ledger::rawInsert(SLE::Ref sle) { Serializer ss; sle->add(ss); @@ -512,7 +512,7 @@ Ledger::rawInsert(SLE::ref sle) } void -Ledger::rawReplace(SLE::ref sle) +Ledger::rawReplace(SLE::Ref sle) { Serializer ss; sle->add(ss); @@ -525,7 +525,7 @@ Ledger::rawReplace(SLE::ref sle) void Ledger::rawTxInsert( - uint256 const& key, + UInt256 const& key, std::shared_ptr const& txn, std::shared_ptr const& metaData) { @@ -635,10 +635,10 @@ Ledger::peek(Keylet const& k) const return sle; } -hash_set +HashSet Ledger::negativeUNL() const { - hash_set negUnl; + HashSet negUnl; if (auto sle = read(keylet::negativeUNL()); sle && sle->isFieldPresent(sfDisabledValidators)) { auto const& nUnlData = sle->getFieldArray(sfDisabledValidators); @@ -817,7 +817,7 @@ Ledger::updateSkipList() { auto const k = keylet::skip(prevIndex); auto sle = peek(k); - std::vector hashes; + std::vector hashes; bool created = false; if (!sle) @@ -849,7 +849,7 @@ Ledger::updateSkipList() // update record of past 256 ledger auto const k = keylet::skip(); auto sle = peek(k); - std::vector hashes; + std::vector hashes; bool created = false; if (!sle) { diff --git a/src/libxrpl/ledger/OpenView.cpp b/src/libxrpl/ledger/OpenView.cpp index 26cb109f85..537b15c0d4 100644 --- a/src/libxrpl/ledger/OpenView.cpp +++ b/src/libxrpl/ledger/OpenView.cpp @@ -24,26 +24,26 @@ namespace xrpl { -class OpenView::TxsIterImpl : public TxsType::iter_base +class OpenView::TxsIterImpl : public TxsType::IterBase { private: bool metadata_; - txs_map::const_iterator iter_; + TxsMap::const_iterator iter_; public: - explicit TxsIterImpl(bool metadata, txs_map::const_iterator iter) + explicit TxsIterImpl(bool metadata, TxsMap::const_iterator iter) : metadata_(metadata), iter_(iter) { } - [[nodiscard]] std::unique_ptr + [[nodiscard]] std::unique_ptr copy() const override { return std::make_unique(metadata_, iter_); } [[nodiscard]] bool - equal(base_type const& impl) const override + equal(BaseType const& impl) const override { if (auto const p = dynamic_cast(&impl)) return iter_ == p->iter_; @@ -170,31 +170,31 @@ OpenView::read(Keylet const& k) const } auto -OpenView::slesBegin() const -> std::unique_ptr +OpenView::slesBegin() const -> std::unique_ptr { return items_.slesBegin(*base_); } auto -OpenView::slesEnd() const -> std::unique_ptr +OpenView::slesEnd() const -> std::unique_ptr { return items_.slesEnd(*base_); } auto -OpenView::slesUpperBound(uint256 const& key) const -> std::unique_ptr +OpenView::slesUpperBound(UInt256 const& key) const -> std::unique_ptr { return items_.slesUpperBound(*base_, key); } auto -OpenView::txsBegin() const -> std::unique_ptr +OpenView::txsBegin() const -> std::unique_ptr { return std::make_unique(!open(), txs_.cbegin()); } auto -OpenView::txsEnd() const -> std::unique_ptr +OpenView::txsEnd() const -> std::unique_ptr { return std::make_unique(!open(), txs_.cend()); } @@ -206,14 +206,14 @@ OpenView::txExists(key_type const& key) const } auto -OpenView::txRead(key_type const& key) const -> tx_type +OpenView::txRead(key_type const& key) const -> TxType { auto const iter = txs_.find(key); if (iter == txs_.end()) return base_->txRead(key); auto const& item = iter->second; auto stx = std::make_shared(SerialIter{item.txn->slice()}); - decltype(tx_type::second) sto; + decltype(TxType::second) sto; if (item.meta) { sto = std::make_shared(SerialIter{item.meta->slice()}, sfMetadata); @@ -228,19 +228,19 @@ OpenView::txRead(key_type const& key) const -> tx_type //--- void -OpenView::rawErase(SLE::ref sle) +OpenView::rawErase(SLE::Ref sle) { items_.erase(sle); } void -OpenView::rawInsert(SLE::ref sle) +OpenView::rawInsert(SLE::Ref sle) { items_.insert(sle); } void -OpenView::rawReplace(SLE::ref sle) +OpenView::rawReplace(SLE::Ref sle) { items_.replace(sle); } diff --git a/src/libxrpl/ledger/RawStateTable.cpp b/src/libxrpl/ledger/RawStateTable.cpp index fbe7bf1d82..b30a3c1a10 100644 --- a/src/libxrpl/ledger/RawStateTable.cpp +++ b/src/libxrpl/ledger/RawStateTable.cpp @@ -17,22 +17,22 @@ namespace xrpl::detail { -class RawStateTable::SlesIterImpl : public ReadView::SlesType::iter_base +class RawStateTable::SlesIterImpl : public ReadView::SlesType::IterBase { private: SLE::const_pointer sle0_; ReadView::SlesType::Iterator iter0_; ReadView::SlesType::Iterator end0_; SLE::const_pointer sle1_; - items_t::const_iterator iter1_; - items_t::const_iterator end1_; + ItemsT::const_iterator iter1_; + ItemsT::const_iterator end1_; public: SlesIterImpl(SlesIterImpl const&) = default; SlesIterImpl( - items_t::const_iterator iter1, - items_t::const_iterator end1, + ItemsT::const_iterator iter1, + ItemsT::const_iterator end1, ReadView::SlesType::Iterator iter0, ReadView::SlesType::Iterator end0) : iter0_(std::move(iter0)), end0_(std::move(end0)), iter1_(iter1), end1_(end1) @@ -46,14 +46,14 @@ public: } } - std::unique_ptr + std::unique_ptr copy() const override { return std::make_unique(*this); } bool - equal(base_type const& impl) const override + equal(BaseType const& impl) const override { if (auto const p = dynamic_cast(&impl)) { @@ -212,7 +212,7 @@ RawStateTable::succ(ReadView const& base, key_type const& key, std::optional std::optional { std::optional next = key; - items_t::const_iterator iter; + ItemsT::const_iterator iter; // Find base successor that is // not also deleted in our list do @@ -241,7 +241,7 @@ RawStateTable::succ(ReadView const& base, key_type const& key, std::optional +std::unique_ptr RawStateTable::slesBegin(ReadView const& base) const { return std::make_unique( items_.begin(), items_.end(), base.sles.begin(), base.sles.end()); } -std::unique_ptr +std::unique_ptr RawStateTable::slesEnd(ReadView const& base) const { return std::make_unique( items_.end(), items_.end(), base.sles.end(), base.sles.end()); } -std::unique_ptr -RawStateTable::slesUpperBound(ReadView const& base, uint256 const& key) const +std::unique_ptr +RawStateTable::slesUpperBound(ReadView const& base, UInt256 const& key) const { return std::make_unique( items_.upper_bound(key), items_.end(), base.sles.upperBound(key), base.sles.end()); diff --git a/src/libxrpl/ledger/ReadView.cpp b/src/libxrpl/ledger/ReadView.cpp index 1877edb383..6ed6ce4a3f 100644 --- a/src/libxrpl/ledger/ReadView.cpp +++ b/src/libxrpl/ledger/ReadView.cpp @@ -66,7 +66,7 @@ makeRulesGivenLedger(DigestAwareReadView const& ledger, Rules const& current) Rules makeRulesGivenLedger( DigestAwareReadView const& ledger, - std::unordered_set> const& presets) + std::unordered_set> const& presets) { Keylet const k = keylet::amendments(); std::optional const digest = ledger.digest(k.key); diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index 75a49187b4..26e3d42353 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -51,12 +51,12 @@ hasExpired( std::optional const& exp, ExpiryComparison comparison) { - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; if (!exp) return false; - auto const boundary = tp{d{*exp}}; + auto const boundary = Tp{D{*exp}}; return comparison == ExpiryComparison::Inclusive // ? view.parentCloseTime() >= boundary : view.parentCloseTime() > boundary; @@ -267,7 +267,7 @@ areCompatible( bool areCompatible( - uint256 const& validHash, + UInt256 const& validHash, LedgerIndex validIndex, ReadView const& testLedger, beast::Journal::Stream& s, @@ -305,10 +305,10 @@ areCompatible( return ret; } -std::set +std::set getEnabledAmendments(ReadView const& view) { - std::set amendments; + std::set amendments; if (auto const sle = view.read(keylet::amendments())) { @@ -322,29 +322,29 @@ getEnabledAmendments(ReadView const& view) return amendments; } -majorityAmendments_t +MajorityAmendmentsT getMajorityAmendments(ReadView const& view) { - majorityAmendments_t ret; + MajorityAmendmentsT ret; if (auto const sle = view.read(keylet::amendments())) { if (sle->isFieldPresent(sfMajorities)) { - using tp = NetClock::time_point; - using d = tp::duration; + using Tp = NetClock::time_point; + using D = Tp::duration; auto const majorities = sle->getFieldArray(sfMajorities); for (auto const& m : majorities) - ret[m.getFieldH256(sfAmendment)] = tp(d(m.getFieldU32(sfCloseTime))); + ret[m.getFieldH256(sfAmendment)] = Tp(D(m.getFieldU32(sfCloseTime))); } } return ret; } -std::optional +std::optional hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal) { // Easy cases... @@ -466,10 +466,10 @@ canWithdraw( ReadView const& view, AccountID const& from, AccountID const& to, - SLE::const_ref toSle, + SLE::ConstRef toSle, STAmount const& amount, bool hasDestinationTag, - std::optional> const& credentialIDs) + std::optional> const& credentialIDs) { if (auto const ret = checkDestinationAndTag(toSle, hasDestinationTag)) return ret; @@ -514,7 +514,7 @@ canWithdraw( AccountID const& to, STAmount const& amount, bool hasDestinationTag, - std::optional> const& credentialIDs) + std::optional> const& credentialIDs) { auto const toSle = view.read(keylet::account(to)); @@ -603,7 +603,7 @@ cleanupOnAccountDelete( // Delete all the entries in the account directory. SLE::pointer sleDirNode{}; unsigned int uDirEntry{0}; - uint256 dirEntry{beast::kZero}; + UInt256 dirEntry{beast::kZero}; std::uint32_t deleted = 0; if (view.exists(ownerDirKeylet) && diff --git a/src/libxrpl/ledger/helpers/AMMHelpers.cpp b/src/libxrpl/ledger/helpers/AMMHelpers.cpp index fcad22d2d5..d087ff8f3f 100644 --- a/src/libxrpl/ledger/helpers/AMMHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AMMHelpers.cpp @@ -670,7 +670,7 @@ deleteAMMTrustLines( sb, keylet::ownerDir(ammAccountID), [&](LedgerEntryType nodeType, - uint256 const&, + UInt256 const&, SLE::pointer& sleItem) -> std::pair { // Skip AMM and MPToken if (nodeType == ltAMM || nodeType == ltMPTOKEN) @@ -706,7 +706,7 @@ deleteAMMMPTokens(Sandbox& sb, AccountID const& ammAccountID, beast::Journal j) sb, keylet::ownerDir(ammAccountID), [&](LedgerEntryType nodeType, - uint256 const&, + UInt256 const&, SLE::pointer& sleItem) -> std::pair { // Skip AMM if (nodeType == ltAMM) diff --git a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp index 819ebb04d1..bc9f99c756 100644 --- a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp @@ -94,7 +94,7 @@ confineOwnerCount( // Returns the number of account reserves funded by this account: 1 for itself (0 if sponsored by // another account) plus the count of accounts it sponsors. std::uint32_t -accountCountImpl(SLE::const_ref sle, std::int32_t accountCountAdj, beast::Journal j) +accountCountImpl(SLE::ConstRef sle, std::int32_t accountCountAdj, beast::Journal j) { bool const isSponsored = sle->isFieldPresent(sfSponsor); std::int64_t const sponsoringAccountCount = sle->getFieldU32(sfSponsoringAccountCount); @@ -123,7 +123,7 @@ accountCountImpl(SLE::const_ref sle, std::int32_t accountCountAdj, beast::Journa std::uint32_t adjustOwnerCountImpl( ApplyView& view, - SLE::ref sle, + SLE::Ref sle, SF_UINT32 const& sfield, AccountID const& accID, std::int32_t ownerCountAdj, @@ -140,8 +140,8 @@ adjustOwnerCountImpl( void adjustOwnerCountSigned( ApplyView& view, - SLE::ref accountSle, - SLE::ref sponsorSle, + SLE::Ref accountSle, + SLE::Ref sponsorSle, std::int32_t adjustment, beast::Journal j) { @@ -225,7 +225,7 @@ adjustOwnerCountSigned( } // namespace std::uint32_t -ownerCount(SLE::const_ref sle, beast::Journal j, std::int32_t ownerCountAdj) +ownerCount(SLE::ConstRef sle, beast::Journal j, std::int32_t ownerCountAdj) { XRPL_ASSERT(sle && sle->getType() == ltACCOUNT_ROOT, "xrpl::ownerCount : sle is account root"); @@ -311,8 +311,8 @@ transferRate(ReadView const& view, AccountID const& issuer) void increaseOwnerCount( ApplyView& view, - SLE::ref accountSle, - SLE::ref sponsorSle, + SLE::Ref accountSle, + SLE::Ref sponsorSle, std::uint32_t count, beast::Journal j) { @@ -326,7 +326,7 @@ increaseOwnerCount( } void -increaseOwnerCount(ApplyViewContext ctx, SLE::ref accountSle, std::uint32_t count, beast::Journal j) +increaseOwnerCount(ApplyViewContext ctx, SLE::Ref accountSle, std::uint32_t count, beast::Journal j) { auto const sponsorExp = getEffectiveTxReserveSponsor(ctx, accountSle); @@ -341,8 +341,8 @@ increaseOwnerCount(ApplyViewContext ctx, SLE::ref accountSle, std::uint32_t coun void decreaseOwnerCount( ApplyView& view, - SLE::ref accountSle, - SLE::ref sponsorSle, + SLE::Ref accountSle, + SLE::Ref sponsorSle, std::uint32_t count, beast::Journal j) { @@ -358,8 +358,8 @@ decreaseOwnerCount( void decreaseOwnerCountForObject( ApplyView& view, - SLE::ref accountSle, - SLE::ref objectSle, + SLE::Ref accountSle, + SLE::Ref objectSle, std::uint32_t count, beast::Journal j) { @@ -372,14 +372,14 @@ decreaseOwnerCountForObject( if (!validObjectType) return; // LCOV_EXCL_LINE - SLE::ref sponsorSle = getLedgerEntryReserveSponsor(view, objectSle); + SLE::Ref sponsorSle = getLedgerEntryReserveSponsor(view, objectSle); decreaseOwnerCount(view, accountSle, sponsorSle, count, j); } void adjustLoanBrokerOwnerCount( ApplyView& view, - SLE::ref brokerSle, + SLE::Ref brokerSle, std::int32_t delta, beast::Journal j) { @@ -398,7 +398,7 @@ adjustLoanBrokerOwnerCount( } XRPAmount -accountReserve(ReadView const& view, SLE::const_ref sle, beast::Journal j, Adjustment adj) +accountReserve(ReadView const& view, SLE::ConstRef sle, beast::Journal j, Adjustment adj) { XRPL_ASSERT(sle && sle->getType() == ltACCOUNT_ROOT, "xrpl::accountReserve : valid sle"); @@ -416,9 +416,9 @@ accountReserve(ReadView const& view, SLE::const_ref sle, beast::Journal j, Adjus TER checkReserve( ApplyViewContext ctx, - SLE::const_ref accSle, + SLE::ConstRef accSle, XRPAmount accBalance, - SLE::const_ref sponsorSle, + SLE::ConstRef sponsorSle, Adjustment adj, beast::Journal j, TER insufReserveCode) @@ -483,7 +483,7 @@ checkReserve( TER checkReserve( ApplyViewContext ctx, - SLE::const_ref accSle, + SLE::ConstRef accSle, XRPAmount accBalance, Adjustment adj, beast::Journal j) @@ -497,7 +497,7 @@ checkReserve( // ---------------------------------------------------- AccountID -pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey) +pseudoAccountAddress(ReadView const& view, UInt256 const& pseudoOwnerKey) { // This number must not be changed without an amendment static constexpr std::uint16_t kMaxAccountAttempts = 256; @@ -557,7 +557,7 @@ isPseudoAccount(SLE::const_pointer sleAcct) } std::expected -createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const& ownerField) +createPseudoAccount(ApplyView& view, UInt256 const& pseudoOwnerKey, SField const& ownerField) { [[maybe_unused]] auto const& fields = getPseudoAccountFields(); @@ -599,7 +599,7 @@ createPseudoAccount(ApplyView& view, uint256 const& pseudoOwnerKey, SField const } [[nodiscard]] TER -checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag) +checkDestinationAndTag(SLE::ConstRef toSle, bool hasDestinationTag) { if (toSle == nullptr) return tecNO_DST; diff --git a/src/libxrpl/ledger/helpers/CredentialHelpers.cpp b/src/libxrpl/ledger/helpers/CredentialHelpers.cpp index 5ba832957d..df1cde300c 100644 --- a/src/libxrpl/ledger/helpers/CredentialHelpers.cpp +++ b/src/libxrpl/ledger/helpers/CredentialHelpers.cpp @@ -74,7 +74,7 @@ removeExpired(ApplyView& view, STVector256 const& arr, beast::Journal const j) } TER -deleteSLE(ApplyView& view, SLE::ref sleCredential, beast::Journal j) +deleteSLE(ApplyView& view, SLE::Ref sleCredential, beast::Journal j) { if (!sleCredential) return tecNO_ENTRY; @@ -142,13 +142,13 @@ checkFields(STTx const& tx, Rules const& rules, beast::Journal j) } if (rules.enabled(fixCleanup3_4_0) && - std::ranges::any_of(credentials, [](uint256 const& id) { return id.isZero(); })) + std::ranges::any_of(credentials, [](UInt256 const& id) { return id.isZero(); })) { JLOG(j.trace()) << "Malformed transaction: zero credential ID."; return temMALFORMED; } - std::unordered_set duplicates; + std::unordered_set duplicates; for (auto const& cred : credentials) { auto [it, ins] = duplicates.insert(cred); @@ -205,7 +205,7 @@ valid(STTx const& tx, ReadView const& view, AccountID const& src, beast::Journal } TER -validDomain(ReadView const& view, uint256 domainID, AccountID const& subject) +validDomain(ReadView const& view, UInt256 domainID, AccountID const& subject) { // Note, permissioned domain objects can be deleted at any time auto const slePD = view.read(keylet::permissionedDomain(domainID)); @@ -296,7 +296,7 @@ checkArray(STArray const& credentials, unsigned maxSize, beast::Journal j) return credentials.empty() ? temARRAY_EMPTY : temARRAY_TOO_LARGE; } - std::unordered_set duplicates; + std::unordered_set duplicates; for (auto const& credential : credentials) { auto const& issuer = credential[sfIssuer]; @@ -332,7 +332,7 @@ checkArray(STArray const& credentials, unsigned maxSize, beast::Journal j) } // namespace credentials TER -verifyValidDomain(ApplyView& view, AccountID const& account, uint256 domainID, beast::Journal j) +verifyValidDomain(ApplyView& view, AccountID const& account, UInt256 domainID, beast::Journal j) { auto const slePD = view.read(keylet::permissionedDomain(domainID)); if (!slePD) @@ -373,7 +373,7 @@ checkDepositPreauth( ReadView const& view, AccountID const& src, AccountID const& dst, - SLE::const_ref sleDst, + SLE::ConstRef sleDst, beast::Journal j) { // If depositPreauth is enabled, then an account that requires @@ -421,7 +421,7 @@ verifyDepositPreauth( ApplyView& view, AccountID const& src, AccountID const& dst, - SLE::const_ref sleDst, + SLE::ConstRef sleDst, beast::Journal j) { if (auto const err = cleanupExpiredCredentials(tx, view, j); !isTesSuccess(err)) diff --git a/src/libxrpl/ledger/helpers/DirectoryHelpers.cpp b/src/libxrpl/ledger/helpers/DirectoryHelpers.cpp index 43f8219b6a..72f9a91722 100644 --- a/src/libxrpl/ledger/helpers/DirectoryHelpers.cpp +++ b/src/libxrpl/ledger/helpers/DirectoryHelpers.cpp @@ -18,10 +18,10 @@ namespace xrpl { bool dirFirst( ApplyView& view, - uint256 const& root, + UInt256 const& root, SLE::pointer& page, unsigned int& index, - uint256& entry) + UInt256& entry) { return detail::internalDirFirst(view, root, page, index, entry); } @@ -29,10 +29,10 @@ dirFirst( bool dirNext( ApplyView& view, - uint256 const& root, + UInt256 const& root, SLE::pointer& page, unsigned int& index, - uint256& entry) + UInt256& entry) { return detail::internalDirNext(view, root, page, index, entry); } @@ -40,10 +40,10 @@ dirNext( bool cdirFirst( ReadView const& view, - uint256 const& root, + UInt256 const& root, SLE::const_pointer& page, unsigned int& index, - uint256& entry) + UInt256& entry) { return detail::internalDirFirst(view, root, page, index, entry); } @@ -51,16 +51,16 @@ cdirFirst( bool cdirNext( ReadView const& view, - uint256 const& root, + UInt256 const& root, SLE::const_pointer& page, unsigned int& index, - uint256& entry) + UInt256& entry) { return detail::internalDirNext(view, root, page, index, entry); } void -forEachItem(ReadView const& view, Keylet const& root, std::function const& f) +forEachItem(ReadView const& view, Keylet const& root, std::function const& f) { XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::forEachItem : valid root type"); @@ -87,10 +87,10 @@ bool forEachItemAfter( ReadView const& view, Keylet const& root, - uint256 const& after, + UInt256 const& after, std::uint64_t const hint, unsigned int limit, - std::function const& f) + std::function const& f) { XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::forEachItemAfter : valid root type"); @@ -176,10 +176,10 @@ dirIsEmpty(ReadView const& view, Keylet const& k) return sleNode->getFieldU64(sfIndexNext) == 0; } -std::function +std::function describeOwnerDir(AccountID const& account) { - return [account](SLE::ref sle) { (*sle)[sfOwner] = account; }; + return [account](SLE::Ref sle) { (*sle)[sfOwner] = account; }; } } // namespace xrpl diff --git a/src/libxrpl/ledger/helpers/LendingHelpers.cpp b/src/libxrpl/ledger/helpers/LendingHelpers.cpp index 2728a3b86f..61a5f857e2 100644 --- a/src/libxrpl/ledger/helpers/LendingHelpers.cpp +++ b/src/libxrpl/ledger/helpers/LendingHelpers.cpp @@ -38,7 +38,7 @@ namespace xrpl { [[nodiscard]] TER canApplyToBrokerCover( ReadView const& view, - SLE::const_ref sleBroker, + SLE::ConstRef sleBroker, Asset const& vaultAsset, STAmount const& amount, beast::Journal j, @@ -170,7 +170,7 @@ isRounded(Asset const& asset, Number const& value, std::int32_t scale) } [[nodiscard]] bool -isPaymentLate(ReadView const& view, SLE::const_ref loanSle) +isPaymentLate(ReadView const& view, SLE::ConstRef loanSle) { return hasExpired( view, @@ -204,7 +204,7 @@ DefaultAmount = (Loan.PrincipalOutstanding + Loan.InterestOutstanding) Which is equivalent to (Loan.TotalValueOutstanding - Loan.ManagementFeeOutstanding) */ Number -loanVaultExposure(SLE::const_ref loanSle) +loanVaultExposure(SLE::ConstRef loanSle) { return loanSle->at(sfTotalValueOutstanding) - loanSle->at(sfManagementFeeOutstanding); } @@ -233,7 +233,7 @@ loanOriginationDeltas(Number const& principalRequested) * DefaultAmount = Loan.PrincipalOutstanding */ Number -loanVaultExposure(SLE::const_ref loanSle) +loanVaultExposure(SLE::ConstRef loanSle) { return loanSle->at(sfPrincipalOutstanding); } @@ -253,7 +253,7 @@ namespace { // VaultVersion::CashBasis). Vaults created before activation keep instant // interest recognition forever, even after the amendment later turns on. bool -cashBasisEnabled(SLE::const_ref vaultSle) +cashBasisEnabled(SLE::ConstRef vaultSle) { return getVaultVersion(vaultSle) == VaultVersion::CashBasis; } @@ -262,7 +262,7 @@ cashBasisEnabled(SLE::const_ref vaultSle) AccountingDeltas loanOriginationDeltas( - SLE::const_ref vaultSle, + SLE::ConstRef vaultSle, Number const& principalRequested, Number const& interestDue) { @@ -273,7 +273,7 @@ loanOriginationDeltas( bool loanOriginationExceedsVaultMaximum( - SLE::const_ref vaultSle, + SLE::ConstRef vaultSle, Number const& vaultTotal, Number const& interestDue) { @@ -288,14 +288,14 @@ loanOriginationExceedsVaultMaximum( } Number -loanVaultExposure(SLE::const_ref vaultSle, SLE::const_ref loanSle) +loanVaultExposure(SLE::ConstRef vaultSle, SLE::ConstRef loanSle) { return cashBasisEnabled(vaultSle) ? cash_basis::loanVaultExposure(loanSle) : instant_recognition::loanVaultExposure(loanSle); } AccountingDeltas -loanPaymentDeltas(SLE::const_ref vaultSle, LoanPaymentParts const& parts) +loanPaymentDeltas(SLE::ConstRef vaultSle, LoanPaymentParts const& parts) { return cashBasisEnabled(vaultSle) ? cash_basis::loanPaymentDeltas(parts) : instant_recognition::loanPaymentDeltas(parts); @@ -579,7 +579,7 @@ loanAccruedInterest( * a computed payment. */ LoanPaymentParts -doPayment(ExtendedPaymentComponents const& payment, SLE::ref loan) +doPayment(ExtendedPaymentComponents const& payment, SLE::Ref loan) { auto totalValueOutstandingProxy = loan->at(sfTotalValueOutstanding); auto principalOutstandingProxy = loan->at(sfPrincipalOutstanding); @@ -905,7 +905,7 @@ doOverpayment( Asset const& asset, std::int32_t loanScale, ExtendedPaymentComponents const& overpaymentComponents, - SLE::ref loan, + SLE::Ref loan, Number const& periodicRate, TenthBips16 const managementFeeRate, beast::Journal j) @@ -1047,7 +1047,7 @@ std::expected computeLatePayment( Asset const& asset, ReadView const& view, - SLE::const_ref loan, + SLE::ConstRef loan, ExtendedPaymentComponents const& periodic, STAmount const& amount, TenthBips16 managementFeeRate, @@ -1143,7 +1143,7 @@ std::expected computeFullPayment( Asset const& asset, ReadView const& view, - SLE::const_ref loan, + SLE::ConstRef loan, Number const& periodicRate, STAmount const& amount, TenthBips16 managementFeeRate, @@ -1489,7 +1489,7 @@ PaymentComponents computePaymentComponents( Rules const& rules, Asset const& asset, - SLE::ref loan, + SLE::Ref loan, Number const& periodicRate, TenthBips16 managementFeeRate) { @@ -1587,7 +1587,7 @@ computeOverpaymentComponents( * interest rate. */ std::pair -loanRatesFor(SLE::const_ref loan, SLE::const_ref brokerSle) +loanRatesFor(SLE::ConstRef loan, SLE::ConstRef brokerSle) { TenthBips16 const managementFeeRate{brokerSle->at(sfManagementFeeRate)}; TenthBips32 const interestRate{loan->at(sfInterestRate)}; @@ -1604,8 +1604,8 @@ std::expected makeFullPayment( Asset const& asset, ApplyView& view, - SLE::ref loan, - SLE::const_ref brokerSle, + SLE::Ref loan, + SLE::ConstRef brokerSle, STAmount const& amount, beast::Journal j) { @@ -1629,8 +1629,8 @@ std::expected makeLatePayment( Asset const& asset, ApplyView const& view, - SLE::ref loan, - SLE::const_ref brokerSle, + SLE::Ref loan, + SLE::ConstRef brokerSle, STAmount const& amount, beast::Journal j) { @@ -1663,8 +1663,8 @@ std::expected makeRegularPayment( Asset const& asset, ApplyView const& view, - SLE::ref loan, - SLE::const_ref brokerSle, + SLE::Ref loan, + SLE::ConstRef brokerSle, STAmount const& amount, LoanPaymentType const paymentType, beast::Journal j) @@ -2100,7 +2100,7 @@ constructLoanState( } LoanState -constructLoanState(SLE::const_ref loan) +constructLoanState(SLE::ConstRef loan) { XRPL_ASSERT(loan && loan->getType() == ltLOAN, "xrpl::constructLoanState : valid loan SLE"); @@ -2254,8 +2254,8 @@ std::expected loanMakePayment( Asset const& asset, ApplyView& view, - SLE::ref loan, - SLE::const_ref brokerSle, + SLE::Ref loan, + SLE::ConstRef brokerSle, STAmount const& amount, LoanPaymentType const paymentType, beast::Journal j) diff --git a/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp b/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp index 27dcd84675..2274f53995 100644 --- a/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp @@ -975,7 +975,7 @@ createMPToken( ApplyView& view, MPTID const& mptIssuanceID, AccountID const& account, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, std::uint32_t const flags) { auto const mptokenKey = keylet::mptoken(mptIssuanceID, account); @@ -1004,7 +1004,7 @@ checkCreateMPT( xrpl::ApplyView& view, xrpl::MPTIssue const& mptIssue, xrpl::AccountID const& holder, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, std::uint32_t flags, beast::Journal j) { diff --git a/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp b/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp index ebe5271765..1c81b52ae1 100644 --- a/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/NFTokenHelpers.cpp @@ -43,7 +43,7 @@ namespace xrpl::nft { static SLE::const_pointer -locatePage(ReadView const& view, AccountID const& owner, uint256 const& id) +locatePage(ReadView const& view, AccountID const& owner, UInt256 const& id) { auto const first = keylet::nftokenPage(keylet::nftokenPageMin(owner), id); auto const last = keylet::nftokenPageMax(owner); @@ -56,7 +56,7 @@ locatePage(ReadView const& view, AccountID const& owner, uint256 const& id) } static SLE::pointer -locatePage(ApplyView& view, AccountID const& owner, uint256 const& id) +locatePage(ApplyView& view, AccountID const& owner, UInt256 const& id) { auto const first = keylet::nftokenPage(keylet::nftokenPageMin(owner), id); auto const last = keylet::nftokenPageMax(owner); @@ -72,7 +72,7 @@ static SLE::pointer getPageForToken( ApplyView& view, AccountID const& owner, - uint256 const& id, + UInt256 const& id, std::function const& createCallback) { auto const base = keylet::nftokenPageMin(owner); @@ -115,7 +115,7 @@ getPageForToken( // We prefer to keep equivalent NFTs on a page boundary. That gives // any additional equivalent NFTs maximum room for expansion. // Round up the boundary until there's a non-equivalent entry. - uint256 const cmp = + UInt256 const cmp = narr[(kDirMaxTokensPerPage / 2) - 1].getFieldH256(sfNFTokenID) & nft::kPageMask; // Note that the calls to find_if_not() and (later) find_if() @@ -174,12 +174,12 @@ getPageForToken( // Determine the ID for the page index. // - // Note that we use uint256::next() because there's a subtlety in the way + // Note that we use UInt256::next() because there's a subtlety in the way // NFT pages are structured. The low 96-bits of NFT ID must be strictly // less than the low 96-bits of the enclosing page's index. In order to // accommodate that requirement we use an index one higher than the // largest NFT in the page. - uint256 const tokenIDForNewPage = narr.size() == kDirMaxTokensPerPage + UInt256 const tokenIDForNewPage = narr.size() == kDirMaxTokensPerPage ? narr[kDirMaxTokensPerPage - 1].getFieldH256(sfNFTokenID).next() : carr[0].getFieldH256(sfNFTokenID); @@ -211,7 +211,7 @@ getPageForToken( } bool -compareTokens(uint256 const& a, uint256 const& b) +compareTokens(UInt256 const& a, UInt256 const& b) { // The sort of NFTokens needs to be fully deterministic, but the sort // is weird because we sort on the low 96-bits first. But if the low @@ -228,7 +228,7 @@ TER changeTokenURI( ApplyView& view, AccountID const& owner, - uint256 const& nftokenID, + UInt256 const& nftokenID, std::optional const& uri) { SLE::pointer const page = locatePage(view, owner, nftokenID); @@ -295,7 +295,7 @@ insertToken(ApplyView& view, AccountID owner, STObject&& nft) } static bool -mergePages(ApplyView& view, SLE::ref p1, SLE::ref p2) +mergePages(ApplyView& view, SLE::Ref p1, SLE::Ref p2) { if (p1->key() >= p2->key()) Throw("mergePages: pages passed in out of order!"); @@ -354,7 +354,7 @@ mergePages(ApplyView& view, SLE::ref p1, SLE::ref p2) * Remove the token from the owner's token directory. */ TER -removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID) +removeToken(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID) { SLE::pointer const page = locatePage(view, owner, nftokenID); @@ -369,7 +369,7 @@ removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID) * Remove the token from the owner's token directory. */ TER -removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, SLE::ref curr) +removeToken(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID, SLE::Ref curr) { // We found a page, but the given NFT may not be in it. auto arr = curr->getFieldArray(sfNFTokens); @@ -385,7 +385,7 @@ removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, S } // Page management: - auto const loadPage = [&view](SLE::ref page1, SF_UINT256 const& field) { + auto const loadPage = [&view](SLE::Ref page1, SF_UINT256 const& field) { SLE::pointer page2; if (auto const id = (*page1)[~field]) @@ -520,7 +520,7 @@ removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, S } std::optional -findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID) +findToken(ReadView const& view, AccountID const& owner, UInt256 const& nftokenID) { SLE::const_pointer const page = locatePage(view, owner, nftokenID); @@ -539,7 +539,7 @@ findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID } std::optional -findTokenAndPage(ApplyView& view, AccountID const& owner, uint256 const& nftokenID) +findTokenAndPage(ApplyView& view, AccountID const& owner, UInt256 const& nftokenID) { SLE::pointer page = locatePage(view, owner, nftokenID); @@ -610,7 +610,7 @@ removeTokenOffersWithLimit(ApplyView& view, Keylet const& directory, std::size_t } bool -deleteTokenOffer(ApplyView& view, SLE::ref offer) +deleteTokenOffer(ApplyView& view, SLE::Ref offer) { if (offer->getType() != ltNFTOKEN_OFFER) return false; @@ -929,7 +929,7 @@ tokenOfferCreateApply( std::optional const& dest, std::optional const& expiration, SeqProxy seqProxy, - uint256 const& nftokenID, + UInt256 const& nftokenID, XRPAmount const& priorBalance, beast::Journal j, std::uint32_t txFlags) @@ -957,7 +957,7 @@ tokenOfferCreateApply( auto const offerNode = view.dirInsert( isSellOffer ? keylet::nftSells(nftokenID) : keylet::nftBuys(nftokenID), offerID, - [&nftokenID, isSellOffer](SLE::ref sle) { + [&nftokenID, isSellOffer](SLE::Ref sle) { (*sle)[sfFlags] = isSellOffer ? lsfNFTokenSellOffers : lsfNFTokenBuyOffers; (*sle)[sfNFTokenID] = nftokenID; }); diff --git a/src/libxrpl/ledger/helpers/OfferHelpers.cpp b/src/libxrpl/ledger/helpers/OfferHelpers.cpp index caa6ffb8ae..8b08568e75 100644 --- a/src/libxrpl/ledger/helpers/OfferHelpers.cpp +++ b/src/libxrpl/ledger/helpers/OfferHelpers.cpp @@ -15,7 +15,7 @@ namespace xrpl { TER -offerDelete(ApplyView& view, SLE::ref sle, beast::Journal j) +offerDelete(ApplyView& view, SLE::Ref sle, beast::Journal j) { if (!sle) return tesSUCCESS; @@ -23,7 +23,7 @@ offerDelete(ApplyView& view, SLE::ref sle, beast::Journal j) auto owner = sle->getAccountID(sfAccount); // Detect legacy directories. - uint256 const uDirectory = sle->getFieldH256(sfBookDirectory); + UInt256 const uDirectory = sle->getFieldH256(sfBookDirectory); if (!view.dirRemove(keylet::ownerDir(owner), sle->getFieldU64(sfOwnerNode), offerIndex, false)) { diff --git a/src/libxrpl/ledger/helpers/PaymentChannelHelpers.cpp b/src/libxrpl/ledger/helpers/PaymentChannelHelpers.cpp index d5a0b25681..b8e2538b40 100644 --- a/src/libxrpl/ledger/helpers/PaymentChannelHelpers.cpp +++ b/src/libxrpl/ledger/helpers/PaymentChannelHelpers.cpp @@ -22,7 +22,7 @@ namespace xrpl { TER -closeChannel(SLE::ref slep, ApplyView& view, uint256 const& key, beast::Journal j) +closeChannel(SLE::Ref slep, ApplyView& view, UInt256 const& key, beast::Journal j) { AccountID const src = (*slep)[sfAccount]; // Remove PayChan from owner directory diff --git a/src/libxrpl/ledger/helpers/PermissionedDEXHelpers.cpp b/src/libxrpl/ledger/helpers/PermissionedDEXHelpers.cpp index f8653f7111..4e000b2e3d 100644 --- a/src/libxrpl/ledger/helpers/PermissionedDEXHelpers.cpp +++ b/src/libxrpl/ledger/helpers/PermissionedDEXHelpers.cpp @@ -22,7 +22,7 @@ bool accountInDomain(ReadView const& view, AccountID const& account, Domain const& domainID) { // Avoid constructing a zero-key PermissionedDomain keylet. - // keylet::permissionedDomain(uint256) uses the DomainID as the ledger key. + // keylet::permissionedDomain(UInt256) uses the DomainID as the ledger key. if (view.rules().enabled(fixCleanup3_2_0) && domainID == beast::kZero) { // LCOV_EXCL_START @@ -56,7 +56,7 @@ accountInDomain(ReadView const& view, AccountID const& account, Domain const& do bool offerInDomain( ReadView const& view, - uint256 const& offerID, + UInt256 const& offerID, Domain const& domainID, beast::Journal j) { diff --git a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp index cc02b56305..497dc5a58f 100644 --- a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp +++ b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp @@ -184,8 +184,8 @@ trustCreate( bool const bSrcHigh, AccountID const& uSrcAccountID, AccountID const& uDstAccountID, - uint256 const& uIndex, // ripple state entry - SLE::ref sleAccount, // the account being set. + UInt256 const& uIndex, // ripple state entry + SLE::Ref sleAccount, // the account being set. bool const bAuth, // authorize account. bool const bNoRipple, // others cannot ripple through bool const bFreeze, // funds cannot leave @@ -196,7 +196,7 @@ trustCreate( // Issuer should be the account being set. std::uint32_t uQualityIn, std::uint32_t uQualityOut, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, beast::Journal j) { JLOG(j.trace()) << "trustCreate: " << to_string(uSrcAccountID) << ", " @@ -298,7 +298,7 @@ trustCreate( TER trustDelete( ApplyView& view, - SLE::ref sleRippleState, + SLE::Ref sleRippleState, AccountID const& uLowAccountID, AccountID const& uHighAccountID, beast::Journal j) @@ -399,7 +399,7 @@ issueIOU( AccountID const& account, STAmount const& amount, Issue const& issue, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, beast::Journal j) { XRPL_ASSERT( diff --git a/src/libxrpl/ledger/helpers/SponsorHelpers.cpp b/src/libxrpl/ledger/helpers/SponsorHelpers.cpp index 433a5f74b5..575e49a514 100644 --- a/src/libxrpl/ledger/helpers/SponsorHelpers.cpp +++ b/src/libxrpl/ledger/helpers/SponsorHelpers.cpp @@ -115,7 +115,7 @@ getTxReserveSponsor(ReadView const& view, STTx const& tx) } std::expected -getEffectiveTxReserveSponsor(ApplyViewContext ctx, SLE::const_ref accountSle) +getEffectiveTxReserveSponsor(ApplyViewContext ctx, SLE::ConstRef accountSle) { // A reserve sponsor only covers tx.Account's own objects. if (ctx.view.rules().enabled(fixCleanup3_2_0)) @@ -138,7 +138,7 @@ getEffectiveTxReserveSponsor(ApplyViewContext ctx, SLE::const_ref accountSle) } std::optional -getLedgerEntryReserveSponsorID(SLE::const_ref sle, SF_ACCOUNT const& field) +getLedgerEntryReserveSponsorID(SLE::ConstRef sle, SF_ACCOUNT const& field) { XRPL_ASSERT( (sle && @@ -152,7 +152,7 @@ getLedgerEntryReserveSponsorID(SLE::const_ref sle, SF_ACCOUNT const& field) } SLE::pointer -getLedgerEntryReserveSponsor(ApplyView& view, SLE::const_ref sle, SF_ACCOUNT const& field) +getLedgerEntryReserveSponsor(ApplyView& view, SLE::ConstRef sle, SF_ACCOUNT const& field) { auto const sponsorID = getLedgerEntryReserveSponsorID(sle, field); if (sponsorID) @@ -166,7 +166,7 @@ getLedgerEntryReserveSponsor(ApplyView& view, SLE::const_ref sle, SF_ACCOUNT con } void -addSponsorToLedgerEntry(SLE::ref sle, SLE::const_ref sponsorSle, SF_ACCOUNT const& field) +addSponsorToLedgerEntry(SLE::Ref sle, SLE::ConstRef sponsorSle, SF_ACCOUNT const& field) { XRPL_ASSERT( (sle->getType() == ltRIPPLE_STATE && (field == sfHighSponsor || field == sfLowSponsor)) || @@ -183,7 +183,7 @@ addSponsorToLedgerEntry(SLE::ref sle, SLE::const_ref sponsorSle, SF_ACCOUNT cons } void -addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::ref sle, SF_ACCOUNT const& field) +addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::Ref sle, SF_ACCOUNT const& field) { // getTxReserveSponsor yields a null pointer when the tx is not // reserve-sponsored, so addSponsorToLedgerEntry becomes a no-op then. The @@ -199,7 +199,7 @@ addSponsorToLedgerEntry(ApplyViewContext ctx, SLE::ref sle, SF_ACCOUNT const& fi } void -removeSponsorFromLedgerEntry(SLE::ref sle, SF_ACCOUNT const& field) +removeSponsorFromLedgerEntry(SLE::Ref sle, SF_ACCOUNT const& field) { XRPL_ASSERT( (sle->getType() == ltRIPPLE_STATE && (field == sfHighSponsor || field == sfLowSponsor)) || diff --git a/src/libxrpl/ledger/helpers/TokenHelpers.cpp b/src/libxrpl/ledger/helpers/TokenHelpers.cpp index 2c2c943a9f..0ced610ef2 100644 --- a/src/libxrpl/ledger/helpers/TokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/TokenHelpers.cpp @@ -326,7 +326,7 @@ getLineIfUsable( static STAmount getTrustLineBalance( ReadView const& view, - SLE::const_ref sle, + SLE::ConstRef sle, AccountID const& account, Currency const& currency, AccountID const& issuer, @@ -687,7 +687,7 @@ directSendNoFeeIOU( AccountID const& uReceiverID, STAmount const& saAmount, bool bCheckIssuer, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, beast::Journal j) { AccountID const& issuer = saAmount.getIssuer(); @@ -841,7 +841,7 @@ directSendNoLimitIOU( STAmount const& saAmount, STAmount& saActual, beast::Journal j, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, WaiveTransferFee waiveFee) { auto const& issuer = saAmount.getIssuer(); @@ -967,7 +967,7 @@ accountSendIOU( AccountID const& uReceiverID, STAmount const& saAmount, beast::Journal j, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, WaiveTransferFee waiveFee) { if (view.rules().enabled(fixAMMv1_1)) @@ -1544,7 +1544,7 @@ accountSend( AccountID const& uReceiverID, STAmount const& saAmount, beast::Journal j, - SLE::ref sponsorSle, + SLE::Ref sponsorSle, WaiveTransferFee waiveFee, AllowMPTOverflow allowOverflow) { diff --git a/src/libxrpl/ledger/helpers/VaultHelpers.cpp b/src/libxrpl/ledger/helpers/VaultHelpers.cpp index 941b94143d..efeb8976ee 100644 --- a/src/libxrpl/ledger/helpers/VaultHelpers.cpp +++ b/src/libxrpl/ledger/helpers/VaultHelpers.cpp @@ -25,7 +25,7 @@ namespace xrpl { [[nodiscard]] std::optional -assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& assets) +assetsToSharesDeposit(SLE::ConstRef vault, SLE::ConstRef issuance, STAmount const& assets) { XRPL_ASSERT(!assets.negative(), "xrpl::assetsToSharesDeposit : non-negative assets"); XRPL_ASSERT( @@ -49,7 +49,7 @@ assetsToSharesDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount co } [[nodiscard]] std::optional -sharesToAssetsDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount const& shares) +sharesToAssetsDeposit(SLE::ConstRef vault, SLE::ConstRef issuance, STAmount const& shares) { XRPL_ASSERT(!shares.negative(), "xrpl::sharesToAssetsDeposit : non-negative shares"); XRPL_ASSERT( @@ -72,7 +72,7 @@ sharesToAssetsDeposit(SLE::const_ref vault, SLE::const_ref issuance, STAmount co } [[nodiscard]] std::expected -clampToAssetsTotalScale(SLE::const_ref vault, STAmount const& delta) +clampToAssetsTotalScale(SLE::ConstRef vault, STAmount const& delta) { XRPL_ASSERT( delta.asset() == vault->at(sfAsset), @@ -131,7 +131,7 @@ clampToAssetsTotalScale(SLE::const_ref vault, STAmount const& delta) } [[nodiscard]] Number -assetsTotalForWithdrawal(SLE::const_ref vault, WaiveUnrealizedLoss waive) +assetsTotalForWithdrawal(SLE::ConstRef vault, WaiveUnrealizedLoss waive) { Number assetTotal = vault->at(sfAssetsTotal); if (waive == WaiveUnrealizedLoss::No) @@ -149,8 +149,8 @@ debitIsNonZeroDust(Asset const& asset, Number const& total, Number const& amount [[nodiscard]] std::optional assetsToSharesWithdraw( - SLE::const_ref vault, - SLE::const_ref issuance, + SLE::ConstRef vault, + SLE::ConstRef issuance, STAmount const& assets, TruncateShares truncate, WaiveUnrealizedLoss waive) @@ -176,8 +176,8 @@ assetsToSharesWithdraw( [[nodiscard]] std::optional sharesToAssetsWithdraw( - SLE::const_ref vault, - SLE::const_ref issuance, + SLE::ConstRef vault, + SLE::ConstRef issuance, STAmount const& shares, WaiveUnrealizedLoss waive) { @@ -198,7 +198,7 @@ sharesToAssetsWithdraw( } [[nodiscard]] bool -isSoleShareholder(ReadView const& view, AccountID const& account, SLE::const_ref issuance) +isSoleShareholder(ReadView const& view, AccountID const& account, SLE::ConstRef issuance) { XRPL_ASSERT( issuance && issuance->getType() == ltMPTOKEN_ISSUANCE, @@ -218,7 +218,7 @@ isSoleShareholder(ReadView const& view, AccountID const& account, SLE::const_ref } [[nodiscard]] VaultVersion -getVaultVersion(SLE::const_ref vault) +getVaultVersion(SLE::ConstRef vault) { XRPL_ASSERT(vault && vault->getType() == ltVAULT, "xrpl::getVaultVersion : valid Vault sle"); if (!vault->isFieldPresent(sfLEVersion)) @@ -248,7 +248,7 @@ decodeVaultKind(std::optional vaultKind) } // namespace [[nodiscard]] VaultKind -getVaultKind(SLE::const_ref vault) +getVaultKind(SLE::ConstRef vault) { XRPL_ASSERT(vault && vault->getType() == ltVAULT, "xrpl::getVaultKind : valid Vault sle"); return decodeVaultKind(vault->at(~sfVaultKind)); @@ -279,7 +279,7 @@ isValidClosedEndedGap(std::uint32_t sub, std::uint32_t red) } [[nodiscard]] VaultPhase -getVaultPhase(ReadView const& view, SLE::const_ref vault) +getVaultPhase(ReadView const& view, SLE::ConstRef vault) { XRPL_ASSERT(vault && vault->getType() == ltVAULT, "xrpl::getVaultPhase : valid Vault sle"); return getVaultPhase( @@ -308,7 +308,7 @@ getVaultPhase( [[nodiscard]] TER checkVaultDomain( ReadView const& view, - SLE::const_ref issuance, + SLE::ConstRef issuance, AccountID const& subject, SuppressExpired suppressExpired) { diff --git a/src/libxrpl/net/HTTPClient.cpp b/src/libxrpl/net/HTTPClient.cpp index 5edd8b5b47..5f6b2fde34 100644 --- a/src/libxrpl/net/HTTPClient.cpp +++ b/src/libxrpl/net/HTTPClient.cpp @@ -299,7 +299,7 @@ public: else if (ssl_) { socket_.asyncHandshake( - AutoSocket::ssl_socket::client, + AutoSocket::SslSocket::client, [self = shared_from_this()](boost::system::error_code const& ec) { self->handleRequest(ec); }); diff --git a/src/libxrpl/nodestore/Database.cpp b/src/libxrpl/nodestore/Database.cpp index f9de660042..5de46b0dae 100644 --- a/src/libxrpl/nodestore/Database.cpp +++ b/src/libxrpl/nodestore/Database.cpp @@ -176,7 +176,7 @@ Database::stop() void Database::asyncFetch( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, std::function const&)>&& cb) { @@ -229,7 +229,7 @@ Database::importInternal(Backend& dstBackend, Database& srcDB) // Perform a fetch and report the time it took std::shared_ptr Database::fetchNodeObject( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, FetchType fetchType, bool duplicate) diff --git a/src/libxrpl/nodestore/DatabaseNodeImp.cpp b/src/libxrpl/nodestore/DatabaseNodeImp.cpp index 1b880ac658..bc2b55210b 100644 --- a/src/libxrpl/nodestore/DatabaseNodeImp.cpp +++ b/src/libxrpl/nodestore/DatabaseNodeImp.cpp @@ -18,7 +18,7 @@ namespace xrpl::node_store { void -DatabaseNodeImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) +DatabaseNodeImp::store(NodeObjectType type, Blob&& data, UInt256 const& hash, std::uint32_t) { storeStats(1, data.size()); @@ -35,7 +35,7 @@ DatabaseNodeImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, st void DatabaseNodeImp::asyncFetch( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledgerSeq, std::function const&)>&& callback) { @@ -60,7 +60,7 @@ DatabaseNodeImp::sweep() std::shared_ptr DatabaseNodeImp::fetchNodeObject( - uint256 const& hash, + UInt256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index 81b1d6b297..184cf075ec 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -119,7 +119,7 @@ DatabaseRotatingImp::sync() } void -DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t) +DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, UInt256 const& hash, std::uint32_t) { auto nObj = NodeObject::createObject(type, std::move(data), hash); @@ -140,7 +140,7 @@ DatabaseRotatingImp::sweep() std::shared_ptr DatabaseRotatingImp::fetchNodeObject( - uint256 const& hash, + UInt256 const& hash, std::uint32_t, FetchReport& fetchReport, bool duplicate) diff --git a/src/libxrpl/nodestore/DecodedBlob.cpp b/src/libxrpl/nodestore/DecodedBlob.cpp index 321089d40f..165ec92c5c 100644 --- a/src/libxrpl/nodestore/DecodedBlob.cpp +++ b/src/libxrpl/nodestore/DecodedBlob.cpp @@ -63,7 +63,7 @@ DecodedBlob::createObject() { Blob data(objectData_, objectData_ + dataBytes_); - object = NodeObject::createObject(objectType_, std::move(data), uint256::fromVoid(key_)); + object = NodeObject::createObject(objectType_, std::move(data), UInt256::fromVoid(key_)); } return object; diff --git a/src/libxrpl/nodestore/NodeObject.cpp b/src/libxrpl/nodestore/NodeObject.cpp index 99432eb495..9935fbfeda 100644 --- a/src/libxrpl/nodestore/NodeObject.cpp +++ b/src/libxrpl/nodestore/NodeObject.cpp @@ -10,13 +10,13 @@ namespace xrpl { //------------------------------------------------------------------------------ -NodeObject::NodeObject(NodeObjectType type, Blob&& data, uint256 const& hash, PrivateAccess) +NodeObject::NodeObject(NodeObjectType type, Blob&& data, UInt256 const& hash, PrivateAccess) : type_(type), hash_(hash), data_(std::move(data)) { } std::shared_ptr -NodeObject::createObject(NodeObjectType type, Blob&& data, uint256 const& hash) +NodeObject::createObject(NodeObjectType type, Blob&& data, UInt256 const& hash) { return std::make_shared(type, std::move(data), hash, PrivateAccess()); } @@ -27,7 +27,7 @@ NodeObject::getType() const return type_; } -uint256 const& +UInt256 const& NodeObject::getHash() const { return hash_; diff --git a/src/libxrpl/nodestore/backend/MemoryFactory.cpp b/src/libxrpl/nodestore/backend/MemoryFactory.cpp index 39d2123bc9..3526f4fd44 100644 --- a/src/libxrpl/nodestore/backend/MemoryFactory.cpp +++ b/src/libxrpl/nodestore/backend/MemoryFactory.cpp @@ -32,7 +32,7 @@ struct MemoryDB std::mutex mutex; bool open = false; - std::map> table; + std::map> table; }; class MemoryFactory : public Factory @@ -83,7 +83,7 @@ registerMemoryFactory(Manager& manager) class MemoryBackend : public Backend { private: - using Map = std::map>; + using Map = std::map>; std::string name_; beast::Journal const journal_; @@ -130,7 +130,7 @@ public: //-------------------------------------------------------------------------- Status - fetch(uint256 const& hash, std::shared_ptr* pObject) override + fetch(UInt256 const& hash, std::shared_ptr* pObject) override { XRPL_ASSERT(db_, "xrpl::node_store::MemoryBackend::fetch : non-null database"); diff --git a/src/libxrpl/nodestore/backend/NuDBFactory.cpp b/src/libxrpl/nodestore/backend/NuDBFactory.cpp index 98173858e8..34a8da49b8 100644 --- a/src/libxrpl/nodestore/backend/NuDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/NuDBFactory.cpp @@ -206,7 +206,7 @@ public: } Status - fetch(uint256 const& hash, std::shared_ptr* pno) override + fetch(UInt256 const& hash, std::shared_ptr* pno) override { Status status = Status::Ok; pno->reset(); diff --git a/src/libxrpl/nodestore/backend/NullFactory.cpp b/src/libxrpl/nodestore/backend/NullFactory.cpp index feef3d37d0..86f8c67736 100644 --- a/src/libxrpl/nodestore/backend/NullFactory.cpp +++ b/src/libxrpl/nodestore/backend/NullFactory.cpp @@ -45,7 +45,7 @@ public: } Status - fetch(uint256 const&, std::shared_ptr*) override + fetch(UInt256 const&, std::shared_ptr*) override { return Status::NotFound; } diff --git a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp index 6f00b762b2..bde97957a0 100644 --- a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp @@ -275,7 +275,7 @@ public: //-------------------------------------------------------------------------- Status - fetch(uint256 const& hash, std::shared_ptr* pObject) override + fetch(UInt256 const& hash, std::shared_ptr* pObject) override { XRPL_ASSERT(db, "xrpl::node_store::RocksDBBackend::fetch : non-null database"); pObject->reset(); diff --git a/src/libxrpl/peerfinder/Bootcache.cpp b/src/libxrpl/peerfinder/Bootcache.cpp index 4f9b5fc816..f73a08d974 100644 --- a/src/libxrpl/peerfinder/Bootcache.cpp +++ b/src/libxrpl/peerfinder/Bootcache.cpp @@ -18,7 +18,7 @@ namespace xrpl::peer_finder { -Bootcache::Bootcache(Store& store, clock_type& clock, beast::Journal journal) +Bootcache::Bootcache(Store& store, ClockType& clock, beast::Journal journal) : store_(store), clock_(clock), journal_(journal), whenUpdate_(clock_.now()) { @@ -35,7 +35,7 @@ Bootcache::empty() const return map_.empty(); } -Bootcache::map_type::size_type +Bootcache::MapType::size_type Bootcache::size() const { return map_.size(); diff --git a/src/libxrpl/peerfinder/PeerfinderManager.cpp b/src/libxrpl/peerfinder/PeerfinderManager.cpp index 0cce2389ec..7c9b931cc4 100644 --- a/src/libxrpl/peerfinder/PeerfinderManager.cpp +++ b/src/libxrpl/peerfinder/PeerfinderManager.cpp @@ -37,7 +37,7 @@ public: // NOLINTBEGIN(readability-identifier-naming) boost::asio::io_context& io_context_; std::optional> work_; - clock_type& clock_; + ClockType& clock_; beast::Journal journal_; Store& store_; Checker checker_; @@ -48,10 +48,10 @@ public: ManagerImp( boost::asio::io_context& ioContext, - clock_type& clock, + ClockType& clock, beast::Journal journal, Store& store, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : io_context_(ioContext) , work_(std::in_place, boost::asio::make_work_guard(io_context_)) , clock_(clock) @@ -134,21 +134,21 @@ public: void onEndpoints(std::shared_ptr const& slot, Endpoints const& endpoints) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); logic_.onEndpoints(impl, endpoints); } void onClosed(std::shared_ptr const& slot) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); logic_.onClosed(impl); } void onFailure(std::shared_ptr const& slot) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); logic_.onFailure(impl); } @@ -166,21 +166,21 @@ public: onConnected(std::shared_ptr const& slot, beast::ip::Endpoint const& localEndpoint) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); return logic_.onConnected(impl, localEndpoint); } Result activate(std::shared_ptr const& slot, PublicKey const& key, bool reserved) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); return logic_.activate(impl, key, reserved); } std::vector redirect(std::shared_ptr const& slot) override { - SlotImp::ptr const impl(std::dynamic_pointer_cast(slot)); + SlotImp::Ptr const impl(std::dynamic_pointer_cast(slot)); return logic_.redirect(impl); } @@ -224,7 +224,7 @@ private: struct Stats { template - Stats(Handler const& handler, beast::insight::Collector::ptr const& collector) + Stats(Handler const& handler, beast::insight::Collector::Ptr const& collector) : hook(collector->makeHook(handler)) , activeInboundPeers(collector->makeGauge("Peer_Finder", "Active_Inbound_Peers")) , activeOutboundPeers(collector->makeGauge("Peer_Finder", "Active_Outbound_Peers")) @@ -257,10 +257,10 @@ Manager::Manager() noexcept : beast::PropertyStream::Source("peerfinder") std::unique_ptr makeManager( boost::asio::io_context& ioContext, - clock_type& clock, + ClockType& clock, beast::Journal journal, Store& store, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) { return std::make_unique(ioContext, clock, journal, store, collector); } diff --git a/src/libxrpl/peerfinder/SlotImp.cpp b/src/libxrpl/peerfinder/SlotImp.cpp index 5209bd51ab..de574d48dd 100644 --- a/src/libxrpl/peerfinder/SlotImp.cpp +++ b/src/libxrpl/peerfinder/SlotImp.cpp @@ -15,7 +15,7 @@ SlotImp::SlotImp( beast::ip::Endpoint const& localEndpoint, beast::ip::Endpoint remoteEndpoint, bool fixed, - clock_type& clock) + ClockType& clock) : recent(clock) , inbound_(true) , fixed_(fixed) @@ -30,7 +30,7 @@ SlotImp::SlotImp( { } -SlotImp::SlotImp(beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type& clock) +SlotImp::SlotImp(beast::ip::Endpoint remoteEndpoint, bool fixed, ClockType& clock) : recent(clock) , inbound_(false) , fixed_(fixed) @@ -78,7 +78,7 @@ SlotImp::state(State state) } void -SlotImp::activate(clock_type::time_point const& now) +SlotImp::activate(ClockType::time_point const& now) { // Can only become active from the accept or connected state XRPL_ASSERT( @@ -95,7 +95,7 @@ Slot::~Slot() = default; //------------------------------------------------------------------------------ -SlotImp::RecentT::RecentT(clock_type& clock) : cache_(clock) +SlotImp::RecentT::RecentT(ClockType& clock) : cache_(clock) { } diff --git a/src/libxrpl/protocol/AMMCore.cpp b/src/libxrpl/protocol/AMMCore.cpp index 52b7fe82c2..779e65bea2 100644 --- a/src/libxrpl/protocol/AMMCore.cpp +++ b/src/libxrpl/protocol/AMMCore.cpp @@ -32,7 +32,7 @@ ammLPTCurrency(Asset const& asset1, Asset const& asset2) // AMM LPToken is 0x03 plus 19 bytes of the hash static constexpr std::int32_t kAmmCurrencyCode = 0x03; auto const& [minA, maxA] = std::minmax(asset1, asset2); - uint256 const hash = std::visit( + UInt256 const hash = std::visit( [](auto&& issue1, auto&& issue2) { auto fromIss = [](T const& issue) { if constexpr (std::is_same_v) diff --git a/src/libxrpl/protocol/ConfidentialTransfer.cpp b/src/libxrpl/protocol/ConfidentialTransfer.cpp index a3e48b5f31..64a2b5128a 100644 --- a/src/libxrpl/protocol/ConfidentialTransfer.cpp +++ b/src/libxrpl/protocol/ConfidentialTransfer.cpp @@ -41,7 +41,7 @@ toAccountId(AccountID const& account) } mpt_issuance_id -toIssuanceId(uint192 const& issuance) +toIssuanceId(UInt192 const& issuance) { mpt_issuance_id res; std::memcpy(res.bytes, issuance.data(), kMPT_ISSUANCE_ID_SIZE); @@ -65,15 +65,15 @@ toParticipant(ConfidentialRecipient const& r) } // namespace -uint256 +UInt256 getSendContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, AccountID const& destination, std::uint32_t version) { - uint256 result; + UInt256 result; mpt_get_send_context_hash( toAccountId(account), toIssuanceId(issuanceID), @@ -84,14 +84,14 @@ getSendContextHash( return result; } -uint256 +UInt256 getClawbackContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, AccountID const& holder) { - uint256 result; + UInt256 result; mpt_get_clawback_context_hash( toAccountId(account), toIssuanceId(issuanceID), @@ -101,23 +101,23 @@ getClawbackContextHash( return result; } -uint256 -getConvertContextHash(AccountID const& account, uint192 const& issuanceID, std::uint32_t sequence) +UInt256 +getConvertContextHash(AccountID const& account, UInt192 const& issuanceID, std::uint32_t sequence) { - uint256 result; + UInt256 result; mpt_get_convert_context_hash( toAccountId(account), toIssuanceId(issuanceID), sequence, result.data()); return result; } -uint256 +UInt256 getConvertBackContextHash( AccountID const& account, - uint192 const& issuanceID, + UInt192 const& issuanceID, std::uint32_t sequence, std::uint32_t version) { - uint256 result; + UInt256 result; mpt_get_convert_back_context_hash( toAccountId(account), toIssuanceId(issuanceID), sequence, version, result.data()); return result; @@ -473,7 +473,7 @@ setMirrorEpochs(SLE const& issuance, SLE& mptoken) } TER -verifySchnorrProof(Slice const& pubKeySlice, Slice const& proofSlice, uint256 const& contextHash) +verifySchnorrProof(Slice const& pubKeySlice, Slice const& proofSlice, UInt256 const& contextHash) { if (proofSlice.size() != kEcSchnorrProofLength || pubKeySlice.size() != kEcPubKeyLength) { @@ -495,7 +495,7 @@ verifyClawbackProof( Slice const& proof, Slice const& pubKeySlice, Slice const& ciphertext, - uint256 const& contextHash) + UInt256 const& contextHash) { if (ciphertext.size() != kEcGamalEncryptedTotalLength || pubKeySlice.size() != kEcPubKeyLength || proof.size() != kEcClawbackProofLength) @@ -527,7 +527,7 @@ verifySendProof( Slice const& spendingBalance, Slice const& amountCommitment, Slice const& balanceCommitment, - uint256 const& contextHash) + UInt256 const& contextHash) { auto const recipientCount = getConfidentialRecipientCount(auditor.has_value()); if (proof.size() != kEcSendProofLength || sender.publicKey.size() != kEcPubKeyLength || @@ -597,7 +597,7 @@ verifyConvertBackProof( Slice const& spendingBalance, Slice const& balanceCommitment, uint64_t amount, - uint256 const& contextHash) + UInt256 const& contextHash) { if (proof.size() != kEcConvertBackProofLength || pubKeySlice.size() != kEcPubKeyLength || spendingBalance.size() != kEcGamalEncryptedTotalLength || diff --git a/src/libxrpl/protocol/Feature.cpp b/src/libxrpl/protocol/Feature.cpp index 2a8476dea8..06fcbe068b 100644 --- a/src/libxrpl/protocol/Feature.cpp +++ b/src/libxrpl/protocol/Feature.cpp @@ -24,7 +24,7 @@ namespace xrpl { inline std::size_t // NOLINTNEXTLINE(readability-identifier-naming) -hash_value(xrpl::uint256 const& feature) +hash_value(xrpl::UInt256 const& feature) { std::size_t seed = 0; using namespace boost; @@ -69,17 +69,17 @@ class FeatureCollections struct Feature { std::string name; - uint256 feature; + UInt256 feature; Feature() = delete; - explicit Feature(std::string name, uint256 const& feature) + explicit Feature(std::string name, UInt256 const& feature) : name(std::move(name)), feature(feature) { } // These structs are used by the `features` multi_index_container to // provide access to the features collection by size_t index, string - // name, and uint256 feature identifier + // name, and UInt256 feature identifier struct ByIndex { }; @@ -93,19 +93,19 @@ class FeatureCollections // Intermediate types to help with readability template - using feature_hashed_unique = boost::multi_index::hashed_unique< + using FeatureHashedUnique = boost::multi_index::hashed_unique< boost::multi_index::tag, boost::multi_index::member>; // Intermediate types to help with readability - using feature_indexing = boost::multi_index::indexed_by< + using FeatureIndexing = boost::multi_index::indexed_by< boost::multi_index::random_access>, - feature_hashed_unique, - feature_hashed_unique>; + FeatureHashedUnique, + FeatureHashedUnique>; // This multi_index_container provides access to the features collection by - // name, index, and uint256 feature identifier - boost::multi_index::multi_index_container features_; + // name, index, and UInt256 feature identifier + boost::multi_index::multi_index_container features_; std::map all_; std::map supported_; std::size_t upVotes_ = 0; @@ -113,7 +113,7 @@ class FeatureCollections mutable std::atomic readOnly_ = false; // These helper functions provide access to the features collection by name, - // index, and uint256 feature identifier, so the details of + // index, and UInt256 feature identifier, so the details of // multi_index_container can be hidden Feature const& getByIndex(size_t i) const @@ -131,7 +131,7 @@ class FeatureCollections return itTo - sequence.begin(); } Feature const* - getByFeature(uint256 const& feature) const + getByFeature(UInt256 const& feature) const { auto const& featureIndex = features_.get(); auto const featureIt = featureIndex.find(feature); @@ -148,10 +148,10 @@ class FeatureCollections public: FeatureCollections(); - std::optional + std::optional getRegisteredFeature(std::string const& name) const; - uint256 + UInt256 registerFeature(std::string const& name, Supported support, VoteBehavior vote); /** @@ -161,13 +161,13 @@ public: registrationIsDone(); std::size_t - featureToBitsetIndex(uint256 const& f) const; + featureToBitsetIndex(UInt256 const& f) const; - uint256 const& + UInt256 const& bitsetIndexToFeature(size_t i) const; std::string - featureToName(uint256 const& f) const; + featureToName(UInt256 const& f) const; /** * All amendments that are registered within the table. @@ -215,7 +215,7 @@ FeatureCollections::FeatureCollections() features_.reserve(xrpl::detail::kNumFeatures); } -std::optional +std::optional FeatureCollections::getRegisteredFeature(std::string const& name) const { XRPL_ASSERT( @@ -233,7 +233,7 @@ check(bool condition, char const* logicErrorMessage) logicError(logicErrorMessage); } -uint256 +UInt256 FeatureCollections::registerFeature(std::string const& name, Supported support, VoteBehavior vote) { check(!readOnly_, "Attempting to register a feature after startup."); @@ -292,7 +292,7 @@ FeatureCollections::registrationIsDone() } size_t -FeatureCollections::featureToBitsetIndex(uint256 const& f) const +FeatureCollections::featureToBitsetIndex(UInt256 const& f) const { XRPL_ASSERT( readOnly_.load(), "xrpl::FeatureCollections::featureToBitsetIndex : startup completed"); @@ -304,7 +304,7 @@ FeatureCollections::featureToBitsetIndex(uint256 const& f) const return getIndex(*feature); } -uint256 const& +UInt256 const& FeatureCollections::bitsetIndexToFeature(size_t i) const { XRPL_ASSERT( @@ -314,7 +314,7 @@ FeatureCollections::bitsetIndexToFeature(size_t i) const } std::string -FeatureCollections::featureToName(uint256 const& f) const +FeatureCollections::featureToName(UInt256 const& f) const { XRPL_ASSERT(readOnly_.load(), "xrpl::FeatureCollections::featureToName : startup completed"); Feature const* feature = getByFeature(f); @@ -365,13 +365,13 @@ detail::numUpVotedAmendments() //------------------------------------------------------------------------------ -std::optional +std::optional getRegisteredFeature(std::string const& name) { return gFeatureCollections.getRegisteredFeature(name); } -uint256 +UInt256 registerFeature(std::string const& name, Supported support, VoteBehavior vote) { return gFeatureCollections.registerFeature(name, support, vote); @@ -379,7 +379,7 @@ registerFeature(std::string const& name, Supported support, VoteBehavior vote) // Retired features are in the ledger and have no code controlled by the // feature. They need to be supported, but do not need to be voted on. -uint256 +UInt256 retireFeature(std::string const& name) { return registerFeature(name, Supported::Yes, VoteBehavior::Obsolete); @@ -395,19 +395,19 @@ registrationIsDone() } size_t -featureToBitsetIndex(uint256 const& f) +featureToBitsetIndex(UInt256 const& f) { return gFeatureCollections.featureToBitsetIndex(f); } -uint256 +UInt256 bitsetIndexToFeature(size_t i) { return gFeatureCollections.bitsetIndexToFeature(i); } std::string -featureToName(uint256 const& f) +featureToName(UInt256 const& f) { return gFeatureCollections.featureToName(f); } @@ -433,22 +433,22 @@ enforceValidFeatureName(auto fn) -> char const* } #define XRPL_FEATURE(name, supported, vote) \ - uint256 const feature##name = \ + UInt256 const feature##name = \ registerFeature(enforceValidFeatureName([] { return #name; }), supported, vote); #define XRPL_FIX(name, supported, vote) \ - uint256 const fix##name = \ + UInt256 const fix##name = \ registerFeature(enforceValidFeatureName([] { return "fix" #name; }), supported, vote); // clang-format off #define XRPL_RETIRE_FEATURE(name) \ [[deprecated("The referenced feature amendment has been retired")]] \ [[maybe_unused]] \ - uint256 const retiredFeature##name = retireFeature(#name); + UInt256 const retiredFeature##name = retireFeature(#name); #define XRPL_RETIRE_FIX(name) \ [[deprecated("The referenced fix amendment has been retired")]] \ [[maybe_unused]] \ - uint256 const retiredFix##name = retireFeature("fix" #name); + UInt256 const retiredFix##name = retireFeature("fix" #name); // clang-format on #include diff --git a/src/libxrpl/protocol/Indexes.cpp b/src/libxrpl/protocol/Indexes.cpp index aa1d3b0bb5..eda6c91027 100644 --- a/src/libxrpl/protocol/Indexes.cpp +++ b/src/libxrpl/protocol/Indexes.cpp @@ -113,13 +113,13 @@ enum class LedgerNameSpace : std::uint16_t { }; template -static uint256 +static UInt256 indexHash(LedgerNameSpace space, Args const&... args) { return sha512Half(safeCast(space), args...); } -uint256 +UInt256 getBookBase(Book const& book) { XRPL_ASSERT(isConsistent(book), "xrpl::getBookBase : input is consistent"); @@ -182,16 +182,16 @@ getBookBase(Book const& book) return k.key; } -uint256 -getQualityNext(uint256 const& uBase) +UInt256 +getQualityNext(UInt256 const& uBase) { - static constexpr uint256 kNextQuality( + static constexpr UInt256 kNextQuality( "0000000000000000000000000000000000000000000000010000000000000000"); return uBase + kNextQuality; } std::uint64_t -getQuality(uint256 const& uBase) +getQuality(UInt256 const& uBase) { // VFALCO [base_uint] This assumes a certain storage format // @@ -223,7 +223,7 @@ account(AccountID const& id) noexcept } Keylet -child(uint256 const& key) noexcept +child(UInt256 const& key) noexcept { return {ltCHILD, key}; } @@ -310,7 +310,7 @@ quality(Keylet const& k, std::uint64_t const q) noexcept // represent adjacent entries. We place the quality, in big endian format, // in the 8 right most bytes; this way, incrementing goes to the next entry // for indexes. - uint256 x = k.key; + UInt256 x = k.key; // Store the quality as a big-endian integer in the final 8 bytes. // store_big_u64 writes through unaligned byte storage (via memcpy) and @@ -382,7 +382,7 @@ depositPreauth( AccountID const& owner, std::set> const& authCreds) noexcept { - std::vector hashes; + std::vector hashes; hashes.reserve(authCreds.size()); for (auto const& o : authCreds) hashes.emplace_back(sha512Half(o.first, o.second)); @@ -394,7 +394,7 @@ depositPreauth( //------------------------------------------------------------------------------ Keylet -unchecked(uint256 const& key) noexcept +unchecked(UInt256 const& key) noexcept { return {ltANY, key}; } @@ -406,7 +406,7 @@ ownerDir(AccountID const& id) noexcept } Keylet -page(uint256 const& key, std::uint64_t const index) noexcept +page(UInt256 const& key, std::uint64_t const index) noexcept { if (index == 0) return {ltDIR_NODE, key}; @@ -431,19 +431,19 @@ nftokenPageMin(AccountID const& owner) { std::array buf{}; std::memcpy(buf.data(), owner.data(), owner.size()); - return {ltNFTOKEN_PAGE, uint256::fromRaw(buf)}; + return {ltNFTOKEN_PAGE, UInt256::fromRaw(buf)}; } Keylet nftokenPageMax(AccountID const& owner) { - uint256 id = nft::kPageMask; + UInt256 id = nft::kPageMask; std::memcpy(id.data(), owner.data(), owner.size()); return {ltNFTOKEN_PAGE, id}; } Keylet -nftokenPage(Keylet const& k, uint256 const& token) +nftokenPage(Keylet const& k, UInt256 const& token) { XRPL_ASSERT(k.type == ltNFTOKEN_PAGE, "xrpl::keylet::nftokenPage : valid input type"); return {ltNFTOKEN_PAGE, (k.key & ~nft::kPageMask) + (token & nft::kPageMask)}; @@ -456,13 +456,13 @@ nftokenOffer(AccountID const& owner, SeqProxy const& seq) } Keylet -nftBuys(uint256 const& id) noexcept +nftBuys(UInt256 const& id) noexcept { return {ltDIR_NODE, indexHash(LedgerNameSpace::NftokenBuyOffers, id)}; } Keylet -nftSells(uint256 const& id) noexcept +nftSells(UInt256 const& id) noexcept { return {ltDIR_NODE, indexHash(LedgerNameSpace::NftokenSellOffers, id)}; } @@ -502,7 +502,7 @@ amm(Asset const& asset1, Asset const& asset2) noexcept } Keylet -amm(uint256 const& id) noexcept +amm(UInt256 const& id) noexcept { return {ltAMM, id}; } @@ -576,7 +576,7 @@ mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept } Keylet -mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept +mptoken(UInt256 const& issuanceKey, AccountID const& holder) noexcept { return {ltMPTOKEN, indexHash(LedgerNameSpace::MPToken, issuanceKey, holder)}; } @@ -600,7 +600,7 @@ loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept } Keylet -loan(uint256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept +loan(UInt256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept { return loan(indexHash(LedgerNameSpace::Loan, loanBrokerID, loanSeq.value())); } @@ -614,7 +614,7 @@ permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept } Keylet -permissionedDomain(uint256 const& domainID) noexcept +permissionedDomain(UInt256 const& domainID) noexcept { return {ltPERMISSIONED_DOMAIN, domainID}; } diff --git a/src/libxrpl/protocol/LedgerHeader.cpp b/src/libxrpl/protocol/LedgerHeader.cpp index 9ddd6e180d..701424277f 100644 --- a/src/libxrpl/protocol/LedgerHeader.cpp +++ b/src/libxrpl/protocol/LedgerHeader.cpp @@ -56,7 +56,7 @@ deserializePrefixedHeader(Slice data, bool hasHash) return deserializeHeader(data + 4, hasHash); } -uint256 +UInt256 calculateLedgerHash(LedgerHeader const& info) { // VFALCO This has to match addRaw in View.h. diff --git a/src/libxrpl/protocol/NFTokenID.cpp b/src/libxrpl/protocol/NFTokenID.cpp index 729f052101..b4c22ef26d 100644 --- a/src/libxrpl/protocol/NFTokenID.cpp +++ b/src/libxrpl/protocol/NFTokenID.cpp @@ -37,14 +37,14 @@ canHaveNFTokenID(std::shared_ptr const& serializedTx, TxMeta const& return true; } -std::optional +std::optional getNFTokenIDFromPage(TxMeta const& transactionMeta) { // The metadata does not make it obvious which NFT was added. To figure // that out we gather up all of the previous NFT IDs and all of the final // NFT IDs and compare them to find what changed. - std::vector prevIDs; - std::vector finalIDs; + std::vector prevIDs; + std::vector finalIDs; for (STObject const& node : transactionMeta.getNodes()) { @@ -108,10 +108,10 @@ getNFTokenIDFromPage(TxMeta const& transactionMeta) return *diff.in1; } -std::vector +std::vector getNFTokenIDFromDeletedOffer(TxMeta const& transactionMeta) { - std::vector tokenIDResult; + std::vector tokenIDResult; for (STObject const& node : transactionMeta.getNodes()) { if (node.getFieldU16(sfLedgerEntryType) != ltNFTOKEN_OFFER || @@ -143,20 +143,20 @@ insertNFTokenID( // We extract the NFTokenID from metadata by comparing affected nodes if (auto const type = transaction->getTxnType(); type == ttNFTOKEN_MINT) { - std::optional result = getNFTokenIDFromPage(transactionMeta); + std::optional result = getNFTokenIDFromPage(transactionMeta); if (result.has_value()) response[jss::nftoken_id] = to_string(result.value()); } else if (type == ttNFTOKEN_ACCEPT_OFFER) { - std::vector result = getNFTokenIDFromDeletedOffer(transactionMeta); + std::vector result = getNFTokenIDFromDeletedOffer(transactionMeta); if (!result.empty()) response[jss::nftoken_id] = to_string(result.front()); } else if (type == ttNFTOKEN_CANCEL_OFFER) { - std::vector const result = getNFTokenIDFromDeletedOffer(transactionMeta); + std::vector const result = getNFTokenIDFromDeletedOffer(transactionMeta); response[jss::nftoken_ids] = json::Value(json::ValueType::Array); for (auto const& nftID : result) diff --git a/src/libxrpl/protocol/NFTokenOfferID.cpp b/src/libxrpl/protocol/NFTokenOfferID.cpp index ee39222bfa..ccdf99c9dd 100644 --- a/src/libxrpl/protocol/NFTokenOfferID.cpp +++ b/src/libxrpl/protocol/NFTokenOfferID.cpp @@ -36,7 +36,7 @@ canHaveNFTokenOfferID( return true; } -std::optional +std::optional getOfferIDFromCreatedOffer(TxMeta const& transactionMeta) { for (STObject const& node : transactionMeta.getNodes()) @@ -59,7 +59,7 @@ insertNFTokenOfferID( if (!canHaveNFTokenOfferID(transaction, transactionMeta)) return; - std::optional result = getOfferIDFromCreatedOffer(transactionMeta); + std::optional result = getOfferIDFromCreatedOffer(transactionMeta); if (result.has_value()) response[jss::offer_id] = to_string(result.value()); diff --git a/src/libxrpl/protocol/Permissions.cpp b/src/libxrpl/protocol/Permissions.cpp index a5adb294e9..1caf11d66c 100644 --- a/src/libxrpl/protocol/Permissions.cpp +++ b/src/libxrpl/protocol/Permissions.cpp @@ -208,7 +208,7 @@ Permission::hasGranularPermissions(TxType txType) const return granularTxTypes_.contains(txType); } -std::optional> +std::optional> Permission::getTxFeature(TxType txType) const { auto const it = txDelegationMap_.find(txType); @@ -216,7 +216,7 @@ Permission::getTxFeature(TxType txType) const it != txDelegationMap_.end(), "xrpl::Permission::getTxFeature : tx exists in txDelegationMap_"); - if (it->second.amendment == uint256{}) + if (it->second.amendment == UInt256{}) return std::nullopt; return std::optional{std::cref(it->second.amendment)}; @@ -229,7 +229,7 @@ Permission::isDelegable(std::uint32_t permissionValue, Rules const& rules) const return false; // LCOV_EXCL_LINE auto const amendmentEnabled = [&rules](TxDelegationEntry const& entry) { - return entry.amendment == uint256{} || rules.enabled(entry.amendment); + return entry.amendment == UInt256{} || rules.enabled(entry.amendment); }; // Granular permissions may authorize a limited subset of a tx type even diff --git a/src/libxrpl/protocol/PublicKey.cpp b/src/libxrpl/protocol/PublicKey.cpp index cb6ea9e851..43f5356360 100644 --- a/src/libxrpl/protocol/PublicKey.cpp +++ b/src/libxrpl/protocol/PublicKey.cpp @@ -112,14 +112,14 @@ sliceToHex(Slice const& slice) std::optional ecdsaCanonicality(Slice const& sig) { - using uint264 = boost::multiprecision::number>; - static uint264 const kG( + static UInt264 const kG( "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"); // NOLINT(readability-identifier-naming) // The format of a signature should be: @@ -134,11 +134,11 @@ ecdsaCanonicality(Slice const& sig) if (!r || !s || !p.empty()) return std::nullopt; - uint264 const rNum(sliceToHex(*r)); + UInt264 const rNum(sliceToHex(*r)); if (rNum >= kG) return std::nullopt; - uint264 const sNum(sliceToHex(*s)); + UInt264 const sNum(sliceToHex(*s)); if (sNum >= kG) return std::nullopt; @@ -223,7 +223,7 @@ publicKeyType(Slice const& slice) bool verifyDigest( PublicKey const& publicKey, - uint256 const& digest, + UInt256 const& digest, Slice const& sig, bool mustBeFullyCanonical) noexcept { diff --git a/src/libxrpl/protocol/Rules.cpp b/src/libxrpl/protocol/Rules.cpp index cb71133d8f..46cac859c7 100644 --- a/src/libxrpl/protocol/Rules.cpp +++ b/src/libxrpl/protocol/Rules.cpp @@ -109,18 +109,18 @@ createGuards( class Rules::Impl { private: - std::unordered_set> set_; - std::optional digest_; - std::unordered_set> const& presets_; + std::unordered_set> set_; + std::optional digest_; + std::unordered_set> const& presets_; public: - explicit Impl(std::unordered_set> const& presets) : presets_(presets) + explicit Impl(std::unordered_set> const& presets) : presets_(presets) { } Impl( - std::unordered_set> const& presets, - std::optional const& digest, + std::unordered_set> const& presets, + std::optional const& digest, STVector256 const& amendments) : digest_(digest), presets_(presets) { @@ -128,14 +128,14 @@ public: set_.insert(amendments.begin(), amendments.end()); } - [[nodiscard]] std::unordered_set> const& + [[nodiscard]] std::unordered_set> const& presets() const { return presets_; } [[nodiscard]] bool - enabled(uint256 const& feature) const + enabled(UInt256 const& feature) const { if (presets_.contains(feature)) return true; @@ -157,27 +157,27 @@ public: } }; -Rules::Rules(std::unordered_set> const& presets) +Rules::Rules(std::unordered_set> const& presets) : impl_(std::make_shared(presets)) { } Rules::Rules( - std::unordered_set> const& presets, - std::optional const& digest, + std::unordered_set> const& presets, + std::optional const& digest, STVector256 const& amendments) : impl_(std::make_shared(presets, digest, amendments)) { } -std::unordered_set> const& +std::unordered_set> const& Rules::presets() const { return impl_->presets(); } bool -Rules::enabled(uint256 const& feature) const +Rules::enabled(UInt256 const& feature) const { XRPL_ASSERT(impl_, "xrpl::Rules::enabled : initialized"); @@ -194,7 +194,7 @@ Rules::operator==(Rules const& other) const } bool -isFeatureEnabled(uint256 const& feature, bool resultIfNoRules) +isFeatureEnabled(UInt256 const& feature, bool resultIfNoRules) { auto const& rules = getCurrentTransactionRules(); if (!rules) @@ -203,7 +203,7 @@ isFeatureEnabled(uint256 const& feature, bool resultIfNoRules) } bool -isFeatureEnabled(uint256 const& feature) +isFeatureEnabled(UInt256 const& feature) { return isFeatureEnabled(feature, false); } diff --git a/src/libxrpl/protocol/STAccount.cpp b/src/libxrpl/protocol/STAccount.cpp index da8b233c61..64cd184290 100644 --- a/src/libxrpl/protocol/STAccount.cpp +++ b/src/libxrpl/protocol/STAccount.cpp @@ -35,11 +35,11 @@ STAccount::STAccount(SField const& n, Buffer const& v) : STAccount(n) // STVar::STVar (SerialIter&, SField const&) // which throws. If STVar can throw in its constructor, then so can // STAccount. - if (v.size() != uint160::kBytes) + if (v.size() != UInt160::kBytes) Throw("Invalid STAccount size"); default_ = false; - memcpy(value_.begin(), v.data(), uint160::kBytes); + memcpy(value_.begin(), v.data(), UInt160::kBytes); } STAccount::STAccount(SerialIter& sit, SField const& name) : STAccount(name, sit.getVLBuffer()) @@ -77,7 +77,7 @@ STAccount::add(Serializer& s) const // Preserve the serialization behavior of an STBlob: // o If we are default (all zeros) serialize as an empty blob. // o Otherwise serialize 160 bits. - int const size = isDefault() ? 0 : uint160::kBytes; + int const size = isDefault() ? 0 : UInt160::kBytes; s.addVL(value_.data(), size); } diff --git a/src/libxrpl/protocol/STLedgerEntry.cpp b/src/libxrpl/protocol/STLedgerEntry.cpp index 9ee8d030ff..748183ea81 100644 --- a/src/libxrpl/protocol/STLedgerEntry.cpp +++ b/src/libxrpl/protocol/STLedgerEntry.cpp @@ -45,14 +45,14 @@ STLedgerEntry::STLedgerEntry(Keylet const& k) : STObject(sfLedgerEntry), key_(k. setFieldU16(sfLedgerEntryType, static_cast(type_)); } -STLedgerEntry::STLedgerEntry(SerialIter& sit, uint256 const& index) +STLedgerEntry::STLedgerEntry(SerialIter& sit, UInt256 const& index) : STObject(sfLedgerEntry), key_(index), type_(ltANY) { set(sit); setSLEType(); } -STLedgerEntry::STLedgerEntry(STObject const& object, uint256 const& index) +STLedgerEntry::STLedgerEntry(STObject const& object, UInt256 const& index) : STObject(object), key_(index), type_(ltANY) { setSLEType(); @@ -143,12 +143,12 @@ STLedgerEntry::isThreadedType(Rules const& rules) const bool STLedgerEntry::thread( - uint256 const& txID, + UInt256 const& txID, std::uint32_t ledgerSeq, - uint256& prevTxID, + UInt256& prevTxID, std::uint32_t& prevLedgerID) { - uint256 const oldPrevTxID = getFieldH256(sfPreviousTxnID); + UInt256 const oldPrevTxID = getFieldH256(sfPreviousTxnID); JLOG(debugLog().info()) << "Thread Tx:" << txID << " prev:" << oldPrevTxID; diff --git a/src/libxrpl/protocol/STObject.cpp b/src/libxrpl/protocol/STObject.cpp index 4447a69457..d3050cd844 100644 --- a/src/libxrpl/protocol/STObject.cpp +++ b/src/libxrpl/protocol/STObject.cpp @@ -371,7 +371,7 @@ STObject::isEquivalent(STBase const& t) const }); } -uint256 +UInt256 STObject::getHash(HashPrefix prefix) const { Serializer s; @@ -380,7 +380,7 @@ STObject::getHash(HashPrefix prefix) const return s.getSHA512Half(); } -uint256 +UInt256 STObject::getSigningHash(HashPrefix prefix) const { Serializer s; @@ -609,25 +609,25 @@ STObject::getFieldU64(SField const& field) const return getFieldByValue(field); } -uint128 +UInt128 STObject::getFieldH128(SField const& field) const { return getFieldByValue(field); } -uint160 +UInt160 STObject::getFieldH160(SField const& field) const { return getFieldByValue(field); } -uint192 +UInt192 STObject::getFieldH192(SField const& field) const { return getFieldByValue(field); } -uint256 +UInt256 STObject::getFieldH256(SField const& field) const { return getFieldByValue(field); @@ -752,19 +752,19 @@ STObject::setFieldU64(SField const& field, std::uint64_t v) } void -STObject::setFieldH128(SField const& field, uint128 const& v) +STObject::setFieldH128(SField const& field, UInt128 const& v) { setFieldUsingSetValue(field, v); } void -STObject::setFieldH192(SField const& field, uint192 const& v) +STObject::setFieldH192(SField const& field, UInt192 const& v) { setFieldUsingSetValue(field, v); } void -STObject::setFieldH256(SField const& field, uint256 const& v) +STObject::setFieldH256(SField const& field, UInt256 const& v) { setFieldUsingSetValue(field, v); } diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index 6ab272b3d1..05ca333560 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -520,7 +520,7 @@ parseLeaf( return ret; } - uint128 num; + UInt128 num; if (auto const s = value.asString(); !num.parseHex(s)) { @@ -544,7 +544,7 @@ parseLeaf( return ret; } - uint160 num; + UInt160 num; if (auto const s = value.asString(); !num.parseHex(s)) { @@ -568,7 +568,7 @@ parseLeaf( return ret; } - uint192 num; + UInt192 num; if (auto const s = value.asString(); !num.parseHex(s)) { @@ -592,7 +592,7 @@ parseLeaf( return ret; } - uint256 num; + UInt256 num; if (auto const s = value.asString(); !num.parseHex(s)) { @@ -720,7 +720,7 @@ parseLeaf( STVector256 tail(field); for (json::UInt i = 0; value.isValidIndex(i); ++i) { - uint256 s; + UInt256 s; if (!s.parseHex(value[i].asString())) Throw("invalid data"); tail.pushBack(s); diff --git a/src/libxrpl/protocol/STPathSet.cpp b/src/libxrpl/protocol/STPathSet.cpp index 2c074c3f2f..a9764b06d2 100644 --- a/src/libxrpl/protocol/STPathSet.cpp +++ b/src/libxrpl/protocol/STPathSet.cpp @@ -74,7 +74,7 @@ static_assert( "should, if the kMaxSize should be increased, or if STPathSet should be stored on the heap " "instead of in STVar."); -STPathSet::STPathSet(DeduplicationTag) : seen_{std::make_unique>()} +STPathSet::STPathSet(DeduplicationTag) : seen_{std::make_unique>()} { } @@ -83,7 +83,7 @@ STPathSet::STPathSet(STPathSet const& other) , CountedObject{other} , value_{other.value_} , seen_{ - other.seen_ != nullptr ? std::make_unique>(*other.seen_) + other.seen_ != nullptr ? std::make_unique>(*other.seen_) : nullptr} { } @@ -95,9 +95,8 @@ STPathSet::operator=(STPathSet const& other) { return *this; } - auto newSeen = other.seen_ != nullptr - ? std::make_unique>(*other.seen_) - : nullptr; + auto newSeen = + other.seen_ != nullptr ? std::make_unique>(*other.seen_) : nullptr; STBase::operator=(other); CountedObject::operator=(other); value_ = other.value_; diff --git a/src/libxrpl/protocol/STTx.cpp b/src/libxrpl/protocol/STTx.cpp index 3db6a3dc6c..0f6e56c86b 100644 --- a/src/libxrpl/protocol/STTx.cpp +++ b/src/libxrpl/protocol/STTx.cpp @@ -176,7 +176,7 @@ getSigningData(STTx const& that, HashPrefix prefix) return s.getData(); } -uint256 +UInt256 STTx::getSigningHash() const { return STObject::getSigningHash(HashPrefix::TxSign); @@ -468,7 +468,7 @@ STTx::checkSingleSign(STObject const& sigObject, HashPrefix prefix) const } std::expected -STTx::checkBatchSingleSign(STObject const& batchSigner, std::vector const& txIds) const +STTx::checkBatchSingleSign(STObject const& batchSigner, std::vector const& txIds) const { XRPL_ASSERT(getTxnType() == ttBATCH, "STTx::checkBatchSingleSign : batch transaction"); Serializer msg; @@ -554,7 +554,7 @@ multiSignHelper( } std::expected -STTx::checkBatchMultiSign(STObject const& batchSigner, std::vector const& txIds) const +STTx::checkBatchMultiSign(STObject const& batchSigner, std::vector const& txIds) const { XRPL_ASSERT(getTxnType() == ttBATCH, "STTx::checkBatchMultiSign : batch transaction"); // We can ease the computational load inside the loop a bit by @@ -634,11 +634,11 @@ STTx::buildBatchTxns() } } -std::vector +std::vector STTx::getBatchTransactionIDs() const { auto const& txns = getBatchTransactions(); - std::vector ids; + std::vector ids; ids.reserve(txns.size()); for (auto const& stx : txns) ids.push_back(stx->getTransactionID()); diff --git a/src/libxrpl/protocol/STValidation.cpp b/src/libxrpl/protocol/STValidation.cpp index 1fad610c83..6267c6f110 100644 --- a/src/libxrpl/protocol/STValidation.cpp +++ b/src/libxrpl/protocol/STValidation.cpp @@ -71,19 +71,19 @@ STValidation::validationFormat() return kFormat; }; -uint256 +UInt256 STValidation::getSigningHash() const { return STObject::getSigningHash(HashPrefix::Validation); } -uint256 +UInt256 STValidation::getLedgerHash() const { return getFieldH256(sfLedgerHash); } -uint256 +UInt256 STValidation::getConsensusHash() const { return getFieldH256(sfConsensusHash); diff --git a/src/libxrpl/protocol/STVector256.cpp b/src/libxrpl/protocol/STVector256.cpp index 877e34c73c..f577ba20e8 100644 --- a/src/libxrpl/protocol/STVector256.cpp +++ b/src/libxrpl/protocol/STVector256.cpp @@ -19,18 +19,18 @@ STVector256::STVector256(SerialIter& sit, SField const& name) : STBase(name) { auto const slice = sit.getSlice(sit.getVLDataLength()); - if (slice.size() % uint256::size() != 0) + if (slice.size() % UInt256::size() != 0) { Throw( "Bad serialization for STVector256: " + std::to_string(slice.size())); } - auto const cnt = slice.size() / uint256::size(); + auto const cnt = slice.size() / UInt256::size(); value_.reserve(cnt); for (std::size_t i = 0; i != cnt; ++i) - value_.push_back(uint256::fromRaw(slice.substr(i * uint256::size(), uint256::size()))); + value_.push_back(UInt256::fromRaw(slice.substr(i * UInt256::size(), UInt256::size()))); } STBase* diff --git a/src/libxrpl/protocol/SecretKey.cpp b/src/libxrpl/protocol/SecretKey.cpp index 7713911ab4..42434dbbc0 100644 --- a/src/libxrpl/protocol/SecretKey.cpp +++ b/src/libxrpl/protocol/SecretKey.cpp @@ -64,7 +64,7 @@ copyUInt32(std::uint8_t* out, std::uint32_t v) *out = v & 0xff; } -uint256 +UInt256 deriveDeterministicRootKey(Seed const& seed) { // We fill this buffer with the seed and append a 32-bit "counter" @@ -121,10 +121,10 @@ deriveDeterministicRootKey(Seed const& seed) class Generator { private: - uint256 root_; + UInt256 root_; std::array generator_{}; - [[nodiscard]] uint256 + [[nodiscard]] UInt256 calculateTweak(std::uint32_t seq) const { // We fill the buffer with the generator, the provided sequence @@ -205,7 +205,7 @@ public: } // namespace detail Buffer -signDigest(PublicKey const& pk, SecretKey const& sk, uint256 const& digest) +signDigest(PublicKey const& pk, SecretKey const& sk, UInt256 const& digest) { if (publicKeyType(pk.slice()) != KeyType::Secp256k1) logicError("sign: secp256k1 required for digest signing"); @@ -243,9 +243,9 @@ sign(PublicKey const& pk, SecretKey const& sk, Slice const& m) return b; } case KeyType::Secp256k1: { - sha512_half_hasher h; + Sha512HalfHasher h; h(m.data(), m.size()); - auto const digest = sha512_half_hasher::result_type(h); + auto const digest = Sha512HalfHasher::result_type(h); secp256k1_ecdsa_signature sigImp; if (secp256k1_ecdsa_sign( diff --git a/src/libxrpl/protocol/Seed.cpp b/src/libxrpl/protocol/Seed.cpp index 42b2e85498..eaba4533cd 100644 --- a/src/libxrpl/protocol/Seed.cpp +++ b/src/libxrpl/protocol/Seed.cpp @@ -35,7 +35,7 @@ Seed::Seed(Slice const& slice) std::memcpy(buf_.data(), slice.data(), buf_.size()); } -Seed::Seed(uint128 const& seed) +Seed::Seed(UInt128 const& seed) { if (seed.size() != buf_.size()) logicError("Seed::Seed: invalid size"); @@ -57,9 +57,9 @@ randomSeed() Seed generateSeed(std::string const& passPhrase) { - sha512_half_hasher_s h; + Sha512HalfHasherS h; h(passPhrase.data(), passPhrase.size()); - auto const digest = sha512_half_hasher::result_type(h); + auto const digest = Sha512HalfHasher::result_type(h); return Seed({digest.data(), 16}); } @@ -90,7 +90,7 @@ parseGenericSeed(std::string const& str, bool rfc1751) } { - uint128 seed; + UInt128 seed; if (seed.parseHex(str)) return Seed{Slice(seed.data(), seed.size())}; @@ -105,7 +105,7 @@ parseGenericSeed(std::string const& str, bool rfc1751) if (RFC1751::getKeyFromEnglish(key, str) == 1) { Blob const blob(key.rbegin(), key.rend()); - return Seed{uint128::fromRaw(blob)}; + return Seed{UInt128::fromRaw(blob)}; } } diff --git a/src/libxrpl/protocol/Serializer.cpp b/src/libxrpl/protocol/Serializer.cpp index 7f6fe625c2..595fbc71da 100644 --- a/src/libxrpl/protocol/Serializer.cpp +++ b/src/libxrpl/protocol/Serializer.cpp @@ -170,7 +170,7 @@ Serializer::chop(int bytes) return true; } -uint256 +UInt256 Serializer::getSHA512Half() const { return sha512Half(makeSlice(data_)); diff --git a/src/libxrpl/protocol/TxMeta.cpp b/src/libxrpl/protocol/TxMeta.cpp index b743598a76..cb7900bfe2 100644 --- a/src/libxrpl/protocol/TxMeta.cpp +++ b/src/libxrpl/protocol/TxMeta.cpp @@ -22,7 +22,7 @@ namespace xrpl { -TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj) +TxMeta::TxMeta(UInt256 const& txid, std::uint32_t ledger, STObject const& obj) : transactionID_(txid) , ledgerSeq_(ledger) , index_(obj.getFieldU32(sfTransactionIndex)) @@ -36,7 +36,7 @@ TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj) setAdditionalFields(obj); } -TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, Blob const& vec) +TxMeta::TxMeta(UInt256 const& txid, std::uint32_t ledger, Blob const& vec) : transactionID_(txid), ledgerSeq_(ledger), nodes_(sfAffectedNodes, 32) { SerialIter sit(makeSlice(vec)); @@ -49,7 +49,7 @@ TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, Blob const& vec) setAdditionalFields(obj); } -TxMeta::TxMeta(uint256 const& transactionID, std::uint32_t ledger) +TxMeta::TxMeta(UInt256 const& transactionID, std::uint32_t ledger) : transactionID_(transactionID) , ledgerSeq_(ledger) , index_(std::numeric_limits::max()) @@ -60,7 +60,7 @@ TxMeta::TxMeta(uint256 const& transactionID, std::uint32_t ledger) } void -TxMeta::setAffectedNode(uint256 const& node, SField const& type, std::uint16_t nodeType) +TxMeta::setAffectedNode(UInt256 const& node, SField const& type, std::uint16_t nodeType) { // make sure the node exists and force its type for (auto& n : nodes_) @@ -146,9 +146,9 @@ TxMeta::getAffectedAccounts() const } STObject& -TxMeta::getAffectedNode(SLE::ref node, SField const& type) +TxMeta::getAffectedNode(SLE::Ref node, SField const& type) { - uint256 const index = node->key(); + UInt256 const index = node->key(); for (auto& n : nodes_) { if (n.getFieldH256(sfLedgerIndex) == index) @@ -158,7 +158,7 @@ TxMeta::getAffectedNode(SLE::ref node, SField const& type) STObject& obj = nodes_.back(); XRPL_ASSERT( - obj.getFName() == type, "xrpl::TxMeta::getAffectedNode(SLE::ref) : field type match"); + obj.getFName() == type, "xrpl::TxMeta::getAffectedNode(SLE::Ref) : field type match"); obj.setFieldH256(sfLedgerIndex, index); obj.setFieldU16(sfLedgerEntryType, node->getFieldU16(sfLedgerEntryType)); @@ -166,7 +166,7 @@ TxMeta::getAffectedNode(SLE::ref node, SField const& type) } STObject& -TxMeta::getAffectedNode(uint256 const& node) +TxMeta::getAffectedNode(UInt256 const& node) { for (auto& n : nodes_) { @@ -174,7 +174,7 @@ TxMeta::getAffectedNode(uint256 const& node) return n; } // LCOV_EXCL_START - UNREACHABLE("xrpl::TxMeta::getAffectedNode(uint256) : node not found"); + UNREACHABLE("xrpl::TxMeta::getAffectedNode(UInt256) : node not found"); Throw("Affected node not found"); return *(nodes_.begin()); // Silence compiler warning. // LCOV_EXCL_STOP diff --git a/src/libxrpl/protocol/tokens.cpp b/src/libxrpl/protocol/tokens.cpp index bd0f54c3ae..7987173fcf 100644 --- a/src/libxrpl/protocol/tokens.cpp +++ b/src/libxrpl/protocol/tokens.cpp @@ -173,7 +173,7 @@ digest2(Args const&... args) static void checksum(void* out, void const* message, std::size_t size) { - auto const h = digest2(message, size); + auto const h = digest2(message, size); std::memcpy(out, h.data(), 4); } diff --git a/src/libxrpl/resource/ResourceManager.cpp b/src/libxrpl/resource/ResourceManager.cpp index cdfa95facd..001ac8fa8b 100644 --- a/src/libxrpl/resource/ResourceManager.cpp +++ b/src/libxrpl/resource/ResourceManager.cpp @@ -36,7 +36,7 @@ private: std::condition_variable cond_; public: - ManagerImp(beast::insight::Collector::ptr const& collector, beast::Journal journal) + ManagerImp(beast::insight::Collector::Ptr const& collector, beast::Journal journal) : journal_(journal), logic_(collector, stopwatch(), journal) { thread_ = std::thread{&ManagerImp::run, this}; @@ -159,7 +159,7 @@ Manager::~Manager() = default; //------------------------------------------------------------------------------ std::unique_ptr -makeManager(beast::insight::Collector::ptr const& collector, beast::Journal journal) +makeManager(beast::insight::Collector::Ptr const& collector, beast::Journal journal) { return std::make_unique(collector, journal); } diff --git a/src/libxrpl/server/InfoSub.cpp b/src/libxrpl/server/InfoSub.cpp index bd50b1311c..c2e720cc39 100644 --- a/src/libxrpl/server/InfoSub.cpp +++ b/src/libxrpl/server/InfoSub.cpp @@ -159,16 +159,16 @@ InfoSub::totalSubscriptionCount() const bool InfoSub::tryReserveAccountSubscriptions( - hash_set const& proposedAccounts, - hash_set const& normalAccounts, + HashSet const& proposedAccounts, + HashSet const& normalAccounts, std::size_t cap) { // One lock hold covers the count, the check and the insert. std::scoped_lock const sl(lock_); // Entries not already tracked; re-subscribing held accounts is not charged. - auto const countNew = [](hash_set const& requested, - hash_set const& existing) { + auto const countNew = [](HashSet const& requested, + HashSet const& existing) { std::size_t fresh = 0; for (auto const& account : requested) { diff --git a/src/libxrpl/server/Manifest.cpp b/src/libxrpl/server/Manifest.cpp index c85c8445f0..0bedffcfce 100644 --- a/src/libxrpl/server/Manifest.cpp +++ b/src/libxrpl/server/Manifest.cpp @@ -213,7 +213,7 @@ Manifest::verify() const return xrpl::verify(st, HashPrefix::Manifest, masterKey, sfMasterSignature); } -uint256 +UInt256 Manifest::hash() const { STObject st(sfGeneric); diff --git a/src/libxrpl/server/Wallet.cpp b/src/libxrpl/server/Wallet.cpp index 56d0db67d4..b5cf649aad 100644 --- a/src/libxrpl/server/Wallet.cpp +++ b/src/libxrpl/server/Wallet.cpp @@ -105,7 +105,7 @@ saveManifests( soci::session& session, std::string const& dbTable, std::function const& isTrusted, - hash_map const& map, + HashMap const& map, beast::Journal j) { soci::transaction tr(session); @@ -299,7 +299,7 @@ readAmendments( void voteAmendment( soci::session& session, - uint256 const& amendment, + UInt256 const& amendment, std::string const& name, AmendmentVote vote) { diff --git a/src/libxrpl/shamap/SHAMap.cpp b/src/libxrpl/shamap/SHAMap.cpp index 827bc4a591..6d5d5cec5d 100644 --- a/src/libxrpl/shamap/SHAMap.cpp +++ b/src/libxrpl/shamap/SHAMap.cpp @@ -67,7 +67,7 @@ SHAMap::SHAMap(SHAMapType t, Family& f) // from the parameters that this is the constructor to use when the hash is // known. The fact that the parameter is unused is an implementation detail that // should not change the interface. -SHAMap::SHAMap(SHAMapType t, uint256 const& hash, Family& f) +SHAMap::SHAMap(SHAMapType t, UInt256 const& hash, Family& f) : f_(f), journal_(f.journal()), state_(SHAMapState::Synching), type_(t) { root_ = intr_ptr::makeShared(cowid_); @@ -97,7 +97,7 @@ SHAMap::snapShot(bool isMutable) const } void -SHAMap::dirtyUp(NodePathStack& stack, uint256 const& target, SHAMapTreeNodePtr child) +SHAMap::dirtyUp(NodePathStack& stack, UInt256 const& target, SHAMapTreeNodePtr child) { // walk the tree up from through the inner nodes to the root_ // update hashes and links @@ -126,7 +126,7 @@ SHAMap::dirtyUp(NodePathStack& stack, uint256 const& target, SHAMapTreeNodePtr c } SHAMapLeafNode* -SHAMap::walkTowardsKey(uint256 const& id, NodePathStack* stack) const +SHAMap::walkTowardsKey(UInt256 const& id, NodePathStack* stack) const { XRPL_ASSERT( stack == nullptr || stack->empty(), "xrpl::SHAMap::walkTowardsKey : empty stack input"); @@ -158,7 +158,7 @@ SHAMap::walkTowardsKey(uint256 const& id, NodePathStack* stack) const } SHAMapLeafNode* -SHAMap::findKey(uint256 const& id) const +SHAMap::findKey(UInt256 const& id) const { SHAMapLeafNode* leaf = walkTowardsKey(id); // NOLINT(misc-const-correctness) if ((leaf != nullptr) && leaf->peekItem()->key() != id) @@ -379,7 +379,7 @@ SHAMap::descendAsync( unsigned int branch, SHAMapSyncFilter const* filter, bool& pending, - descendCallback&& callback) const + DescendCallback&& callback) const { pending = false; @@ -523,7 +523,7 @@ SHAMap::peekFirstItem(NodePathStack& stack) const } SHAMapLeafNode const* -SHAMap::peekNextItem(uint256 const& id, NodePathStack& stack) const +SHAMap::peekNextItem(UInt256 const& id, NodePathStack& stack) const { XRPL_ASSERT(!stack.empty(), "xrpl::SHAMap::peekNextItem : non-empty stack input"); XRPL_ASSERT(stack.top().first->isLeaf(), "xrpl::SHAMap::peekNextItem : stack starts with leaf"); @@ -552,7 +552,7 @@ SHAMap::peekNextItem(uint256 const& id, NodePathStack& stack) const } boost::intrusive_ptr const& -SHAMap::peekItem(uint256 const& id) const +SHAMap::peekItem(UInt256 const& id) const { SHAMapLeafNode const* leaf = findKey(id); @@ -563,7 +563,7 @@ SHAMap::peekItem(uint256 const& id) const } boost::intrusive_ptr const& -SHAMap::peekItem(uint256 const& id, SHAMapHash& hash) const +SHAMap::peekItem(UInt256 const& id, SHAMapHash& hash) const { SHAMapLeafNode const* leaf = findKey(id); @@ -575,7 +575,7 @@ SHAMap::peekItem(uint256 const& id, SHAMapHash& hash) const } SHAMap::ConstIterator -SHAMap::boundHelper(uint256 const& id, BelowDirection direction) const +SHAMap::boundHelper(UInt256 const& id, BelowDirection direction) const { auto const searchingForward = direction == BelowDirection::First; @@ -616,25 +616,25 @@ SHAMap::boundHelper(uint256 const& id, BelowDirection direction) const } SHAMap::ConstIterator -SHAMap::upperBound(uint256 const& id) const +SHAMap::upperBound(UInt256 const& id) const { return boundHelper(id, BelowDirection::First); } SHAMap::ConstIterator -SHAMap::lowerBound(uint256 const& id) const +SHAMap::lowerBound(UInt256 const& id) const { return boundHelper(id, BelowDirection::Last); } bool -SHAMap::hasItem(uint256 const& id) const +SHAMap::hasItem(UInt256 const& id) const { return (findKey(id) != nullptr); } bool -SHAMap::delItem(uint256 const& id) +SHAMap::delItem(UInt256 const& id) { // delete the item with this ID XRPL_ASSERT(state_ != SHAMapState::Immutable, "xrpl::SHAMap::delItem : not immutable"); @@ -723,7 +723,7 @@ SHAMap::addGiveItem(SHAMapNodeType type, boost::intrusive_ptr XRPL_ASSERT(type != SHAMapNodeType::TnInner, "xrpl::SHAMap::addGiveItem : valid type input"); // add the specified item, does not update - uint256 const tag = item->key(); + UInt256 const tag = item->key(); NodePathStack stack; walkTowardsKey(tag, &stack); @@ -808,7 +808,7 @@ bool SHAMap::updateGiveItem(SHAMapNodeType type, boost::intrusive_ptr item) { // can't change the tag but can change the hash - uint256 const tag = item->key(); + UInt256 const tag = item->key(); XRPL_ASSERT(state_ != SHAMapState::Immutable, "xrpl::SHAMap::updateGiveItem : not immutable"); diff --git a/src/libxrpl/shamap/SHAMapDelta.cpp b/src/libxrpl/shamap/SHAMapDelta.cpp index 1306fe6990..50a00ed14d 100644 --- a/src/libxrpl/shamap/SHAMapDelta.cpp +++ b/src/libxrpl/shamap/SHAMapDelta.cpp @@ -153,7 +153,7 @@ SHAMap::compare(SHAMap const& otherMap, Delta& differences, int maxCount) const { // LCOV_EXCL_START UNREACHABLE("xrpl::SHAMap::compare : missing a node"); - Throw(type_, uint256()); + Throw(type_, UInt256()); // LCOV_EXCL_STOP } diff --git a/src/libxrpl/shamap/SHAMapInnerNode.cpp b/src/libxrpl/shamap/SHAMapInnerNode.cpp index bdd89388b2..4f0aea97b6 100644 --- a/src/libxrpl/shamap/SHAMapInnerNode.cpp +++ b/src/libxrpl/shamap/SHAMapInnerNode.cpp @@ -124,7 +124,7 @@ SHAMapTreeNodePtr SHAMapInnerNode::makeFullInner(Slice data, SHAMapHash const& hash, bool hashValid) { // A full inner node is serialized as 16 256-bit hashes, back to back: - if (data.size() != kBranchFactor * uint256::kBytes) + if (data.size() != kBranchFactor * UInt256::kBytes) Throw("Invalid FI node"); auto ret = intr_ptr::makeShared(0, kBranchFactor); @@ -160,7 +160,7 @@ SHAMapInnerNode::makeCompressedInner(Slice data) { // A compressed inner node is serialized as a series of 33 byte chunks, // representing a one byte "position" and a 256-bit hash: - static constexpr std::size_t kChunkSize = uint256::kBytes + 1; + static constexpr std::size_t kChunkSize = UInt256::kBytes + 1; if (auto const s = data.size(); (s % kChunkSize != 0) || (s > kChunkSize * kBranchFactor)) Throw("Invalid CI node"); @@ -193,14 +193,14 @@ SHAMapInnerNode::makeCompressedInner(Slice data) void SHAMapInnerNode::updateHash() { - uint256 nh; + UInt256 nh; if (isBranch_ != 0) { - sha512_half_hasher h; + Sha512HalfHasher h; using beast::hash_append; hash_append(h, HashPrefix::InnerNode); iterChildren([&](SHAMapHash const& hh) { hash_append(h, hh); }); - nh = static_cast(h); + nh = static_cast(h); } hash_ = SHAMapHash{nh}; } diff --git a/src/libxrpl/shamap/SHAMapNodeID.cpp b/src/libxrpl/shamap/SHAMapNodeID.cpp index 42b946b921..89e81ecd53 100644 --- a/src/libxrpl/shamap/SHAMapNodeID.cpp +++ b/src/libxrpl/shamap/SHAMapNodeID.cpp @@ -14,18 +14,18 @@ namespace xrpl { -static uint256 const& +static UInt256 const& depthMask(unsigned int depth) { static constexpr auto kMaskSize = SHAMap::kLeafDepth + 1; struct MasksT { - uint256 entry[kMaskSize]; + UInt256 entry[kMaskSize]; MasksT() { - uint256 selector; + UInt256 selector; for (auto i = 0u; i < kMaskSize - 1; i += 2) { entry[i] = selector; @@ -43,8 +43,8 @@ depthMask(unsigned int depth) // The prefix of `key` at `depth`: the leading nibbles naming the subtree a node at that depth // identifies, with the remainder of the key masked off. -static uint256 -maskedToDepth(uint256 const& key, unsigned int depth) +static UInt256 +maskedToDepth(UInt256 const& key, unsigned int depth) { return key & depthMask(depth); } @@ -52,13 +52,13 @@ maskedToDepth(uint256 const& key, unsigned int depth) // Whether `id` at `depth` is what `key` looks like once masked down to that depth, i.e. // whether an ID with this depth and id names a subtree that `key` falls under. static bool -isPrefixOfAtDepth(uint256 const& id, unsigned int depth, uint256 const& key) +isPrefixOfAtDepth(UInt256 const& id, unsigned int depth, UInt256 const& key) { return maskedToDepth(key, depth) == id; } // canonicalize the hash to a node ID for this depth -SHAMapNodeID::SHAMapNodeID(unsigned int depth, uint256 const& hash) : id_(hash), depth_(depth) +SHAMapNodeID::SHAMapNodeID(unsigned int depth, UInt256 const& hash) : id_(hash), depth_(depth) { // Every SHAMapNodeID's depth is stored here, so this is the one place that can stop an // out-of-range one from being kept: a depth past kLeafDepth would go on to index depthMask @@ -118,7 +118,7 @@ SHAMapNodeID::getChildNodeID(unsigned int branch) const } bool -SHAMapNodeID::isPrefixOf(uint256 const& key) const +SHAMapNodeID::isPrefixOf(UInt256 const& key) const { return isPrefixOfAtDepth(id_, depth_, key); } @@ -135,7 +135,7 @@ deserializeSHAMapNodeID(void const* data, std::size_t size) { // Reject a serialized ID carrying bits below its own depth. Checked before // constructing, since the constructor asserts that same property. - if (auto const id = uint256::fromVoid(data); isPrefixOfAtDepth(id, depth, id)) + if (auto const id = UInt256::fromVoid(data); isPrefixOfAtDepth(id, depth, id)) ret.emplace(depth, id); } } @@ -144,7 +144,7 @@ deserializeSHAMapNodeID(void const* data, std::size_t size) } [[nodiscard]] unsigned int -selectBranch(SHAMapNodeID const& id, uint256 const& hash) +selectBranch(SHAMapNodeID const& id, UInt256 const& hash) { XRPL_ASSERT(id.getDepth() < SHAMap::kLeafDepth, "xrpl::selectBranch : depth below leaf depth"); @@ -167,7 +167,7 @@ selectBranch(SHAMapNodeID const& id, uint256 const& hash) } SHAMapNodeID -SHAMapNodeID::createID(unsigned int depth, uint256 const& key) +SHAMapNodeID::createID(unsigned int depth, UInt256 const& key) { // The mask is chosen here, before the constructor runs, so the clamp there cannot cover this // call: an out-of-range depth would index depthMask's table while still evaluating this diff --git a/src/libxrpl/shamap/SHAMapSync.cpp b/src/libxrpl/shamap/SHAMapSync.cpp index 602d8e629c..a40419a49b 100644 --- a/src/libxrpl/shamap/SHAMapSync.cpp +++ b/src/libxrpl/shamap/SHAMapSync.cpp @@ -316,7 +316,7 @@ SHAMap::gmnProcessDeferredReads(MissingNodes& mn) * but not available locally. The filter can hold alternate sources of * nodes that are not permanently stored locally */ -std::vector> +std::vector> SHAMap::getMissingNodes(int max, SHAMapSyncFilter const* filter) { XRPL_ASSERT(root_->getHash().isNonZero(), "xrpl::SHAMap::getMissingNodes : nonzero root hash"); @@ -753,7 +753,7 @@ SHAMap::hasInnerNode(SHAMapNodeID const& targetNodeID, SHAMapHash const& targetN * Does this map have this leaf node? */ bool -SHAMap::hasLeafNode(uint256 const& tag, SHAMapHash const& targetNodeHash) const +SHAMap::hasLeafNode(UInt256 const& tag, SHAMapHash const& targetNodeHash) const { auto node = root_.get(); SHAMapNodeID nodeID; @@ -791,7 +791,7 @@ SHAMap::hasLeafNode(uint256 const& tag, SHAMapHash const& targetNodeHash) const } std::optional> -SHAMap::getProofPath(uint256 const& key) const +SHAMap::getProofPath(UInt256 const& key) const { NodePathStack stack; walkTowardsKey(key, &stack); @@ -824,7 +824,7 @@ SHAMap::getProofPath(uint256 const& key) const } bool -SHAMap::verifyProofPath(uint256 const& rootHash, uint256 const& key, std::vector const& path) +SHAMap::verifyProofPath(UInt256 const& rootHash, UInt256 const& key, std::vector const& path) { if (path.empty() || path.size() > kLeafDepth + 1u) return false; diff --git a/src/libxrpl/shamap/SHAMapTreeNode.cpp b/src/libxrpl/shamap/SHAMapTreeNode.cpp index 1ae7cf18af..2e7dfd2cae 100644 --- a/src/libxrpl/shamap/SHAMapTreeNode.cpp +++ b/src/libxrpl/shamap/SHAMapTreeNode.cpp @@ -48,7 +48,7 @@ SHAMapTreeNode::makeTransactionWithMeta(Slice data, SHAMapHash const& hash, bool { Serializer s(data.data(), data.size()); - uint256 tag; + UInt256 tag; if (s.size() < tag.kBytes) { @@ -88,7 +88,7 @@ SHAMapTreeNode::makeAccountState(Slice data, SHAMapHash const& hash, bool hashVa { Serializer s(data.data(), data.size()); - uint256 tag; + UInt256 tag; if (s.size() < tag.kBytes) { diff --git a/src/libxrpl/tx/ApplyContext.cpp b/src/libxrpl/tx/ApplyContext.cpp index 96dcd5f587..cd6007e13f 100644 --- a/src/libxrpl/tx/ApplyContext.cpp +++ b/src/libxrpl/tx/ApplyContext.cpp @@ -22,7 +22,7 @@ namespace xrpl { ApplyContext::ApplyContext( ServiceRegistry& registry, OpenView& base, - std::optional const& parentBatchId, + std::optional const& parentBatchId, STTx const& tx, TER preclaimResult, XRPAmount baseFee, @@ -71,7 +71,7 @@ ApplyContext::size() void ApplyContext::visit( - std::function const& func) + std::function const& func) { view_->visit(base_, func); // NOLINT(bugprone-unchecked-optional-access) } diff --git a/src/libxrpl/tx/SignerEntries.cpp b/src/libxrpl/tx/SignerEntries.cpp index 943b66292e..082e79e31b 100644 --- a/src/libxrpl/tx/SignerEntries.cpp +++ b/src/libxrpl/tx/SignerEntries.cpp @@ -43,7 +43,7 @@ SignerEntries::deserialize(STObject const& obj, beast::Journal journal, std::str // Extract SignerEntry fields. AccountID const account = sEntry.getAccountID(sfAccount); std::uint16_t const weight = sEntry.getFieldU16(sfSignerWeight); - std::optional const tag = sEntry.at(~sfWalletLocator); + std::optional const tag = sEntry.at(~sfWalletLocator); accountVec.emplace_back(account, weight, tag); } diff --git a/src/libxrpl/tx/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp index 6bf99e567d..09725370e9 100644 --- a/src/libxrpl/tx/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -810,7 +810,7 @@ TER Transactor::ticketDelete( ApplyView& view, AccountID const& account, - uint256 const& ticketIndex, + UInt256 const& ticketIndex, beast::Journal j) { // Delete the Ticket, adjust the account root ticket count, and @@ -918,7 +918,7 @@ NotTEC Transactor::checkSign( ReadView const& view, ApplyFlags flags, - std::optional const& parentBatchId, + std::optional const& parentBatchId, AccountID const& idAccount, STObject const& sigObject, beast::Journal const j, @@ -1210,7 +1210,7 @@ Transactor::checkMultiSign( //------------------------------------------------------------------------------ static void -removeUnfundedOffers(ApplyView& view, std::vector const& offers, beast::Journal viewJ) +removeUnfundedOffers(ApplyView& view, std::vector const& offers, beast::Journal viewJ) { int removed = 0; @@ -1229,7 +1229,7 @@ removeUnfundedOffers(ApplyView& view, std::vector const& offers, beast: static void removeExpiredNFTokenOffers( ApplyView& view, - std::vector const& offers, + std::vector const& offers, beast::Journal viewJ) { std::size_t removed = 0; @@ -1246,7 +1246,7 @@ removeExpiredNFTokenOffers( } static void -removeExpiredCredentials(ApplyView& view, std::vector const& creds, beast::Journal viewJ) +removeExpiredCredentials(ApplyView& view, std::vector const& creds, beast::Journal viewJ) { for (auto const& index : creds) { @@ -1265,7 +1265,7 @@ removeExpiredCredentials(ApplyView& view, std::vector const& creds, bea static void removeDeletedTrustLines( ApplyView& view, - std::vector const& trustLines, + std::vector const& trustLines, beast::Journal viewJ) { if (trustLines.size() > kMaxDeletableAmmTrustLines) @@ -1422,7 +1422,7 @@ Transactor::getFeePayer(ReadView const& view, STTx const& tx) // The sole purpose of this function is to provide a convenient, named // location to set a breakpoint, to be used when replaying transactions. void -Transactor::trapTransaction(uint256 txHash) const +Transactor::trapTransaction(UInt256 txHash) const { JLOG(j_.debug()) << "Transaction trapped: " << txHash; } @@ -1460,12 +1460,12 @@ Transactor::processPersistentChanges(TER result, XRPAmount fee) // re-applied after the context is reset. auto const typesToCollect = typesForResult(result); - std::map> deletedObjects; + std::map> deletedObjects; if (!typesToCollect.empty()) { ctx_.visit( [&typesToCollect, &deletedObjects]( - uint256 const& index, bool isDelete, SLE::const_ref before, SLE::const_ref after) { + UInt256 const& index, bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (isDelete) { XRPL_ASSERT( diff --git a/src/libxrpl/tx/apply.cpp b/src/libxrpl/tx/apply.cpp index 688c585e2a..e52d57456e 100644 --- a/src/libxrpl/tx/apply.cpp +++ b/src/libxrpl/tx/apply.cpp @@ -138,7 +138,7 @@ checkValidity(HashRouter& router, STTx const& tx, Rules const& rules) } void -forceValidity(HashRouter& router, uint256 const& txid, Validity validity) +forceValidity(HashRouter& router, UInt256 const& txid, Validity validity) { // Callers reach here when they deliberately skip signature verification, // such as a cluster peer that trusts its neighbor's checks, or a @@ -188,7 +188,7 @@ ApplyResult apply( ServiceRegistry& registry, OpenView& view, - uint256 const& parentBatchId, + UInt256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) diff --git a/src/libxrpl/tx/applySteps.cpp b/src/libxrpl/tx/applySteps.cpp index 9a1636eff1..d448707210 100644 --- a/src/libxrpl/tx/applySteps.cpp +++ b/src/libxrpl/tx/applySteps.cpp @@ -369,7 +369,7 @@ PreflightResult preflight( ServiceRegistry& registry, Rules const& rules, - uint256 const& parentBatchId, + UInt256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) diff --git a/src/libxrpl/tx/invariants/AMMInvariant.cpp b/src/libxrpl/tx/invariants/AMMInvariant.cpp index cca0ce149c..765dd30b32 100644 --- a/src/libxrpl/tx/invariants/AMMInvariant.cpp +++ b/src/libxrpl/tx/invariants/AMMInvariant.cpp @@ -24,7 +24,7 @@ namespace xrpl { void -ValidAMM::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidAMM::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (isDelete) { diff --git a/src/libxrpl/tx/invariants/FreezeInvariant.cpp b/src/libxrpl/tx/invariants/FreezeInvariant.cpp index 272e52f09a..ee07fd6b43 100644 --- a/src/libxrpl/tx/invariants/FreezeInvariant.cpp +++ b/src/libxrpl/tx/invariants/FreezeInvariant.cpp @@ -25,7 +25,7 @@ namespace xrpl { void -TransfersNotFrozen::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +TransfersNotFrozen::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { /* * A trust line freeze state alone doesn't determine if a transfer is @@ -114,7 +114,7 @@ TransfersNotFrozen::finalize( } bool -TransfersNotFrozen::isValidEntry(SLE::const_ref before, SLE::const_ref after) +TransfersNotFrozen::isValidEntry(SLE::ConstRef before, SLE::ConstRef after) { // `after` can never be null, even if the trust line is deleted. XRPL_ASSERT(after, "xrpl::TransfersNotFrozen::isValidEntry : valid after."); @@ -139,10 +139,7 @@ TransfersNotFrozen::isValidEntry(SLE::const_ref before, SLE::const_ref after) } STAmount -TransfersNotFrozen::calculateBalanceChange( - SLE::const_ref before, - SLE::const_ref after, - bool isDelete) +TransfersNotFrozen::calculateBalanceChange(SLE::ConstRef before, SLE::ConstRef after, bool isDelete) { auto const getBalance = [](auto const& line, auto const& other, bool zero) { STAmount const amt = line ? line->at(sfBalance) : other->at(sfBalance).zeroed(); @@ -185,7 +182,7 @@ TransfersNotFrozen::recordBalance(Issue const& issue, BalanceChange change) } void -TransfersNotFrozen::recordBalanceChanges(SLE::const_ref after, STAmount const& balanceChange) +TransfersNotFrozen::recordBalanceChanges(SLE::ConstRef after, STAmount const& balanceChange) { auto const balanceChangeSign = balanceChange.signum(); auto const currency = after->at(sfBalance).get().currency; @@ -214,7 +211,7 @@ TransfersNotFrozen::findIssuer(AccountID const& issuerID, ReadView const& view) bool TransfersNotFrozen::validateIssuerChanges( - SLE::const_ref issuer, + SLE::ConstRef issuer, IssuerChanges const& changes, STTx const& tx, beast::Journal const& j, diff --git a/src/libxrpl/tx/invariants/InvariantCheck.cpp b/src/libxrpl/tx/invariants/InvariantCheck.cpp index 96820d00bb..de220c95b1 100644 --- a/src/libxrpl/tx/invariants/InvariantCheck.cpp +++ b/src/libxrpl/tx/invariants/InvariantCheck.cpp @@ -88,7 +88,7 @@ ledgerEntryTypeName(SLE const& sle) } void -TransactionFeeCheck::visitEntry(bool, SLE::const_ref, SLE::const_ref) +TransactionFeeCheck::visitEntry(bool, SLE::ConstRef, SLE::ConstRef) { // nothing to do } @@ -131,7 +131,7 @@ TransactionFeeCheck::finalize( //------------------------------------------------------------------------------ void -XRPNotCreated::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +XRPNotCreated::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { /* We go through all modified ledger entries, looking only at account roots, * escrow payments, and payment channels. We remove from the total any @@ -232,7 +232,7 @@ XRPNotCreated::finalize( //------------------------------------------------------------------------------ void -XRPBalanceChecks::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +XRPBalanceChecks::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { auto isBad = [](STAmount const& balance) { if (!balance.native()) @@ -279,7 +279,7 @@ XRPBalanceChecks::finalize( //------------------------------------------------------------------------------ void -NoBadOffers::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +NoBadOffers::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { auto isBad = [](STAmount const& pays, STAmount const& gets) { // An offer should never be negative @@ -320,7 +320,7 @@ NoBadOffers::finalize( //------------------------------------------------------------------------------ void -NoZeroEscrow::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +NoZeroEscrow::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { auto isBad = [](STAmount const& amount) { // XRP case @@ -424,7 +424,7 @@ NoZeroEscrow::finalize( //------------------------------------------------------------------------------ void -AccountRootsNotDeleted::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref) +AccountRootsNotDeleted::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef) { if (isDelete && before && before->getType() == ltACCOUNT_ROOT) accountsDeleted_++; @@ -476,7 +476,7 @@ AccountRootsNotDeleted::finalize( //------------------------------------------------------------------------------ void -AccountRootsDeletedClean::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +AccountRootsDeletedClean::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (isDelete && before && before->getType() == ltACCOUNT_ROOT) accountsDeleted_.emplace_back(before, after); @@ -573,7 +573,7 @@ AccountRootsDeletedClean::finalize( Keylet const first = keylet::nftokenPageMin(accountID); Keylet const last = keylet::nftokenPageMax(accountID); - std::optional key = view.succ(first.key, last.key.next()); + std::optional key = view.succ(first.key, last.key.next()); // current page if (key && objectExists(Keylet{ltNFTOKEN_PAGE, *key}) && enforce) @@ -599,7 +599,7 @@ AccountRootsDeletedClean::finalize( //------------------------------------------------------------------------------ void -LedgerEntryTypesMatch::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +LedgerEntryTypesMatch::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { if (before && after && before->getType() != after->getType()) typeMismatch_ = true; @@ -653,7 +653,7 @@ LedgerEntryTypesMatch::finalize( //------------------------------------------------------------------------------ void -NoXRPTrustLines::visitEntry(bool, SLE::const_ref, SLE::const_ref after) +NoXRPTrustLines::visitEntry(bool, SLE::ConstRef, SLE::ConstRef after) { bool const overwriteFixEnabled = isFeatureEnabled(fixCleanup3_1_3, true); @@ -693,7 +693,7 @@ NoXRPTrustLines::finalize( //------------------------------------------------------------------------------ void -NoDeepFreezeTrustLinesWithoutFreeze::visitEntry(bool, SLE::const_ref, SLE::const_ref after) +NoDeepFreezeTrustLinesWithoutFreeze::visitEntry(bool, SLE::ConstRef, SLE::ConstRef after) { if (after && after->getType() == ltRIPPLE_STATE) { @@ -736,7 +736,7 @@ NoDeepFreezeTrustLinesWithoutFreeze::finalize( //------------------------------------------------------------------------------ void -ValidNewAccountRoot::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +ValidNewAccountRoot::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { if (!before && after->getType() == ltACCOUNT_ROOT) { @@ -834,7 +834,7 @@ clawbackTrustLineBalanceInHolderTerms( } void -ValidClawback::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidClawback::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (before && before->getType() == ltRIPPLE_STATE) { @@ -1009,7 +1009,7 @@ ValidClawback::finalize( //------------------------------------------------------------------------------ void -ValidPseudoAccounts::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidPseudoAccounts::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (isDelete) { @@ -1104,7 +1104,7 @@ ValidPseudoAccounts::finalize( //------------------------------------------------------------------------------ void -NoModifiedUnmodifiableFields::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +NoModifiedUnmodifiableFields::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (isDelete || !before) { @@ -1280,7 +1280,7 @@ ValidAmounts::finalize( } void -ObjectHasPseudoAccount::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ObjectHasPseudoAccount::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (!isDelete) return; diff --git a/src/libxrpl/tx/invariants/InvariantRunner.cpp b/src/libxrpl/tx/invariants/InvariantRunner.cpp index 55bff2d693..d793d7a778 100644 --- a/src/libxrpl/tx/invariants/InvariantRunner.cpp +++ b/src/libxrpl/tx/invariants/InvariantRunner.cpp @@ -47,7 +47,7 @@ checkInvariantsHelper( { auto checkers = getInvariantChecks(); - ctx.visit([&](uint256 const&, bool isDelete, SLE::const_ref before, SLE::const_ref after) { + ctx.visit([&](UInt256 const&, bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { if (txCheck) txCheck->get().visitEntry(isDelete, before, after); (..., std::get(checkers).visitEntry(isDelete, before, after)); diff --git a/src/libxrpl/tx/invariants/LoanBrokerInvariant.cpp b/src/libxrpl/tx/invariants/LoanBrokerInvariant.cpp index e15921b7b2..b2aef5f08c 100644 --- a/src/libxrpl/tx/invariants/LoanBrokerInvariant.cpp +++ b/src/libxrpl/tx/invariants/LoanBrokerInvariant.cpp @@ -25,7 +25,7 @@ namespace xrpl { void -ValidLoanBroker::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidLoanBroker::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { // Track LoanBroker deletions so finalize() can enforce: // (a) only ttLOAN_BROKER_DELETE removes a broker @@ -71,10 +71,7 @@ ValidLoanBroker::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref } bool -ValidLoanBroker::goodZeroDirectory( - ReadView const& view, - SLE::const_ref dir, - beast::Journal const& j) +ValidLoanBroker::goodZeroDirectory(ReadView const& view, SLE::ConstRef dir, beast::Journal const& j) { auto const next = dir->at(~sfIndexNext); auto const prev = dir->at(~sfIndexPrevious); diff --git a/src/libxrpl/tx/invariants/LoanInvariant.cpp b/src/libxrpl/tx/invariants/LoanInvariant.cpp index f87a7620af..4a1292713f 100644 --- a/src/libxrpl/tx/invariants/LoanInvariant.cpp +++ b/src/libxrpl/tx/invariants/LoanInvariant.cpp @@ -24,7 +24,7 @@ namespace xrpl { void -ValidLoan::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidLoan::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { // Classify here, but leave the decision about which checks apply to // finalize(), which is the only place that can see the Rules. diff --git a/src/libxrpl/tx/invariants/MPTInvariant.cpp b/src/libxrpl/tx/invariants/MPTInvariant.cpp index 060673c6e1..c5edb46abb 100644 --- a/src/libxrpl/tx/invariants/MPTInvariant.cpp +++ b/src/libxrpl/tx/invariants/MPTInvariant.cpp @@ -67,7 +67,7 @@ subtractMPTAmountDelta(std::int64_t delta, std::uint64_t amount) } // namespace void -ValidMPTIssuance::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidMPTIssuance::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { // The sfReferenceHolding tracking and the deleted-holding capture are // only meaningful post-fixCleanup3_2_0 (the field is never set @@ -428,7 +428,7 @@ ValidMPTIssuance::finalize( } void -ValidMPTBalanceChanges::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +ValidMPTBalanceChanges::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { if (overflow_) return; @@ -562,7 +562,7 @@ ValidConfidentialMPToken::visitEntry( std::shared_ptr const& after) { // Helper to get MPToken Issuance ID safely - auto const getMptID = [](std::shared_ptr const& sle) -> uint192 { + auto const getMptID = [](std::shared_ptr const& sle) -> UInt192 { if (!sle) return beast::kZero; if (sle->getType() == ltMPTOKEN) @@ -574,7 +574,7 @@ ValidConfidentialMPToken::visitEntry( if (before && before->getType() == ltMPTOKEN) { - uint192 const id = getMptID(before); + UInt192 const id = getMptID(before); auto& change = changes_[id]; change.mptAmountDelta = subtractMPTAmountDelta(change.mptAmountDelta, before->getFieldU64(sfMPTAmount)); @@ -595,7 +595,7 @@ ValidConfidentialMPToken::visitEntry( if (after && after->getType() == ltMPTOKEN) { - uint192 const id = getMptID(after); + UInt192 const id = getMptID(after); auto& change = changes_[id]; change.mptAmountDelta = addMPTAmountDelta(change.mptAmountDelta, after->getFieldU64(sfMPTAmount)); @@ -634,7 +634,7 @@ ValidConfidentialMPToken::visitEntry( if (before && before->getType() == ltMPTOKEN_ISSUANCE) { - uint192 const id = getMptID(before); + UInt192 const id = getMptID(before); auto& change = changes_[id]; if (before->isFieldPresent(sfConfidentialOutstandingAmount)) { @@ -647,7 +647,7 @@ ValidConfidentialMPToken::visitEntry( if (after && after->getType() == ltMPTOKEN_ISSUANCE) { - uint192 const id = getMptID(after); + UInt192 const id = getMptID(after); auto& change = changes_[id]; bool const hasCOA = after->isFieldPresent(sfConfidentialOutstandingAmount); @@ -667,7 +667,7 @@ ValidConfidentialMPToken::visitEntry( if (before && after && before->getType() == ltMPTOKEN && after->getType() == ltMPTOKEN) { - uint192 const id = getMptID(after); + UInt192 const id = getMptID(after); // sfConfidentialBalanceVersion must change when spending changes auto const spendingBefore = (*before)[~sfConfidentialBalanceSpending]; diff --git a/src/libxrpl/tx/invariants/NFTInvariant.cpp b/src/libxrpl/tx/invariants/NFTInvariant.cpp index b3b1601018..2359dbb8e9 100644 --- a/src/libxrpl/tx/invariants/NFTInvariant.cpp +++ b/src/libxrpl/tx/invariants/NFTInvariant.cpp @@ -25,19 +25,19 @@ namespace xrpl { void -ValidNFTokenPage::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidNFTokenPage::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { - static constexpr uint256 const& kPageBits = nft::kPageMask; - static constexpr uint256 kAccountBits = ~kPageBits; + static constexpr UInt256 const& kPageBits = nft::kPageMask; + static constexpr UInt256 kAccountBits = ~kPageBits; if ((before && before->getType() != ltNFTOKEN_PAGE) || (after && after->getType() != ltNFTOKEN_PAGE)) return; - auto check = [this, isDelete](SLE::const_ref sle) { - uint256 const account = sle->key() & kAccountBits; - uint256 const hiLimit = sle->key() & kPageBits; - std::optional const prev = (*sle)[~sfPreviousPageMin]; + auto check = [this, isDelete](SLE::ConstRef sle) { + UInt256 const account = sle->key() & kAccountBits; + UInt256 const hiLimit = sle->key() & kPageBits; + std::optional const prev = (*sle)[~sfPreviousPageMin]; // Make sure that any page links... // 1. Are properly associated with the owning account and @@ -70,20 +70,20 @@ ValidNFTokenPage::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_re // If prev is valid, use it to establish a lower bound for // page entries. If prev is not valid the lower bound is zero. - uint256 const loLimit = prev ? *prev & kPageBits : uint256(beast::kZero); + UInt256 const loLimit = prev ? *prev & kPageBits : UInt256(beast::kZero); // Also verify that all NFTokenIDs in the page are sorted. - uint256 loCmp = loLimit; + UInt256 loCmp = loLimit; for (auto const& obj : nftokens) { - uint256 const tokenID = obj[sfNFTokenID]; + UInt256 const tokenID = obj[sfNFTokenID]; if (!nft::compareTokens(loCmp, tokenID)) badSort_ = true; loCmp = tokenID; // None of the NFTs on this page should belong on lower or // higher pages. - if (uint256 const tokenPageBits = tokenID & kPageBits; + if (UInt256 const tokenPageBits = tokenID & kPageBits; tokenPageBits < loLimit || tokenPageBits >= hiLimit) badEntry_ = true; @@ -183,7 +183,7 @@ ValidNFTokenPage::finalize( //------------------------------------------------------------------------------ void -NFTokenCountTracking::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +NFTokenCountTracking::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { if (before && before->getType() == ltACCOUNT_ROOT) { diff --git a/src/libxrpl/tx/invariants/PermissionedDEXInvariant.cpp b/src/libxrpl/tx/invariants/PermissionedDEXInvariant.cpp index 5c53552a3f..fb38543798 100644 --- a/src/libxrpl/tx/invariants/PermissionedDEXInvariant.cpp +++ b/src/libxrpl/tx/invariants/PermissionedDEXInvariant.cpp @@ -19,14 +19,14 @@ namespace xrpl { void -ValidPermissionedDEX::visitEntry(bool isDelete, SLE::const_ref, SLE::const_ref after) +ValidPermissionedDEX::visitEntry(bool isDelete, SLE::ConstRef, SLE::ConstRef after) { // Post-fixCleanup3_4_0: skip when after is null (defensive). // Pre-amendment: original after-only path via the `if (after && ...)` checks below. if (isFeatureEnabled(fixCleanup3_4_0) && !after) return; - auto trackDomain = [this, isDelete](uint256 const& domain) { + auto trackDomain = [this, isDelete](UInt256 const& domain) { domainsOld_.insert(domain); if (!isDelete) domains_.insert(domain); diff --git a/src/libxrpl/tx/invariants/PermissionedDomainInvariant.cpp b/src/libxrpl/tx/invariants/PermissionedDomainInvariant.cpp index fcb53e7c8f..437b9d0288 100644 --- a/src/libxrpl/tx/invariants/PermissionedDomainInvariant.cpp +++ b/src/libxrpl/tx/invariants/PermissionedDomainInvariant.cpp @@ -21,14 +21,14 @@ namespace xrpl { void -ValidPermissionedDomain::visitEntry(bool isDel, SLE::const_ref before, SLE::const_ref after) +ValidPermissionedDomain::visitEntry(bool isDel, SLE::ConstRef before, SLE::ConstRef after) { if (before && before->getType() != ltPERMISSIONED_DOMAIN) return; if (after && after->getType() != ltPERMISSIONED_DOMAIN) return; - auto check = [isDel](std::vector& sleStatus, SLE::const_ref sle) { + auto check = [isDel](std::vector& sleStatus, SLE::ConstRef sle) { auto const& credentials = sle->getFieldArray(sfAcceptedCredentials); auto const sorted = credentials::makeSorted(credentials); diff --git a/src/libxrpl/tx/invariants/SponsorshipInvariant.cpp b/src/libxrpl/tx/invariants/SponsorshipInvariant.cpp index bdf37492f3..0e19baf86b 100644 --- a/src/libxrpl/tx/invariants/SponsorshipInvariant.cpp +++ b/src/libxrpl/tx/invariants/SponsorshipInvariant.cpp @@ -17,26 +17,26 @@ namespace xrpl { // Add new sponsorship-related invariants implementations void -SponsorshipOwnerCountsMatch::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +SponsorshipOwnerCountsMatch::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { - auto getSponsored = [](SLE::const_ref sle) -> std::uint32_t { + auto getSponsored = [](SLE::ConstRef sle) -> std::uint32_t { if (sle && sle->getType() == ltACCOUNT_ROOT) return sle->getFieldU32(sfSponsoredOwnerCount); return 0; }; - auto getSponsoring = [](SLE::const_ref sle) -> std::uint32_t { + auto getSponsoring = [](SLE::ConstRef sle) -> std::uint32_t { if (sle && sle->getType() == ltACCOUNT_ROOT) return sle->getFieldU32(sfSponsoringOwnerCount); return 0; }; - auto getOwnerCount = [](SLE::const_ref sle) -> std::uint32_t { + auto getOwnerCount = [](SLE::ConstRef sle) -> std::uint32_t { if (sle && sle->getType() == ltACCOUNT_ROOT) return sle->getFieldU32(sfOwnerCount); return 0; }; - auto getSponsoredObjectOwnerCount = [&](SLE::const_ref sle) -> std::uint32_t { + auto getSponsoredObjectOwnerCount = [&](SLE::ConstRef sle) -> std::uint32_t { if (!sle) return 0; switch (sle->getType()) @@ -116,15 +116,15 @@ SponsorshipOwnerCountsMatch::finalize( } void -SponsorshipAccountCountMatchesField::visitEntry(bool, SLE::const_ref before, SLE::const_ref after) +SponsorshipAccountCountMatchesField::visitEntry(bool, SLE::ConstRef before, SLE::ConstRef after) { - auto getSponsoringAccountCount = [](SLE::const_ref sle) -> std::uint32_t { + auto getSponsoringAccountCount = [](SLE::ConstRef sle) -> std::uint32_t { if (sle && sle->getType() == ltACCOUNT_ROOT) return sle->getFieldU32(sfSponsoringAccountCount); return 0; }; - auto hasSponsorField = [](SLE::const_ref sle) -> bool { + auto hasSponsorField = [](SLE::ConstRef sle) -> bool { return sle && sle->getType() == ltACCOUNT_ROOT && sle->isFieldPresent(sfSponsor); }; diff --git a/src/libxrpl/tx/invariants/VaultInvariant.cpp b/src/libxrpl/tx/invariants/VaultInvariant.cpp index 69c3ce92e0..4402fc7172 100644 --- a/src/libxrpl/tx/invariants/VaultInvariant.cpp +++ b/src/libxrpl/tx/invariants/VaultInvariant.cpp @@ -84,7 +84,7 @@ ValidVault::Shares::make(SLE const& from) } void -ValidVault::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) +ValidVault::visitEntry(bool isDelete, SLE::ConstRef before, SLE::ConstRef after) { // If `before` is empty, this means an object is being created, in which // case `isDelete` must be false. Otherwise `before` and `after` are set and @@ -190,7 +190,7 @@ ValidVault::visitEntry(bool isDelete, SLE::const_ref before, SLE::const_ref afte } } - uint256 const key = (before ? before->key() : after->key()); + UInt256 const key = (before ? before->key() : after->key()); // Append to deltas if sign is non-zero, i.e. an object of an interesting // type has been updated. A transaction may update an object even when // its balance has not changed, e.g. transaction fee equals the amount @@ -208,7 +208,7 @@ std::optional ValidVault::deltaAssets(AccountID const& id) const { auto const& vaultAsset = afterVault_[0].asset; - auto const lookup = [&](uint256 const& key) -> std::optional { + auto const lookup = [&](UInt256 const& key) -> std::optional { auto const it = deltas_.find(key); if (it == deltas_.end()) return std::nullopt; diff --git a/src/libxrpl/tx/paths/BookStep.cpp b/src/libxrpl/tx/paths/BookStep.cpp index ae218a4cff..0bdf0b7f32 100644 --- a/src/libxrpl/tx/paths/BookStep.cpp +++ b/src/libxrpl/tx/paths/BookStep.cpp @@ -168,14 +168,14 @@ public: revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, TOut const& out); std::pair fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, TIn const& in); std::pair @@ -227,7 +227,7 @@ private: // If callback returns false, don't process any more offers. // Return the unfunded, bad offers and the number of offers consumed. template - std::pair, std::uint32_t> + std::pair, std::uint32_t> forEachOffer( PaymentSandbox& sb, ApplyView& afView, @@ -697,7 +697,7 @@ limitStepOut( template template -std::pair, std::uint32_t> +std::pair, std::uint32_t> BookStep::forEachOffer( PaymentSandbox& sb, ApplyView& afView, @@ -1068,7 +1068,7 @@ std::pair BookStep::revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, TOut const& out) { cache_.reset(); @@ -1147,7 +1147,7 @@ BookStep::revImp( return DebtDirection::Issues; }(); auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer); - boost::container::flat_set const toRm = std::move(std::get<0>(r)); + boost::container::flat_set const toRm = std::move(std::get<0>(r)); std::uint32_t const offersConsumed = std::get<1>(r); offersUsed_ = offersConsumed; setUnion(ofrsToRm, toRm); @@ -1186,7 +1186,7 @@ std::pair BookStep::fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, TIn const& in) { XRPL_ASSERT(cache_, "xrpl::BookStep::fwdImp : cache is set"); @@ -1327,7 +1327,7 @@ BookStep::fwdImp( return DebtDirection::Issues; }(); auto const r = forEachOffer(sb, afView, prevStepDebtDir, eachOffer); - boost::container::flat_set const toRm = std::move(std::get<0>(r)); + boost::container::flat_set const toRm = std::move(std::get<0>(r)); std::uint32_t const offersConsumed = std::get<1>(r); offersUsed_ = offersConsumed; setUnion(ofrsToRm, toRm); @@ -1378,7 +1378,7 @@ BookStep::validFwd( try { - boost::container::flat_set dummy; + boost::container::flat_set dummy; fwdImp(sb, afView, dummy, get(in)); // changes cache } catch (FlowException const&) @@ -1568,12 +1568,13 @@ bookStepEqual(Step const& step, xrpl::Book const& book) { return std::visit( [&](TIn const&, TOut const&) { - using TIn_ = TIn::amount_type; - using TOut_ = TOut::amount_type; + using TInAmount = TIn::Amount; + using TOutAmount = TOut::Amount; - if constexpr (ValidTaker) + if constexpr (ValidTaker) { - return equalHelper>(step, book); + return equalHelper>( + step, book); } else { diff --git a/src/libxrpl/tx/paths/DirectStep.cpp b/src/libxrpl/tx/paths/DirectStep.cpp index 1854bd3632..302853baec 100644 --- a/src/libxrpl/tx/paths/DirectStep.cpp +++ b/src/libxrpl/tx/paths/DirectStep.cpp @@ -159,14 +159,14 @@ public: revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, IOUAmount const& out); std::pair fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, IOUAmount const& in); std::pair @@ -270,7 +270,7 @@ public: // Verify the consistency of the step. These checks are specific to // payments and assume that general checks were already performed. [[nodiscard]] TER - check(StrandContext const& ctx, SLE::const_ref sleSrc) const; + check(StrandContext const& ctx, SLE::ConstRef sleSrc) const; [[nodiscard]] std::string logString() const override @@ -328,7 +328,7 @@ public: // Verify the consistency of the step. These checks are specific to // offer crossing and assume that general checks were already performed. static TER - check(StrandContext const& ctx, SLE::const_ref sleSrc); + check(StrandContext const& ctx, SLE::ConstRef sleSrc); [[nodiscard]] std::string logString() const override @@ -416,7 +416,7 @@ DirectIOfferCrossingStep::maxFlow(ReadView const& sb, IOUAmount const& desired) } TER -DirectIPaymentStep::check(StrandContext const& ctx, SLE::const_ref sleSrc) const +DirectIPaymentStep::check(StrandContext const& ctx, SLE::ConstRef sleSrc) const { // Since this is a payment a trust line must be present. Perform all // trust line related checks. @@ -464,7 +464,7 @@ DirectIPaymentStep::check(StrandContext const& ctx, SLE::const_ref sleSrc) const } TER -DirectIOfferCrossingStep::check(StrandContext const&, SLE::const_ref) +DirectIOfferCrossingStep::check(StrandContext const&, SLE::ConstRef) { // The standard checks are all we can do because any remaining checks // require the existence of a trust line. Offer crossing does not @@ -504,7 +504,7 @@ std::pair DirectStepI::revImp( PaymentSandbox& sb, ApplyView& /*afView*/, - boost::container::flat_set& /*ofrsToRm*/, + boost::container::flat_set& /*ofrsToRm*/, IOUAmount const& out) { cache_.reset(); @@ -618,7 +618,7 @@ std::pair DirectStepI::fwdImp( PaymentSandbox& sb, ApplyView& /*afView*/, - boost::container::flat_set& /*ofrsToRm*/, + boost::container::flat_set& /*ofrsToRm*/, IOUAmount const& in) { XRPL_ASSERT(cache_, "xrpl::DirectStepI::fwdImp : cache is set"); @@ -702,7 +702,7 @@ DirectStepI::validFwd(PaymentSandbox& sb, ApplyView& afView, EitherAmo try { - boost::container::flat_set dummy; + boost::container::flat_set dummy; fwdImp(sb, afView, dummy, in.get()); // changes cache } catch (FlowException const&) diff --git a/src/libxrpl/tx/paths/Flow.cpp b/src/libxrpl/tx/paths/Flow.cpp index 80e05f058c..09cab7c6bd 100644 --- a/src/libxrpl/tx/paths/Flow.cpp +++ b/src/libxrpl/tx/paths/Flow.cpp @@ -53,7 +53,7 @@ flow( OfferCrossing offerCrossing, std::optional const& limitQuality, std::optional const& sendMax, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j, path::detail::FlowDebugInfo* flowDebugInfo) { @@ -125,16 +125,16 @@ flow( // amount types. return std::visit( [&, &strands = strands](TIn const&, TOut const&) { - using TIn_ = TIn::amount_type; - using TOut_ = TOut::amount_type; + using TInAmount = TIn::Amount; + using TOutAmount = TOut::Amount; return finishFlow( sb, srcAsset, dstAsset, - flow( + flow( sb, strands, - get(deliver), + get(deliver), partialPayment, offerCrossing, limitQuality, diff --git a/src/libxrpl/tx/paths/MPTEndpointStep.cpp b/src/libxrpl/tx/paths/MPTEndpointStep.cpp index 8fd69d3106..4ef332f1a7 100644 --- a/src/libxrpl/tx/paths/MPTEndpointStep.cpp +++ b/src/libxrpl/tx/paths/MPTEndpointStep.cpp @@ -177,14 +177,14 @@ public: revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, MPTAmount const& out); std::pair fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, MPTAmount const& in); std::pair @@ -272,7 +272,7 @@ public: // Verify the consistency of the step. These checks are specific to // payments and assume that general checks were already performed. [[nodiscard]] TER - check(StrandContext const& ctx, SLE::const_ref sleSrc) const; + check(StrandContext const& ctx, SLE::ConstRef sleSrc) const; [[nodiscard]] std::string logString() const override @@ -320,7 +320,7 @@ public: // Verify the consistency of the step. These checks are specific to // offer crossing and assume that general checks were already performed. static TER - check(StrandContext const& ctx, SLE::const_ref sleSrc); + check(StrandContext const& ctx, SLE::ConstRef sleSrc); [[nodiscard]] std::string logString() const override @@ -336,7 +336,7 @@ public: //------------------------------------------------------------------------------ TER -MPTEndpointPaymentStep::check(StrandContext const& ctx, SLE::const_ref sleSrc) const +MPTEndpointPaymentStep::check(StrandContext const& ctx, SLE::ConstRef sleSrc) const { // Since this is a payment, MPToken must be present. Perform all // MPToken related checks. @@ -400,7 +400,7 @@ MPTEndpointPaymentStep::check(StrandContext const& ctx, SLE::const_ref sleSrc) c } TER -MPTEndpointOfferCrossingStep::check(StrandContext const& ctx, SLE::const_ref) +MPTEndpointOfferCrossingStep::check(StrandContext const& ctx, SLE::ConstRef) { // The standard checks are all we can do because any remaining checks // require the existence of a MPToken. Offer crossing does not @@ -505,7 +505,7 @@ std::pair MPTEndpointStep::revImp( PaymentSandbox& sb, ApplyView& /*afView*/, - boost::container::flat_set& /*ofrsToRm*/, + boost::container::flat_set& /*ofrsToRm*/, MPTAmount const& out) { cache_.reset(); @@ -615,7 +615,7 @@ std::pair MPTEndpointStep::fwdImp( PaymentSandbox& sb, ApplyView& /*afView*/, - boost::container::flat_set& /*ofrsToRm*/, + boost::container::flat_set& /*ofrsToRm*/, MPTAmount const& in) { XRPL_ASSERT(cache_, "MPTEndpointStep::fwdImp : valid cache"); @@ -731,7 +731,7 @@ MPTEndpointStep::validFwd(PaymentSandbox& sb, ApplyView& afView, Eithe try { - boost::container::flat_set dummy; + boost::container::flat_set dummy; fwdImp(sb, afView, dummy, in.get()); // changes cache } catch (FlowException const&) diff --git a/src/libxrpl/tx/paths/OfferStream.cpp b/src/libxrpl/tx/paths/OfferStream.cpp index 6884a113bd..8342ef9d4f 100644 --- a/src/libxrpl/tx/paths/OfferStream.cpp +++ b/src/libxrpl/tx/paths/OfferStream.cpp @@ -230,9 +230,9 @@ TOfferStreamBase::step() } // Remove if expired - using d = NetClock::duration; - using tp = NetClock::time_point; - if (entry->isFieldPresent(sfExpiration) && tp{d{(*entry)[sfExpiration]}} <= expire_) + using D = NetClock::duration; + using Tp = NetClock::time_point; + if (entry->isFieldPresent(sfExpiration) && Tp{D{(*entry)[sfExpiration]}} <= expire_) { JLOG(j_.trace()) << "Removing expired offer " << entry->key(); permRmOffer(entry->key()); @@ -401,7 +401,7 @@ TOfferStreamBase::step() template void -FlowOfferStream::permRmOffer(uint256 const& offerIndex) +FlowOfferStream::permRmOffer(UInt256 const& offerIndex) { permToRemove_.insert(offerIndex); } diff --git a/src/libxrpl/tx/paths/PaySteps.cpp b/src/libxrpl/tx/paths/PaySteps.cpp index 0a5adeb77f..c86900f020 100644 --- a/src/libxrpl/tx/paths/PaySteps.cpp +++ b/src/libxrpl/tx/paths/PaySteps.cpp @@ -178,7 +178,7 @@ toStrand( bool ownerPaysTransferFee, OfferCrossing offerCrossing, AMMContext& ammContext, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j) { if (isXRP(src) || isXRP(dst) || !isConsistent(deliver) || @@ -583,7 +583,7 @@ toStrands( bool ownerPaysTransferFee, OfferCrossing offerCrossing, AMMContext& ammContext, - std::optional const& domainID, + std::optional const& domainID, beast::Journal j) { std::vector result; @@ -699,7 +699,7 @@ StrandContext::StrandContext( std::array, 2>& seenDirectAssets, boost::container::flat_set& seenBookOuts, AMMContext& ammContext, - std::optional const& domainId, + std::optional const& domainId, beast::Journal j) : view(view) , strandSrc(strandSrc) diff --git a/src/libxrpl/tx/paths/RippleCalc.cpp b/src/libxrpl/tx/paths/RippleCalc.cpp index cc497b7935..c44a69eef2 100644 --- a/src/libxrpl/tx/paths/RippleCalc.cpp +++ b/src/libxrpl/tx/paths/RippleCalc.cpp @@ -45,7 +45,7 @@ RippleCalc::rippleCalculate( // explore for liquidity. STPathSet const& spsPaths, - std::optional const& domainID, + std::optional const& domainID, ServiceRegistry& registry, Input const* const pInputs) { diff --git a/src/libxrpl/tx/paths/XRPEndpointStep.cpp b/src/libxrpl/tx/paths/XRPEndpointStep.cpp index 05d893a50d..08e9b1bd55 100644 --- a/src/libxrpl/tx/paths/XRPEndpointStep.cpp +++ b/src/libxrpl/tx/paths/XRPEndpointStep.cpp @@ -97,14 +97,14 @@ public: revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, XRPAmount const& out); std::pair fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, XRPAmount const& in); std::pair @@ -260,7 +260,7 @@ std::pair XRPEndpointStep::revImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, XRPAmount const& out) { auto const balance = static_cast(this)->xrpLiquid(sb); @@ -282,7 +282,7 @@ std::pair XRPEndpointStep::fwdImp( PaymentSandbox& sb, ApplyView& afView, - boost::container::flat_set& ofrsToRm, + boost::container::flat_set& ofrsToRm, XRPAmount const& in) { XRPL_ASSERT(cache_, "xrpl::XRPEndpointStep::fwdImp : cache is set"); diff --git a/src/libxrpl/tx/transactors/account/AccountDelete.cpp b/src/libxrpl/tx/transactors/account/AccountDelete.cpp index 0936fe26dc..991af69bff 100644 --- a/src/libxrpl/tx/transactors/account/AccountDelete.cpp +++ b/src/libxrpl/tx/transactors/account/AccountDelete.cpp @@ -69,8 +69,8 @@ using DeleterFuncPtr = TER (*)( ServiceRegistry& registry, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref sleDel, + UInt256 const& delIndex, + SLE::Ref sleDel, beast::Journal j); // Local function definitions that provides signature compatibility. @@ -79,8 +79,8 @@ offerDelete( ServiceRegistry&, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref sleDel, + UInt256 const& delIndex, + SLE::Ref sleDel, beast::Journal j) { return offerDelete(view, sleDel, j); @@ -91,8 +91,8 @@ removeSignersFromLedger( ServiceRegistry& registry, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref sleDel, + UInt256 const& delIndex, + SLE::Ref sleDel, beast::Journal j) { return SignerListSet::removeFromLedger(registry, view, account, j); @@ -103,8 +103,8 @@ removeTicketFromLedger( ServiceRegistry&, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref, + UInt256 const& delIndex, + SLE::Ref, beast::Journal j) { return Transactor::ticketDelete(view, account, delIndex, j); @@ -115,8 +115,8 @@ removeDepositPreauthFromLedger( ServiceRegistry&, ApplyView& view, AccountID const&, - uint256 const& delIndex, - SLE::ref, + UInt256 const& delIndex, + SLE::Ref, beast::Journal j) { return DepositPreauth::removeFromLedger(view, delIndex, j); @@ -127,8 +127,8 @@ removeNFTokenOfferFromLedger( ServiceRegistry&, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref sleDel, + UInt256 const& delIndex, + SLE::Ref sleDel, beast::Journal) { if (!nft::deleteTokenOffer(view, sleDel)) @@ -142,8 +142,8 @@ removeDIDFromLedger( ServiceRegistry&, ApplyView& view, AccountID const& account, - uint256 const& delIndex, - SLE::ref sleDel, + UInt256 const& delIndex, + SLE::Ref sleDel, beast::Journal j) { return DIDDelete::deleteSLE(view, sleDel, account, j); @@ -154,8 +154,8 @@ removeOracleFromLedger( ServiceRegistry&, ApplyView& view, AccountID const& account, - uint256 const&, - SLE::ref sleDel, + UInt256 const&, + SLE::Ref sleDel, beast::Journal j) { return OracleDelete::deleteOracle(view, sleDel, account, j); @@ -166,8 +166,8 @@ removeCredentialFromLedger( ServiceRegistry&, ApplyView& view, AccountID const&, - uint256 const&, - SLE::ref sleDel, + UInt256 const&, + SLE::Ref sleDel, beast::Journal j) { return credentials::deleteSLE(view, sleDel, j); @@ -178,8 +178,8 @@ removeDelegateFromLedger( ServiceRegistry&, ApplyView& view, AccountID const&, - uint256 const&, - SLE::ref sleDel, + UInt256 const&, + SLE::Ref sleDel, beast::Journal j) { return DelegateSet::deleteDelegate(view, sleDel, j); @@ -312,7 +312,7 @@ AccountDelete::preclaim(PreclaimContext const& ctx) SLE::const_pointer sleDirNode{}; unsigned int uDirEntry{0}; - uint256 dirEntry{beast::kZero}; + UInt256 dirEntry{beast::kZero}; // Account has no directory at all. This _should_ have been caught // by the dirIsEmpty() check earlier, but it's okay to catch it here. @@ -376,7 +376,7 @@ AccountDelete::doApply() view(), ownerDirKeylet, [&](LedgerEntryType nodeType, - uint256 const& dirEntry, + UInt256 const& dirEntry, SLE::pointer& sleItem) -> std::pair { if (auto deleter = nonObligationDeleter(nodeType)) { @@ -455,7 +455,7 @@ AccountDelete::doApply() } void -AccountDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AccountDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/account/AccountSet.cpp b/src/libxrpl/tx/transactors/account/AccountSet.cpp index f0ad5b113a..d6ccc1f4ee 100644 --- a/src/libxrpl/tx/transactors/account/AccountSet.cpp +++ b/src/libxrpl/tx/transactors/account/AccountSet.cpp @@ -408,7 +408,7 @@ AccountSet::doApply() // if (tx.isFieldPresent(sfEmailHash)) { - uint128 const uHash = tx.getFieldH128(sfEmailHash); + UInt128 const uHash = tx.getFieldH128(sfEmailHash); if (!uHash) { @@ -427,7 +427,7 @@ AccountSet::doApply() // if (tx.isFieldPresent(sfWalletLocator)) { - uint256 const uHash = tx.getFieldH256(sfWalletLocator); + UInt256 const uHash = tx.getFieldH256(sfWalletLocator); if (!uHash) { @@ -588,7 +588,7 @@ AccountSet::doApply() } void -AccountSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AccountSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/account/SetRegularKey.cpp b/src/libxrpl/tx/transactors/account/SetRegularKey.cpp index f408f31690..800bab1e26 100644 --- a/src/libxrpl/tx/transactors/account/SetRegularKey.cpp +++ b/src/libxrpl/tx/transactors/account/SetRegularKey.cpp @@ -79,7 +79,7 @@ SetRegularKey::doApply() } void -SetRegularKey::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +SetRegularKey::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/account/SignerListSet.cpp b/src/libxrpl/tx/transactors/account/SignerListSet.cpp index 799c292bfc..3b72cc8b98 100644 --- a/src/libxrpl/tx/transactors/account/SignerListSet.cpp +++ b/src/libxrpl/tx/transactors/account/SignerListSet.cpp @@ -406,7 +406,7 @@ SignerListSet::writeSignersToSLE(SLE::pointer const& ledgerEntry, std::uint32_t } void -SignerListSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +SignerListSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp b/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp index cbfb93c386..34b6bd749a 100644 --- a/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp +++ b/src/libxrpl/tx/transactors/bridge/XChainBridge.cpp @@ -2235,7 +2235,7 @@ XChainCreateAccountCommit::doApply() } void -XChainCreateBridge::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainCreateBridge::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2253,7 +2253,7 @@ XChainCreateBridge::finalizeInvariants( } void -BridgeModify::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +BridgeModify::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2271,7 +2271,7 @@ BridgeModify::finalizeInvariants( } void -XChainClaim::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainClaim::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2284,7 +2284,7 @@ XChainClaim::finalizeInvariants(STTx const&, TER, XRPAmount, ReadView const&, be } void -XChainCommit::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainCommit::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2302,7 +2302,7 @@ XChainCommit::finalizeInvariants( } void -XChainCreateClaimID::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainCreateClaimID::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2320,7 +2320,7 @@ XChainCreateClaimID::finalizeInvariants( } void -XChainAddClaimAttestation::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainAddClaimAttestation::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2338,7 +2338,7 @@ XChainAddClaimAttestation::finalizeInvariants( } void -XChainAddAccountCreateAttestation::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainAddAccountCreateAttestation::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } @@ -2356,7 +2356,7 @@ XChainAddAccountCreateAttestation::finalizeInvariants( } void -XChainCreateAccountCommit::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +XChainCreateAccountCommit::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/check/CheckCancel.cpp b/src/libxrpl/tx/transactors/check/CheckCancel.cpp index f4602f98c6..8194c8284a 100644 --- a/src/libxrpl/tx/transactors/check/CheckCancel.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCancel.cpp @@ -104,7 +104,7 @@ CheckCancel::doApply() } void -CheckCancel::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CheckCancel::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/check/CheckCash.cpp b/src/libxrpl/tx/transactors/check/CheckCash.cpp index f753f604f0..87ad3cd098 100644 --- a/src/libxrpl/tx/transactors/check/CheckCash.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCash.cpp @@ -630,7 +630,7 @@ CheckCash::doApply() } void -CheckCash::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CheckCash::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/check/CheckCreate.cpp b/src/libxrpl/tx/transactors/check/CheckCreate.cpp index 129855e48d..6b3761b09b 100644 --- a/src/libxrpl/tx/transactors/check/CheckCreate.cpp +++ b/src/libxrpl/tx/transactors/check/CheckCreate.cpp @@ -257,7 +257,7 @@ CheckCreate::doApply() } void -CheckCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CheckCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp b/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp index c0ef7ea9e8..5ef9b2aaf6 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialAccept.cpp @@ -137,7 +137,7 @@ CredentialAccept::doApply() } void -CredentialAccept::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CredentialAccept::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp b/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp index 5cce1a7de8..c264c853ca 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialCreate.cpp @@ -186,7 +186,7 @@ CredentialCreate::doApply() } void -CredentialCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CredentialCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp b/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp index 6bd4ad54c5..43cf65c29f 100644 --- a/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp +++ b/src/libxrpl/tx/transactors/credentials/CredentialDelete.cpp @@ -95,7 +95,7 @@ CredentialDelete::doApply() } void -CredentialDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +CredentialDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp b/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp index 12edb43bff..afded198ba 100644 --- a/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp +++ b/src/libxrpl/tx/transactors/delegate/DelegateSet.cpp @@ -140,7 +140,7 @@ DelegateSet::doApply() } TER -DelegateSet::deleteDelegate(ApplyView& view, SLE::ref sle, beast::Journal j) +DelegateSet::deleteDelegate(ApplyView& view, SLE::Ref sle, beast::Journal j) { if (!sle) return tecINTERNAL; // LCOV_EXCL_LINE @@ -182,7 +182,7 @@ DelegateSet::deleteDelegate(ApplyView& view, SLE::ref sle, beast::Journal j) } void -DelegateSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +DelegateSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/delegate/DelegateUtils.cpp b/src/libxrpl/tx/transactors/delegate/DelegateUtils.cpp index 6def542c7d..70ae012e10 100644 --- a/src/libxrpl/tx/transactors/delegate/DelegateUtils.cpp +++ b/src/libxrpl/tx/transactors/delegate/DelegateUtils.cpp @@ -11,7 +11,7 @@ namespace xrpl { NotTEC -checkTxPermission(SLE::const_ref delegate, STTx const& tx) +checkTxPermission(SLE::ConstRef delegate, STTx const& tx) { if (!delegate) return terNO_DELEGATE_PERMISSION; @@ -30,7 +30,7 @@ checkTxPermission(SLE::const_ref delegate, STTx const& tx) } std::unordered_set -getGranularPermission(SLE::const_ref delegate, TxType const& txType) +getGranularPermission(SLE::ConstRef delegate, TxType const& txType) { std::unordered_set granularPermissions; if (!delegate) diff --git a/src/libxrpl/tx/transactors/dex/AMMBid.cpp b/src/libxrpl/tx/transactors/dex/AMMBid.cpp index 154e64ca8e..ba25026676 100644 --- a/src/libxrpl/tx/transactors/dex/AMMBid.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMBid.cpp @@ -377,7 +377,7 @@ AMMBid::doApply() } void -AMMBid::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMBid::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMClawback.cpp b/src/libxrpl/tx/transactors/dex/AMMClawback.cpp index f95f257ab6..76aa186db7 100644 --- a/src/libxrpl/tx/transactors/dex/AMMClawback.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMClawback.cpp @@ -416,7 +416,7 @@ AMMClawback::equalWithdrawMatchingOneAmount( } void -AMMClawback::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMClawback::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp index 2bc9aa5ba1..c61c18c6b8 100644 --- a/src/libxrpl/tx/transactors/dex/AMMCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMCreate.cpp @@ -418,7 +418,7 @@ AMMCreate::doApply() } void -AMMCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMDelete.cpp b/src/libxrpl/tx/transactors/dex/AMMDelete.cpp index e2ecec8242..527923ae4c 100644 --- a/src/libxrpl/tx/transactors/dex/AMMDelete.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMDelete.cpp @@ -65,7 +65,7 @@ AMMDelete::doApply() } void -AMMDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp index 64d6d70e67..64cca17b82 100644 --- a/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMDeposit.cpp @@ -1091,7 +1091,7 @@ AMMDeposit::equalDepositInEmptyState( } void -AMMDeposit::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMDeposit::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMVote.cpp b/src/libxrpl/tx/transactors/dex/AMMVote.cpp index 0f2b721ac4..2dafe29f21 100644 --- a/src/libxrpl/tx/transactors/dex/AMMVote.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMVote.cpp @@ -246,7 +246,7 @@ AMMVote::doApply() } void -AMMVote::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMVote::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp index 77b9071cf8..5c7ddaf1ec 100644 --- a/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp +++ b/src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp @@ -1263,7 +1263,7 @@ AMMWithdraw::isWithdrawAll(STTx const& tx) return WithdrawAll::No; } void -AMMWithdraw::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +AMMWithdraw::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/OfferCancel.cpp b/src/libxrpl/tx/transactors/dex/OfferCancel.cpp index fd19037d4f..9d19895acf 100644 --- a/src/libxrpl/tx/transactors/dex/OfferCancel.cpp +++ b/src/libxrpl/tx/transactors/dex/OfferCancel.cpp @@ -70,7 +70,7 @@ OfferCancel::doApply() } void -OfferCancel::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +OfferCancel::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp index 6c3c04f1a0..457d0dfc74 100644 --- a/src/libxrpl/tx/transactors/dex/OfferCreate.cpp +++ b/src/libxrpl/tx/transactors/dex/OfferCreate.cpp @@ -97,7 +97,7 @@ OfferCreate::preflight(PreflightContext const& ctx) return temINVALID_FLAG; // A zero DomainID is invalid for a PermissionedDomain ledger entry because - // keylet::permissionedDomain(uint256) uses the DomainID as the ledger key. + // keylet::permissionedDomain(UInt256) uses the DomainID as the ledger key. if (auto const domainID = tx[~sfDomainID]; ctx.rules.enabled(fixCleanup3_2_0) && domainID && *domainID == beast::kZero) return temMALFORMED; @@ -381,7 +381,7 @@ OfferCreate::flowCross( PaymentSandbox& psb, PaymentSandbox& psbCancel, Amounts const& takerAmount, - std::optional const& domainID) + std::optional const& domainID) { try { @@ -600,7 +600,7 @@ OfferCreate::applyHybrid( STAmount const& saTakerPays, STAmount const& saTakerGets, std::uint64_t openRate, - std::function)> const& setDir) + std::function)> const& setDir) { if (!sleOffer->isFieldPresent(sfDomainID)) return tecINTERNAL; // LCOV_EXCL_LINE @@ -614,7 +614,7 @@ OfferCreate::applyHybrid( auto dir = keylet::quality(keylet::book(book), openRate); bool const bookExists = sb.exists(dir); - auto const bookNode = sb.dirAppend(dir, offerKey, [&](SLE::ref sle) { + auto const bookNode = sb.dirAppend(dir, offerKey, [&](SLE::Ref sle) { // don't set domainID on the directory object since this directory is // for open book setDir(sle, std::nullopt); @@ -945,7 +945,7 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel) auto dir = keylet::quality(keylet::book(book), uRate); bool const bookExisted = static_cast(sb.peek(dir)); - auto setBookDir = [&](SLE::ref sle, std::optional const& maybeDomain) { + auto setBookDir = [&](SLE::Ref sle, std::optional const& maybeDomain) { saTakerPays.asset().visit( [&](Issue const& issue) { sle->setFieldH160(sfTakerPaysCurrency, issue.currency); @@ -963,7 +963,7 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel) sle->setFieldH256(sfDomainID, *maybeDomain); }; - auto const bookNode = sb.dirAppend(dir, offerIndex, [&](SLE::ref sle) { + auto const bookNode = sb.dirAppend(dir, offerIndex, [&](SLE::Ref sle) { // sets domainID on book directory if it's a domain offer setBookDir(sle, domainID); }); @@ -1066,7 +1066,7 @@ OfferCreate::doApply() } void -OfferCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +OfferCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/did/DIDDelete.cpp b/src/libxrpl/tx/transactors/did/DIDDelete.cpp index a2af4c1100..8eeeb08a62 100644 --- a/src/libxrpl/tx/transactors/did/DIDDelete.cpp +++ b/src/libxrpl/tx/transactors/did/DIDDelete.cpp @@ -64,7 +64,7 @@ DIDDelete::doApply() } void -DIDDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +DIDDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/did/DIDSet.cpp b/src/libxrpl/tx/transactors/did/DIDSet.cpp index 2659460b8d..68a36410f2 100644 --- a/src/libxrpl/tx/transactors/did/DIDSet.cpp +++ b/src/libxrpl/tx/transactors/did/DIDSet.cpp @@ -63,7 +63,7 @@ DIDSet::preflight(PreflightContext const& ctx) } static TER -addSLE(ApplyContext& ctx, SLE::ref sle, AccountID const& owner) +addSLE(ApplyContext& ctx, SLE::Ref sle, AccountID const& owner) { auto const sleAccount = ctx.view().peek(keylet::account(owner)); if (!sleAccount) @@ -151,7 +151,7 @@ DIDSet::doApply() } void -DIDSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +DIDSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp b/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp index 32b56b909f..19435f6e9e 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowCancel.cpp @@ -228,7 +228,7 @@ EscrowCancel::doApply() } void -EscrowCancel::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +EscrowCancel::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp index 589ad70230..9a8a0f1c74 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowCreate.cpp @@ -565,7 +565,7 @@ EscrowCreate::doApply() } void -EscrowCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +EscrowCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp index 59bec8ca4c..ced883ada6 100644 --- a/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp +++ b/src/libxrpl/tx/transactors/escrow/EscrowFinish.cpp @@ -415,7 +415,7 @@ EscrowFinish::doApply() } void -EscrowFinish::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +EscrowFinish::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp index b914f3cf24..d6ecb4045e 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverClawback.cpp @@ -83,7 +83,7 @@ LoanBrokerCoverClawback::preflight(PreflightContext const& ctx) return tesSUCCESS; } -std::expected +std::expected determineBrokerID(ReadView const& view, STTx const& tx) { // If the broker ID was provided in the transaction, that's all we @@ -161,7 +161,7 @@ determineClawAmount( SLE const& sleBroker, Asset const& vaultAsset, std::optional const& amount, - SLE::const_ref vaultSle, + SLE::ConstRef vaultSle, Rules const& rules) { auto const maxClawAmount = [&]() { @@ -376,7 +376,7 @@ LoanBrokerCoverClawback::doApply() } void -LoanBrokerCoverClawback::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanBrokerCoverClawback::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp index 09ab03347a..28855561c6 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverDeposit.cpp @@ -189,7 +189,7 @@ LoanBrokerCoverDeposit::doApply() } void -LoanBrokerCoverDeposit::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanBrokerCoverDeposit::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp index 88b6f8c38b..756af3f0cd 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerCoverWithdraw.cpp @@ -243,7 +243,7 @@ LoanBrokerCoverWithdraw::doApply() } void -LoanBrokerCoverWithdraw::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanBrokerCoverWithdraw::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp index 433d77806a..b816457e60 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerDelete.cpp @@ -201,7 +201,7 @@ LoanBrokerDelete::doApply() } void -LoanBrokerDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanBrokerDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp b/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp index 1ab4eb2ce0..2348f1a9b5 100644 --- a/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanBrokerSet.cpp @@ -295,7 +295,7 @@ LoanBrokerSet::doApply() } void -LoanBrokerSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanBrokerSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanDelete.cpp b/src/libxrpl/tx/transactors/lending/LoanDelete.cpp index bc8e974d10..3c94015cdc 100644 --- a/src/libxrpl/tx/transactors/lending/LoanDelete.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanDelete.cpp @@ -136,7 +136,7 @@ LoanDelete::doApply() } void -LoanDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanManage.cpp b/src/libxrpl/tx/transactors/lending/LoanManage.cpp index 2d710ceebe..575e305932 100644 --- a/src/libxrpl/tx/transactors/lending/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanManage.cpp @@ -134,9 +134,9 @@ LoanManage::preclaim(PreclaimContext const& ctx) TER LoanManage::defaultLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref brokerSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref brokerSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j) { @@ -286,8 +286,8 @@ LoanManage::defaultLoan( TER LoanManage::impairLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j) { @@ -338,8 +338,8 @@ LoanManage::impairLoan( [[nodiscard]] TER LoanManage::unimpairLoan( ApplyView& view, - SLE::ref loanSle, - SLE::ref vaultSle, + SLE::Ref loanSle, + SLE::Ref vaultSle, Asset const& vaultAsset, beast::Journal j) { @@ -436,7 +436,7 @@ LoanManage::doApply() } void -LoanManage::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanManage::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanPay.cpp b/src/libxrpl/tx/transactors/lending/LoanPay.cpp index 624c4d0a84..1015e89afc 100644 --- a/src/libxrpl/tx/transactors/lending/LoanPay.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanPay.cpp @@ -848,7 +848,7 @@ LoanPay::doApply() } void -LoanPay::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanPay::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/lending/LoanSet.cpp b/src/libxrpl/tx/transactors/lending/LoanSet.cpp index 85de6332d9..8425b8a55a 100644 --- a/src/libxrpl/tx/transactors/lending/LoanSet.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanSet.cpp @@ -76,7 +76,7 @@ LoanSet::preflight(PreflightContext const& ctx) if (tx.isFlag(tfInnerBatchTxn) && ctx.rules.enabled(featureBatchV1_1) && !tx.isFieldPresent(sfCounterparty)) { - auto const parentBatchId = ctx.parentBatchId.value_or(uint256{0}); + auto const parentBatchId = ctx.parentBatchId.value_or(UInt256{0}); JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: " << "no Counterparty for inner LoanSet transaction."; return temBAD_SIGNER; @@ -245,9 +245,9 @@ LoanSet::preclaim(PreclaimContext const& ctx) // startDate + (paymentInterval * paymentTotal) + gracePeriod. // If that value is larger than "maxTime", the value // overflows, and we kill the transaction. - using timeType = decltype(sfNextPaymentDueDate)::type::value_type; - static_assert(std::is_same_v); - constexpr timeType kMaxTime = std::numeric_limits::max(); + using TimeType = decltype(sfNextPaymentDueDate)::type::value_type; + static_assert(std::is_same_v); + constexpr TimeType kMaxTime = std::numeric_limits::max(); static_assert(kMaxTime == 4'294'967'295); auto const timeAvailable = kMaxTime - getStartDate(ctx.view); @@ -729,7 +729,7 @@ LoanSet::doApply() } void -LoanSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LoanSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp index 0cf7af1463..46dc782880 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenAcceptOffer.cpp @@ -64,7 +64,7 @@ TER NFTokenAcceptOffer::preclaim(PreclaimContext const& ctx) { auto const checkOffer = - [&ctx](std::optional id) -> std::pair { + [&ctx](std::optional id) -> std::pair { if (id) { if (id->isZero()) @@ -365,7 +365,7 @@ TER NFTokenAcceptOffer::transferNFToken( AccountID const& buyer, AccountID const& seller, - uint256 const& nftokenID) + UInt256 const& nftokenID) { auto tokenAndPage = nft::findTokenAndPage(view(), seller, nftokenID); @@ -405,7 +405,7 @@ NFTokenAcceptOffer::transferNFToken( } TER -NFTokenAcceptOffer::acceptOffer(SLE::ref offer) +NFTokenAcceptOffer::acceptOffer(SLE::Ref offer) { bool const isSell = offer->isFlag(lsfSellNFToken); AccountID const owner = (*offer)[sfOwner]; @@ -442,7 +442,7 @@ NFTokenAcceptOffer::acceptOffer(SLE::ref offer) TER NFTokenAcceptOffer::doApply() { - auto const loadToken = [this](std::optional const& id) { + auto const loadToken = [this](std::optional const& id) { SLE::pointer sle; if (id) sle = view().peek(keylet::nftokenOffer(*id)); @@ -458,7 +458,7 @@ NFTokenAcceptOffer::doApply() { bool foundExpired = false; - auto const deleteOfferIfExpired = [this, &foundExpired](SLE::ref offer) -> TER { + auto const deleteOfferIfExpired = [this, &foundExpired](SLE::Ref offer) -> TER { if (offer && hasExpired(view(), (*offer)[~sfExpiration])) { JLOG(j_.trace()) << "Offer is expired, deleting: " << offer->key(); @@ -570,7 +570,7 @@ NFTokenAcceptOffer::doApply() } void -NFTokenAcceptOffer::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenAcceptOffer::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp index d33b1af8c2..8e98a1fb63 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenBurn.cpp @@ -93,7 +93,7 @@ NFTokenBurn::doApply() } void -NFTokenBurn::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenBurn::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp index 6c6f7d4e8b..8e29436c59 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenCancelOffer.cpp @@ -29,7 +29,7 @@ NFTokenCancelOffer::preflight(PreflightContext const& ctx) // Zero offer IDs cannot be passed as ledger entry keys. if (ctx.rules.enabled(fixCleanup3_2_0) && - std::ranges::any_of(offerIds, [](uint256 const& id) { return id.isZero(); })) + std::ranges::any_of(offerIds, [](UInt256 const& id) { return id.isZero(); })) return temMALFORMED; // In order to prevent unnecessarily overlarge transactions, we @@ -49,7 +49,7 @@ NFTokenCancelOffer::preclaim(PreclaimContext const& ctx) auto const& ids = ctx.tx[sfNFTokenOffers]; - auto ret = std::ranges::find_if(ids, [&ctx, &account](uint256 const& id) { + auto ret = std::ranges::find_if(ids, [&ctx, &account](UInt256 const& id) { auto const offer = ctx.view.read(keylet::child(id)); // If id is not in the ledger we assume the offer was consumed @@ -103,7 +103,7 @@ NFTokenCancelOffer::doApply() } void -NFTokenCancelOffer::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenCancelOffer::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp b/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp index 259b9d7864..02795cced0 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenCreateOffer.cpp @@ -52,7 +52,7 @@ NFTokenCreateOffer::preclaim(PreclaimContext const& ctx) if (hasExpired(ctx.view, ctx.tx[~sfExpiration])) return tecEXPIRED; - uint256 const nftokenID = ctx.tx[sfNFTokenID]; + UInt256 const nftokenID = ctx.tx[sfNFTokenID]; std::uint32_t const txFlags = ctx.tx.getFlags(); if (!nft::findToken( ctx.view, ctx.tx[ctx.tx.isFlag(tfSellNFToken) ? sfAccount : sfOwner], nftokenID)) @@ -90,7 +90,7 @@ NFTokenCreateOffer::doApply() } void -NFTokenCreateOffer::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenCreateOffer::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp b/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp index 5490c2de3a..6eeceac9d4 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenMint.cpp @@ -131,7 +131,7 @@ NFTokenMint::preflight(PreflightContext const& ctx) return tesSUCCESS; } -uint256 +UInt256 NFTokenMint::createNFTokenID( std::uint16_t flags, std::uint16_t fee, @@ -176,7 +176,7 @@ NFTokenMint::createNFTokenID( std::distance(buf.data(), ptr) == buf.size(), "xrpl::NFTokenMint::createNFTokenID : data size matches the buffer"); - return uint256::fromVoid(buf.data()); + return UInt256::fromVoid(buf.data()); } TER @@ -346,7 +346,7 @@ NFTokenMint::doApply() } void -NFTokenMint::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenMint::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp b/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp index 32ba362ded..0572b4c780 100644 --- a/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp +++ b/src/libxrpl/tx/transactors/nft/NFTokenModify.cpp @@ -60,14 +60,14 @@ NFTokenModify::preclaim(PreclaimContext const& ctx) TER NFTokenModify::doApply() { - uint256 const nftokenID = ctx_.tx[sfNFTokenID]; + UInt256 const nftokenID = ctx_.tx[sfNFTokenID]; AccountID const owner = ctx_.tx[ctx_.tx.isFieldPresent(sfOwner) ? sfOwner : sfAccount]; return nft::changeTokenURI(view(), owner, nftokenID, ctx_.tx[~sfURI]); } void -NFTokenModify::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +NFTokenModify::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp b/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp index b4c12b9514..cfa484b06f 100644 --- a/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp +++ b/src/libxrpl/tx/transactors/oracle/OracleDelete.cpp @@ -52,7 +52,7 @@ OracleDelete::preclaim(PreclaimContext const& ctx) TER OracleDelete::deleteOracle( ApplyView& view, - SLE::ref sle, + SLE::Ref sle, AccountID const& account, beast::Journal j) { @@ -88,7 +88,7 @@ OracleDelete::doApply() } void -OracleDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +OracleDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/oracle/OracleSet.cpp b/src/libxrpl/tx/transactors/oracle/OracleSet.cpp index ead26824e5..454dfa9bd1 100644 --- a/src/libxrpl/tx/transactors/oracle/OracleSet.cpp +++ b/src/libxrpl/tx/transactors/oracle/OracleSet.cpp @@ -344,7 +344,7 @@ OracleSet::doApply() } void -OracleSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +OracleSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp b/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp index c11c0ed916..dd979ceda3 100644 --- a/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp +++ b/src/libxrpl/tx/transactors/payment/DepositPreauth.cpp @@ -268,7 +268,7 @@ DepositPreauth::doApply() } TER -DepositPreauth::removeFromLedger(ApplyView& view, uint256 const& preauthIndex, beast::Journal j) +DepositPreauth::removeFromLedger(ApplyView& view, UInt256 const& preauthIndex, beast::Journal j) { // Existence already checked in preclaim and AccountDelete auto const slePreauth{view.peek(keylet::depositPreauth(preauthIndex))}; @@ -301,7 +301,7 @@ DepositPreauth::removeFromLedger(ApplyView& view, uint256 const& preauthIndex, b } void -DepositPreauth::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +DepositPreauth::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/payment/Payment.cpp b/src/libxrpl/tx/transactors/payment/Payment.cpp index d2da173345..a9369d3963 100644 --- a/src/libxrpl/tx/transactors/payment/Payment.cpp +++ b/src/libxrpl/tx/transactors/payment/Payment.cpp @@ -141,7 +141,7 @@ Payment::preflight(PreflightContext const& ctx) return temMALFORMED; // A zero DomainID is invalid for a PermissionedDomain ledger entry because - // keylet::permissionedDomain(uint256) uses the DomainID as the ledger key. + // keylet::permissionedDomain(UInt256) uses the DomainID as the ledger key. if (auto const domainID = tx[~sfDomainID]; ctx.rules.enabled(fixCleanup3_2_0) && domainID && *domainID == beast::kZero) return temMALFORMED; @@ -837,7 +837,7 @@ Payment::doApply() } void -Payment::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +Payment::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp index 9143a675f6..b6fdb767e1 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelClaim.cpp @@ -207,7 +207,7 @@ PaymentChannelClaim::doApply() } void -PaymentChannelClaim::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +PaymentChannelClaim::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp index 26d8ff4f04..35f35237f9 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelCreate.cpp @@ -218,7 +218,7 @@ PaymentChannelCreate::doApply() } void -PaymentChannelCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +PaymentChannelCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp index 1d1cf07e25..fd83cd9cad 100644 --- a/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp +++ b/src/libxrpl/tx/transactors/payment_channel/PaymentChannelFund.cpp @@ -119,7 +119,7 @@ PaymentChannelFund::doApply() } void -PaymentChannelFund::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +PaymentChannelFund::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp index dc1b323482..249d8624b9 100644 --- a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp +++ b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainDelete.cpp @@ -74,7 +74,7 @@ PermissionedDomainDelete::doApply() } void -PermissionedDomainDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +PermissionedDomainDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp index 36c324eb80..7f7888bfc9 100644 --- a/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp +++ b/src/libxrpl/tx/transactors/permissioned_domain/PermissionedDomainSet.cpp @@ -138,7 +138,7 @@ PermissionedDomainSet::doApply() } void -PermissionedDomainSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +PermissionedDomainSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/proposal/TransactionProposalCreate.cpp b/src/libxrpl/tx/transactors/proposal/TransactionProposalCreate.cpp index 3ac7ead168..ace880651e 100644 --- a/src/libxrpl/tx/transactors/proposal/TransactionProposalCreate.cpp +++ b/src/libxrpl/tx/transactors/proposal/TransactionProposalCreate.cpp @@ -342,7 +342,7 @@ TransactionProposalCreate::doApply() } void -TransactionProposalCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +TransactionProposalCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). Object-level // invariants for the TransactionProposal ledger entry (unsigned canonical diff --git a/src/libxrpl/tx/transactors/sponsor/SponsorshipSet.cpp b/src/libxrpl/tx/transactors/sponsor/SponsorshipSet.cpp index e717c626e4..0d0f629a03 100644 --- a/src/libxrpl/tx/transactors/sponsor/SponsorshipSet.cpp +++ b/src/libxrpl/tx/transactors/sponsor/SponsorshipSet.cpp @@ -34,7 +34,7 @@ namespace xrpl { // clamped to zero (field absent) and overflow is rejected in preclaim. static std::int64_t totalRemainingOwnerCount( - SLE::const_ref sponsorshipSle, + SLE::ConstRef sponsorshipSle, std::optional const& remainingOwnerCountDelta) { std::uint32_t const currentCount = @@ -44,7 +44,7 @@ totalRemainingOwnerCount( static bool hasSponsorshipBudget( - SLE::const_ref sponsorshipSle, + SLE::ConstRef sponsorshipSle, std::optional const& feeAmountDelta, std::optional const& remainingOwnerCountDelta) { @@ -202,7 +202,7 @@ SponsorshipSet::preclaim(PreclaimContext const& ctx) } static TER -deleteSponsorship(ApplyView& view, SLE::ref sle, beast::Journal j) +deleteSponsorship(ApplyView& view, SLE::Ref sle, beast::Journal j) { if (!sle) return tecINTERNAL; // LCOV_EXCL_LINE @@ -250,8 +250,8 @@ SponsorshipSet::createSponsorship( Keylet const& sponsorshipKeylet, AccountID const& sponsorID, AccountID const& sponseeID, - SLE::ref sponsorAccSle, - SLE::ref reserveSponsorAccSle) + SLE::Ref sponsorAccSle, + SLE::Ref reserveSponsorAccSle) { auto const feeAmountDelta = ctx_.tx[~sfFeeAmountDelta]; auto const maxFee = ctx_.tx[~sfMaxFee]; @@ -469,7 +469,7 @@ SponsorshipSet::doApply() } void -SponsorshipSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +SponsorshipSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { } diff --git a/src/libxrpl/tx/transactors/sponsor/SponsorshipTransfer.cpp b/src/libxrpl/tx/transactors/sponsor/SponsorshipTransfer.cpp index 46c6ad4800..24f58fe984 100644 --- a/src/libxrpl/tx/transactors/sponsor/SponsorshipTransfer.cpp +++ b/src/libxrpl/tx/transactors/sponsor/SponsorshipTransfer.cpp @@ -28,7 +28,7 @@ namespace xrpl { static TER incrementSponsorCount( ApplyView& view, - SLE::ref sle, + SLE::Ref sle, SF_UINT32 const& field, std::uint32_t const delta) { @@ -50,7 +50,7 @@ incrementSponsorCount( static TER decrementSponsorCount( ApplyView& view, - SLE::ref sle, + SLE::Ref sle, SF_UINT32 const& field, std::uint32_t const delta) { @@ -71,7 +71,7 @@ decrementSponsorCount( // Consume the sponsor's pre-funded reserve budget and lowers the Sponsorship // object's RemainingOwnerCount. static TER -decrementPrefundedReserveCount(ApplyView& view, SLE::ref sponsorshipSle, std::uint32_t const delta) +decrementPrefundedReserveCount(ApplyView& view, SLE::Ref sponsorshipSle, std::uint32_t const delta) { if (delta == 0) return tesSUCCESS; // LCOV_EXCL_LINE @@ -317,7 +317,7 @@ SponsorshipTransfer::doApply() if (!sponseeSle) return tefINTERNAL; // LCOV_EXCL_LINE - auto const balanceBeforeFee = [&](SLE::const_ref sle) -> XRPAmount { + auto const balanceBeforeFee = [&](SLE::ConstRef sle) -> XRPAmount { if (sle->getAccountID(sfAccount) == accountID_) return preFeeBalance_; return sle->getFieldAmount(sfBalance).xrp(); @@ -552,7 +552,7 @@ SponsorshipTransfer::doApply() } void -SponsorshipTransfer::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +SponsorshipTransfer::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { } diff --git a/src/libxrpl/tx/transactors/system/Batch.cpp b/src/libxrpl/tx/transactors/system/Batch.cpp index e14611917e..877cdaeadd 100644 --- a/src/libxrpl/tx/transactors/system/Batch.cpp +++ b/src/libxrpl/tx/transactors/system/Batch.cpp @@ -253,11 +253,11 @@ Batch::preflight(PreflightContext const& ctx) } // Validation Inner Batch Txns - std::unordered_set uniqueHashes; + std::unordered_set uniqueHashes; std::unordered_map> accountSeqTicket; auto checkSignatureFields = [&parentBatchId, &j = ctx.j]( - STObject const& sig, uint256 const& hash, char const* label = "") -> NotTEC { + STObject const& sig, UInt256 const& hash, char const* label = "") -> NotTEC { if (sig.isFieldPresent(sfTxnSignature)) { JLOG(j.debug()) << "BatchTrace[" << parentBatchId << "]: " @@ -599,7 +599,7 @@ Batch::doApply() } void -Batch::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +Batch::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/system/Change.cpp b/src/libxrpl/tx/transactors/system/Change.cpp index 0d50b80af4..6f8facdd68 100644 --- a/src/libxrpl/tx/transactors/system/Change.cpp +++ b/src/libxrpl/tx/transactors/system/Change.cpp @@ -166,7 +166,7 @@ Change::preCompute() TER Change::applyAmendment() { - uint256 const amendment(ctx_.tx.getFieldH256(sfAmendment)); + UInt256 const amendment(ctx_.tx.getFieldH256(sfAmendment)); auto const k = keylet::amendments(); @@ -415,7 +415,7 @@ Change::applyUNLModify() } void -Change::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +Change::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp b/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp index 65c32b788c..23bb439928 100644 --- a/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp +++ b/src/libxrpl/tx/transactors/system/LedgerStateFix.cpp @@ -152,7 +152,7 @@ LedgerStateFix::doApply() } void -LedgerStateFix::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +LedgerStateFix::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/system/TicketCreate.cpp b/src/libxrpl/tx/transactors/system/TicketCreate.cpp index 8844d325a8..c49ae3abcc 100644 --- a/src/libxrpl/tx/transactors/system/TicketCreate.cpp +++ b/src/libxrpl/tx/transactors/system/TicketCreate.cpp @@ -135,7 +135,7 @@ TicketCreate::doApply() } void -TicketCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +TicketCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/Clawback.cpp b/src/libxrpl/tx/transactors/token/Clawback.cpp index 64457a3b5f..6ae27761a3 100644 --- a/src/libxrpl/tx/transactors/token/Clawback.cpp +++ b/src/libxrpl/tx/transactors/token/Clawback.cpp @@ -274,7 +274,7 @@ Clawback::doApply() } void -Clawback::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +Clawback::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.cpp b/src/libxrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.cpp index c00486e5e6..925c6fe817 100644 --- a/src/libxrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.cpp +++ b/src/libxrpl/tx/transactors/token/ConfidentialMPTMirrorUpdate.cpp @@ -255,7 +255,7 @@ ConfidentialMPTMirrorUpdate::doApply() } void -ConfidentialMPTMirrorUpdate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +ConfidentialMPTMirrorUpdate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { } diff --git a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp index 60b5c6d3af..7bfe46876c 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp @@ -171,7 +171,7 @@ MPTokenAuthorize::doApply() } void -MPTokenAuthorize::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +MPTokenAuthorize::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp index cd0f839030..6f02f9e305 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceCreate.cpp @@ -229,7 +229,7 @@ MPTokenIssuanceCreate::doApply() } void -MPTokenIssuanceCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +MPTokenIssuanceCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp index 05d39c3596..5b66bb8573 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceDestroy.cpp @@ -56,7 +56,7 @@ MPTokenIssuanceDestroy::doApply() } void -MPTokenIssuanceDestroy::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +MPTokenIssuanceDestroy::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp b/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp index 6bd7140631..b27b58a8d4 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenIssuanceSet.cpp @@ -499,7 +499,7 @@ MPTokenIssuanceSet::doApply() } void -MPTokenIssuanceSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +MPTokenIssuanceSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/token/TrustSet.cpp b/src/libxrpl/tx/transactors/token/TrustSet.cpp index 3d078ce825..a0a25274c0 100644 --- a/src/libxrpl/tx/transactors/token/TrustSet.cpp +++ b/src/libxrpl/tx/transactors/token/TrustSet.cpp @@ -376,8 +376,8 @@ TrustSet::doApply() std::uint32_t uHighQualityOut = 0; auto const& uLowAccountID = !bHigh ? accountID_ : uDstAccountID; auto const& uHighAccountID = bHigh ? accountID_ : uDstAccountID; - SLE::ref sleLowAccount = !bHigh ? sle : sleDst; - SLE::ref sleHighAccount = bHigh ? sle : sleDst; + SLE::Ref sleLowAccount = !bHigh ? sle : sleDst; + SLE::Ref sleHighAccount = bHigh ? sle : sleDst; // // Balances @@ -748,7 +748,7 @@ TrustSet::doApply() } void -TrustSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +TrustSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultClawback.cpp b/src/libxrpl/tx/transactors/vault/VaultClawback.cpp index 059da7cc0f..c236d5441a 100644 --- a/src/libxrpl/tx/transactors/vault/VaultClawback.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultClawback.cpp @@ -61,7 +61,7 @@ VaultClawback::preflight(PreflightContext const& ctx) [[nodiscard]] STAmount clawbackAmount( - SLE::const_ref vault, + SLE::ConstRef vault, std::optional const& maybeAmount, AccountID const& account) { @@ -232,8 +232,8 @@ VaultClawback::preclaim(PreclaimContext const& ctx) std::expected, TER> VaultClawback::assetsToClawback( - SLE::ref vault, - SLE::const_ref sleShareIssuance, + SLE::Ref vault, + SLE::ConstRef sleShareIssuance, AccountID const& holder, STAmount const& clawbackAmount) { @@ -542,7 +542,7 @@ VaultClawback::doApply() } void -VaultClawback::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultClawback::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultCreate.cpp b/src/libxrpl/tx/transactors/vault/VaultCreate.cpp index 7ade4ed5ab..da79d1675d 100644 --- a/src/libxrpl/tx/transactors/vault/VaultCreate.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultCreate.cpp @@ -223,7 +223,7 @@ VaultCreate::doApply() // Post-fixCleanup3_2_0: surface the vault pseudo's holding (MPToken // for MPT, RippleState for IOU) on the share via sfReferenceHolding. // XRP underlyings leave it unset. - auto const referenceHolding = [&]() -> std::optional { + auto const referenceHolding = [&]() -> std::optional { if (!view().rules().enabled(fixCleanup3_2_0) || asset.native()) return std::nullopt; return asset.holds() @@ -314,7 +314,7 @@ VaultCreate::doApply() } void -VaultCreate::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultCreate::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultDelete.cpp b/src/libxrpl/tx/transactors/vault/VaultDelete.cpp index 9c6c41654b..12a62811fb 100644 --- a/src/libxrpl/tx/transactors/vault/VaultDelete.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultDelete.cpp @@ -223,7 +223,7 @@ VaultDelete::doApply() } void -VaultDelete::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultDelete::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp b/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp index fc72159444..234ee9b8f5 100644 --- a/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultDeposit.cpp @@ -33,7 +33,7 @@ namespace xrpl { [[nodiscard]] static STAmount -roundToVaultScale(STAmount const& amount, SLE::const_ref vault) +roundToVaultScale(STAmount const& amount, SLE::ConstRef vault) { XRPL_ASSERT(vault && vault->getType() == ltVAULT, "xrpl::roundToVaultScale : valid vault sle"); XRPL_ASSERT( @@ -427,7 +427,7 @@ VaultDeposit::doApply() } void -VaultDeposit::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultDeposit::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultSet.cpp b/src/libxrpl/tx/transactors/vault/VaultSet.cpp index c71e84858a..ba8eeca63a 100644 --- a/src/libxrpl/tx/transactors/vault/VaultSet.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultSet.cpp @@ -178,7 +178,7 @@ VaultSet::doApply() } void -VaultSet::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultSet::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp b/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp index 4dc5b95c89..24af50a3e8 100644 --- a/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp +++ b/src/libxrpl/tx/transactors/vault/VaultWithdraw.cpp @@ -38,7 +38,7 @@ VaultWithdraw::checkExtraFeatures(PreflightContext const& ctx) } static WaiveUnrealizedLoss -shouldWaiveWithdrawal(ReadView const& view, AccountID const& account, SLE::const_ref issuance) +shouldWaiveWithdrawal(ReadView const& view, AccountID const& account, SLE::ConstRef issuance) { XRPL_ASSERT( issuance && issuance->getType() == ltMPTOKEN_ISSUANCE, @@ -589,7 +589,7 @@ VaultWithdraw::doApply() } void -VaultWithdraw::visitInvariantEntry(bool, SLE::const_ref, SLE::const_ref) +VaultWithdraw::visitInvariantEntry(bool, SLE::ConstRef, SLE::ConstRef) { // No transaction-specific invariants yet (future work). } diff --git a/src/test/app/AMMCalc_test.cpp b/src/test/app/AMMCalc_test.cpp index 23f251d57a..c2026731e1 100644 --- a/src/test/app/AMMCalc_test.cpp +++ b/src/test/app/AMMCalc_test.cpp @@ -45,15 +45,15 @@ namespace xrpl::test { */ class AMMCalc_test : public beast::unit_test::Suite { - using token_iter = boost::sregex_token_iterator; - using steps = std::vector>; - using transfer_rates = std::map; - using swapargs = std::tuple; + using TokenIter = boost::sregex_token_iterator; + using Steps = std::vector>; + using TransferRates = std::map; + using SwapArgs = std::tuple; jtx::Account const gw_{jtx::Account("gw")}; - token_iter const end_; + TokenIter const end_; std::optional - getAmt(token_iter const& p, bool* delimited = nullptr) + getAmt(TokenIter const& p, bool* delimited = nullptr) { using namespace jtx; if (p == end_) @@ -82,7 +82,7 @@ class AMMCalc_test : public beast::unit_test::Suite } std::optional> - getRate(token_iter const& p) + getRate(TokenIter const& p) { if (p == end_) return std::nullopt; @@ -103,7 +103,7 @@ class AMMCalc_test : public beast::unit_test::Suite } std::uint32_t - getFee(token_iter const& p) + getFee(TokenIter const& p) { if (p != end_) { @@ -114,7 +114,7 @@ class AMMCalc_test : public beast::unit_test::Suite } std::optional> - getAmounts(token_iter& p) + getAmounts(TokenIter& p) { if (p == end_) return std::nullopt; @@ -129,10 +129,10 @@ class AMMCalc_test : public beast::unit_test::Suite return {{{*a1, *a2}, amm}}; } - std::optional - getTransferRate(token_iter& p) + std::optional + getTransferRate(TokenIter& p) { - transfer_rates rates{}; + TransferRates rates{}; if (p == end_) return rates; std::string str = *p; @@ -156,11 +156,11 @@ class AMMCalc_test : public beast::unit_test::Suite return rates; } - std::optional - getSwap(token_iter& p) + std::optional + getSwap(TokenIter& p) { // pairs of amm pool or offer - steps pairs; + Steps pairs; // either amm pool or offer auto isPair = [](auto const& p) { std::string const s = *p; @@ -203,12 +203,12 @@ class AMMCalc_test : public beast::unit_test::Suite } static void - swapOut(swapargs const& args) + swapOut(SwapArgs const& args) { - auto const vp = std::get(args); + 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{}; @@ -266,12 +266,12 @@ class AMMCalc_test : public beast::unit_test::Suite } static void - swapIn(swapargs const& args) + swapIn(SwapArgs const& args) { - auto const vp = std::get(args); + 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{}; @@ -334,7 +334,7 @@ class AMMCalc_test : public beast::unit_test::Suite using namespace jtx; auto const a = arg(); boost::regex const re(","); - token_iter p(a.begin(), a.end(), re, -1); + TokenIter p(a.begin(), a.end(), re, -1); // Token is denoted as CUR(xxx), where CUR is the currency code // and xxx is the amount, for instance: XRP(100) or USD(11.5) // AMM is denoted as A(CUR1(xxx1),CUR2(xxx2)), for instance: diff --git a/src/test/app/AMMExtendedMPT_test.cpp b/src/test/app/AMMExtendedMPT_test.cpp index 5059128d4b..ae1339c41b 100644 --- a/src/test/app/AMMExtendedMPT_test.cpp +++ b/src/test/app/AMMExtendedMPT_test.cpp @@ -1085,7 +1085,7 @@ private: env.close(); env.require(Balance(cam, aBux(350'000'000'000'000))); env.require(Balance(cam, bBux(350'000'000'000'000))); - env.require(offers(cam, 1)); + env.require(Offers(cam, 1)); // This offer caused the assert. env(offer(cam, bBux(300'000'000'000'000), aBux(300'000'000'000'000))); diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 971a540ff7..04af29146f 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -1219,7 +1219,7 @@ private: env.close(); env.require(Balance(cam, aBux(35))); env.require(Balance(cam, bBux(35))); - env.require(offers(cam, 1)); + env.require(Offers(cam, 1)); // This offer caused the assert. env(offer(cam, bBux(30), aBux(30))); diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 0212035c6e..2645578707 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -89,7 +89,7 @@ private: // Seed from the local testableAmendments() which strips SAV and Lending. static std::vector - amendmentCombinations(std::initializer_list features) + amendmentCombinations(std::initializer_list features) { return jtx::amendmentCombinations(features, testableAmendments()); } @@ -6112,7 +6112,7 @@ private: double const rateGH = 0.0; }; - using uint64_t = std::uint64_t; + using Uint64T = std::uint64_t; for (auto const& input : { InputSet{ @@ -6120,15 +6120,15 @@ private: .poolUsdBIT = 3, // .poolUsdGH = 273, // .sendMaxUsdBIT{usdBIT(50)}, // - .sendUsdGH{usdGH, uint64_t(272'455089820359), -12}, // + .sendUsdGH{usdGH, Uint64T(272'455089820359), -12}, // .failUsdGH = STAmount{0}, // .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(46'47826086956522), -14}, // - .failUsdBITr{usdBIT, uint64_t(46'47826086956521), -14}, // - .goodUsdGH{usdGH, uint64_t(96'7543114220382), -13}, // - .goodUsdGHr{usdGH, uint64_t(96'7543114222965), -13}, // - .goodUsdBIT{usdBIT, uint64_t(8'464739069120721), -15}, // - .goodUsdBITr{usdBIT, uint64_t(8'464739069098152), -15}, // + .failUsdBIT{usdBIT, Uint64T(46'47826086956522), -14}, // + .failUsdBITr{usdBIT, Uint64T(46'47826086956521), -14}, // + .goodUsdGH{usdGH, Uint64T(96'7543114220382), -13}, // + .goodUsdGHr{usdGH, Uint64T(96'7543114222965), -13}, // + .goodUsdBIT{usdBIT, Uint64T(8'464739069120721), -15}, // + .goodUsdBITr{usdBIT, Uint64T(8'464739069098152), -15}, // .lpTokenBalance = {28'61817604250837, -14}, // .lpTokenBalanceAlt = IOUAmount{28'61817604250836, -14}, // .offer1BtcGH = 0.1, // @@ -6138,104 +6138,20 @@ private: .rateGH = 1.2, // }, InputSet{ - .testCase = "Overflow test {1, 100, 0.111}", // - .poolUsdBIT = 1, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(0.111)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(1'111), -3}, // - .failUsdBITr{usdBIT, uint64_t(1'111), -3}, // - .goodUsdGH{usdGH, uint64_t(90'04347888284115), -14}, // - .goodUsdGHr{usdGH, uint64_t(90'04347888284201), -14}, // - .goodUsdBIT{usdBIT, uint64_t(1'111), -3}, // - .goodUsdBITr{usdBIT, uint64_t(1'111), -3}, // - .lpTokenBalance{10, 0}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // - }, - InputSet{ - .testCase = "Overflow test {1, 100, 1.00}", // - .poolUsdBIT = 1, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(1.00)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(2), 0}, // - .failUsdBITr{usdBIT, uint64_t(2), 0}, // - .goodUsdGH{usdGH, uint64_t(52'94379354424079), -14}, // - .goodUsdGHr{usdGH, uint64_t(52'94379354424135), -14}, // - .goodUsdBIT{usdBIT, uint64_t(2), 0}, // - .goodUsdBITr{usdBIT, uint64_t(2), 0}, // - .lpTokenBalance{10, 0}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // - }, - InputSet{ - .testCase = "Overflow test {1, 100, 4.6432}", // - .poolUsdBIT = 1, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(4.6432)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(5'6432), -4}, // - .failUsdBITr{usdBIT, uint64_t(5'6432), -4}, // - .goodUsdGH{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdGHr{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdBIT{usdBIT, uint64_t(2'821579689703915), -15}, // - .goodUsdBITr{usdBIT, uint64_t(2'821579689703954), -15}, // - .lpTokenBalance{10, 0}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // - }, - InputSet{ - .testCase = "Overflow test {1, 100, 10}", // - .poolUsdBIT = 1, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(10)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(11), 0}, // - .failUsdBITr{usdBIT, uint64_t(11), 0}, // - .goodUsdGH{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdGHr{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdBIT{usdBIT, uint64_t(2'821579689703915), -15}, // - .goodUsdBITr{usdBIT, uint64_t(2'821579689703954), -15}, // - .lpTokenBalance{10, 0}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // - }, - InputSet{ - .testCase = "Overflow test {50, 100, 5.55}", // - .poolUsdBIT = 50, // + .testCase = "Overflow test {1, 100, 0.111}", // + .poolUsdBIT = 1, // .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(5.55)}, // + .sendMaxUsdBIT{usdBIT(0.111)}, // .sendUsdGH{usdGH, 100}, // .failUsdGH = STAmount{0}, // .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(55'55), -2}, // - .failUsdBITr{usdBIT, uint64_t(55'55), -2}, // - .goodUsdGH{usdGH, uint64_t(90'04347888284113), -14}, // - .goodUsdGHr{usdGH, uint64_t(90'0434788828413), -13}, // - .goodUsdBIT{usdBIT, uint64_t(55'55), -2}, // - .goodUsdBITr{usdBIT, uint64_t(55'55), -2}, // - .lpTokenBalance{uint64_t(70'71067811865475), -14}, // + .failUsdBIT{usdBIT, Uint64T(1'111), -3}, // + .failUsdBITr{usdBIT, Uint64T(1'111), -3}, // + .goodUsdGH{usdGH, Uint64T(90'04347888284115), -14}, // + .goodUsdGHr{usdGH, Uint64T(90'04347888284201), -14}, // + .goodUsdBIT{usdBIT, Uint64T(1'111), -3}, // + .goodUsdBITr{usdBIT, Uint64T(1'111), -3}, // + .lpTokenBalance{10, 0}, // .offer1BtcGH = 1e-5, // .offer2BtcGH = 1, // .offer2UsdGH = 1e-5, // @@ -6243,67 +6159,151 @@ private: .rateGH = 0, // }, InputSet{ - .testCase = "Overflow test {50, 100, 50.00}", // - .poolUsdBIT = 50, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(50.00)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH{usdGH, uint64_t(52'94379354424081), -14}, // - .failUsdGHr{usdGH, uint64_t(52'94379354424092), -14}, // - .failUsdBIT{usdBIT, uint64_t(100), 0}, // - .failUsdBITr{usdBIT, uint64_t(100), 0}, // - .goodUsdGH{usdGH, uint64_t(52'94379354424081), -14}, // - .goodUsdGHr{usdGH, uint64_t(52'94379354424092), -14}, // - .goodUsdBIT{usdBIT, uint64_t(100), 0}, // - .goodUsdBITr{usdBIT, uint64_t(100), 0}, // - .lpTokenBalance{uint64_t(70'71067811865475), -14}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // + .testCase = "Overflow test {1, 100, 1.00}", // + .poolUsdBIT = 1, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(1.00)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(2), 0}, // + .failUsdBITr{usdBIT, Uint64T(2), 0}, // + .goodUsdGH{usdGH, Uint64T(52'94379354424079), -14}, // + .goodUsdGHr{usdGH, Uint64T(52'94379354424135), -14}, // + .goodUsdBIT{usdBIT, Uint64T(2), 0}, // + .goodUsdBITr{usdBIT, Uint64T(2), 0}, // + .lpTokenBalance{10, 0}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // }, InputSet{ - .testCase = "Overflow test {50, 100, 232.16}", // - .poolUsdBIT = 50, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(232.16)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(282'16), -2}, // - .failUsdBITr{usdBIT, uint64_t(282'16), -2}, // - .goodUsdGH{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdGHr{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdBIT{usdBIT, uint64_t(141'0789844851958), -13}, // - .goodUsdBITr{usdBIT, uint64_t(141'0789844851962), -13}, // - .lpTokenBalance{70'71067811865475, -14}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // + .testCase = "Overflow test {1, 100, 4.6432}", // + .poolUsdBIT = 1, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(4.6432)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(5'6432), -4}, // + .failUsdBITr{usdBIT, Uint64T(5'6432), -4}, // + .goodUsdGH{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdGHr{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdBIT{usdBIT, Uint64T(2'821579689703915), -15}, // + .goodUsdBITr{usdBIT, Uint64T(2'821579689703954), -15}, // + .lpTokenBalance{10, 0}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // }, InputSet{ - .testCase = "Overflow test {50, 100, 500}", // - .poolUsdBIT = 50, // - .poolUsdGH = 100, // - .sendMaxUsdBIT{usdBIT(500)}, // - .sendUsdGH{usdGH, 100}, // - .failUsdGH = STAmount{0}, // - .failUsdGHr = STAmount{0}, // - .failUsdBIT{usdBIT, uint64_t(550), 0}, // - .failUsdBITr{usdBIT, uint64_t(550), 0}, // - .goodUsdGH{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdGHr{usdGH, uint64_t(35'44113971506987), -14}, // - .goodUsdBIT{usdBIT, uint64_t(141'0789844851958), -13}, // - .goodUsdBITr{usdBIT, uint64_t(141'0789844851962), -13}, // - .lpTokenBalance{70'71067811865475, -14}, // - .offer1BtcGH = 1e-5, // - .offer2BtcGH = 1, // - .offer2UsdGH = 1e-5, // - .rateBIT = 0, // - .rateGH = 0, // + .testCase = "Overflow test {1, 100, 10}", // + .poolUsdBIT = 1, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(10)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(11), 0}, // + .failUsdBITr{usdBIT, Uint64T(11), 0}, // + .goodUsdGH{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdGHr{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdBIT{usdBIT, Uint64T(2'821579689703915), -15}, // + .goodUsdBITr{usdBIT, Uint64T(2'821579689703954), -15}, // + .lpTokenBalance{10, 0}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // + }, + InputSet{ + .testCase = "Overflow test {50, 100, 5.55}", // + .poolUsdBIT = 50, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(5.55)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(55'55), -2}, // + .failUsdBITr{usdBIT, Uint64T(55'55), -2}, // + .goodUsdGH{usdGH, Uint64T(90'04347888284113), -14}, // + .goodUsdGHr{usdGH, Uint64T(90'0434788828413), -13}, // + .goodUsdBIT{usdBIT, Uint64T(55'55), -2}, // + .goodUsdBITr{usdBIT, Uint64T(55'55), -2}, // + .lpTokenBalance{Uint64T(70'71067811865475), -14}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // + }, + InputSet{ + .testCase = "Overflow test {50, 100, 50.00}", // + .poolUsdBIT = 50, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(50.00)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH{usdGH, Uint64T(52'94379354424081), -14}, // + .failUsdGHr{usdGH, Uint64T(52'94379354424092), -14}, // + .failUsdBIT{usdBIT, Uint64T(100), 0}, // + .failUsdBITr{usdBIT, Uint64T(100), 0}, // + .goodUsdGH{usdGH, Uint64T(52'94379354424081), -14}, // + .goodUsdGHr{usdGH, Uint64T(52'94379354424092), -14}, // + .goodUsdBIT{usdBIT, Uint64T(100), 0}, // + .goodUsdBITr{usdBIT, Uint64T(100), 0}, // + .lpTokenBalance{Uint64T(70'71067811865475), -14}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // + }, + InputSet{ + .testCase = "Overflow test {50, 100, 232.16}", // + .poolUsdBIT = 50, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(232.16)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(282'16), -2}, // + .failUsdBITr{usdBIT, Uint64T(282'16), -2}, // + .goodUsdGH{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdGHr{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdBIT{usdBIT, Uint64T(141'0789844851958), -13}, // + .goodUsdBITr{usdBIT, Uint64T(141'0789844851962), -13}, // + .lpTokenBalance{70'71067811865475, -14}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // + }, + InputSet{ + .testCase = "Overflow test {50, 100, 500}", // + .poolUsdBIT = 50, // + .poolUsdGH = 100, // + .sendMaxUsdBIT{usdBIT(500)}, // + .sendUsdGH{usdGH, 100}, // + .failUsdGH = STAmount{0}, // + .failUsdGHr = STAmount{0}, // + .failUsdBIT{usdBIT, Uint64T(550), 0}, // + .failUsdBITr{usdBIT, Uint64T(550), 0}, // + .goodUsdGH{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdGHr{usdGH, Uint64T(35'44113971506987), -14}, // + .goodUsdBIT{usdBIT, Uint64T(141'0789844851958), -13}, // + .goodUsdBITr{usdBIT, Uint64T(141'0789844851962), -13}, // + .lpTokenBalance{70'71067811865475, -14}, // + .offer1BtcGH = 1e-5, // + .offer2BtcGH = 1, // + .offer2UsdGH = 1e-5, // + .rateBIT = 0, // + .rateGH = 0, // }, }) { diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index aa7fe898e3..c39405fd7e 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -289,7 +289,7 @@ public: env(offer(alice, gw["USD"](1), XRP(1))); env.close(); } - env.require(offers(alice, 45)); + env.require(Offers(alice, 45)); // Close enough ledgers to be able to delete alice's account. incLgrSeqForAccDel(env, alice); @@ -337,8 +337,8 @@ public: env(offer(becky, gw["USD"](1), XRP(1))); env.close(); } - env.require(offers(alice, 200)); - env.require(offers(becky, 200)); + env.require(Offers(alice, 200)); + env.require(Offers(becky, 200)); // Close enough ledgers to be able to delete alice's and becky's // accounts. @@ -348,7 +348,7 @@ public: // alice writes a check to becky. Until that check is cashed or // canceled it will prevent alice's and becky's accounts from being // deleted. - uint256 const checkId = keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key; + UInt256 const checkId = keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(check::create(alice, becky, XRP(1))); env.close(); @@ -543,10 +543,10 @@ public: env(acctdelete(alice, gw), Fee(acctDelFee), Ter(tefTOO_BIG)); // Cancel one of alice's offers. Then the account delete can succeed. - env.require(offers(alice, kOfferCount)); + env.require(Offers(alice, kOfferCount)); env(offerCancel(alice, offerSeq0)); env.close(); - env.require(offers(alice, kOfferCount - 1)); + env.require(Offers(alice, kOfferCount - 1)); // alice successfully deletes her account. auto const alicePreDelBal{env.balance(alice)}; diff --git a/src/test/app/AccountSet_test.cpp b/src/test/app/AccountSet_test.cpp index d94fb66e50..307041d420 100644 --- a/src/test/app/AccountSet_test.cpp +++ b/src/test/app/AccountSet_test.cpp @@ -433,7 +433,7 @@ public: // non-zero sfMintedNFTokens and sfBurnedNFTokens fields. This // prevents an exception when the AccountRoot template is applied. { - uint256 const nftId0{token::getNextID(env, gw, 0u)}; + UInt256 const nftId0{token::getNextID(env, gw, 0u)}; env(token::mint(gw, 0u)); env.close(); @@ -556,19 +556,19 @@ public: std::uint32_t const ticketSeq{env.seq(alice) + 1}; env(ticket::create(alice, 1)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Try using a ticket that alice doesn't have. env(noop(alice), ticket::Use(ticketSeq + 1), Ter(terPRE_TICKET)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Actually use alice's ticket. Note that if a transaction consumes // a ticket then the account's sequence number does not advance. std::uint32_t const aliceSeq{env.seq(alice)}; env(noop(alice), ticket::Use(ticketSeq)); env.close(); - env.require(Owners(alice, 0), tickets(alice, 0)); + env.require(Owners(alice, 0), Tickets(alice, 0)); BEAST_EXPECT(aliceSeq == env.seq(alice)); // Try re-using a ticket that alice already used. diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index d420990cbc..814fd43155 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -44,14 +44,14 @@ namespace xrpl { class AmendmentTable_test final : public beast::unit_test::Suite { private: - static uint256 + static UInt256 amendmentId(std::string in) { - sha256_hasher h; + Sha256Hasher h; using beast::hash_append; hash_append(h, in); - auto const d = static_cast(h); - uint256 result; + auto const d = static_cast(h); + UInt256 result; std::memcpy(result.data(), d.data(), d.size()); return result; } @@ -72,7 +72,7 @@ private: } static Section - makeSection(uint256 const& amendment) + makeSection(UInt256 const& amendment) { Section section("Test"); section.append(to_string(amendment) + " " + to_string(amendment)); @@ -107,7 +107,7 @@ private: } static std::vector - makeDefaultYes(uint256 const amendment) + makeDefaultYes(UInt256 const amendment) { std::vector result{ {to_string(amendment), amendment, VoteBehavior::DefaultYes}}; @@ -226,7 +226,7 @@ public: { testcase("Construction"); test::jtx::Env env{*this, makeConfig()}; - auto table = makeTable(env, weeks(1)); + auto table = makeTable(env, Weeks(1)); for (auto const& a : allSupported_) BEAST_EXPECT(table->isSupported(amendmentId(a))); @@ -256,7 +256,7 @@ public: testcase("Name to ID mapping"); test::jtx::Env env{*this, makeConfig()}; - auto table = makeTable(env, weeks(1)); + auto table = makeTable(env, Weeks(1)); for (auto const& a : yes_) BEAST_EXPECT(table->find(a) == amendmentId(a)); @@ -273,7 +273,7 @@ public: // Vetoing an unsupported amendment should add the amendment to table. // Verify that unsupportedID is not in table. - uint256 const unsupportedID = amendmentId(unsupported_[0]); + UInt256 const unsupportedID = amendmentId(unsupported_[0]); { json::Value const unsupp = table->getJson(unsupportedID, true)[to_string(unsupportedID)]; @@ -305,7 +305,7 @@ public: try { test::jtx::Env env{*this, makeConfig()}; - if (makeTable(env, weeks(2), yesVotes, test, emptySection_)) + if (makeTable(env, Weeks(2), yesVotes, test, emptySection_)) fail("Accepted only amendment ID"); } catch (std::exception const& e) @@ -321,7 +321,7 @@ public: try { test::jtx::Env env{*this, makeConfig()}; - if (makeTable(env, weeks(2), yesVotes, test, emptySection_)) + if (makeTable(env, Weeks(2), yesVotes, test, emptySection_)) fail("Accepted extra arguments"); } catch (std::exception const& e) @@ -340,7 +340,7 @@ public: try { test::jtx::Env env{*this, makeConfig()}; - if (makeTable(env, weeks(2), yesVotes, test, emptySection_)) + if (makeTable(env, Weeks(2), yesVotes, test, emptySection_)) fail("Accepted short amendment ID"); } catch (std::exception const& e) @@ -359,7 +359,7 @@ public: try { test::jtx::Env env{*this, makeConfig()}; - if (makeTable(env, weeks(2), yesVotes, test, emptySection_)) + if (makeTable(env, Weeks(2), yesVotes, test, emptySection_)) fail("Accepted long amendment ID"); } catch (std::exception const& e) @@ -379,7 +379,7 @@ public: try { test::jtx::Env env{*this, makeConfig()}; - if (makeTable(env, weeks(2), yesVotes, test, emptySection_)) + if (makeTable(env, Weeks(2), yesVotes, test, emptySection_)) fail("Accepted non-hex amendment ID"); } catch (std::exception const& e) @@ -395,14 +395,14 @@ public: testcase("enable and veto"); test::jtx::Env env{*this, makeConfig()}; - std::unique_ptr table = makeTable(env, weeks(2)); + std::unique_ptr table = makeTable(env, Weeks(2)); // Note which entries are enabled (convert the amendment names to IDs) - std::set allEnabled; + std::set allEnabled; for (auto const& a : enabled_) allEnabled.insert(amendmentId(a)); - for (uint256 const& a : allEnabled) + for (UInt256 const& a : allEnabled) BEAST_EXPECT(table->enable(a)); // So far all enabled amendments are supported. @@ -411,7 +411,7 @@ public: // Verify all enables are enabled and nothing else. for (std::string const& a : yes_) { - uint256 const supportedID = amendmentId(a); + UInt256 const supportedID = amendmentId(a); bool const enabled = table->isEnabled(supportedID); bool const found = allEnabled.contains(supportedID); BEAST_EXPECTS( @@ -421,12 +421,12 @@ public: // All supported and unVetoed amendments should be returned as desired. { - std::set vetoed; + std::set vetoed; for (std::string const& a : vetoed_) vetoed.insert(amendmentId(a)); - std::vector const desired = table->getDesired(); - for (uint256 const& a : desired) + std::vector const desired = table->getDesired(); + for (UInt256 const& a : desired) BEAST_EXPECT(not vetoed.contains(a)); // Unveto an amendment that is already not vetoed. Shouldn't @@ -438,10 +438,10 @@ public: // UnVeto one of the vetoed amendments. It should now be desired. { - uint256 const unvetoedID = amendmentId(vetoed_[0]); + UInt256 const unvetoedID = amendmentId(vetoed_[0]); BEAST_EXPECT(table->unVeto(unvetoedID)); - std::vector const desired = table->getDesired(); + std::vector const desired = table->getDesired(); BEAST_EXPECT(std::ranges::find(desired, unvetoedID) != desired.end()); } @@ -467,7 +467,7 @@ public: { std::vector> ret; ret.reserve(num); - hash_set trustedValidators; + HashSet trustedValidators; trustedValidators.reserve(num); for (int i = 0; i < num; ++i) { @@ -491,10 +491,10 @@ public: AmendmentTable& table, std::chrono::hours hour, std::vector> const& validators, - std::vector> const& votes, - std::vector& ourVotes, - std::set& enabled, - majorityAmendments_t& majority) + std::vector> const& votes, + std::vector& ourVotes, + std::set& enabled, + MajorityAmendmentsT& majority) { // Do a round at the specified time // Returns the amendments we voted for @@ -517,7 +517,7 @@ public: for (auto const& [pub, sec] : validators) { ++i; - std::vector field; + std::vector field; for (auto const& [hash, nVotes] : votes) { @@ -584,19 +584,19 @@ public: auto const testAmendment = amendmentId("TestAmendment"); test::jtx::Env env{*this, feat}; - auto table = makeTable(env, weeks(2), emptyYes_, emptySection_, emptySection_); + auto table = makeTable(env, Weeks(2), emptyYes_, emptySection_, emptySection_); auto const validators = makeValidators(10, table); - std::vector> votes; - std::vector ourVotes; - std::set enabled; - majorityAmendments_t majority; + std::vector> votes; + std::vector ourVotes; + std::set enabled; + MajorityAmendmentsT majority; doRound( env.current()->rules(), *table, - weeks{1}, + Weeks{1}, validators, votes, ourVotes, @@ -606,7 +606,7 @@ public: BEAST_EXPECT(enabled.empty()); BEAST_EXPECT(majority.empty()); - uint256 const unsupportedID = amendmentId(unsupported_[0]); + UInt256 const unsupportedID = amendmentId(unsupported_[0]); { json::Value const unsupp = table->getJson(unsupportedID, false)[to_string(unsupportedID)]; @@ -627,7 +627,7 @@ public: doRound( env.current()->rules(), *table, - weeks{2}, + Weeks{2}, validators, votes, ourVotes, @@ -636,14 +636,14 @@ public: BEAST_EXPECT(ourVotes.empty()); BEAST_EXPECT(enabled.empty()); - majority[testAmendment] = hourTime(weeks{1}); + majority[testAmendment] = hourTime(Weeks{1}); // Note that the simulation code assumes others behave as we do, // so the amendment won't get enabled doRound( env.current()->rules(), *table, - weeks{5}, + Weeks{5}, validators, votes, ourVotes, @@ -662,19 +662,19 @@ public: auto const testAmendment = amendmentId("vetoedAmendment"); test::jtx::Env env{*this, feat}; - auto table = makeTable(env, weeks(2), emptyYes_, emptySection_, makeSection(testAmendment)); + auto table = makeTable(env, Weeks(2), emptyYes_, emptySection_, makeSection(testAmendment)); auto const validators = makeValidators(10, table); - std::vector> votes; - std::vector ourVotes; - std::set enabled; - majorityAmendments_t majority; + std::vector> votes; + std::vector ourVotes; + std::set enabled; + MajorityAmendmentsT majority; doRound( env.current()->rules(), *table, - weeks{1}, + Weeks{1}, validators, votes, ourVotes, @@ -689,7 +689,7 @@ public: doRound( env.current()->rules(), *table, - weeks{2}, + Weeks{2}, validators, votes, ourVotes, @@ -698,12 +698,12 @@ public: BEAST_EXPECT(ourVotes.empty()); BEAST_EXPECT(enabled.empty()); - majority[testAmendment] = hourTime(weeks{1}); + majority[testAmendment] = hourTime(Weeks{1}); doRound( env.current()->rules(), *table, - weeks{5}, + Weeks{5}, validators, votes, ourVotes, @@ -720,20 +720,20 @@ public: testcase("voteEnable"); test::jtx::Env env{*this, feat}; - auto table = makeTable(env, weeks(2), makeDefaultYes(yes_), emptySection_, emptySection_); + auto table = makeTable(env, Weeks(2), makeDefaultYes(yes_), emptySection_, emptySection_); auto const validators = makeValidators(10, table); - std::vector> votes; - std::vector ourVotes; - std::set enabled; - majorityAmendments_t majority; + std::vector> votes; + std::vector ourVotes; + std::set enabled; + MajorityAmendmentsT majority; // Week 1: We should vote for all known amendments not enabled doRound( env.current()->rules(), *table, - weeks{1}, + Weeks{1}, validators, votes, ourVotes, @@ -752,7 +752,7 @@ public: doRound( env.current()->rules(), *table, - weeks{2}, + Weeks{2}, validators, votes, ourVotes, @@ -762,13 +762,13 @@ public: BEAST_EXPECT(enabled.empty()); for (auto const& i : yes_) - BEAST_EXPECT(majority[amendmentId(i)] == hourTime(weeks{2})); + BEAST_EXPECT(majority[amendmentId(i)] == hourTime(Weeks{2})); // Week 5: We should enable the amendment doRound( env.current()->rules(), *table, - weeks{5}, + Weeks{5}, validators, votes, ourVotes, @@ -780,7 +780,7 @@ public: doRound( env.current()->rules(), *table, - weeks{6}, + Weeks{6}, validators, votes, ourVotes, @@ -801,17 +801,17 @@ public: auto const testAmendment = amendmentId("detectMajority"); test::jtx::Env env{*this, feat}; auto table = - makeTable(env, weeks(2), makeDefaultYes(testAmendment), emptySection_, emptySection_); + makeTable(env, Weeks(2), makeDefaultYes(testAmendment), emptySection_, emptySection_); auto const validators = makeValidators(16, table); - std::set enabled; - majorityAmendments_t majority; + std::set enabled; + MajorityAmendmentsT majority; for (int i = 0; i <= 17; ++i) { - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; if ((i > 0) && (i < 17)) votes.emplace_back(testAmendment, i); @@ -819,7 +819,7 @@ public: doRound( env.current()->rules(), *table, - weeks{i}, + Weeks{i}, validators, votes, ourVotes, @@ -867,24 +867,24 @@ public: test::jtx::Env env{*this, feat}; auto table = - makeTable(env, weeks(8), makeDefaultYes(testAmendment), emptySection_, emptySection_); + makeTable(env, Weeks(8), makeDefaultYes(testAmendment), emptySection_, emptySection_); auto const validators = makeValidators(16, table); - std::set enabled; - majorityAmendments_t majority; + std::set enabled; + MajorityAmendmentsT majority; { // establish majority - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; votes.emplace_back(testAmendment, validators.size()); doRound( env.current()->rules(), *table, - weeks{1}, + Weeks{1}, validators, votes, ourVotes, @@ -897,8 +897,8 @@ public: for (int i = 1; i < 8; ++i) { - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; // Gradually reduce support votes.emplace_back(testAmendment, validators.size() - i); @@ -906,7 +906,7 @@ public: doRound( env.current()->rules(), *table, - weeks{i + 1}, + Weeks{i + 1}, validators, votes, ourVotes, @@ -939,24 +939,24 @@ public: auto const testAmendment = amendmentId("changedUNL"); test::jtx::Env env{*this, feat}; auto table = - makeTable(env, weeks(8), makeDefaultYes(testAmendment), emptySection_, emptySection_); + makeTable(env, Weeks(8), makeDefaultYes(testAmendment), emptySection_, emptySection_); std::vector> validators = makeValidators(10, table); - std::set enabled; - majorityAmendments_t majority; + std::set enabled; + MajorityAmendmentsT majority; { // 10 validators with 2 voting against won't get majority. - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; votes.emplace_back(testAmendment, validators.size() - 2); doRound( env.current()->rules(), *table, - weeks{1}, + Weeks{1}, validators, votes, ourVotes, @@ -974,8 +974,8 @@ public: // trusted validators. auto callTrustChanged = [](std::vector> const& validators, std::unique_ptr const& table) { - // We need a hash_set to pass to trustChanged. - hash_set trustedValidators; + // We need a HashSet to pass to trustChanged. + HashSet trustedValidators; trustedValidators.reserve(validators.size()); std::ranges::for_each(validators, [&trustedValidators](auto const& val) { trustedValidators.insert(val.first); @@ -990,15 +990,15 @@ public: { // 11 validators with 2 voting against gains majority. - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; votes.emplace_back(testAmendment, validators.size() - 2); doRound( env.current()->rules(), *table, - weeks{2}, + Weeks{2}, validators, votes, ourVotes, @@ -1014,15 +1014,15 @@ public: std::pair const savedValidator = validators.front(); validators.erase(validators.begin()); - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; votes.emplace_back(testAmendment, validators.size() - 2); doRound( env.current()->rules(), *table, - weeks{3}, + Weeks{3}, validators, votes, ourVotes, @@ -1041,7 +1041,7 @@ public: doRound( env.current()->rules(), *table, - weeks{4}, + Weeks{4}, validators, votes, ourVotes, @@ -1063,7 +1063,7 @@ public: doRound( env.current()->rules(), *table, - weeks{5}, + Weeks{5}, validators, votes, ourVotes, @@ -1094,7 +1094,7 @@ public: test::jtx::Env env{*this, feat}; auto const testAmendment = amendmentId("validatorFlapping"); auto table = makeTable( - env, weeks(1), makeDefaultYes(testAmendment), emptySection_, emptySection_); + env, Weeks(1), makeDefaultYes(testAmendment), emptySection_, emptySection_); // Make two lists of validators, one with a missing validator, to // make it easy to simulate validator flapping. @@ -1103,11 +1103,11 @@ public: const mostValidators(allValidators.begin() + 1, allValidators.end()); BEAST_EXPECT(allValidators.size() == mostValidators.size() + 1); - std::set enabled; - majorityAmendments_t majority; + std::set enabled; + MajorityAmendmentsT majority; - std::vector> votes; - std::vector ourVotes; + std::vector> votes; + std::vector ourVotes; votes.emplace_back(testAmendment, allValidators.size() - 2); @@ -1165,18 +1165,18 @@ public: testcase("hasUnsupportedEnabled"); using namespace std::chrono_literals; - constexpr weeks kW(1); + constexpr Weeks kW(1); test::jtx::Env env{*this, makeConfig()}; auto table = makeTable(env, kW); BEAST_EXPECT(!table->hasUnsupportedEnabled()); BEAST_EXPECT(!table->firstUnsupportedExpected()); BEAST_EXPECT(table->needValidatedLedger(1)); - std::set enabled; + std::set enabled; std::ranges::for_each( unsupported_, [&enabled](auto const& s) { enabled.insert(amendmentId(s)); }); - majorityAmendments_t majority; + MajorityAmendmentsT majority; table->doValidatedLedger(1, enabled, majority); BEAST_EXPECT(table->hasUnsupportedEnabled()); BEAST_EXPECT(!table->firstUnsupportedExpected()); diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 7e6ecfb8ca..37b90d1725 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -164,7 +164,7 @@ class Batch_test : public beast::unit_test::Suite return std::make_pair(txIDs, strHex(batchID)); } - static uint256 + static UInt256 getCheckIndex(AccountID const& account, std::uint32_t uSequence) { return keylet::check(account, SeqProxy::rawSequence(uSequence)).key; @@ -462,7 +462,7 @@ class Batch_test : public beast::unit_test::Suite { auto jtx = env.jt(pay(alice, bob, XRP(1))); PreflightContext const pfCtx( - env.app(), *jtx.stx, uint256{1}, env.current()->rules(), TapBatch, env.journal); + env.app(), *jtx.stx, UInt256{1}, env.current()->rules(), TapBatch, env.journal); auto const pf = Transactor::invokePreflight(pfCtx); BEAST_EXPECT(pf == temINVALID_INNER_BATCH); } @@ -3357,7 +3357,7 @@ class Batch_test : public beast::unit_test::Suite auto const preBobUSD = env.balance(bob, usd.issue()); auto const batchFee = batch::calcBatchFee(env, 1, 2); - uint256 const chkID{getCheckIndex(bob, env.seq(bob))}; + UInt256 const chkID{getCheckIndex(bob, env.seq(bob))}; auto const [txIDs, batchID] = submitBatch( env, tesSUCCESS, @@ -3414,7 +3414,7 @@ class Batch_test : public beast::unit_test::Suite auto const preBobUSD = env.balance(bob, usd.issue()); auto const batchFee = batch::calcBatchFee(env, 1, 2); - uint256 const chkID{getCheckIndex(bob, env.seq(bob))}; + UInt256 const chkID{getCheckIndex(bob, env.seq(bob))}; auto const [txIDs, batchID] = submitBatch( env, tesSUCCESS, @@ -3491,7 +3491,7 @@ class Batch_test : public beast::unit_test::Suite auto const preBobUSD = env.balance(bob, usd.issue()); auto const batchFee = batch::calcBatchFee(env, 1, 3); - uint256 const chkID{getCheckIndex(bob, bobSeq + 1)}; + UInt256 const chkID{getCheckIndex(bob, bobSeq + 1)}; auto const [txIDs, batchID] = submitBatch( env, tesSUCCESS, @@ -3568,7 +3568,7 @@ class Batch_test : public beast::unit_test::Suite auto const preBobUSD = env.balance(bob, usd.issue()); auto const batchFee = batch::calcBatchFee(env, 2, 2); - uint256 const chkID{getCheckIndex(bob, env.seq(bob))}; + UInt256 const chkID{getCheckIndex(bob, env.seq(bob))}; auto const [txIDs, batchID] = submitBatch( env, tesSUCCESS, @@ -4194,7 +4194,7 @@ class Batch_test : public beast::unit_test::Suite auto const aliceSeq = env.seq(alice); // CheckCash Txn - uint256 const chkID{getCheckIndex(alice, aliceSeq)}; + UInt256 const chkID{getCheckIndex(alice, aliceSeq)}; auto const objTxn = env.jt(check::cash(bob, chkID, XRP(10))); auto const objTxnID = to_string(objTxn.stx->getTransactionID()); env(objTxn, Ter(tecNO_ENTRY)); @@ -4258,7 +4258,7 @@ class Batch_test : public beast::unit_test::Suite auto const bobSeq = env.seq(bob); // CheckCreate Txn - uint256 const chkID{getCheckIndex(alice, aliceSeq)}; + UInt256 const chkID{getCheckIndex(alice, aliceSeq)}; auto const objTxn = env.jt(check::create(alice, bob, XRP(10))); auto const objTxnID = to_string(objTxn.stx->getTransactionID()); env(objTxn, Ter(tesSUCCESS)); @@ -4321,7 +4321,7 @@ class Batch_test : public beast::unit_test::Suite // Batch Txn auto const batchFee = batch::calcBatchFee(env, 0, 2); - uint256 const chkID{getCheckIndex(alice, aliceSeq)}; + UInt256 const chkID{getCheckIndex(alice, aliceSeq)}; auto const [txIDs, batchID] = submitBatch( env, tesSUCCESS, @@ -4381,7 +4381,7 @@ class Batch_test : public beast::unit_test::Suite STTx const stx = STTx(ttAMENDMENT, [&](auto& obj) { obj.setAccountID(sfAccount, AccountID()); - obj.setFieldH256(sfAmendment, uint256(2)); + obj.setFieldH256(sfAmendment, UInt256(2)); obj.setFieldU32(sfLedgerSequence, env.seq(alice)); obj.setFieldU32(sfFlags, tfInnerBatchTxn); }); @@ -4662,7 +4662,7 @@ class Batch_test : public beast::unit_test::Suite env.fund(XRP(10000), alice, bob); env.close(); - auto submitTx = [&](std::uint32_t flags) -> uint256 { + auto submitTx = [&](std::uint32_t flags) -> UInt256 { auto jt = env.jt(pay(alice, bob, XRP(1)), Txflags(flags)); Serializer s; jt.stx->add(s); @@ -4670,7 +4670,7 @@ class Batch_test : public beast::unit_test::Suite return jt.stx->getTransactionID(); }; - auto processTxn = [&](std::uint32_t flags) -> uint256 { + auto processTxn = [&](std::uint32_t flags) -> UInt256 { auto jt = env.jt(pay(alice, bob, XRP(1)), Txflags(flags)); Serializer s; jt.stx->add(s); @@ -4684,13 +4684,13 @@ class Batch_test : public beast::unit_test::Suite // Validate: NetworkOPs::submitTransaction() { // Submit a tx with tfInnerBatchTxn - uint256 const txBad = submitTx(tfInnerBatchTxn); + UInt256 const txBad = submitTx(tfInnerBatchTxn); BEAST_EXPECT(env.app().getHashRouter().getFlags(txBad) == HashRouterFlags::UNDEFINED); } // Validate: NetworkOPs::processTransaction() { - uint256 const txid = processTxn(tfInnerBatchTxn); + UInt256 const txid = processTxn(tfInnerBatchTxn); // HashRouter::getFlags() should return LedgerFlags::BAD BEAST_EXPECT(env.app().getHashRouter().getFlags(txid) == HashRouterFlags::BAD); } diff --git a/src/test/app/CheckMPT_test.cpp b/src/test/app/CheckMPT_test.cpp index ffc9fb21b4..4c568afc47 100644 --- a/src/test/app/CheckMPT_test.cpp +++ b/src/test/app/CheckMPT_test.cpp @@ -58,7 +58,7 @@ class CheckMPT_test : public beast::unit_test::Suite checksOnAccount(test::jtx::Env& env, test::jtx::Account account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle && sle->getType() == ltCHECK) result.push_back(sle); }); @@ -150,13 +150,13 @@ class CheckMPT_test : public beast::unit_test::Suite env.close(); env(check::create(alice, bob, usd(50)), DestTag(3)); env.close(); - env(check::create(alice, bob, usd(50)), InvoiceId(uint256{4})); + env(check::create(alice, bob, usd(50)), InvoiceId(UInt256{4})); env.close(); env(check::create(alice, bob, usd(50)), Expiration(env.now() + 1s), SourceTag(12), DestTag(13), - InvoiceId(uint256{4})); + InvoiceId(UInt256{4})); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == aliceCount + 5); @@ -445,7 +445,7 @@ class CheckMPT_test : public beast::unit_test::Suite MPTTester({.env = env, .issuer = gw, .holders = {alice}, .maxAmt = 105}); // alice writes the check before she gets the funds. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(100))); env.close(); @@ -487,7 +487,7 @@ class CheckMPT_test : public beast::unit_test::Suite env(pay(bob, alice, usd(70))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(70))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 1); @@ -506,10 +506,10 @@ class CheckMPT_test : public beast::unit_test::Suite // alice writes two checks for USD(20), although she only has // USD(20). - uint256 const chkId3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(20))); env.close(); - uint256 const chkId4{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId4{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(20))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 2); @@ -547,7 +547,7 @@ class CheckMPT_test : public beast::unit_test::Suite env(pay(gw, bob, usd(200)), Ter(tecPATH_PARTIAL)); env.close(); - uint256 const chkId20{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId20{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, bob, usd(200))); env.close(); @@ -585,16 +585,16 @@ class CheckMPT_test : public beast::unit_test::Suite env.close(); // alice creates several checks ahead of time. - uint256 const chkId9{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId9{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(9))); env.close(); - uint256 const chkId8{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId8{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(8))); env.close(); - uint256 const chkId7{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId7{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(7))); env.close(); - uint256 const chkId6{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId6{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(6))); env.close(); @@ -668,7 +668,7 @@ class CheckMPT_test : public beast::unit_test::Suite env(pay(gw, alice, usd(deliverMin))); env.close(); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(deliverMin))); env.close(); @@ -699,7 +699,7 @@ class CheckMPT_test : public beast::unit_test::Suite // alice writes a check to bob for USD. bob can't cash it // because he is not authorized to hold gw["USD"]. - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(7))); env.close(); @@ -739,11 +739,11 @@ class CheckMPT_test : public beast::unit_test::Suite MPTTester({.env = env, .issuer = gw, .holders = {alice, bob}, .maxAmt = 20}); // alice creates her checks ahead of time. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); @@ -816,7 +816,7 @@ class CheckMPT_test : public beast::unit_test::Suite // alice writes a check with a SendMax of USD(125). The most bob // can get is USD(100) because of the transfer rate. - uint256 const chkId125{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId125{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(125))); env.close(); @@ -848,7 +848,7 @@ class CheckMPT_test : public beast::unit_test::Suite env(pay(gw, alice, eur(kMaxMpTokenAmount))); env.close(); - uint256 const chkIdMax{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdMax{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, eur(kMaxMpTokenAmount))); env.close(); @@ -895,48 +895,48 @@ class CheckMPT_test : public beast::unit_test::Suite // bob tries to cash a non-existent check from alice. { - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::cash(bob, chkId, usd(20)), Ter(tecNO_ENTRY)); env.close(); } // alice creates her checks ahead of time. - uint256 const chkIdU{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdU{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(20))); env.close(); - uint256 const chkIdX{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdX{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); using namespace std::chrono_literals; - uint256 const chkIdExp{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdFroz1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkIdFroz2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); - uint256 const chkIdFroz3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(3))); env.close(); - uint256 const chkIdNoDest1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNoDest1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkIdHasDest2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdHasDest2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2)), DestTag(7)); env.close(); // Same set of failing cases for both MPT and XRP check cashing. auto failingCases = [&env, &gw, &alice, &bob]( - uint256 const& chkId, STAmount const& amount) { + UInt256 const& chkId, STAmount const& amount) { // Bad fee. env(check::cash(bob, chkId, amount), Fee(drops(-10)), Ter(temBAD_FEE)); env.close(); @@ -1110,7 +1110,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Already at maximum BEAST_EXPECT(env.balance(gw, usdm) == usdm(-maxAmt)); - uint256 const chkId{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, bob, usdm(10))); env.close(); @@ -1150,51 +1150,51 @@ class CheckMPT_test : public beast::unit_test::Suite // alice creates her checks ahead of time. // Three ordinary checks with no expiration. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); - uint256 const chkId3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); // Three checks that expire in 10 minutes. using namespace std::chrono_literals; - uint256 const chkIdNotExp1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 600s)); env.close(); - uint256 const chkIdNotExp2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 600s)); env.close(); - uint256 const chkIdNotExp3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 600s)); env.close(); // Three checks that expire in one second. - uint256 const chkIdExp1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdExp2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdExp3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 1s)); env.close(); // Two checks to cancel using a regular key and using multisigning. - uint256 const chkIdReg{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdReg{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); - uint256 const chkIdMSig{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdMSig{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 11); @@ -1320,10 +1320,10 @@ class CheckMPT_test : public beast::unit_test::Suite env.require(Owners(alice, 11)); env.require(Owners(bob, 11)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); env(pay(gw, alice, usd(900))); @@ -1331,22 +1331,22 @@ class CheckMPT_test : public beast::unit_test::Suite // alice creates four checks; two XRP, two MPT. Bob will cash // one of each and cancel one of each. - uint256 const chkIdXrp1{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdXrp1{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, XRP(200)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdXrp2{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdXrp2{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, XRP(300)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdUsd1{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdUsd1{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, usd(200)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdUsd2{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdUsd2{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, usd(300)), ticket::Use(aliceTicketSeq++)); env.close(); // Alice used four tickets but created four checks. env.require(Owners(alice, 11)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).size() == 4); BEAST_EXPECT(env.seq(alice) == aliceSeq); @@ -1359,7 +1359,7 @@ class CheckMPT_test : public beast::unit_test::Suite env.close(); env.require(Owners(alice, 9)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).size() == 2); BEAST_EXPECT(env.seq(alice) == aliceSeq); @@ -1373,7 +1373,7 @@ class CheckMPT_test : public beast::unit_test::Suite auto const baseFee = env.current()->fees().base; env.require(Owners(alice, 7)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).empty()); BEAST_EXPECT(env.seq(alice) == aliceSeq); env.require(Balance(alice, usd(700))); @@ -1398,12 +1398,12 @@ class CheckMPT_test : public beast::unit_test::Suite // An account that independently tracks its owner count. struct AccountOwns { - using iterator = hash_map::iterator; + using iterator = HashMap::iterator; beast::unit_test::Suite& suite; Env& env; Account const acct; std::size_t owners{0}; - hash_map mpts; + HashMap mpts; bool const isIssuer; bool const requireAuth; @@ -1551,7 +1551,7 @@ class CheckMPT_test : public beast::unit_test::Suite env.fund(XRP(200), yui); env.close(); - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, yui, cK8(99))); env.close(); @@ -1608,7 +1608,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. MPT const cK1 = gw1["CK1"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK1(98))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK1.issuanceID, alice)) == nullptr); @@ -1658,7 +1658,7 @@ class CheckMPT_test : public beast::unit_test::Suite // impact MPT. Even though gw1 does not have rippling enabled, the // check cash succeeds for MPT and MPT is created. MPT const cK1 = gw1["CK1"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK1(97))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK1, bob)) == nullptr); @@ -1698,7 +1698,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK2 = gw1["CK2"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK2(96))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK2, alice)) == nullptr); @@ -1738,7 +1738,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK2 = gw1["CK2"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK2(95))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK2, bob)) == nullptr); @@ -1785,7 +1785,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK3 = gw1["CK3"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK3(94))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK3, alice)) == nullptr); @@ -1824,7 +1824,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK3 = gw1["CK3"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK3(93))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK3, bob)) == nullptr); @@ -1862,7 +1862,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK4 = gw1["CK4"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, bob, cK4(92))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK4, bob)) == nullptr); @@ -1903,7 +1903,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK4 = gw1["CK4"]; gw1.set(cK4, tfMPTLock); - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK4(92)), Ter(tecLOCKED)); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK4, alice)) == nullptr); @@ -1949,7 +1949,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. MPT const cK4 = gw1["CK4"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK4(91))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK4, bob)) == nullptr); @@ -1994,7 +1994,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. MPT const cK4 = gw1["CK4"]; gw1.set(cK4, tfMPTLock); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK4(91)), Ter(tecLOCKED)); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK4, bob)) == nullptr); @@ -2046,7 +2046,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create MPT. MPT const cK5 = gw2["CK5"]; - uint256 const chkId{getCheckIndex(gw2, env.seq(gw2))}; + UInt256 const chkId{getCheckIndex(gw2, env.seq(gw2))}; env(check::create(gw2, alice, cK5(92))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK5, alice)) == nullptr); @@ -2095,7 +2095,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. MPT const cK5 = gw3["CK5"]; - uint256 const chkId{getCheckIndex(gw3, env.seq(gw3))}; + UInt256 const chkId{getCheckIndex(gw3, env.seq(gw3))}; env(check::create(gw3, alice, cK5(92))); ++gw3.owners; env.close(); @@ -2145,7 +2145,7 @@ class CheckMPT_test : public beast::unit_test::Suite MPT const cK5 = gw2["CK5"]; gw2.authorize(cK5, alice); gw2.pay(gw2, alice, cK5(91)); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK5(91))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK5, bob)) == nullptr); @@ -2179,7 +2179,7 @@ class CheckMPT_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. MPT const cK5 = gw3["CK5"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK5(91))); env.close(); BEAST_EXPECT(env.le(keylet::mptoken(cK5, bob)) == nullptr); diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index 364f66c03a..590b49e96d 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -51,7 +51,7 @@ namespace xrpl { class Check_test : public beast::unit_test::Suite { - static uint256 + static UInt256 getCheckIndex(AccountID const& account, std::uint32_t uSequence) { return keylet::check(account, SeqProxy::rawSequence(uSequence)).key; @@ -62,7 +62,7 @@ class Check_test : public beast::unit_test::Suite checksOnAccount(test::jtx::Env& env, test::jtx::Account account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle && sle->getType() == ltCHECK) result.push_back(sle); }); @@ -109,14 +109,14 @@ class Check_test : public beast::unit_test::Suite env.fund(XRP(1000), alice); env.close(); - uint256 const checkId1{getCheckIndex(env.master, env.seq(env.master))}; + UInt256 const checkId1{getCheckIndex(env.master, env.seq(env.master))}; env(check::create(env.master, alice, XRP(100))); env.close(); env(check::cash(alice, checkId1, XRP(100))); env.close(); - uint256 const checkId2{getCheckIndex(env.master, env.seq(env.master))}; + UInt256 const checkId2{getCheckIndex(env.master, env.seq(env.master))}; env(check::create(env.master, alice, XRP(100))); env.close(); @@ -185,13 +185,13 @@ class Check_test : public beast::unit_test::Suite env.close(); env(check::create(alice, bob, usd(50)), DestTag(3)); env.close(); - env(check::create(alice, bob, usd(50)), InvoiceId(uint256{4})); + env(check::create(alice, bob, usd(50)), InvoiceId(UInt256{4})); env.close(); env(check::create(alice, bob, usd(50)), Expiration(env.now() + 1s), SourceTag(12), DestTag(13), - InvoiceId(uint256{4})); + InvoiceId(UInt256{4})); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == aliceCount + 5); @@ -505,7 +505,7 @@ class Check_test : public beast::unit_test::Suite env.close(); { // Basic XRP check. - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); env.require(Balance(alice, startBalance - drops(baseFeeDrops))); @@ -535,7 +535,7 @@ class Check_test : public beast::unit_test::Suite // Write a check that chews into alice's reserve. STAmount const reserve{env.current()->fees().reserve}; STAmount const checkAmount{startBalance - reserve - drops(baseFeeDrops)}; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, checkAmount)); env.close(); @@ -569,7 +569,7 @@ class Check_test : public beast::unit_test::Suite // Write a check that goes one drop past what alice can pay. STAmount const reserve{env.current()->fees().reserve}; STAmount const checkAmount{startBalance - reserve - drops(baseFeeDrops - 1)}; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, checkAmount)); env.close(); @@ -617,7 +617,7 @@ class Check_test : public beast::unit_test::Suite env.close(); // alice writes the check before she gets the funds. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); @@ -668,7 +668,7 @@ class Check_test : public beast::unit_test::Suite env(pay(bob, alice, usd(7))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(7))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 1); @@ -686,10 +686,10 @@ class Check_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, bob) == 1); // alice writes two checks for USD(2), although she only has USD(2). - uint256 const chkId3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); - uint256 const chkId4{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId4{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 2); @@ -729,7 +729,7 @@ class Check_test : public beast::unit_test::Suite env(pay(gw, bob, usd(20)), Ter(tecPATH_PARTIAL)); env.close(); - uint256 const chkId20{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId20{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, bob, usd(20))); env.close(); @@ -766,16 +766,16 @@ class Check_test : public beast::unit_test::Suite env.close(); // alice creates several checks ahead of time. - uint256 const chkId9{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId9{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(9))); env.close(); - uint256 const chkId8{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId8{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(8))); env.close(); - uint256 const chkId7{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId7{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(7))); env.close(); - uint256 const chkId6{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId6{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(6))); env.close(); @@ -850,7 +850,7 @@ class Check_test : public beast::unit_test::Suite // alice writes a check to bob for USD. bob can't cash it // because he is not authorized to hold gw["USD"]. - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(7))); env.close(); @@ -895,11 +895,11 @@ class Check_test : public beast::unit_test::Suite env.close(); // alice creates her checks ahead of time. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); @@ -974,14 +974,14 @@ class Check_test : public beast::unit_test::Suite // alice writes a check with a SendMax of USD(125). The most bob // can get is USD(100) because of the transfer rate. - uint256 const chkId125{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId125{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(125))); env.close(); // alice writes another check that won't get cashed until the transfer // rate changes so we can see the rate applies when the check is // cashed, not when it is created. - uint256 const chkId120{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId120{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(120))); env.close(); @@ -1087,7 +1087,7 @@ class Check_test : public beast::unit_test::Suite env(trust(truster, iou(1000)), inOrOut(pct)); env.close(); - uint256 const chkId = getCheckIndex(alice, env.seq(alice)); + UInt256 const chkId = getCheckIndex(alice, env.seq(alice)); env(check::create(alice, bob, usd(10))); env.close(); @@ -1184,7 +1184,7 @@ class Check_test : public beast::unit_test::Suite env.close(); // alice writes check to gw. gw cashes. - uint256 const chkAliceId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkAliceId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, gw, usd(max1))); env.close(); @@ -1193,7 +1193,7 @@ class Check_test : public beast::unit_test::Suite env.require(Balance(alice, aliceStart - usd(10))); // gw writes check to alice. alice cashes. - uint256 const chkGwId{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkGwId{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, alice, usd(max2))); env.close(); @@ -1253,7 +1253,7 @@ class Check_test : public beast::unit_test::Suite // bob tries to cash a non-existent check from alice. { - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::cash(bob, chkId, usd(20)), Ter(tecNO_ENTRY)); env.close(); } @@ -1261,59 +1261,59 @@ class Check_test : public beast::unit_test::Suite // Can't run pre-amendment behavior due to assertion failure. if (features[fixCleanup3_3_0]) { - env(check::cash(bob, uint256{}, usd(20)), Ter(temMALFORMED)); + env(check::cash(bob, UInt256{}, usd(20)), Ter(temMALFORMED)); env.close(); } // alice creates her checks ahead of time. - uint256 const chkIdU{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdU{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(20))); env.close(); - uint256 const chkIdX{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdX{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); using namespace std::chrono_literals; - uint256 const chkIdExp{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdFroz1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkIdFroz2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2))); env.close(); - uint256 const chkIdFroz3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(3))); env.close(); - uint256 const chkIdFroz4{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz4{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(4))); env.close(); - uint256 const chkIdFroz4ToIssuer{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdFroz4ToIssuer{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, gw, usd(4))); env.close(); - uint256 const chkIdFroz4Issuer{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkIdFroz4Issuer{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, alice, usd(4))); env.close(); - uint256 const chkIdNoDest1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNoDest1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(1))); env.close(); - uint256 const chkIdHasDest2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdHasDest2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(2)), DestTag(7)); env.close(); // Same set of failing cases for both IOU and XRP check cashing. auto failingCases = [&env, &gw, &alice, &bob]( - uint256 const& chkId, STAmount const& amount) { + UInt256 const& chkId, STAmount const& amount) { // Bad fee. env(check::cash(bob, chkId, amount), Fee(drops(-10)), Ter(temBAD_FEE)); env.close(); @@ -1547,51 +1547,51 @@ class Check_test : public beast::unit_test::Suite // alice creates her checks ahead of time. // Three ordinary checks with no expiration. - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); - uint256 const chkId2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); - uint256 const chkId3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); // Three checks that expire in 10 minutes. using namespace std::chrono_literals; - uint256 const chkIdNotExp1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 600s)); env.close(); - uint256 const chkIdNotExp2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 600s)); env.close(); - uint256 const chkIdNotExp3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdNotExp3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 600s)); env.close(); // Three checks that expire in one second. - uint256 const chkIdExp1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdExp2{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp2{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10)), Expiration(env.now() + 1s)); env.close(); - uint256 const chkIdExp3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdExp3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10)), Expiration(env.now() + 1s)); env.close(); // Two checks to cancel using a regular key and using multisigning. - uint256 const chkIdReg{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdReg{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, usd(10))); env.close(); - uint256 const chkIdMSig{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdMSig{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(10))); env.close(); BEAST_EXPECT(checksOnAccount(env, alice).size() == 11); @@ -1716,7 +1716,7 @@ class Check_test : public beast::unit_test::Suite // Can't run pre-amendment behavior due to assertion failure. if (features[fixCleanup3_3_0]) { - env(check::cancel(bob, uint256{}), Ter(temMALFORMED)); + env(check::cancel(bob, UInt256{}), Ter(temMALFORMED)); env.close(); } } @@ -1735,7 +1735,7 @@ class Check_test : public beast::unit_test::Suite env.fund(XRP(1000), alice, bob); env.close(); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, XRP(200))); env.close(); @@ -1791,10 +1791,10 @@ class Check_test : public beast::unit_test::Suite env.require(Owners(alice, 10)); env.require(Owners(bob, 10)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); env(pay(gw, alice, usd(900))); @@ -1802,22 +1802,22 @@ class Check_test : public beast::unit_test::Suite // alice creates four checks; two XRP, two IOU. Bob will cash // one of each and cancel one of each. - uint256 const chkIdXrp1{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdXrp1{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, XRP(200)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdXrp2{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdXrp2{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, XRP(300)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdUsd1{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdUsd1{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, usd(200)), ticket::Use(aliceTicketSeq++)); - uint256 const chkIdUsd2{getCheckIndex(alice, aliceTicketSeq)}; + UInt256 const chkIdUsd2{getCheckIndex(alice, aliceTicketSeq)}; env(check::create(alice, bob, usd(300)), ticket::Use(aliceTicketSeq++)); env.close(); // Alice used four tickets but created four checks. env.require(Owners(alice, 10)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).size() == 4); BEAST_EXPECT(env.seq(alice) == aliceSeq); @@ -1830,7 +1830,7 @@ class Check_test : public beast::unit_test::Suite env.close(); env.require(Owners(alice, 8)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).size() == 2); BEAST_EXPECT(env.seq(alice) == aliceSeq); @@ -1843,7 +1843,7 @@ class Check_test : public beast::unit_test::Suite env.close(); env.require(Owners(alice, 6)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(checksOnAccount(env, alice).empty()); BEAST_EXPECT(env.seq(alice) == aliceSeq); env.require(Balance(alice, usd(700))); @@ -1927,7 +1927,7 @@ class Check_test : public beast::unit_test::Suite env.fund(XRP(200), yui); env.close(); - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, yui, cK8(99))); env.close(); @@ -2053,7 +2053,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK1 = gw1["CK1"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK1(98))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(gw1, alice, cK1.currency)) == nullptr); @@ -2106,7 +2106,7 @@ class Check_test : public beast::unit_test::Suite // have rippling enabled the check cash fails and bob does not // have a trust line created. IOU const cK1 = gw1["CK1"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK1(97))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(alice, bob, cK1.currency)) == nullptr); @@ -2153,7 +2153,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK2 = gw1["CK2"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK2(96))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(gw1, alice, cK2.currency)) == nullptr); @@ -2194,7 +2194,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK2 = gw1["CK2"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK2(95))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(alice, bob, cK2.currency)) == nullptr); @@ -2244,7 +2244,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK3 = gw1["CK3"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK3(94))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(gw1, alice, cK3.currency)) == nullptr); @@ -2285,7 +2285,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK3 = gw1["CK3"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK3(93))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(alice, bob, cK3.currency)) == nullptr); @@ -2325,7 +2325,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK4 = gw1["CK4"]; - uint256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; + UInt256 const chkId{getCheckIndex(gw1, env.seq(gw1))}; env(check::create(gw1, alice, cK4(92)), Ter(tecFROZEN)); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(gw1, alice, cK4.currency)) == nullptr); @@ -2363,7 +2363,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK4 = gw1["CK4"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK4(91)), Ter(tecFROZEN)); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(alice, bob, cK4.currency)) == nullptr); @@ -2420,7 +2420,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK5 = gw2["CK5"]; - uint256 const chkId{getCheckIndex(gw2, env.seq(gw2))}; + UInt256 const chkId{getCheckIndex(gw2, env.seq(gw2))}; env(check::create(gw2, alice, cK5(92))); ++gw2.owners; env.close(); @@ -2465,7 +2465,7 @@ class Check_test : public beast::unit_test::Suite // Use check cashing to automatically create the trust line. IOU const cK5 = gw2["CK5"]; - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, bob, cK5(91))); env.close(); BEAST_EXPECT(env.le(keylet::trustLine(alice, bob, cK5.currency)) == nullptr); diff --git a/src/test/app/ConfidentialTransferExtended_test.cpp b/src/test/app/ConfidentialTransferExtended_test.cpp index fe5e0b3064..744f3bda72 100644 --- a/src/test/app/ConfidentialTransferExtended_test.cpp +++ b/src/test/app/ConfidentialTransferExtended_test.cpp @@ -434,7 +434,7 @@ class ConfidentialTransferExtended_test : public ConfidentialTransferTestBase std::vector tooManyCredentials; tooManyCredentials.reserve(9); for (int i = 0; i < 9; ++i) - tooManyCredentials.push_back(to_string(uint256(i))); + tooManyCredentials.push_back(to_string(UInt256(i))); mpt.send({ .account = carol, @@ -484,7 +484,7 @@ class ConfidentialTransferExtended_test : public ConfidentialTransferTestBase {.account = carol, .payAmount = 100, .convertAmount = 50}}}; auto& mpt = confEnv.mpt; - std::string const fakeCredIdx = to_string(uint256(999)); + std::string const fakeCredIdx = to_string(UInt256(999)); mpt.send({ .account = carol, .dest = bob, @@ -762,7 +762,7 @@ class ConfidentialTransferExtended_test : public ConfidentialTransferTestBase // than the ticket seq (ticketSeq1). { BEAST_EXPECT(env.seq(bob) != ticketSeq1); - uint256 const badCtxHash = + UInt256 const badCtxHash = getConvertContextHash(bob, mptAlice.issuanceID(), env.seq(bob)); auto const badProof = requireOptional( mptAlice.getSchnorrProof(bob, badCtxHash), "Missing Schnorr Proof."); diff --git a/src/test/app/ConfidentialTransfer_test.cpp b/src/test/app/ConfidentialTransfer_test.cpp index 9ff9270a7d..cc302f4a29 100644 --- a/src/test/app/ConfidentialTransfer_test.cpp +++ b/src/test/app/ConfidentialTransfer_test.cpp @@ -3431,7 +3431,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Generate the proof using known spending balance value auto const version = mptAlice.getMPTokenVersion(bob); - uint256 const convertBackContextHash = + UInt256 const convertBackContextHash = getConvertBackContextHash(bob.id(), mptAlice.issuanceID(), env.seq(bob), version); auto const proof = mptAlice.getConvertBackProof( @@ -5253,7 +5253,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // The proof uses PC(1, rho) but the transaction submits PC(balance, rho). // Verification fails because the proof doesn't match the submitted commitment. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); Buffer const badPedersenCommitment = mptAlice.getPedersenCommitment(1, pcBlindingFactor); @@ -5286,7 +5286,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // The pedersen commitment PC = balance*G + rho*H requires the same rho // used in proof generation. Using a different rho breaks the linkage. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); auto const proof = mptAlice.getConvertBackProof( @@ -5320,7 +5320,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // we cannot call mpt_get_convert_back_proof because it has client-side // verification. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); uint64_t constexpr claimedBalance = 20; // wrong: real balance is 40 @@ -5353,7 +5353,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // different pedersen commitment. Verification fails because the // submitted commitment doesn't match what the proof was generated for. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); Buffer const badPedersenCommitment = mptAlice.getPedersenCommitment(1, pcBlindingFactor); @@ -5387,7 +5387,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // sequence, issuanceID, amount, version). Using a different context hash // makes the proof invalid for this transaction, preventing replay attacks. { - uint256 const badContextHash{1}; + UInt256 const badContextHash{1}; auto const proof = mptAlice.getConvertBackProof( bob, @@ -5417,7 +5417,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Test 6: Correct proof to verify the test setup is valid. // All parameters are correct, so the transaction should succeed. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); auto const proof = mptAlice.getConvertBackProof( @@ -5912,7 +5912,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // we cannot call mpt_get_convert_back_proof because it has client-side // verification. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); uint64_t constexpr claimedBalance = 20; // wrong: real balance is 40 @@ -5945,7 +5945,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Pedersen commitment PC = balance*G + rho*H. Using a different rho // creates an inconsistency the verifier detects. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); auto const proof = mptAlice.getConvertBackProof( @@ -5978,7 +5978,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // sequence, issuanceID, amount, version). Using a different context hash // makes the proof invalid for this transaction, preventing replay attacks. { - uint256 const badContextHash{1}; + UInt256 const badContextHash{1}; auto const proof = mptAlice.getConvertBackProof( bob, amt, @@ -6007,7 +6007,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Test 4: Correct proof to verify the test setup is valid. // All parameters are correct, so the transaction should succeed. { - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), version); auto const proof = mptAlice.getConvertBackProof( @@ -6170,7 +6170,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Generate a valid proof pi for Amount m1 = 10 uint64_t const amtA = 10; uint32_t const currentSeq = env.seq(bob); - uint256 const contextHashA = + UInt256 const contextHashA = getConvertBackContextHash(bob, mptAlice.issuanceID(), currentSeq, version); auto const proofA = mptAlice.getConvertBackProof( @@ -6253,7 +6253,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase // Attack: Attempt to reuse proof tied to Version v at ledger Version v+1 uint32_t const currentSeq = env.seq(bob); // Proof is explicitly generated using the outdated Version v - uint256 const oldContextHash = + UInt256 const oldContextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), currentSeq, versionV); auto const oldProof = mptAlice.getConvertBackProof( @@ -6327,7 +6327,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase auto const currentVersion = mptAlice.getMPTokenVersion(bob); // Uses the new signature: Account, IssuanceID, Sequence, Version - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), currentVersion); auto const proof = mptAlice.getConvertBackProof( @@ -6472,7 +6472,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase Buffer const pedersenCommitment = mptAlice.getPedersenCommitment(kUnderflowedAmt, pcBf); auto const currentVersion = mptAlice.getMPTokenVersion(bob); - uint256 const contextHash = + UInt256 const contextHash = getConvertBackContextHash(bob, mptAlice.issuanceID(), env.seq(bob), currentVersion); auto const proof = mptAlice.getConvertBackProof( @@ -7764,7 +7764,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase mptAlice.getPedersenCommitment(spendingBalance, pcBlindingFactor); auto const version = mptAlice.getMPTokenVersion(bob); - uint256 const convertBackCtxHash = + UInt256 const convertBackCtxHash = getConvertBackContextHash(bob.id(), mptAlice.issuanceID(), env.seq(bob), version); auto const convertBackProof = mptAlice.getConvertBackProof( @@ -7807,7 +7807,7 @@ class ConfidentialTransfer_test : public ConfidentialTransferTestBase ConfidentialSendSetup const setup(mptAlice, bob, carol, alice, sendAmount); // Compute context hash with a fabricated (wrong) issuanceID - uint192 const fakeIssuanceID{1}; + UInt192 const fakeIssuanceID{1}; auto const wrongCtxHash = getSendContextHash( bob.id(), fakeIssuanceID, env.seq(bob), carol.id(), setup.version); diff --git a/src/test/app/CrossingLimitsMPT_test.cpp b/src/test/app/CrossingLimitsMPT_test.cpp index 8bd0c767f7..6bc6c5b2d6 100644 --- a/src/test/app/CrossingLimitsMPT_test.cpp +++ b/src/test/app/CrossingLimitsMPT_test.cpp @@ -265,16 +265,16 @@ public: env.require(Balance(bob, usd(1'500))); env.require(Balance(bob, eur(900))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(2'503))); env.require(Balance(alice, eur(1'100))); auto const numAOffers = 2'000 + 100 + 1'000 + 1 - ((2 * 100) + (2 * 199) + 1 + 1); - env.require(offers(alice, numAOffers)); + env.require(Offers(alice, numAOffers)); env.require(Owners(alice, numAOffers + 2)); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); }; testHelper2TokensMix(test); } @@ -352,17 +352,17 @@ public: env.require(Balance(bob, usd(1'509))); env.require(Balance(bob, eur(900))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(2'494))); env.require(Balance(alice, eur(1'100))); auto const numAOffers = 1 + 2'000 + 100 + 1'000 + 1 - (1 + (2 * 100) + (2 * 199) + 1 + 1); - env.require(offers(alice, numAOffers)); + env.require(Offers(alice, numAOffers)); env.require(Owners(alice, numAOffers + 2)); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); }; testHelper2TokensMix(test); } diff --git a/src/test/app/CrossingLimits_test.cpp b/src/test/app/CrossingLimits_test.cpp index c48892f04e..c92979e9ec 100644 --- a/src/test/app/CrossingLimits_test.cpp +++ b/src/test/app/CrossingLimits_test.cpp @@ -253,16 +253,16 @@ public: env.require(Balance(bob, usd(1500))); env.require(Balance(bob, eur(900))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(2503))); env.require(Balance(alice, eur(1100))); auto const numAOffers = 2000 + 100 + 1000 + 1 - ((2 * 100) + (2 * 199) + 1 + 1); - env.require(offers(alice, numAOffers)); + env.require(Offers(alice, numAOffers)); env.require(Owners(alice, numAOffers + 2)); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); } { Env env(*this, features); @@ -324,16 +324,16 @@ public: env.require(Balance(bob, usd(1509))); env.require(Balance(bob, eur(900))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(2494))); env.require(Balance(alice, eur(1100))); auto const numAOffers = 1 + 2000 + 100 + 1000 + 1 - (1 + (2 * 100) + (2 * 199) + 1 + 1); - env.require(offers(alice, numAOffers)); + env.require(Offers(alice, numAOffers)); env.require(Owners(alice, numAOffers + 2)); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); } } diff --git a/src/test/app/DNS_test.cpp b/src/test/app/DNS_test.cpp index c7e65fd995..2a3c025026 100644 --- a/src/test/app/DNS_test.cpp +++ b/src/test/app/DNS_test.cpp @@ -20,10 +20,10 @@ namespace xrpl::test { class DNS_test : public beast::unit_test::Suite { - using endpoint_type = boost::asio::ip::tcp::endpoint; - using error_code = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using ErrorCode = boost::system::error_code; std::weak_ptr work_; - endpoint_type lastEndpoint_; + EndpointType lastEndpoint_; ParsedUrl pUrl_; std::string port_; jtx::Env env_; @@ -37,11 +37,11 @@ public: } void - makeRequest(endpoint_type const& lastEndpoint, bool lastStatus) + makeRequest(EndpointType const& lastEndpoint, bool lastStatus) { - auto onFetch = [&](error_code const& errorCode, - endpoint_type const& endpoint, - xrpl::detail::response_type const& resp) { + auto onFetch = [&](ErrorCode const& errorCode, + EndpointType const& endpoint, + xrpl::detail::ResponseType const& resp) { BEAST_EXPECT(!errorCode); lastEndpoint_ = endpoint; resolved_[endpoint.address().to_string()]++; diff --git a/src/test/app/Delegate_test.cpp b/src/test/app/Delegate_test.cpp index 5f57cfa21b..bda89cdf98 100644 --- a/src/test/app/Delegate_test.cpp +++ b/src/test/app/Delegate_test.cpp @@ -625,7 +625,7 @@ class Delegate_test : public beast::unit_test::Suite auto const delegateKey = keylet::delegate(alice.id(), bob.id()); BEAST_EXPECT(env.closed()->exists(delegateKey)); - auto hasKey = [](xrpl::Dir const& dir, uint256 const& key) { + auto hasKey = [](xrpl::Dir const& dir, UInt256 const& key) { return std::any_of( // NOLINT(modernize-use-ranges) dir.begin(), dir.end(), [&](auto const& sle) { return sle->key() == key; }); }; @@ -674,7 +674,7 @@ class Delegate_test : public beast::unit_test::Suite auto const delegateKey = keylet::delegate(alice.id(), bob.id()); BEAST_EXPECT(env.closed()->exists(delegateKey)); - auto hasKey = [](xrpl::Dir const& dir, uint256 const& key) { + auto hasKey = [](xrpl::Dir const& dir, UInt256 const& key) { return std::any_of( // NOLINT(modernize-use-ranges) dir.begin(), dir.end(), [&](auto const& sle) { return sle->key() == key; }); }; @@ -743,7 +743,7 @@ class Delegate_test : public beast::unit_test::Suite auto const aliceBobKey = keylet::delegate(alice.id(), bob.id()); auto const carolBobKey = keylet::delegate(carol.id(), bob.id()); - auto hasKey = [](xrpl::Dir const& dir, uint256 const& key) { + auto hasKey = [](xrpl::Dir const& dir, UInt256 const& key) { return std::any_of( // NOLINT(modernize-use-ranges) dir.begin(), dir.end(), [&](auto const& sle) { return sle->key() == key; }); }; @@ -1256,11 +1256,11 @@ class Delegate_test : public beast::unit_test::Suite // sfDomainID is not in the PaymentMint or PaymentBurn template. env(pay(gw, alice, usd(100)), - Domain(uint256{1}), + Domain(UInt256{1}), delegate::As(bob), Ter(terNO_DELEGATE_PERMISSION)); env(pay(alice, gw, usd(50)), - Domain(uint256{1}), + Domain(UInt256{1}), delegate::As(bob), Ter(terNO_DELEGATE_PERMISSION)); } @@ -2666,7 +2666,7 @@ class Delegate_test : public beast::unit_test::Suite // non-delegable tx are not included. // NFTokenMint, NFTokenBurn, NFTokenCreateOffer, NFTokenCancelOffer, // NFTokenAcceptOffer are not included, they are tested separately. - std::unordered_map txRequiredFeatures{ + std::unordered_map txRequiredFeatures{ {"AMMClawback", featureAMMClawback}, {"AMMCreate", featureAMM}, {"AMMDeposit", featureAMM}, diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index c987e603be..b836db3515 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -421,7 +421,7 @@ struct DepositPreauth_test : public beast::unit_test::Suite env(ticket::create(alice, 2)); std::uint32_t const aliceSeq{env.seq(alice)}; env.close(); - env.require(tickets(alice, 2)); + env.require(Tickets(alice, 2)); // Consume the tickets from biggest seq to smallest 'cuz we can. std::uint32_t aliceTicketSeq{env.seq(alice)}; @@ -430,7 +430,7 @@ struct DepositPreauth_test : public beast::unit_test::Suite env(deposit::auth(alice, becky), ticket::Use(--aliceTicketSeq)); env.close(); // Alice uses a ticket but gains a preauth entry. - env.require(tickets(alice, 1)); + env.require(Tickets(alice, 1)); env.require(Owners(alice, 2)); BEAST_EXPECT(env.seq(alice) == aliceSeq); env.require(Owners(becky, 0)); @@ -438,7 +438,7 @@ struct DepositPreauth_test : public beast::unit_test::Suite // Remove a DepositPreauth from alice. env(deposit::unauth(alice, becky), ticket::Use(--aliceTicketSeq)); env.close(); - env.require(tickets(alice, 0)); + env.require(Tickets(alice, 0)); env.require(Owners(alice, 0)); BEAST_EXPECT(env.seq(alice) == aliceSeq); env.require(Owners(becky, 0)); @@ -608,7 +608,7 @@ struct DepositPreauth_test : public beast::unit_test::Suite env(pay(gw, alice, usd(500))); env.close(); - env(offer(alice, XRP(100), usd(100), tfPassive), Require(offers(alice, 1))); + env(offer(alice, XRP(100), usd(100), tfPassive), Require(Offers(alice, 1))); env.close(); // becky pays herself USD (10) by consuming part of alice's offer. diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 8a0d651004..3673bddb23 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1359,8 +1359,8 @@ struct Escrow_test : public beast::unit_test::Suite env(ticket::create(bob, kBobTicketCount)); env.close(); std::uint32_t bobTicket{env.seq(bob)}; - env.require(tickets(alice, 1)); - env.require(tickets(bob, kBobTicketCount)); + env.require(Tickets(alice, 1)); + env.require(Tickets(bob, kBobTicketCount)); // Note that from here on all transactions use tickets. No account // root sequences should change. @@ -1375,8 +1375,8 @@ struct Escrow_test : public beast::unit_test::Suite escrow::kFinishTime(ts), ticket::Use(aliceTicket)); BEAST_EXPECT(env.seq(alice) == aliceRootSeq); - env.require(tickets(alice, 0)); - env.require(tickets(bob, kBobTicketCount)); + env.require(Tickets(alice, 0)); + env.require(Tickets(bob, kBobTicketCount)); // Advance the ledger, verifying that the finish won't complete // prematurely. Note that each tec consumes one of bob's tickets. @@ -1419,8 +1419,8 @@ struct Escrow_test : public beast::unit_test::Suite std::uint32_t bobTicket{env.seq(bob) + 1}; env(ticket::create(bob, kBobTicketCount)); env.close(); - env.require(tickets(alice, 1)); - env.require(tickets(bob, kBobTicketCount)); + env.require(Tickets(alice, 1)); + env.require(Tickets(bob, kBobTicketCount)); // Note that from here on all transactions use tickets. No account // root sequences should change. @@ -1436,8 +1436,8 @@ struct Escrow_test : public beast::unit_test::Suite escrow::kCancelTime(ts), ticket::Use(aliceTicket)); BEAST_EXPECT(env.seq(alice) == aliceRootSeq); - env.require(tickets(alice, 0)); - env.require(tickets(bob, kBobTicketCount)); + env.require(Tickets(alice, 0)); + env.require(Tickets(bob, kBobTicketCount)); // Advance the ledger, verifying that the cancel won't complete // prematurely. @@ -1467,7 +1467,7 @@ struct Escrow_test : public beast::unit_test::Suite BEAST_EXPECT(env.seq(bob) == bobRootSeq); // Verify that bob actually consumed his tickets. - env.require(tickets(bob, env.seq(bob) - bobTicket)); + env.require(Tickets(bob, env.seq(bob) - bobTicket)); } } diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index 666dec1249..ce18ad2ed0 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -274,7 +274,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Create the next ledger to apply transaction to @@ -304,7 +304,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Create the next ledger to apply transaction to @@ -337,7 +337,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Create the next ledger to apply transaction to @@ -359,7 +359,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Create the next ledger to apply transaction to @@ -386,7 +386,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Create the next ledger to apply transaction to @@ -425,7 +425,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); ledger = std::make_shared(*ledger, env.app().getTimeKeeper().closeTime()); @@ -473,7 +473,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); ledger = std::make_shared(*ledger, env.app().getTimeKeeper().closeTime()); @@ -504,7 +504,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); ledger = std::make_shared(*ledger, env.app().getTimeKeeper().closeTime()); @@ -550,7 +550,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); ledger = std::make_shared(*ledger, env.app().getTimeKeeper().closeTime()); @@ -591,7 +591,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto sec = randomSecretKey(); @@ -621,7 +621,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto sec = randomSecretKey(); @@ -666,7 +666,7 @@ class FeeVote_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // doVoting requires a flag ledger (every 256th ledger) diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index d73ab9b6c7..1ebe3645ec 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -47,12 +47,12 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite // A helper function that generates 96 nfts packed into three pages // of 32 each. Returns a sorted vector of the NFTokenIDs packed into // the pages. - std::vector + std::vector genPackedTokens(test::jtx::Env& env, test::jtx::Account const& owner) { using namespace test::jtx; - std::vector nfts; + std::vector nfts; nfts.reserve(96); // We want to create fully packed NFT pages. This is a little @@ -178,7 +178,7 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite // NFTokenPageLink fixes require sfOwner and reject fields that // belong to other LedgerStateFix types. json::Value tx = ledger_state_fix::nftPageLinks(alice, alice); - tx[sfBookDirectory.jsonName] = to_string(uint256{1}); + tx[sfBookDirectory.jsonName] = to_string(UInt256{1}); env(tx, Fee(linkFixFee), Ter(temINVALID)); } { @@ -270,12 +270,12 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite //********************************************************************** // alice generates three packed pages. - std::vector aliceNFTs = genPackedTokens(env, alice); + std::vector aliceNFTs = genPackedTokens(env, alice); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); // Get the index of the middle page. - uint256 const aliceMiddleNFTokenPageIndex = [&env, &alice]() { + UInt256 const aliceMiddleNFTokenPageIndex = [&env, &alice]() { auto lastNFTokenPage = env.le(keylet::nftokenPageMax(alice)); return lastNFTokenPage->at(sfPreviousPageMin); }(); @@ -318,12 +318,12 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite //********************************************************************** // bob generates three packed pages. - std::vector bobNFTs = genPackedTokens(env, bob); + std::vector bobNFTs = genPackedTokens(env, bob); BEAST_EXPECT(nftCount(env, bob) == 96); BEAST_EXPECT(ownerCount(env, bob) == 3); // Get the index of the middle page. - uint256 const bobMiddleNFTokenPageIndex = [&env, &bob]() { + UInt256 const bobMiddleNFTokenPageIndex = [&env, &bob]() { auto lastNFTokenPage = env.le(keylet::nftokenPageMax(bob)); return lastNFTokenPage->at(sfPreviousPageMin); }(); @@ -361,22 +361,22 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite //********************************************************************** // carol generates three packed pages. - std::vector carolNFTs = genPackedTokens(env, carol); + std::vector carolNFTs = genPackedTokens(env, carol); BEAST_EXPECT(nftCount(env, carol) == 96); BEAST_EXPECT(ownerCount(env, carol) == 3); // Get the index of the middle page. - uint256 const carolMiddleNFTokenPageIndex = [&env, &carol]() { + UInt256 const carolMiddleNFTokenPageIndex = [&env, &carol]() { auto lastNFTokenPage = env.le(keylet::nftokenPageMax(carol)); return lastNFTokenPage->at(sfPreviousPageMin); }(); // carol sells all of the tokens in the very last page to daria. - std::vector dariaNFTs; + std::vector dariaNFTs; dariaNFTs.reserve(32); for (int i = 0; i < 32; ++i) { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(carol, SeqProxy::rawSequence(env.seq(carol))).key; env(token::createOffer(carol, carolNFTs.back(), XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -409,9 +409,9 @@ class FixNFTokenPageLinks_test : public beast::unit_test::Suite // bob's has: the last page is missing. Now we make things more // complicated by putting the last page back. carol buys their NFTs // back from daria. - for (uint256 const& nft : dariaNFTs) + for (UInt256 const& nft : dariaNFTs) { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(carol, SeqProxy::rawSequence(env.seq(carol))).key; env(token::createOffer(carol, nft, drops(1)), token::Owner(daria)); env.close(); diff --git a/src/test/app/FlowMPT_test.cpp b/src/test/app/FlowMPT_test.cpp index 0f88814d4f..d993af387b 100644 --- a/src/test/app/FlowMPT_test.cpp +++ b/src/test/app/FlowMPT_test.cpp @@ -576,7 +576,7 @@ struct FlowMPT_test : public beast::unit_test::Suite Sendmax(XRP(40)), Txflags(tfPartialPayment)); // +1 for fset in helperIssueIOU - using tEUR = std::decay_t; + using TEur = std::decay_t; auto const fee = txFee(env, 3); // bob pays 25% on 40USD (40 since sendmax is 40XRP) // 8USD goes to gw and 32USD goes back to bob -> @@ -584,7 +584,7 @@ struct FlowMPT_test : public beast::unit_test::Suite // bob pays 25% on 32EUR -> 7EUR if MPT, 6.4EUR if IOU, // therefore carl gets 25EUR if MPT, 25.6EUR if IOU. auto const carolEUR = [&]() { - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { return eur(25.6); } @@ -880,7 +880,7 @@ struct FlowMPT_test : public beast::unit_test::Suite offersOnAccount(jtx::Env& env, jtx::Account account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) result.push_back(sle); }); @@ -1758,7 +1758,7 @@ struct FlowMPT_test : public beast::unit_test::Suite .issuer = gw, .holders = {alice, carol}, .limit = 100}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; auto const eur = issue2( {.env = env, .token = "EUR", @@ -1772,7 +1772,7 @@ struct FlowMPT_test : public beast::unit_test::Suite env(pay(gw, carol, usd(100)), Sendmax(eur(100)), Path(~usd)); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) BEAST_EXPECT(env.balance(gw, usd) == usd(-100)); BEAST_EXPECT(env.balance(alice, usd) == usd(0)); BEAST_EXPECT(env.balance(alice, eur) == eur(100)); @@ -1841,14 +1841,14 @@ struct FlowMPT_test : public beast::unit_test::Suite .issuer = gw, .holders = {alice, carol, bob}, .limit = 1'000}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; auto const eur = issue2( {.env = env, .token = "EUR", .issuer = gw, .holders = {alice, carol, bob}, .limit = 1'000}); - using tEUR = std::decay_t; + using TEur = std::decay_t; env(pay(gw, alice, usd(600))); env(pay(gw, carol, eur(700))); @@ -1865,7 +1865,7 @@ struct FlowMPT_test : public beast::unit_test::Suite Path(~usd), Txflags(tfPartialPayment)); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { BEAST_EXPECT(env.balance(gw, usd) == usd(-1'000)); BEAST_EXPECT(env.balance(alice, usd) == usd(495)); @@ -1879,9 +1879,9 @@ struct FlowMPT_test : public beast::unit_test::Suite // for the holders BEAST_EXPECT(env.balance(bob, usd) == usd(615)); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { BEAST_EXPECT(env.balance(carol, eur) == eur(210)); } @@ -1898,9 +1898,9 @@ struct FlowMPT_test : public beast::unit_test::Suite } // 100/101 is partially crossed (90/91) and 100/100 is // unfunded when MPT. All offers are consumed if IOU. - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); // alice's offer is consumed. - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); }; testHelper2TokensMix(test); } @@ -1932,8 +1932,8 @@ struct FlowMPT_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(gw, usd) == usd(-1'624)); BEAST_EXPECT(env.balance(carol, usd) == usd(1'102)); - env.require(offers(carol, 0)); - env.require(offers(gw, 0)); + env.require(Offers(carol, 0)); + env.require(Offers(gw, 0)); // 100 XRP's = 5+6+7+17+23+10+15+17(25-8) BEAST_EXPECT(isOffer(env, alice, XRP(8), usd(15))); } diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 5f12d54aec..766d4cf3ab 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -715,7 +715,7 @@ struct Flow_test : public beast::unit_test::Suite offersOnAccount(jtx::Env& env, jtx::Account account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) result.push_back(sle); }); diff --git a/src/test/app/Freeze_test.cpp b/src/test/app/Freeze_test.cpp index 79087dacc3..cc538ec247 100644 --- a/src/test/app/Freeze_test.cpp +++ b/src/test/app/Freeze_test.cpp @@ -304,21 +304,21 @@ class Freeze_test : public beast::unit_test::Suite auto const flags = getTrustlineFlags(env, 5u, 3u, false); BEAST_EXPECT(flags & lsfLowFreeze); env.close(); - env.require(lines(a1, 1)); + env.require(Lines(a1, 1)); } // Cleanup env(trust(g1, a1["USD"](0), tfClearFreeze)); env.close(); - env.require(lines(g1, 0)); - env.require(lines(a1, 0)); + env.require(Lines(g1, 0)); + env.require(Lines(a1, 0)); // test: cannot create deep frozen trustline without normal freeze if (features[featureDeepFreeze]) { env(trust(g1, a1["USD"](1000), tfSetDeepFreeze), Ter(tecNO_PERMISSION)); env.close(); - env.require(lines(a1, 0)); + env.require(Lines(a1, 0)); } // test: can create deep frozen trustline together with normal freeze @@ -329,7 +329,7 @@ class Freeze_test : public beast::unit_test::Suite BEAST_EXPECT(flags & lsfLowFreeze); BEAST_EXPECT(flags & lsfLowDeepFreeze); env.close(); - env.require(lines(a1, 1)); + env.require(Lines(a1, 1)); } } @@ -768,7 +768,7 @@ class Freeze_test : public beast::unit_test::Suite // Wants to buy 100 USD for 100 XRP env(offer(a3, usd(100), XRP(100)), Txflags(tfPassive)); env.close(); - env.require(offers(a2, 1), offers(a3, 1)); + env.require(Offers(a2, 1), Offers(a3, 1)); // Checking A1 can buy from A2 by crossing it's offer env(offer(a1, usd(1), XRP(2)), Txflags(tfFillOrKill)); @@ -789,26 +789,26 @@ class Freeze_test : public beast::unit_test::Suite // test: can still make passive buy offer env(offer(a1, usd(1), XRP(0.5)), Txflags(tfPassive)); env.close(); - env.require(Balance(a1, usd(1000)), offers(a1, 1)); + env.require(Balance(a1, usd(1000)), Offers(a1, 1)); // Cleanup env(offerCancel(a1, env.seq(a1) - 1)); - env.require(offers(a1, 0)); + env.require(Offers(a1, 0)); env.close(); // test: can still buy from A2 env(offer(a1, usd(1), XRP(2)), Txflags(tfFillOrKill)); env.close(); - env.require(Balance(a1, usd(1001)), Balance(a2, usd(998)), offers(a1, 0)); + env.require(Balance(a1, usd(1001)), Balance(a2, usd(998)), Offers(a1, 0)); // test: cannot create passive sell offer env(offer(a1, XRP(2), usd(1)), Txflags(tfPassive), Ter(tecUNFUNDED_OFFER)); env.close(); - env.require(Balance(a1, usd(1001)), offers(a1, 0)); + env.require(Balance(a1, usd(1001)), Offers(a1, 0)); // test: cannot sell to A3 env(offer(a1, XRP(1), usd(1)), Txflags(tfFillOrKill), Ter(tecUNFUNDED_OFFER)); env.close(); - env.require(Balance(a1, usd(1001)), offers(a1, 0)); + env.require(Balance(a1, usd(1001)), Offers(a1, 0)); env(trust(g1, a1["USD"](0), tfClearFreeze)); env.close(); @@ -839,7 +839,7 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, a1["USD"](0), tfClearFreeze | tfClearDeepFreeze)); env.close(); - env.require(Balance(a1, usd(1001)), offers(a1, 0)); + env.require(Balance(a1, usd(1001)), Offers(a1, 0)); } // Testing already existing offers behavior after trustline is frozen by @@ -849,7 +849,7 @@ class Freeze_test : public beast::unit_test::Suite env(offer(a1, XRP(1.9), usd(1))); env(offer(a1, usd(1), XRP(1.1))); env.close(); - env.require(Balance(a1, usd(1001)), offers(a1, 2)); + env.require(Balance(a1, usd(1001)), Offers(a1, 2)); env(trust(g1, a1["USD"](0), tfSetFreeze)); env.close(); @@ -858,13 +858,13 @@ class Freeze_test : public beast::unit_test::Suite env.require(Balance(a1, usd(1001)), Balance(a2, usd(998))); env(offer(a2, XRP(1.1), usd(1)), Txflags(tfFillOrKill)); env.close(); - env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), Offers(a1, 1)); // test: A3 wants to buy from A1, must fail - env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), Offers(a1, 1)); env(offer(a3, usd(1), XRP(1.9)), Txflags(tfFillOrKill), Ter(tecKILLED)); env.close(); - env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), offers(a1, 0)); + env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), Offers(a1, 0)); env(trust(g1, a1["USD"](0), tfClearFreeze)); env.close(); @@ -878,7 +878,7 @@ class Freeze_test : public beast::unit_test::Suite env(offer(a1, XRP(1.9), usd(1))); env(offer(a1, usd(1), XRP(1.1))); env.close(); - env.require(Balance(a1, usd(1002)), offers(a1, 2)); + env.require(Balance(a1, usd(1002)), Offers(a1, 2)); env(trust(g1, a1["USD"](0), tfSetFreeze | tfSetDeepFreeze)); env.close(); @@ -887,13 +887,13 @@ class Freeze_test : public beast::unit_test::Suite env.require(Balance(a1, usd(1002)), Balance(a2, usd(997))); env(offer(a2, XRP(1.1), usd(1)), Txflags(tfFillOrKill), Ter(tecKILLED)); env.close(); - env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), Offers(a1, 1)); // test: A3 wants to buy from A1, must fail - env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), Offers(a1, 1)); env(offer(a3, usd(1), XRP(1.9)), Txflags(tfFillOrKill), Ter(tecKILLED)); env.close(); - env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), offers(a1, 0)); + env.require(Balance(a1, usd(1002)), Balance(a3, usd(1)), Offers(a1, 0)); env(trust(g1, a1["USD"](0), tfClearFreeze | tfClearDeepFreeze)); env.close(); @@ -908,30 +908,30 @@ class Freeze_test : public beast::unit_test::Suite // test: A1 can make passive buy offer env(offer(a1, usd(1), XRP(0.5)), Txflags(tfPassive)); env.close(); - env.require(Balance(a1, usd(1002)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Offers(a1, 1)); // Cleanup env(offerCancel(a1, env.seq(a1) - 1)); - env.require(offers(a1, 0)); + env.require(Offers(a1, 0)); env.close(); // test: A1 wants to buy, must fail env(offer(a1, usd(1), XRP(2)), Txflags(tfFillOrKill), Ter(tecKILLED)); env.close(); - env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), offers(a1, 0)); + env.require(Balance(a1, usd(1002)), Balance(a2, usd(997)), Offers(a1, 0)); // test: A1 can create passive sell offer env(offer(a1, XRP(2), usd(1)), Txflags(tfPassive)); env.close(); - env.require(Balance(a1, usd(1002)), offers(a1, 1)); + env.require(Balance(a1, usd(1002)), Offers(a1, 1)); // Cleanup env(offerCancel(a1, env.seq(a1) - 1)); - env.require(offers(a1, 0)); + env.require(Offers(a1, 0)); env.close(); // test: A1 can sell to A3 env(offer(a1, XRP(1), usd(1)), Txflags(tfFillOrKill)); env.close(); - env.require(Balance(a1, usd(1001)), offers(a1, 0)); + env.require(Balance(a1, usd(1001)), Offers(a1, 0)); env(trust(a1, limit, tfClearFreeze)); env.close(); @@ -1089,7 +1089,7 @@ class Freeze_test : public beast::unit_test::Suite // Cleanup env(offerCancel(a1, env.seq(a1) - 1)); - env.require(offers(a1, 0)); + env.require(Offers(a1, 0)); env.close(); env(offer(a2, usd(100), XRP(100)), Txflags(tfPassive)); @@ -1186,7 +1186,7 @@ class Freeze_test : public beast::unit_test::Suite // Cleanup env(offerCancel(a1, env.seq(a1) - 1)); - env.require(offers(a1, 0)); + env.require(Offers(a1, 0)); env.close(); } @@ -1338,7 +1338,7 @@ class Freeze_test : public beast::unit_test::Suite // Confirming we can write and cash checks { - uint256 const checkId{getCheckIndex(g1, env.seq(g1))}; + UInt256 const checkId{getCheckIndex(g1, env.seq(g1))}; env(check::create(g1, a1, usd(10))); env.close(); env(check::cash(a1, checkId, usd(10))); @@ -1346,7 +1346,7 @@ class Freeze_test : public beast::unit_test::Suite } { - uint256 const checkId{getCheckIndex(g1, env.seq(g1))}; + UInt256 const checkId{getCheckIndex(g1, env.seq(g1))}; env(check::create(g1, a2, usd(10))); env.close(); env(check::cash(a2, checkId, usd(10))); @@ -1354,7 +1354,7 @@ class Freeze_test : public beast::unit_test::Suite } { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, g1, usd(10))); env.close(); env(check::cash(g1, checkId, usd(10))); @@ -1362,7 +1362,7 @@ class Freeze_test : public beast::unit_test::Suite } { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, a2, usd(10))); env.close(); env(check::cash(a2, checkId, usd(10))); @@ -1370,7 +1370,7 @@ class Freeze_test : public beast::unit_test::Suite } { - uint256 const checkId{getCheckIndex(a2, env.seq(a2))}; + UInt256 const checkId{getCheckIndex(a2, env.seq(a2))}; env(check::create(a2, g1, usd(10))); env.close(); env(check::cash(g1, checkId, usd(10))); @@ -1378,7 +1378,7 @@ class Freeze_test : public beast::unit_test::Suite } { - uint256 const checkId{getCheckIndex(a2, env.seq(a2))}; + UInt256 const checkId{getCheckIndex(a2, env.seq(a2))}; env(check::create(a2, a1, usd(10))); env.close(); env(check::cash(a1, checkId, usd(10))); @@ -1393,7 +1393,7 @@ class Freeze_test : public beast::unit_test::Suite // test: issuer writes check to A1. { - uint256 const checkId{getCheckIndex(g1, env.seq(g1))}; + UInt256 const checkId{getCheckIndex(g1, env.seq(g1))}; env(check::create(g1, a1, usd(10))); env.close(); env(check::cash(a1, checkId, usd(10)), Ter(tecFROZEN)); @@ -1402,7 +1402,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A2 writes check to A1. { - uint256 const checkId{getCheckIndex(a2, env.seq(a2))}; + UInt256 const checkId{getCheckIndex(a2, env.seq(a2))}; env(check::create(a2, a1, usd(10))); env.close(); // Same as previous test @@ -1428,10 +1428,10 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, a1["USD"](0), tfClearFreeze)); env.close(); - uint256 const checkId1{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId1{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, g1, usd(10))); env.close(); - uint256 const checkId2{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId2{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, a2, usd(10))); env.close(); @@ -1463,7 +1463,7 @@ class Freeze_test : public beast::unit_test::Suite // test: issuer writes check to A1. { - uint256 const checkId{getCheckIndex(g1, env.seq(g1))}; + UInt256 const checkId{getCheckIndex(g1, env.seq(g1))}; env(check::create(g1, a1, usd(10))); env.close(); @@ -1473,7 +1473,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A2 writes check to A1. { - uint256 const checkId{getCheckIndex(a2, env.seq(a2))}; + UInt256 const checkId{getCheckIndex(a2, env.seq(a2))}; env(check::create(a2, a1, usd(10))); env.close(); // Same as previous test @@ -1499,10 +1499,10 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, a1["USD"](0), tfClearFreeze | tfClearDeepFreeze)); env.close(); - uint256 const checkId1{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId1{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, g1, usd(10))); env.close(); - uint256 const checkId2{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId2{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, a2, usd(10))); env.close(); @@ -1545,7 +1545,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A1 writes check to issuer { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, g1, usd(10))); env.close(); env(check::cash(g1, checkId, usd(10))); @@ -1554,7 +1554,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A1 writes check to A2 { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, a2, usd(10))); env.close(); env(check::cash(a2, checkId, usd(10))); @@ -1586,7 +1586,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A1 writes check to issuer { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, g1, usd(10))); env.close(); env(check::cash(g1, checkId, usd(10)), Ter(tecPATH_PARTIAL)); @@ -1595,7 +1595,7 @@ class Freeze_test : public beast::unit_test::Suite // test: A1 writes check to A2 { - uint256 const checkId{getCheckIndex(a1, env.seq(a1))}; + UInt256 const checkId{getCheckIndex(a1, env.seq(a1))}; env(check::create(a1, a2, usd(10))); env.close(); env(check::cash(a2, checkId, usd(10)), Ter(tecPATH_PARTIAL)); @@ -1785,7 +1785,7 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, a2["USD"](0), tfSetFreeze | tfSetDeepFreeze)); env.close(); - uint256 const nftID{token::getNextID(env, a2, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, a2, 0u, tfTransferable)}; env(token::mint(a2, 0), Txflags(tfTransferable)); env.close(); @@ -1871,11 +1871,11 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, broker["USD"](1000), tfSetFreeze | tfSetDeepFreeze)); env.close(); - uint256 const nftID{token::getNextID(env, a2, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, a2, 0u, tfTransferable)}; env(token::mint(a2, 0), Txflags(tfTransferable)); env.close(); - uint256 const sellIdx = + UInt256 const sellIdx = keylet::nftokenOffer(a2, SeqProxy::rawSequence(env.seq(a2))).key; env(token::createOffer(a2, nftID, usd(10)), Txflags(tfSellNFToken)); env.close(); @@ -1898,18 +1898,18 @@ class Freeze_test : public beast::unit_test::Suite env(trust(g1, minter["USD"](1000))); env.close(); - uint256 const nftID{token::getNextID(env, minter, 0u, tfTransferable, 1u)}; + UInt256 const nftID{token::getNextID(env, minter, 0u, tfTransferable, 1u)}; env(token::mint(minter, 0), token::XferFee(1u), Txflags(tfTransferable)); env.close(); - uint256 const minterSellIdx = + UInt256 const minterSellIdx = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, drops(1)), Txflags(tfSellNFToken)); env.close(); env(token::acceptSellOffer(a2, minterSellIdx)); env.close(); - uint256 const sellIdx = + UInt256 const sellIdx = keylet::nftokenOffer(a2, SeqProxy::rawSequence(env.seq(a2))).key; env(token::createOffer(a2, nftID, usd(100)), Txflags(tfSellNFToken)); env.close(); @@ -1947,24 +1947,24 @@ class Freeze_test : public beast::unit_test::Suite } // Helper function that returns the index of the next check on account - static uint256 + static UInt256 getCheckIndex(AccountID const& account, std::uint32_t uSequence) { return keylet::check(account, SeqProxy::rawSequence(uSequence)).key; } - static uint256 + static UInt256 createNFTSellOffer( test::jtx::Env& env, test::jtx::Account const& account, test::jtx::PrettyAmount const& currency) { using namespace test::jtx; - uint256 const nftID{token::getNextID(env, account, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, account, 0u, tfTransferable)}; env(token::mint(account, 0), Txflags(tfTransferable)); env.close(); - uint256 const sellOfferIndex = + UInt256 const sellOfferIndex = keylet::nftokenOffer(account, SeqProxy::rawSequence(env.seq(account))).key; env(token::createOffer(account, nftID, currency), Txflags(tfSellNFToken)); env.close(); diff --git a/src/test/app/HashRouter_test.cpp b/src/test/app/HashRouter_test.cpp index 0266da2bc0..8299be0154 100644 --- a/src/test/app/HashRouter_test.cpp +++ b/src/test/app/HashRouter_test.cpp @@ -38,9 +38,9 @@ class HashRouter_test : public beast::unit_test::Suite HashRouterFlags const key2(HashRouterFlags::PRIVATE2); HashRouterFlags const key3(HashRouterFlags::PRIVATE3); - auto const ukey1 = uint256{static_cast(key1)}; - auto const ukey2 = uint256{static_cast(key2)}; - auto const ukey3 = uint256{static_cast(key3)}; + auto const ukey1 = UInt256{static_cast(key1)}; + auto const ukey2 = UInt256{static_cast(key2)}; + auto const ukey3 = UInt256{static_cast(key3)}; // t=0 router.setFlags(ukey1, HashRouterFlags::PRIVATE1); @@ -81,10 +81,10 @@ class HashRouter_test : public beast::unit_test::Suite HashRouterFlags const key3(HashRouterFlags::PRIVATE3); HashRouterFlags const key4(HashRouterFlags::PRIVATE4); - auto const ukey1 = uint256{static_cast(key1)}; - auto const ukey2 = uint256{static_cast(key2)}; - auto const ukey3 = uint256{static_cast(key3)}; - auto const ukey4 = uint256{static_cast(key4)}; + auto const ukey1 = UInt256{static_cast(key1)}; + auto const ukey2 = UInt256{static_cast(key2)}; + auto const ukey3 = UInt256{static_cast(key3)}; + auto const ukey4 = UInt256{static_cast(key4)}; BEAST_EXPECT(key1 != key2 && key2 != key3 && key3 != key4); @@ -162,10 +162,10 @@ class HashRouter_test : public beast::unit_test::Suite TestStopwatch stopwatch; HashRouter router(getSetup(2s, 1s), stopwatch); - uint256 const key1(1); - uint256 const key2(2); - uint256 const key3(3); - uint256 const key4(4); + UInt256 const key1(1); + UInt256 const key2(2); + UInt256 const key3(3); + UInt256 const key4(4); BEAST_EXPECT(key1 != key2 && key2 != key3 && key3 != key4); HashRouterFlags flags(HashRouterFlags::BAD); // This value is ignored @@ -191,7 +191,7 @@ class HashRouter_test : public beast::unit_test::Suite TestStopwatch stopwatch; HashRouter router(getSetup(2s, 1s), stopwatch); - uint256 const key1(1); + UInt256 const key1(1); BEAST_EXPECT(router.setFlags(key1, HashRouterFlags::PRIVATE1)); BEAST_EXPECT(!router.setFlags(key1, HashRouterFlags::PRIVATE1)); BEAST_EXPECT(router.setFlags(key1, HashRouterFlags::PRIVATE2)); @@ -205,7 +205,7 @@ class HashRouter_test : public beast::unit_test::Suite TestStopwatch stopwatch; HashRouter router(getSetup(50s, 1s), stopwatch); - uint256 const key1(1); + UInt256 const key1(1); std::optional> peers; @@ -248,7 +248,7 @@ class HashRouter_test : public beast::unit_test::Suite using namespace std::chrono_literals; TestStopwatch stopwatch; HashRouter router(getSetup(5s, 1s), stopwatch); - uint256 const key(1); + UInt256 const key(1); HashRouter::PeerShortID const peer = 1; HashRouterFlags flags = HashRouterFlags::UNDEFINED; diff --git a/src/test/app/LPTokenTransfer_test.cpp b/src/test/app/LPTokenTransfer_test.cpp index 3e72094eb3..5758d06b4a 100644 --- a/src/test/app/LPTokenTransfer_test.cpp +++ b/src/test/app/LPTokenTransfer_test.cpp @@ -314,7 +314,7 @@ class LPTokenTransfer_test : public jtx::AMMTest // carol_ can always create a check with lptoken that has frozen // token - uint256 const carolChkId{keylet::check(carol_, SeqProxy::rawSequence(env.seq(carol_))).key}; + UInt256 const carolChkId{keylet::check(carol_, SeqProxy::rawSequence(env.seq(carol_))).key}; env(check::create(carol_, bob_, STAmount{lpIssue, 10})); env.close(); @@ -331,7 +331,7 @@ class LPTokenTransfer_test : public jtx::AMMTest env.close(); // bob_ creates a check - uint256 const bobChkId{keylet::check(bob_, SeqProxy::rawSequence(env.seq(bob_))).key}; + UInt256 const bobChkId{keylet::check(bob_, SeqProxy::rawSequence(env.seq(bob_))).key}; env(check::create(bob_, carol_, STAmount{lpIssue, 10})); env.close(); @@ -358,12 +358,12 @@ class LPTokenTransfer_test : public jtx::AMMTest auto const lpIssue = ammAlice.lptIssue(); // bob_ mints a nft - uint256 const nftID{token::getNextID(env, bob_, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, bob_, 0u, tfTransferable)}; env(token::mint(bob_, 0), Txflags(tfTransferable)); env.close(); // bob_ creates a sell offer for lptoken - uint256 const sellOfferIndex = + UInt256 const sellOfferIndex = keylet::nftokenOffer(bob_, SeqProxy::rawSequence(env.seq(bob_))).key; env(token::createOffer(bob_, nftID, STAmount{lpIssue, 10}), Txflags(tfSellNFToken)); env.close(); @@ -425,7 +425,7 @@ class LPTokenTransfer_test : public jtx::AMMTest env.close(); // bob_ creates a buy offer with lptoken despite bob_'s USD is frozen - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(bob_, SeqProxy::rawSequence(env.seq(bob_))).key; env(token::createOffer(bob_, nftID, STAmount{lpIssue, 10}), token::Owner(carol_)); env.close(); diff --git a/src/test/app/LedgerHistory_test.cpp b/src/test/app/LedgerHistory_test.cpp index f8688899e0..1b8410c96a 100644 --- a/src/test/app/LedgerHistory_test.cpp +++ b/src/test/app/LedgerHistory_test.cpp @@ -51,7 +51,7 @@ public: kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); } auto res = std::make_shared(*prev, prev->header().closeTime + closeOffset); @@ -92,7 +92,7 @@ public: Env env{*this, envconfig(), std::make_unique("MISMATCH ", &found)}; LedgerHistory lh{beast::insight::NullCollector::make(), env.app()}; auto const genesis = makeLedger({}, env, lh, 0s); - uint256 const dummyTxHash{1}; + UInt256 const dummyTxHash{1}; lh.builtLedger(genesis, dummyTxHash, {}); lh.validatedLedger(genesis, dummyTxHash); @@ -111,7 +111,7 @@ public: auto const ledgerA = makeLedger(genesis, env, lh, 4s); auto const ledgerB = makeLedger(genesis, env, lh, 40s); - uint256 const dummyTxHash{1}; + UInt256 const dummyTxHash{1}; lh.builtLedger(ledgerA, dummyTxHash, {}); lh.validatedLedger(ledgerB, dummyTxHash); @@ -132,7 +132,7 @@ public: auto const ledgerAC = makeLedger(ledgerA, env, lh, 4s); auto const ledgerBD = makeLedger(ledgerB, env, lh, 4s); - uint256 const dummyTxHash{1}; + UInt256 const dummyTxHash{1}; lh.builtLedger(ledgerAC, dummyTxHash, {}); lh.validatedLedger(ledgerBD, dummyTxHash); diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index 8fb10c1088..8b900c85d4 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -38,7 +38,7 @@ class LedgerLoad_test : public beast::unit_test::Suite std::string const& dbPath, std::string const& ledger, StartUpType type, - std::optional trapTxHash) + std::optional trapTxHash) { cfg->startLedger = ledger; cfg->startUp = type; @@ -56,7 +56,7 @@ class LedgerLoad_test : public beast::unit_test::Suite std::string ledgerFile = {}; json::Value ledger = {}; json::Value hashes = {}; - uint256 trapTxHash = {}; + UInt256 trapTxHash = {}; // NOLINTEND(readability-redundant-member-init) }; @@ -104,7 +104,7 @@ class LedgerLoad_test : public beast::unit_test::Suite auto const txs = env.rpc( "ledger", std::to_string(41), "tx")[jss::result][jss::ledger][jss::transactions]; BEAST_EXPECT(txs.isArray() && txs.size() > 0); - uint256 tmp; + UInt256 tmp; BEAST_EXPECT(tmp.parseHex(txs[0u][jss::hash].asString())); return tmp; }(); diff --git a/src/test/app/LedgerMaster_test.cpp b/src/test/app/LedgerMaster_test.cpp index 2f2f81bb8a..34db5221c1 100644 --- a/src/test/app/LedgerMaster_test.cpp +++ b/src/test/app/LedgerMaster_test.cpp @@ -102,7 +102,7 @@ class LedgerMaster_test : public beast::unit_test::Suite BEAST_EXPECT( // NOLINTNEXTLINE(bugprone-unchecked-optional-access) *result == - uint256( + UInt256( "277F4FD89C20B92457FEF05FF63F6405563AD0563C73D967A29727" "72679ADC65")); } @@ -113,7 +113,7 @@ class LedgerMaster_test : public beast::unit_test::Suite BEAST_EXPECT( // NOLINTNEXTLINE(bugprone-unchecked-optional-access) *result == - uint256( + UInt256( "293DF7335EBBAF4420D52E70ABF470EB4C5792CAEA2F91F76193C2" "819F538FDE")); } diff --git a/src/test/app/LedgerNodeHelpers_test.cpp b/src/test/app/LedgerNodeHelpers_test.cpp index 76c3e3cc52..dc6dbb5f68 100644 --- a/src/test/app/LedgerNodeHelpers_test.cpp +++ b/src/test/app/LedgerNodeHelpers_test.cpp @@ -83,7 +83,7 @@ class LedgerNodeHelpers_test : public beast::unit_test::Suite auto const leafNode = intr_ptr::makeShared(leafItem, 1); // Truncate the data to trigger an exception in SHAMapTreeNode::makeAccountState when // the data is used to deserialize the node. - uint256 const tag; + UInt256 const tag; auto const leafData = serializeNode(leafNode).substr(0, tag.kBytes - 1); auto const result = getTreeNode(leafData); BEAST_EXPECT(!result); @@ -105,7 +105,7 @@ class LedgerNodeHelpers_test : public beast::unit_test::Suite // Valid: legacy `nodeid` field at arbitrary depth. { auto const innerDepth = 3; - auto const innerID = SHAMapNodeID::createID(innerDepth, uint256{}); + auto const innerID = SHAMapNodeID::createID(innerDepth, UInt256{}); protocol::TMLedgerNode ledgerNode; ledgerNode.set_nodedata(innerData); @@ -117,7 +117,7 @@ class LedgerNodeHelpers_test : public beast::unit_test::Suite // Valid: new `id` field at minimum depth. { auto const innerDepth = 0; - auto const innerID = SHAMapNodeID::createID(innerDepth, uint256{}); + auto const innerID = SHAMapNodeID::createID(innerDepth, UInt256{}); protocol::TMLedgerNode ledgerNode; ledgerNode.set_nodedata(innerData); @@ -138,7 +138,7 @@ class LedgerNodeHelpers_test : public beast::unit_test::Suite // Invalid: both legacy `nodeid` and new `id` fields set for an inner node. { auto const innerDepth = 9; - auto const innerID = SHAMapNodeID::createID(innerDepth, uint256{}); + auto const innerID = SHAMapNodeID::createID(innerDepth, UInt256{}); protocol::TMLedgerNode ledgerNode; ledgerNode.set_nodedata(innerData); diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index bb0c790e37..64b5eebdab 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -158,7 +158,7 @@ public: ~MagicInboundLedgers() override = default; std::shared_ptr - acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason) override + acquire(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason) override { if (bhvr == InboundLedgersBehavior::DropAll) return {}; @@ -172,7 +172,7 @@ public: } void - acquireAsync(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override + acquireAsync(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override { } @@ -197,12 +197,12 @@ public: } void - logFailure(uint256 const& h, std::uint32_t seq) override + logFailure(UInt256 const& h, std::uint32_t seq) override { } bool - isFailure(uint256 const& h) override + isFailure(UInt256 const& h) override { return false; } @@ -283,7 +283,7 @@ public: // The replay code only asks peers that already have the ledger. [[nodiscard]] bool - hasLedger(uint256 const&, std::uint32_t) const override + hasLedger(UInt256 const&, std::uint32_t) const override { return true; } @@ -377,10 +377,10 @@ struct TestPeerSet : public PeerSet } } - [[nodiscard]] std::set const& + [[nodiscard]] std::set const& getPeerIds() const override { - static std::set const kEmptyPeers; + static std::set const kEmptyPeers; return kEmptyPeers; } @@ -571,9 +571,9 @@ public: } bool - haveLedgers(uint256 const& finishLedgerHash, int totalReplay) + haveLedgers(UInt256 const& finishLedgerHash, int totalReplay) { - uint256 hash = finishLedgerHash; + UInt256 hash = finishLedgerHash; int i = 0; for (; i < totalReplay; ++i) { @@ -586,7 +586,7 @@ public: } bool - waitForLedgers(uint256 const& finishLedgerHash, int totalReplay) + waitForLedgers(UInt256 const& finishLedgerHash, int totalReplay) { int const totalRound = 100; for (int i = 0; i < totalRound; ++i) @@ -633,7 +633,7 @@ public: } std::shared_ptr - findTask(uint256 const& hash, int totalReplay) + findTask(UInt256 const& hash, int totalReplay) { std::unique_lock const lock(replayer.mtx_); auto i = std::ranges::find_if(replayer.tasks_, [&](auto const& t) { @@ -667,7 +667,7 @@ public: } std::shared_ptr - findSkipListAcquire(uint256 const& hash) + findSkipListAcquire(UInt256 const& hash) { std::unique_lock const lock(replayer.mtx_); auto i = replayer.skipLists_.find(hash); @@ -677,7 +677,7 @@ public: } std::shared_ptr - findLedgerDeltaAcquire(uint256 const& hash) + findLedgerDeltaAcquire(UInt256 const& hash) { std::unique_lock const lock(replayer.mtx_); auto i = replayer.deltas_.find(hash); @@ -724,7 +724,7 @@ public: bool asExpected( - uint256 const& hash, + UInt256 const& hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, @@ -741,7 +741,7 @@ public: bool checkStatus( - uint256 const& hash, + UInt256 const& hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, @@ -758,7 +758,7 @@ public: bool waitAndCheckStatus( - uint256 const& hash, + UInt256 const& hash, int totalReplay, TaskStatus taskExpect, TaskStatus skiplistExpect, @@ -857,7 +857,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite auto request = std::make_shared(); request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE); request->set_key(keylet::skip().key.data(), keylet::skip().key.size()); - uint256 hash(1234567); + UInt256 hash(1234567); request->set_ledgerhash(hash.data(), hash.size()); auto reply = std::make_shared( server.msgHandler.processProofPathRequest(request)); @@ -966,7 +966,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite BEAST_EXPECT( server.msgHandler.processReplayDeltaResponse(reply) == ReplayMsgStatus::BadData); // request, wrong hash - uint256 hash(1234567); + UInt256 hash(1234567); request->set_ledgerhash(hash.data(), hash.size()); reply = std::make_shared( server.msgHandler.processReplayDeltaRequest(request)); @@ -1095,24 +1095,24 @@ struct LedgerReplayer_test : public beast::unit_test::Suite { testcase("TaskParameter"); - auto makeSkipList = [](int count) -> std::vector { - std::vector sList; + auto makeSkipList = [](int count) -> std::vector { + std::vector sList; sList.reserve(count); for (int i = 0; i < count; ++i) sList.emplace_back(i); return sList; }; - LedgerReplayTask::TaskParameter tp10(InboundLedger::Reason::GENERIC, uint256(10), 10); - BEAST_EXPECT(!tp10.update(uint256(777), 5, makeSkipList(10))); - BEAST_EXPECT(!tp10.update(uint256(10), 5, makeSkipList(8))); - BEAST_EXPECT(tp10.update(uint256(10), 10, makeSkipList(10))); + LedgerReplayTask::TaskParameter tp10(InboundLedger::Reason::GENERIC, UInt256(10), 10); + BEAST_EXPECT(!tp10.update(UInt256(777), 5, makeSkipList(10))); + BEAST_EXPECT(!tp10.update(UInt256(10), 5, makeSkipList(8))); + BEAST_EXPECT(tp10.update(UInt256(10), 10, makeSkipList(10))); // can merge to self BEAST_EXPECT(tp10.canMergeInto(tp10)); // smaller task - LedgerReplayTask::TaskParameter tp9(InboundLedger::Reason::GENERIC, uint256(9), 9); + LedgerReplayTask::TaskParameter tp9(InboundLedger::Reason::GENERIC, UInt256(9), 9); BEAST_EXPECT(tp9.canMergeInto(tp10)); BEAST_EXPECT(!tp10.canMergeInto(tp9)); @@ -1127,14 +1127,14 @@ struct LedgerReplayer_test : public beast::unit_test::Suite tp9.reason = InboundLedger::Reason::GENERIC; BEAST_EXPECT(tp9.canMergeInto(tp10)); - tp9.finishHash = uint256(1234); + tp9.finishHash = UInt256(1234); BEAST_EXPECT(!tp9.canMergeInto(tp10)); - tp9.finishHash = uint256(9); + tp9.finishHash = UInt256(9); BEAST_EXPECT(tp9.canMergeInto(tp10)); // larger task - LedgerReplayTask::TaskParameter tp20(InboundLedger::Reason::GENERIC, uint256(20), 20); - BEAST_EXPECT(tp20.update(uint256(20), 20, makeSkipList(20))); + LedgerReplayTask::TaskParameter tp20(InboundLedger::Reason::GENERIC, UInt256(20), 20); + BEAST_EXPECT(tp20.update(UInt256(20), 20, makeSkipList(20))); BEAST_EXPECT(tp10.canMergeInto(tp20)); BEAST_EXPECT(tp9.canMergeInto(tp20)); BEAST_EXPECT(!tp20.canMergeInto(tp10)); @@ -1177,7 +1177,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite testcase("handshake test"); auto handshake = [&](bool client, bool server, bool expecting) -> bool { auto request = xrpl::makeRequest(true, false, client, false, false); - http_request_type httpRequest; + HttpRequestType httpRequest; httpRequest.version(request.version()); httpRequest.base() = request.base(); bool const serverResult = peerFeatureEnabled(httpRequest, kFeatureLedgerReplay, server); @@ -1188,7 +1188,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite jtx::Env serverEnv(*this); serverEnv.app().config().ledgerReplay = server; auto httpResp = xrpl::makeResponse( - true, httpRequest, addr, addr, uint256{1}, 1, {1, 0}, serverEnv.app()); + true, httpRequest, addr, addr, UInt256{1}, 1, {1, 0}, serverEnv.app()); auto const clientResult = peerFeatureEnabled(httpResp, kFeatureLedgerReplay, client); return clientResult == expecting; }; @@ -1210,7 +1210,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite NetworkOfTwo net(*this, {.initLedgers = totalReplay + 1}, psBhvr, ilBhvr, peerFeature); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; for (int i = 0; i < totalReplay; ++i) { BEAST_EXPECT(l); @@ -1248,7 +1248,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite PeerFeature::None); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); std::vector const deltaStatuses(totalReplay - 1, TaskStatus::Completed); @@ -1305,7 +1305,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite // feed client with start ledger since InboundLedgers drops all auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; for (int i = 0; i < totalReplay - 1; ++i) { l = net.server.ledgerMaster.getLedgerByHash(l->header().parentHash); @@ -1337,7 +1337,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); std::vector const deltaStatuses; @@ -1362,13 +1362,13 @@ struct LedgerReplayer_test : public beast::unit_test::Suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); auto skipList = net.client.findSkipListAcquire(finalHash); std::uint8_t payload[55] = {0x6A, 0x09, 0xE6, 0x67, 0xF3, 0xBC, 0xC9, 0x08, 0xB2}; - auto item = makeShamapitem(uint256(12345), Slice(payload, sizeof(payload))); + auto item = makeShamapitem(UInt256(12345), Slice(payload, sizeof(payload))); skipList->processData(l->seq(), item); std::vector const deltaStatuses; @@ -1395,7 +1395,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.ledgerMaster.storeLedger(l); net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1427,7 +1427,7 @@ struct LedgerReplayer_test : public beast::unit_test::Suite InboundLedgersBehavior::Good, PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); std::vector deltaStatuses(totalReplay - 1, TaskStatus::Completed); BEAST_EXPECT(net.client.waitAndCheckStatus( @@ -1526,7 +1526,7 @@ struct LedgerReplayerTimeout_test : public beast::unit_test::Suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); std::vector const deltaStatuses; @@ -1552,7 +1552,7 @@ struct LedgerReplayerTimeout_test : public beast::unit_test::Suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 const finalHash = l->header().hash; + UInt256 const finalHash = l->header().hash; net.client.ledgerMaster.storeLedger(l); net.client.replayer.replay(InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1590,7 +1590,7 @@ struct LedgerReplayerLong_test : public beast::unit_test::Suite InboundLedgersBehavior::Good, PeerFeature::LedgerReplayEnabled); - std::vector finishHashes; + std::vector finishHashes; auto l = net.server.ledgerMaster.getClosedLedger(); for (int i = 0; i < rounds; ++i) { diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 7086adf743..508e2401fb 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -122,7 +122,7 @@ class MPToken_test : public beast::unit_test::Suite .assetScale = 0, .metadata = "test", .flags = tfMPTRequireAuth, - .domainID = uint256(42), + .domainID = UInt256(42), .err = temDISABLED}); } else @@ -132,7 +132,7 @@ class MPToken_test : public beast::unit_test::Suite {.maxAmt = 100, .assetScale = 0, .metadata = "test", - .domainID = uint256(42), + .domainID = UInt256(42), .err = temMALFORMED}); // tries to set zero DomainID @@ -141,7 +141,7 @@ class MPToken_test : public beast::unit_test::Suite .assetScale = 0, .metadata = "test", .flags = tfMPTRequireAuth, - .domainID = uint256{}, + .domainID = UInt256{}, .err = temMALFORMED}); } @@ -205,7 +205,7 @@ class MPToken_test : public beast::unit_test::Suite json::Value jv; jv[sfAccount] = alice.human(); jv[sfTransactionType] = jss::MPTokenIssuanceCreate; - jv[sfReferenceHolding] = to_string(uint256{1}); + jv[sfReferenceHolding] = to_string(UInt256{1}); env(jv, Ter(temMALFORMED)); } } @@ -622,7 +622,7 @@ class MPToken_test : public beast::unit_test::Suite .err = tecNO_PERMISSION}); // cannot set DomainID since SAV is not enabled - mptAlice.set({.account = alice, .domainID = uint256(42), .err = temDISABLED}); + mptAlice.set({.account = alice, .domainID = UInt256(42), .err = temDISABLED}); } else { @@ -635,7 +635,7 @@ class MPToken_test : public beast::unit_test::Suite if (!features[featurePermissionedDomains] || !features[featureSingleAssetVault]) { // cannot set DomainID since PD is not enabled - mptAlice.set({.account = alice, .domainID = uint256(42), .err = temDISABLED}); + mptAlice.set({.account = alice, .domainID = UInt256(42), .err = temDISABLED}); } else if (features[featureSingleAssetVault]) { @@ -643,7 +643,7 @@ class MPToken_test : public beast::unit_test::Suite mptAlice.set( {.account = alice, .holder = bob, - .domainID = uint256(42), + .domainID = UInt256(42), .err = temMALFORMED}); } } @@ -725,9 +725,9 @@ class MPToken_test : public beast::unit_test::Suite mptAlice.create({}); // Trying to set DomainID on a public MPTokenIssuance - mptAlice.set({.domainID = uint256(42), .err = tecNO_PERMISSION}); + mptAlice.set({.domainID = UInt256(42), .err = tecNO_PERMISSION}); - mptAlice.set({.domainID = uint256{}, .err = tecNO_PERMISSION}); + mptAlice.set({.domainID = UInt256{}, .err = tecNO_PERMISSION}); } { @@ -737,14 +737,14 @@ class MPToken_test : public beast::unit_test::Suite mptAlice.create({.flags = tfMPTRequireAuth}); // Trying to set non-existing DomainID - mptAlice.set({.domainID = uint256(42), .err = tecOBJECT_NOT_FOUND}); + mptAlice.set({.domainID = UInt256(42), .err = tecOBJECT_NOT_FOUND}); // Trying to lock but locking is disabled mptAlice.set( - {.flags = tfMPTUnlock, .domainID = uint256(42), .err = tecNO_PERMISSION}); + {.flags = tfMPTUnlock, .domainID = UInt256(42), .err = tecNO_PERMISSION}); mptAlice.set( - {.flags = tfMPTUnlock, .domainID = uint256{}, .err = tecNO_PERMISSION}); + {.flags = tfMPTUnlock, .domainID = UInt256{}, .err = tecNO_PERMISSION}); } } } @@ -863,7 +863,7 @@ class MPToken_test : public beast::unit_test::Suite BEAST_EXPECT(mptAlice.checkDomainID(std::nullopt)); // reset "domain not set" to "domain not set", i.e. no change - mptAlice.set({.domainID = uint256{}}); + mptAlice.set({.domainID = UInt256{}}); BEAST_EXPECT(mptAlice.checkDomainID(std::nullopt)); // reset "domain not set" to domain1 @@ -875,7 +875,7 @@ class MPToken_test : public beast::unit_test::Suite BEAST_EXPECT(mptAlice.checkDomainID(domainId2)); // reset domain to "domain not set" - mptAlice.set({.domainID = uint256{}}); + mptAlice.set({.domainID = UInt256{}}); BEAST_EXPECT(mptAlice.checkDomainID(std::nullopt)); } } @@ -1138,7 +1138,7 @@ class MPToken_test : public beast::unit_test::Suite // bob is authorized via domain mptAlice.pay(alice, bob, 100); - mptAlice.set({.domainID = uint256{}}); + mptAlice.set({.domainID = UInt256{}}); // bob is no longer authorized mptAlice.pay(alice, bob, 100, tecNO_AUTH); @@ -1190,7 +1190,7 @@ class MPToken_test : public beast::unit_test::Suite // bob is still authorized, via domain mptAlice.pay(bob, alice, 10); - mptAlice.set({.domainID = uint256{}}); + mptAlice.set({.domainID = UInt256{}}); // bob fails to send back to alice because he is no longer // authorize to move his funds! @@ -1997,7 +1997,7 @@ class MPToken_test : public beast::unit_test::Suite json::Value jv; jv[jss::TransactionType] = jss::PaymentChannelFund; jv[jss::Account] = alice.human(); - jv[sfChannel.fieldName] = to_string(uint256{1}); + jv[sfChannel.fieldName] = to_string(UInt256{1}); jv[jss::Amount] = mpt.getJson(JsonOptions::Values::None); test(jv, jss::Amount.cStr()); } @@ -2006,7 +2006,7 @@ class MPToken_test : public beast::unit_test::Suite json::Value jv; jv[jss::TransactionType] = jss::PaymentChannelClaim; jv[jss::Account] = alice.human(); - jv[sfChannel.fieldName] = to_string(uint256{1}); + jv[sfChannel.fieldName] = to_string(UInt256{1}); jv[jss::Amount] = mpt.getJson(JsonOptions::Values::None); test(jv, jss::Amount.cStr()); } @@ -2015,7 +2015,7 @@ class MPToken_test : public beast::unit_test::Suite json::Value jv; jv[jss::TransactionType] = jss::NFTokenCreateOffer; jv[jss::Account] = alice.human(); - jv[sfNFTokenID.fieldName] = to_string(uint256{1}); + jv[sfNFTokenID.fieldName] = to_string(UInt256{1}); jv[jss::Amount] = mpt.getJson(JsonOptions::Values::None); test(jv, jss::Amount.cStr()); } @@ -2967,7 +2967,7 @@ class MPToken_test : public beast::unit_test::Suite auto const issue = makeIssue(env); auto const badAmount = badMPTAmount(issue, bad); - uint256 const fakeVaultId = keylet::vault(gw.id(), SeqProxy::rawSequence(1)).key; + UInt256 const fakeVaultId = keylet::vault(gw.id(), SeqProxy::rawSequence(1)).key; auto tx = withNonCanonicalMPTAmount( env.jt( Vault::clawback( @@ -6565,7 +6565,7 @@ class MPToken_test : public beast::unit_test::Suite auto const mpt = mptTester["MPT"]; mptTester.authorize({.account = alice}); - uint256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; + UInt256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; env(check::create(gw, alice, mpt(100)), Ter(temDISABLED)); env.close(); @@ -6586,7 +6586,7 @@ class MPToken_test : public beast::unit_test::Suite mptTester.authorize({.account = alice}); mptTester.pay(gw, alice, 50); - uint256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; + UInt256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; // can create env(check::create(alice, carol, mpt(100))); @@ -6616,7 +6616,7 @@ class MPToken_test : public beast::unit_test::Suite .flags = tfMPTCanTransfer | tfMPTCanTrade}); auto const mpt = mptTester["MPT"]; - uint256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; + UInt256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; // can create env(check::create(gw, alice, mpt(200))); @@ -6640,7 +6640,7 @@ class MPToken_test : public beast::unit_test::Suite env(check::create(alice, carol, MPT(gw)(50)), Ter(tecOBJECT_NOT_FOUND)); env.close(); auto btc = MPTTester({.env = env, .issuer = gw}); - uint256 const chkId{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId{getCheckIndex(gw, env.seq(gw))}; env(check::cash(carol, chkId, MPT(gw)(1)), Ter(tecNO_ENTRY)); env.close(); } @@ -6651,7 +6651,7 @@ class MPToken_test : public beast::unit_test::Suite Env env{*this, features}; env.fund(XRP(1'000), gw, alice, carol); auto btc = MPTTester({.env = env, .issuer = gw}); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, btc(50))); env.close(); @@ -6683,10 +6683,10 @@ class MPToken_test : public beast::unit_test::Suite mpt.set({.flags = tfMPTUnlock}); // Create Check succeeds, holder or issuer as destination - uint256 const chkIdAlice{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkIdAlice{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, mpt(10))); env.close(); - uint256 const chkIdGw{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkIdGw{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, carol, mpt(10))); env.close(); @@ -6712,16 +6712,16 @@ class MPToken_test : public beast::unit_test::Suite env.close(); mpt.set({.holder = alice, .flags = tfMPTUnlock}); - uint256 const chkId1{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId1{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, mpt(10))); env.close(); - uint256 const chkId2{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId2{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, alice, mpt(10))); env.close(); - uint256 const chkId3{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId3{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, gw, mpt(10))); env.close(); - uint256 const chkId4{getCheckIndex(gw, env.seq(gw))}; + UInt256 const chkId4{getCheckIndex(gw, env.seq(gw))}; env(check::create(gw, alice, mpt(10))); env.close(); mpt.set({.holder = alice, .flags = tfMPTLock}); @@ -6742,7 +6742,7 @@ class MPToken_test : public beast::unit_test::Suite .issuer = gw, .holders = {alice, carol}, .flags = tfMPTRequireAuth | kMptDexFlags}); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, btc(50))); env.close(); @@ -6770,7 +6770,7 @@ class MPToken_test : public beast::unit_test::Suite {.env = env, .issuer = gw, .holders = {alice, carol}, .flags = tfMPTCanTrade}); // src is issuer - uint256 checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; + UInt256 checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; // can create env(check::create(gw, alice, mpt(100))); @@ -6828,7 +6828,7 @@ class MPToken_test : public beast::unit_test::Suite .pay = 10, .flags = tfMPTCanTransfer}); - uint256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; + UInt256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; // can create env(check::create(alice, carol, mpt(100))); @@ -6844,7 +6844,7 @@ class MPToken_test : public beast::unit_test::Suite Env env{*this, features}; env.fund(XRP(1'000), gw, alice, carol); auto usd = MPTTester({.env = env, .issuer = gw, .holders = {alice}}); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, usd(1))); env.close(); @@ -6861,7 +6861,7 @@ class MPToken_test : public beast::unit_test::Suite auto btc = MPTTester({.env = env, .issuer = gw, .holders = {alice}, .pay = 1'000}); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, btc(1))); env.close(); @@ -6882,7 +6882,7 @@ class MPToken_test : public beast::unit_test::Suite .holders = {alice}, .flags = tfMPTRequireAuth | kMptDexFlags, .authHolder = true}); - uint256 const chkId{getCheckIndex(alice, env.seq(alice))}; + UInt256 const chkId{getCheckIndex(alice, env.seq(alice))}; env(check::create(alice, carol, btc(1))); env.close(); @@ -6902,7 +6902,7 @@ class MPToken_test : public beast::unit_test::Suite env.fund(XRP(1'000), alice, carol); // src is issuer - uint256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; + UInt256 const checkId{keylet::check(alice, SeqProxy::rawSequence(env.seq(alice))).key}; // can create env(check::create(alice, carol, mpt(100))); @@ -6930,7 +6930,7 @@ class MPToken_test : public beast::unit_test::Suite auto const mpt = mptTester["MPT"]; mptTester.authorize({.account = alice}); - uint256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; + UInt256 const checkId{keylet::check(gw, SeqProxy::rawSequence(env.seq(gw))).key}; env(check::create(gw, alice, mpt(100))); env.close(); diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 5f02f1b079..d117e78f98 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -997,7 +997,7 @@ public: env(trust("alice", usd(100)), Msig(becky, bogie_), Fee(3 * baseFee), - Require(lines("alice", 1))); + Require(Lines("alice", 1))); env.close(); env.require(Owners(alice, 2)); @@ -1388,20 +1388,20 @@ public: // Attach phantom signers to alice using a ticket. env(signers(alice, 1, {{bogie_, 1}, {demon_, 1}}), ticket::Use(aliceTicketSeq++)); env.close(); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); // This should work. auto const baseFee = env.current()->fees().base; env(noop(alice), Msig(bogie_, demon_), Fee(3 * baseFee), ticket::Use(aliceTicketSeq++)); env.close(); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); // Should also be able to remove the signer list using a ticket. env(signers(alice, jtx::kNone), ticket::Use(aliceTicketSeq++)); env.close(); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); } @@ -1421,8 +1421,8 @@ public: uint8_t tag2[] = "hello world some ascii 32b long"; // including 1 byte for NUL - uint256 bogieTag = xrpl::BaseUInt<256>::fromVoid(tag1); - uint256 demonTag = xrpl::BaseUInt<256>::fromVoid(tag2); + UInt256 bogieTag = xrpl::BaseUInt<256>::fromVoid(tag1); + UInt256 demonTag = xrpl::BaseUInt<256>::fromVoid(tag2); // Attach phantom signers to alice and use them for a transaction. env(signers(alice, 1, {{bogie_, 1, bogieTag}, {demon_, 1, demonTag}})); diff --git a/src/test/app/NFTokenAuth_test.cpp b/src/test/app/NFTokenAuth_test.cpp index e82a47a5d7..e13bb28322 100644 --- a/src/test/app/NFTokenAuth_test.cpp +++ b/src/test/app/NFTokenAuth_test.cpp @@ -561,7 +561,7 @@ public: auto const [nftID, minterSellIdx] = mintAndOfferNFT(env, minter, drops(1), 1); env(token::acceptSellOffer(a1, minterSellIdx)); - uint256 const sellIdx = keylet::nftokenOffer(a1, SeqProxy::rawSequence(env.seq(a1))).key; + UInt256 const sellIdx = keylet::nftokenOffer(a1, SeqProxy::rawSequence(env.seq(a1))).key; env(token::createOffer(a1, nftID, usd(100)), Txflags(tfSellNFToken)); if (features[fixEnforceNFTokenTrustlineV2]) diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index cc54c4feb5..984db2f483 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -59,15 +59,15 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Helper function that returns new nft id for an account and create // specified number of sell offers - static uint256 + static UInt256 createNftAndOffers( test::jtx::Env& env, test::jtx::Account const& owner, - std::vector& offerIndexes, + std::vector& offerIndexes, size_t const tokenCancelCount) { using namespace test::jtx; - uint256 const nftokenID = token::getNextID(env, owner, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, owner, 0, tfTransferable); env(token::mint(owner, 0), token::Uri(std::string(kMaxTokenUriLength, 'u')), Txflags(tfTransferable)); @@ -162,7 +162,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite struct AcctStat { test::jtx::Account const acct; - std::vector nfts; + std::vector nfts; AcctStat(char const* name) : acct(name) { @@ -236,7 +236,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite { // We do the same work on alice and minter, so make a lambda. auto xferNFT = [&env, &becky](AcctStat& acct, auto& iter) { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(acct.acct, SeqProxy::rawSequence(env.seq(acct.acct))) .key; env(token::createOffer(acct, *iter, XRP(0)), Txflags(tfSellNFToken)); @@ -262,7 +262,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Next we'll create offers for all of those NFTs. This calls for // another lambda. auto addOffers = [&env](AcctStat& owner, AcctStat& other1, AcctStat& other2) { - for (uint256 const nft : owner.nfts) + for (UInt256 const nft : owner.nfts) { // Create sell offers for owner. env(token::createOffer(owner, nft, drops(1)), @@ -308,7 +308,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Pick one of the nfts. std::uniform_int_distribution nftDist(0lu, owner.nfts.size() - 1); auto nftIter = owner.nfts.begin() + nftDist(engine); - uint256 const nft = *nftIter; + UInt256 const nft = *nftIter; owner.nfts.erase(nftIter); // Decide which of the accounts should burn the nft. If the @@ -366,7 +366,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // A lambda that generates 96 nfts packed into three pages of 32 each. // Returns a sorted vector of the NFTokenIDs packed into the pages. auto genPackedTokens = [this, &env, &alice]() { - std::vector nfts; + std::vector nfts; nfts.reserve(96); // We want to create fully packed NFT pages. This is a little @@ -434,11 +434,11 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Generate three packed pages. Then burn the tokens in order from // first to last. This exercises specific cases where coalescing // pages is not possible. - std::vector const nfts = genPackedTokens(); + std::vector const nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); - for (uint256 const& nft : nfts) + for (UInt256 const& nft : nfts) { env(token::burn(alice, {nft})); env.close(); @@ -468,7 +468,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Generate three packed pages. Then burn the tokens in order from // last to first. This exercises different specific cases where // coalescing pages is not possible. - std::vector nfts = genPackedTokens(); + std::vector nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); @@ -478,13 +478,13 @@ class NFTokenBurn_test : public beast::unit_test::Suite if (!BEAST_EXPECT(lastNFTokenPage)) return; - uint256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); + UInt256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); auto middleNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), middleNFTokenPageIndex)); if (!BEAST_EXPECT(middleNFTokenPage)) return; - uint256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); + UInt256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); auto firstNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), firstNFTokenPageIndex)); if (!BEAST_EXPECT(firstNFTokenPage)) @@ -572,7 +572,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Generate three packed pages. Then burn all tokens in the middle // page. This exercises the case where a page is removed between // two fully populated pages. - std::vector nfts = genPackedTokens(); + std::vector nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); @@ -582,13 +582,13 @@ class NFTokenBurn_test : public beast::unit_test::Suite if (!BEAST_EXPECT(lastNFTokenPage)) return; - uint256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); + UInt256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); auto middleNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), middleNFTokenPageIndex)); if (!BEAST_EXPECT(middleNFTokenPage)) return; - uint256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); + UInt256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); auto firstNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), firstNFTokenPageIndex)); if (!BEAST_EXPECT(firstNFTokenPage)) @@ -620,7 +620,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite BEAST_EXPECT(!firstNFTokenPage->isFieldPresent(sfPreviousPageMin)); // Burn the remaining nfts. - for (uint256 const& nft : nfts) + for (UInt256 const& nft : nfts) { env(token::burn(alice, {nft})); env.close(); @@ -633,7 +633,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Generate three packed pages. Then burn all the tokens in the // first page followed by all the tokens in the last page. This // exercises a specific case where coalescing pages is not possible. - std::vector nfts = genPackedTokens(); + std::vector nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); @@ -643,13 +643,13 @@ class NFTokenBurn_test : public beast::unit_test::Suite if (!BEAST_EXPECT(lastNFTokenPage)) return; - uint256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); + UInt256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); auto middleNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), middleNFTokenPageIndex)); if (!BEAST_EXPECT(middleNFTokenPage)) return; - uint256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); + UInt256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); auto firstNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), firstNFTokenPageIndex)); if (!BEAST_EXPECT(firstNFTokenPage)) @@ -757,7 +757,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // tests that this one is modeled after. // Generate three closely packed NFTokenPages. - std::vector nfts = genPackedTokens(); + std::vector nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); @@ -860,18 +860,18 @@ class NFTokenBurn_test : public beast::unit_test::Suite // alice creates 498 sell offers and becky creates 1 buy offers. // When the token is burned, 498 sell offers and 1 buy offer are // removed. In total, 499 offers are removed - std::vector offerIndexes; + std::vector offerIndexes; auto const nftokenID = createNftAndOffers(env, alice, offerIndexes, kMaxDeletableTokenOfferEntries - 2); // Verify all sell offers are present in the ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(env.le(keylet::nftokenOffer(offerIndex))); } // Becky creates a buy offer - uint256 const beckyOfferIndex = + UInt256 const beckyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftokenID, drops(1)), token::Owner(alice)); env.close(); @@ -882,7 +882,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Burning the token should remove all 498 sell offers // that alice created - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(!env.le(keylet::nftokenOffer(offerIndex))); } @@ -908,12 +908,12 @@ class NFTokenBurn_test : public beast::unit_test::Suite // alice creates 501 sell offers for the token // After we burn the token, 500 of the sell offers should be // removed, and one is left over - std::vector offerIndexes; + std::vector offerIndexes; auto const nftokenID = createNftAndOffers(env, alice, offerIndexes, kMaxDeletableTokenOfferEntries + 1); // Verify all sell offers are present in the ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(env.le(keylet::nftokenOffer(offerIndex))); } @@ -924,7 +924,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite uint32_t offerDeletedCount = 0; // Count the number of sell offers that have been deleted - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { if (!env.le(keylet::nftokenOffer(offerIndex))) offerDeletedCount++; @@ -952,12 +952,12 @@ class NFTokenBurn_test : public beast::unit_test::Suite // When the token is burned, 499 sell offers and 1 buy offer // are removed. // In total, 500 offers are removed - std::vector offerIndexes; + std::vector offerIndexes; auto const nftokenID = createNftAndOffers(env, alice, offerIndexes, kMaxDeletableTokenOfferEntries - 1); // Verify all sell offers are present in the ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(env.le(keylet::nftokenOffer(offerIndex))); } @@ -974,7 +974,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // Burning the token should remove all 499 sell offers from the // ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(!env.le(keylet::nftokenOffer(offerIndex))); } @@ -1012,7 +1012,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite // A lambda that generates 96 nfts packed into three pages of 32 each. // Returns a sorted vector of the NFTokenIDs packed into the pages. auto genPackedTokens = [this, &env, &alice, &minter]() { - std::vector nfts; + std::vector nfts; nfts.reserve(96); // We want to create fully packed NFT pages. This is a little @@ -1047,7 +1047,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite env.close(); // Minter creates an offer for the NFToken. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nfts.back(), XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -1088,7 +1088,7 @@ class NFTokenBurn_test : public beast::unit_test::Suite }; // Generate three packed pages. - std::vector nfts = genPackedTokens(); + std::vector nfts = genPackedTokens(); BEAST_EXPECT(nftCount(env, alice) == 96); BEAST_EXPECT(ownerCount(env, alice) == 3); @@ -1098,27 +1098,27 @@ class NFTokenBurn_test : public beast::unit_test::Suite if (!BEAST_EXPECT(lastNFTokenPage)) return; - uint256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); + UInt256 const middleNFTokenPageIndex = lastNFTokenPage->at(sfPreviousPageMin); auto middleNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), middleNFTokenPageIndex)); if (!BEAST_EXPECT(middleNFTokenPage)) return; - uint256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); + UInt256 const firstNFTokenPageIndex = middleNFTokenPage->at(sfPreviousPageMin); auto firstNFTokenPage = env.le(keylet::nftokenPage(keylet::nftokenPageMin(alice), firstNFTokenPageIndex)); if (!BEAST_EXPECT(firstNFTokenPage)) return; // Sell all the tokens in the very last page back to minter. - std::vector last32NFTs; + std::vector last32NFTs; for (int i = 0; i < 32; ++i) { last32NFTs.push_back(nfts.back()); nfts.pop_back(); // alice creates an offer for the NFToken. - uint256 const aliceOfferIndex = + UInt256 const aliceOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, last32NFTs.back(), XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -1150,10 +1150,10 @@ class NFTokenBurn_test : public beast::unit_test::Suite env.close(); // minter sells the last 32 NFTs back to alice. - for (uint256 const nftID : last32NFTs) + for (UInt256 const nftID : last32NFTs) { // minter creates an offer for the NFToken. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); diff --git a/src/test/app/NFTokenDir_test.cpp b/src/test/app/NFTokenDir_test.cpp index 7770741a36..aabfd93e54 100644 --- a/src/test/app/NFTokenDir_test.cpp +++ b/src/test/app/NFTokenDir_test.cpp @@ -128,7 +128,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // Mint 100 sequential NFTs. Tweak the taxon so zero is always stored. // That's what makes them sequential. static constexpr std::size_t kNftCount = 100; - std::vector nftIDs; + std::vector nftIDs; nftIDs.reserve(kNftCount); for (int i = 0; i < kNftCount; ++i) { @@ -140,8 +140,8 @@ class NFTokenDir_test : public beast::unit_test::Suite // Create an offer for each of the NFTs. This verifies that the ledger // can find all of the minted NFTs. - std::vector offers; - for (uint256 const& nftID : nftIDs) + std::vector offers; + for (UInt256 const& nftID : nftIDs) { offers.emplace_back( keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key); @@ -151,7 +151,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // Buyer accepts all of the offers in reverse order. std::ranges::reverse(offers); - for (uint256 const& offer : offers) + for (UInt256 const& offer : offers) { env(token::acceptSellOffer(buyer, offer)); env.close(); @@ -204,13 +204,13 @@ class NFTokenDir_test : public beast::unit_test::Suite // All of the accounts create one NFT and and offer that NFT to // buyer. - std::vector nftIDs; - std::vector offers; + std::vector nftIDs; + std::vector offers; offers.reserve(accounts.size()); for (Account const& account : accounts) { // Mint the NFT. - uint256 const& nftID = + UInt256 const& nftID = nftIDs.emplace_back(token::getNextID(env, account, 0, tfTransferable)); env(token::mint(account, 0), Txflags(tfTransferable)); env.close(); @@ -225,7 +225,7 @@ class NFTokenDir_test : public beast::unit_test::Suite env.close(); // buyer accepts all of the offers. - for (uint256 const& offer : offers) + for (UInt256 const& offer : offers) { env(token::acceptSellOffer(buyer, offer)); env.close(); @@ -238,9 +238,9 @@ class NFTokenDir_test : public beast::unit_test::Suite // ledger by having buyer create sell offers for all of their // NFTs. Attempting to sell an offer that the ledger can't find // generates a non-tesSUCCESS error code. - for (uint256 const& nftID : nftIDs) + for (UInt256 const& nftID : nftIDs) { - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(100)), Txflags(tfSellNFToken)); env.close(); @@ -259,7 +259,7 @@ class NFTokenDir_test : public beast::unit_test::Suite BEAST_EXPECT(buyerNFTs[jss::result][jss::account_nfts].size() == nftIDs.size()); for (json::Value const& ownedNFT : buyerNFTs[jss::result][jss::account_nfts]) { - uint256 ownedID; + UInt256 ownedID; BEAST_EXPECT(ownedID.parseHex(ownedNFT[sfNFTokenID.jsonName].asString())); auto const foundIter = std::ranges::find(nftIDs, ownedID); @@ -410,13 +410,13 @@ class NFTokenDir_test : public beast::unit_test::Suite // All of the accounts create one NFT and and offer that NFT to // buyer. - std::vector nftIDs; - std::vector offers; + std::vector nftIDs; + std::vector offers; offers.reserve(accounts.size()); for (Account const& account : accounts) { // Mint the NFT. - uint256 const& nftID = + UInt256 const& nftID = nftIDs.emplace_back(token::getNextID(env, account, 0, tfTransferable)); env(token::mint(account, 0), Txflags(tfTransferable)); env.close(); @@ -448,9 +448,9 @@ class NFTokenDir_test : public beast::unit_test::Suite // ledger by having buyer create sell offers for all of their // NFTs. Attempting to sell an offer that the ledger can't find // generates a non-tesSUCCESS error code. - for (uint256 const& nftID : nftIDs) + for (UInt256 const& nftID : nftIDs) { - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(100)), Txflags(tfSellNFToken)); env.close(); @@ -469,7 +469,7 @@ class NFTokenDir_test : public beast::unit_test::Suite BEAST_EXPECT(buyerNFTs[jss::result][jss::account_nfts].size() == nftIDs.size()); for (json::Value const& ownedNFT : buyerNFTs[jss::result][jss::account_nfts]) { - uint256 ownedID; + UInt256 ownedID; BEAST_EXPECT(ownedID.parseHex(ownedNFT[sfNFTokenID.jsonName].asString())); auto const foundIter = std::ranges::find(nftIDs, ownedID); @@ -642,13 +642,13 @@ class NFTokenDir_test : public beast::unit_test::Suite env.close(); // All of the accounts create one NFT and and offer that NFT to buyer. - std::vector nftIDs; - std::vector offers; + std::vector nftIDs; + std::vector offers; offers.reserve(accounts.size()); for (Account const& account : accounts) { // Mint the NFT. - uint256 const& nftID = + UInt256 const& nftID = nftIDs.emplace_back(token::getNextID(env, account, 0, tfTransferable)); env(token::mint(account, 0), Txflags(tfTransferable)); env.close(); @@ -663,8 +663,8 @@ class NFTokenDir_test : public beast::unit_test::Suite env.close(); // Verify that the low 96 bits of all generated NFTs is identical. - uint256 const expectLowBits = nftIDs.front() & nft::kPageMask; - for (uint256 const& nftID : nftIDs) + UInt256 const expectLowBits = nftIDs.front() & nft::kPageMask; + for (UInt256 const& nftID : nftIDs) { BEAST_EXPECT(expectLowBits == (nftID & nft::kPageMask)); } @@ -672,11 +672,11 @@ class NFTokenDir_test : public beast::unit_test::Suite // Remove one NFT and offer from the vectors. This offer is the one // that will overflow the page. nftIDs.pop_back(); - uint256 const offerForPageOverflow = offers.back(); + UInt256 const offerForPageOverflow = offers.back(); offers.pop_back(); // buyer accepts all of the offers but one. - for (uint256 const& offer : offers) + for (UInt256 const& offer : offers) { env(token::acceptSellOffer(buyer, offer)); env.close(); @@ -689,9 +689,9 @@ class NFTokenDir_test : public beast::unit_test::Suite // the ledger by having buyer create sell offers for all of their NFTs. // Attempting to sell an offer that the ledger can't find generates // a non-tesSUCCESS error code. - for (uint256 const& nftID : nftIDs) + for (UInt256 const& nftID : nftIDs) { - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(100)), Txflags(tfSellNFToken)); env.close(); @@ -710,7 +710,7 @@ class NFTokenDir_test : public beast::unit_test::Suite BEAST_EXPECT(buyerNFTs[jss::result][jss::account_nfts].size() == nftIDs.size()); for (json::Value const& ownedNFT : buyerNFTs[jss::result][jss::account_nfts]) { - uint256 ownedID; + UInt256 ownedID; BEAST_EXPECT(ownedID.parseHex(ownedNFT[sfNFTokenID.jsonName].asString())); auto const foundIter = std::ranges::find(nftIDs, ownedID); @@ -809,10 +809,10 @@ class NFTokenDir_test : public beast::unit_test::Suite // All of the accounts create seven consecutive NFTs and and offer // those NFTs to buyer. - std::array, 7> nftIDsByPage; + std::array, 7> nftIDsByPage; for (auto& vec : nftIDsByPage) vec.reserve(accounts.size()); - std::array, 7> offers; + std::array, 7> offers; for (auto& vec : offers) vec.reserve(accounts.size()); for (std::size_t i = 0; i < nftIDsByPage.size(); ++i) @@ -822,7 +822,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // Mint the NFT. Tweak the taxon so zero is always stored. std::uint32_t const taxon = toUInt32(nft::cipheredTaxon(i, nft::toTaxon(0))); - uint256 const& nftID = nftIDsByPage[i].emplace_back( + UInt256 const& nftID = nftIDsByPage[i].emplace_back( token::getNextID(env, account, taxon, tfTransferable)); env(token::mint(account, taxon), Txflags(tfTransferable)); env.close(); @@ -841,8 +841,8 @@ class NFTokenDir_test : public beast::unit_test::Suite // sequence is identical. for (auto const& vec : nftIDsByPage) { - uint256 const expectLowBits = vec.front() & nft::kPageMask; - for (uint256 const& nftID : vec) + UInt256 const expectLowBits = vec.front() & nft::kPageMask; + for (UInt256 const& nftID : vec) { BEAST_EXPECT(expectLowBits == (nftID & nft::kPageMask)); } @@ -850,9 +850,9 @@ class NFTokenDir_test : public beast::unit_test::Suite // Remove one NFT and offer from each of the vectors. These offers // are the ones that will overflow the page. - std::vector overflowNFTs; + std::vector overflowNFTs; overflowNFTs.reserve(nftIDsByPage.size()); - std::vector overflowOffers; + std::vector overflowOffers; overflowOffers.reserve(nftIDsByPage.size()); for (std::size_t i = 0; i < nftIDsByPage.size(); ++i) @@ -871,7 +871,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // cases. for (int const i : std::initializer_list{3, 6, 0, 1, 2, 5, 4}) { - for (uint256 const& offer : offers[i]) + for (UInt256 const& offer : offers[i]) { env(token::acceptSellOffer(buyer, offer)); env.close(); @@ -880,7 +880,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // buyer accepts the seven offers that would cause page overflows if // the transaction succeeded. - for (uint256 const& offer : overflowOffers) + for (UInt256 const& offer : overflowOffers) { env(token::acceptSellOffer(buyer, offer), Ter(tecNO_SUITABLE_NFTOKEN_PAGE)); env.close(); @@ -892,7 +892,7 @@ class NFTokenDir_test : public beast::unit_test::Suite // a non-tesSUCCESS error code. for (auto const& vec : nftIDsByPage) { - for (uint256 const& nftID : vec) + for (UInt256 const& nftID : vec) { env(token::createOffer(buyer, nftID, XRP(100)), Txflags(tfSellNFToken)); env.close(); @@ -942,14 +942,14 @@ class NFTokenDir_test : public beast::unit_test::Suite // Cancel all the offers. { - std::vector cancelOffers; + std::vector cancelOffers; cancelOffers.reserve(ownedNftOffers.size()); for (auto const& offer : ownedNftOffers) { if (offer.isMember(jss::index)) { - uint256 offerIndex; + UInt256 offerIndex; if (offerIndex.parseHex(offer[jss::index].asString())) cancelOffers.push_back(offerIndex); } @@ -1006,7 +1006,7 @@ class NFTokenDir_test : public beast::unit_test::Suite } while (!marker.empty()); // Copy all of the nftIDs into a set to make validation easier. - std::set allNftIDs; + std::set allNftIDs; for (auto& vec : nftIDsByPage) allNftIDs.insert(vec.begin(), vec.end()); @@ -1016,7 +1016,7 @@ class NFTokenDir_test : public beast::unit_test::Suite { if (ownedNFT.isMember(sfNFTokenID.jsonName)) { - uint256 ownedID; + UInt256 ownedID; BEAST_EXPECT(ownedID.parseHex(ownedNFT[sfNFTokenID.jsonName].asString())); auto const foundIter = allNftIDs.find(ownedID); diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 89c14fbfc5..016407e79e 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -123,7 +123,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(mintedCount(env, master) == 0); BEAST_EXPECT(burnedCount(env, master) == 0); - uint256 const nftId0{token::getNextID(env, env.master, 0u)}; + UInt256 const nftId0{token::getNextID(env, env.master, 0u)}; env(token::mint(env.master, 0u)); env.close(); BEAST_EXPECT(ownerCount(env, master) == 1); @@ -136,7 +136,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(mintedCount(env, master) == 1); BEAST_EXPECT(burnedCount(env, master) == 1); - uint256 const nftId1{token::getNextID(env, env.master, 0u, tfTransferable)}; + UInt256 const nftId1{token::getNextID(env, env.master, 0u, tfTransferable)}; env(token::mint(env.master, 0u), Txflags(tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, master) == 1); @@ -146,7 +146,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite Account const alice{"alice"}; env.fund(XRP(10000), alice); env.close(); - uint256 const aliceOfferIndex = + UInt256 const aliceOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId1, XRP(1000)), token::Owner(master)); env.close(); @@ -437,7 +437,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // sfBurnedNFTokens fields. This prevents an exception when the // AccountRoot template is applied. { - uint256 const nftId0{token::getNextID(env, alice, 0u)}; + UInt256 const nftId0{token::getNextID(env, alice, 0u)}; env(token::mint(alice, 0u)); env.close(); @@ -566,7 +566,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); @@ -619,17 +619,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable, 10); + UInt256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable, 10); env(token::mint(alice, 0u), Txflags(tfTransferable), token::XferFee(10)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); - uint256 const nftXrpOnlyID = token::getNextID(env, alice, 0, tfOnlyXRP | tfTransferable); + UInt256 const nftXrpOnlyID = token::getNextID(env, alice, 0, tfOnlyXRP | tfTransferable); env(token::mint(alice, 0), Txflags(tfOnlyXRP | tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); - uint256 const nftNoXferID = token::getNextID(env, alice, 0); + UInt256 const nftNoXferID = token::getNextID(env, alice, 0); env(token::mint(alice, 0)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); @@ -859,13 +859,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); // This is the offer we'll try to cancel. - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftAlice0ID, XRP(1)), token::Owner(alice), Ter(tesSUCCESS)); env.close(); @@ -903,7 +903,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite if (features[fixCleanup3_2_0]) { // Zero is not a valid offer ID. - env(token::cancelOffer(buyer, {uint256{}}), Ter(temMALFORMED)); + env(token::cancelOffer(buyer, {UInt256{}}), Ter(temMALFORMED)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == 1); @@ -911,7 +911,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // craftedIndex is not a valid offer index but it is not zero. auto const craftedIndex = keylet::nftokenOffer(gw, SeqProxy::rawSequence(env.seq(gw))).key; - env(token::cancelOffer(buyer, {buyerOfferIndex, uint256{}, craftedIndex}), + env(token::cancelOffer(buyer, {buyerOfferIndex, UInt256{}, craftedIndex}), Ter(temMALFORMED)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == 1); @@ -919,7 +919,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // List of tokens to delete is too long. { - std::vector const offers(kMaxTokenOfferCancelCount + 1, buyerOfferIndex); + std::vector const offers(kMaxTokenOfferCancelCount + 1, buyerOfferIndex); env(token::cancelOffer(buyer, offers), Ter(temMALFORMED)); env.close(); @@ -995,45 +995,45 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, alice) == 0); BEAST_EXPECT(ownerCount(env, buyer) == 0); - uint256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftAlice0ID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); uint8_t aliceCount = 1; BEAST_EXPECT(ownerCount(env, alice) == aliceCount); - uint256 const nftXrpOnlyID = token::getNextID(env, alice, 0, tfOnlyXRP | tfTransferable); + UInt256 const nftXrpOnlyID = token::getNextID(env, alice, 0, tfOnlyXRP | tfTransferable); env(token::mint(alice, 0), Txflags(tfOnlyXRP | tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == aliceCount); - uint256 const nftNoXferID = token::getNextID(env, alice, 0); + UInt256 const nftNoXferID = token::getNextID(env, alice, 0); env(token::mint(alice, 0)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == aliceCount); // alice creates sell offers for her nfts. - uint256 const plainOfferIndex = + UInt256 const plainOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAlice0ID, XRP(10)), Txflags(tfSellNFToken)); env.close(); aliceCount++; BEAST_EXPECT(ownerCount(env, alice) == aliceCount); - uint256 const audOfferIndex = + UInt256 const audOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAlice0ID, gwAUD(30)), Txflags(tfSellNFToken)); env.close(); aliceCount++; BEAST_EXPECT(ownerCount(env, alice) == aliceCount); - uint256 const xrpOnlyOfferIndex = + UInt256 const xrpOnlyOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftXrpOnlyID, XRP(20)), Txflags(tfSellNFToken)); env.close(); aliceCount++; BEAST_EXPECT(ownerCount(env, alice) == aliceCount); - uint256 const noXferOfferIndex = + UInt256 const noXferOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftNoXferID, XRP(30)), Txflags(tfSellNFToken)); env.close(); @@ -1041,7 +1041,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, alice) == aliceCount); // alice creates a sell offer that will expire soon. - uint256 const aliceExpOfferIndex = + UInt256 const aliceExpOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftNoXferID, XRP(40)), Txflags(tfSellNFToken), @@ -1051,7 +1051,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, alice) == aliceCount); // buyer creates a Buy offer that will expire soon. - uint256 const buyerExpOfferIndex = + UInt256 const buyerExpOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftAlice0ID, XRP(40)), token::Owner(alice), @@ -1120,7 +1120,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, buyer) == buyerCount); // The buy offer must be present in the ledger. - uint256 const missingOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(1)).key; + UInt256 const missingOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(1)).key; env(token::acceptBuyOffer(buyer, missingOfferIndex), Ter(tecOBJECT_NOT_FOUND)); env.close(); BEAST_EXPECT(ownerCount(env, buyer) == buyerCount); @@ -1183,7 +1183,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // corresponding buy and sell offers. { // buyer creates a buy offer for one of alice's nfts. - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftAlice0ID, gwAUD(29)), token::Owner(alice)); env.close(); @@ -1217,7 +1217,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } { // buyer creates a buy offer for one of alice's nfts. - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftAlice0ID, gwAUD(31)), token::Owner(alice)); env.close(); @@ -1257,7 +1257,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // preclaim buy { // buyer creates a buy offer for one of alice's nfts. - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftAlice0ID, gwAUD(30)), token::Owner(alice)); env.close(); @@ -1285,7 +1285,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice gives her NFT to gw, so alice no longer owns nftAlice0. { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAlice0ID, XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -1311,7 +1311,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // preclaim sell { // buyer creates a buy offer for one of alice's nfts. - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftXrpOnlyID, XRP(30)), token::Owner(alice)); env.close(); @@ -1340,7 +1340,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // buyer attempting to accept one of alice's offers with // insufficient funds. { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(gw, SeqProxy::rawSequence(env.seq(gw))).key; env(token::createOffer(gw, nftAlice0ID, XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -1390,11 +1390,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // 2. minted by minter and // 3. transfers that nft to buyer. auto nftToBuyer = [&env, &alice, &minter1, &buyer](std::uint32_t flags) { - uint256 const nftID{token::getNextID(env, alice, 0u, flags)}; + UInt256 const nftID{token::getNextID(env, alice, 0u, flags)}; env(token::mint(minter1, 0u), token::Issuer(alice), Txflags(flags)); env.close(); - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(minter1, SeqProxy::rawSequence(env.seq(minter1))).key; env(token::createOffer(minter1, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -1407,7 +1407,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // An NFT without flagBurnable can only be burned by its owner. { - uint256 const noBurnID = nftToBuyer(0); + UInt256 const noBurnID = nftToBuyer(0); env(token::burn(alice, noBurnID), token::Owner(buyer), Ter(tecNO_PERMISSION)); env.close(); env(token::burn(minter1, noBurnID), token::Owner(buyer), Ter(tecNO_PERMISSION)); @@ -1422,7 +1422,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } // An NFT with flagBurnable can be burned by the issuer. { - uint256 const burnableID = nftToBuyer(tfBurnable); + UInt256 const burnableID = nftToBuyer(tfBurnable); env(token::burn(minter2, burnableID), token::Owner(buyer), Ter(tecNO_PERMISSION)); env.close(); @@ -1433,7 +1433,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } // An NFT with flagBurnable can be burned by the owner. { - uint256 const burnableID = nftToBuyer(tfBurnable); + UInt256 const burnableID = nftToBuyer(tfBurnable); BEAST_EXPECT(ownerCount(env, buyer) == 1); env(token::burn(buyer, burnableID)); env.close(); @@ -1441,7 +1441,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } // An NFT with flagBurnable can be burned by the minter. { - uint256 const burnableID = nftToBuyer(tfBurnable); + UInt256 const burnableID = nftToBuyer(tfBurnable); BEAST_EXPECT(ownerCount(env, buyer) == 1); env(token::burn(buyer, burnableID), token::Owner(buyer)); env.close(); @@ -1450,7 +1450,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // An nft with flagBurnable may be burned by the issuers' minter, // who may not be the original minter. { - uint256 const burnableID = nftToBuyer(tfBurnable); + UInt256 const burnableID = nftToBuyer(tfBurnable); BEAST_EXPECT(ownerCount(env, buyer) == 1); env(token::setMinter(alice, minter2)); @@ -1493,19 +1493,19 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Don't set flagOnlyXRP and offers can be made with IOUs. { - uint256 const nftIOUsOkayID{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftIOUsOkayID{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 2); - uint256 const aliceOfferIndex = + UInt256 const aliceOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftIOUsOkayID, gwAUD(50)), Txflags(tfSellNFToken)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 3); BEAST_EXPECT(ownerCount(env, buyer) == 1); - uint256 const buyerOfferIndex = + UInt256 const buyerOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftIOUsOkayID, gwAUD(50)), token::Owner(alice)); env.close(); @@ -1526,7 +1526,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Set flagOnlyXRP and offers using IOUs are rejected. { - uint256 const nftOnlyXrpID{ + UInt256 const nftOnlyXrpID{ token::getNextID(env, alice, 0u, tfOnlyXRP | tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfOnlyXRP | tfTransferable)); env.close(); @@ -1603,13 +1603,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // fee will not allow creating offers that use IOUs for payment. for (std::uint32_t const xferFee : {0, 1}) { - uint256 const nftNoAutoTrustID{ + UInt256 const nftNoAutoTrustID{ token::getNextID(env, alice, 0u, tfTransferable, xferFee)}; env(token::mint(alice, 0u), token::XferFee(xferFee), Txflags(tfTransferable)); env.close(); // becky buys the nft for 1 drop. - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, drops(1)), token::Owner(alice)); env.close(); @@ -1618,7 +1618,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // becky attempts to sell the nft for AUD. TER const createOfferTER = (xferFee != 0u) ? TER(tecNO_LINE) : TER(tesSUCCESS); - uint256 const beckyOfferIndex = + UInt256 const beckyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, gwAUD(100)), Txflags(tfSellNFToken), @@ -1626,7 +1626,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // cheri offers to buy the nft for CAD. - uint256 const cheriOfferIndex = + UInt256 const cheriOfferIndex = keylet::nftokenOffer(cheri, SeqProxy::rawSequence(env.seq(cheri))).key; env(token::createOffer(cheri, nftNoAutoTrustID, gwCAD(100)), token::Owner(becky), @@ -1643,7 +1643,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint16_t const transferFee = 10000; // 10% - uint256 const nftAutoTrustID{ + UInt256 const nftAutoTrustID{ token::getNextID(env, alice, 0u, tfTransferable | tfTrustLine, transferFee)}; // If the fixRemoveNFTokenAutoTrustLine amendment is active @@ -1665,7 +1665,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite break; } // becky buys the nft for 1 drop. - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, drops(1)), token::Owner(alice)); env.close(); @@ -1673,7 +1673,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // becky sells the nft for AUD. - uint256 const beckySellOfferIndex = + UInt256 const beckySellOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, gwAUD(100)), Txflags(tfSellNFToken)); env.close(); @@ -1684,7 +1684,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(alice, gwAUD) == gwAUD(10)); // becky buys the nft back for CAD. - uint256 const beckyBuyBackOfferIndex = + UInt256 const beckyBuyBackOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, gwCAD(50)), token::Owner(cheri)); env.close(); @@ -1699,13 +1699,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // flagCreateTrustLines will work for preestablished trust lines. { std::uint16_t const transferFee = 5000; // 5% - uint256 const nftNoAutoTrustID{ + UInt256 const nftNoAutoTrustID{ token::getNextID(env, alice, 0u, tfTransferable, transferFee)}; env(token::mint(alice, 0u), token::XferFee(transferFee), Txflags(tfTransferable)); env.close(); // alice sells the nft using AUD. - uint256 const aliceSellOfferIndex = + UInt256 const aliceSellOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftNoAutoTrustID, gwAUD(200)), Txflags(tfSellNFToken)); @@ -1723,7 +1723,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite Txflags(tfSellNFToken), Ter(tecNO_LINE)); env.close(); - uint256 const cheriSellOfferIndex = + UInt256 const cheriSellOfferIndex = keylet::nftokenOffer(cheri, SeqProxy::rawSequence(env.seq(cheri))).key; env(token::createOffer(cheri, nftNoAutoTrustID, gwCAD(100)), Txflags(tfSellNFToken)); @@ -1759,7 +1759,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // First try an nft made by alice without flagTransferable set. { BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const nftAliceNoTransferID{token::getNextID(env, alice, 0u)}; + UInt256 const nftAliceNoTransferID{token::getNextID(env, alice, 0u)}; env(token::mint(alice, 0u), token::XferFee(0)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); @@ -1771,7 +1771,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite Ter(tefNFTOKEN_IS_NOT_TRANSFERABLE)); // alice offers to sell the nft and becky accepts the offer. - uint256 const aliceSellOfferIndex = + UInt256 const aliceSellOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAliceNoTransferID, XRP(20)), Txflags(tfSellNFToken)); env.close(); @@ -1800,7 +1800,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice offers to buy the nft back from becky. becky accepts // the offer. - uint256 const aliceBuyOfferIndex = + UInt256 const aliceBuyOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAliceNoTransferID, XRP(22)), token::Owner(becky)); env.close(); @@ -1821,7 +1821,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); BEAST_EXPECT(ownerCount(env, minter) == 0); - uint256 const nftMinterNoTransferID{token::getNextID(env, alice, 0u)}; + UInt256 const nftMinterNoTransferID{token::getNextID(env, alice, 0u)}; env(token::mint(minter), token::Issuer(alice)); env.close(); BEAST_EXPECT(ownerCount(env, minter) == 1); @@ -1857,7 +1857,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // minter successfully offers their nft for sale. BEAST_EXPECT(ownerCount(env, minter) == 1); - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftMinterNoTransferID, XRP(22)), Txflags(tfSellNFToken)); env.close(); @@ -1893,7 +1893,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice can create an offer to buy the nft. BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const aliceBuyOfferIndex = + UInt256 const aliceBuyOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftMinterNoTransferID, XRP(25)), token::Owner(becky)); env.close(); @@ -1909,7 +1909,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Now minter can create an offer to buy the nft. BEAST_EXPECT(ownerCount(env, minter) == 0); - uint256 const minterBuyOfferIndex = + UInt256 const minterBuyOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftMinterNoTransferID, XRP(26)), token::Owner(becky)); env.close(); @@ -1943,19 +1943,19 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // by anybody. { BEAST_EXPECT(ownerCount(env, alice) == 0); - uint256 const nftAliceID{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftAliceID{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 1); // Both alice and becky can make offers for alice's nft. - uint256 const aliceSellOfferIndex = + UInt256 const aliceSellOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftAliceID, XRP(20)), Txflags(tfSellNFToken)); env.close(); BEAST_EXPECT(ownerCount(env, alice) == 2); - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAliceID, XRP(21)), token::Owner(alice)); env.close(); @@ -1968,7 +1968,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, becky) == 2); // becky offers to sell the nft. - uint256 const beckySellOfferIndex = + UInt256 const beckySellOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAliceID, XRP(22)), Txflags(tfSellNFToken)); env.close(); @@ -1984,7 +1984,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, minter) == 1); // minter offers to sell the nft. - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftAliceID, XRP(23)), Txflags(tfSellNFToken)); env.close(); @@ -2062,12 +2062,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, carol) == 1); BEAST_EXPECT(ownerCount(env, minter) == 1); - uint256 const nftID = token::getNextID(env, alice, 0u, tfTransferable); + UInt256 const nftID = token::getNextID(env, alice, 0u, tfTransferable); env(token::mint(alice), Txflags(tfTransferable)); env.close(); // Becky buys the nft for XAU(10). Check balances. - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(10)), token::Owner(alice)); env.close(); @@ -2080,7 +2080,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(becky, gwXAU) == gwXAU(990)); // becky sells nft to carol. alice's balance should not change. - uint256 const beckySellOfferIndex = + UInt256 const beckySellOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(10)), Txflags(tfSellNFToken)); env.close(); @@ -2091,7 +2091,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(carol, gwXAU) == gwXAU(990)); // minter buys nft from carol. alice's balance should not change. - uint256 const minterBuyOfferIndex = + UInt256 const minterBuyOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(10)), token::Owner(carol)); env.close(); @@ -2104,7 +2104,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // minter sells the nft to alice. gwXAU balances should finish // where they started. - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(10)), Txflags(tfSellNFToken)); env.close(); @@ -2127,12 +2127,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Set the smallest possible transfer fee. { // An nft with a transfer fee of 1 basis point. - uint256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); + UInt256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); env(token::mint(alice), Txflags(tfTransferable), token::XferFee(1)); env.close(); // Becky buys the nft for XAU(10). Check balances. - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(10)), token::Owner(alice)); env.close(); @@ -2145,7 +2145,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(becky, gwXAU) == gwXAU(990)); // becky sells nft to carol. alice's balance goes up. - uint256 const beckySellOfferIndex = + UInt256 const beckySellOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(10)), Txflags(tfSellNFToken)); env.close(); @@ -2157,7 +2157,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(carol, gwXAU) == gwXAU(990)); // minter buys nft from carol. alice's balance goes up. - uint256 const minterBuyOfferIndex = + UInt256 const minterBuyOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(10)), token::Owner(carol)); env.close(); @@ -2171,7 +2171,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // minter sells the nft to alice. Because alice is part of the // transaction no transfer fee is removed. - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(10)), Txflags(tfSellNFToken)); env.close(); @@ -2212,12 +2212,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Make an nft with a transfer fee of 50%. - uint256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, kMaxTransferFee); + UInt256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, kMaxTransferFee); env(token::mint(alice), Txflags(tfTransferable), token::XferFee(kMaxTransferFee)); env.close(); // Becky buys the nft for XAU(10). Check balances. - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(10)), token::Owner(alice)); env.close(); @@ -2230,7 +2230,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(becky, gwXAU) == gwXAU(990)); // becky sells nft to minter. alice's balance goes up. - uint256 const beckySellOfferIndex = + UInt256 const beckySellOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, gwXAU(100)), Txflags(tfSellNFToken)); env.close(); @@ -2242,7 +2242,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(minter, gwXAU) == gwXAU(900)); // carol buys nft from minter. alice's balance goes up. - uint256 const carolBuyOfferIndex = + UInt256 const carolBuyOfferIndex = keylet::nftokenOffer(carol, SeqProxy::rawSequence(env.seq(carol))).key; env(token::createOffer(carol, nftID, gwXAU(10)), token::Owner(minter)); env.close(); @@ -2256,7 +2256,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // carol sells the nft to alice. Because alice is part of the // transaction no transfer fee is removed. - uint256 const carolSellOfferIndex = + UInt256 const carolSellOfferIndex = keylet::nftokenOffer(carol, SeqProxy::rawSequence(env.seq(carol))).key; env(token::createOffer(carol, nftID, gwXAU(10)), Txflags(tfSellNFToken)); env.close(); @@ -2290,7 +2290,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // of drops. { // An nft with a transfer fee of 1 basis point. - uint256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); + UInt256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); env(token::mint(alice), Txflags(tfTransferable), token::XferFee(1)); env.close(); @@ -2298,7 +2298,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice there should be no transfer fee. STAmount aliceBalance = env.balance(alice); STAmount minterBalance = env.balance(minter); - uint256 const minterBuyOfferIndex = + UInt256 const minterBuyOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(1)), token::Owner(alice)); env.close(); @@ -2313,7 +2313,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice does not get any transfer fee. auto pmt = drops(50000); STAmount carolBalance = env.balance(carol); - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, pmt), Txflags(tfSellNFToken)); env.close(); @@ -2328,7 +2328,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // carol sells to becky. This is the smallest amount to pay for a // transfer that enables a transfer fee of 1 basis point. STAmount beckyBalance = env.balance(becky); - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; pmt = drops(50001); env(token::createOffer(becky, nftID, pmt), token::Owner(carol)); @@ -2349,7 +2349,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // of an IOU. { // An nft with a transfer fee of 1 basis point. - uint256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); + UInt256 const nftID = token::getNextID(env, alice, 0u, tfTransferable, 1); env(token::mint(alice), Txflags(tfTransferable), token::XferFee(1)); env.close(); @@ -2374,7 +2374,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice there should be no transfer fee. STAmount aliceBalance = env.balance(alice, gwXAU); STAmount minterBalance = env.balance(minter, gwXAU); - uint256 const minterBuyOfferIndex = + UInt256 const minterBuyOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, tinyXAU), token::Owner(alice)); env.close(); @@ -2387,7 +2387,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // minter sells to carol. STAmount carolBalance = env.balance(carol, gwXAU); - uint256 const minterSellOfferIndex = + UInt256 const minterSellOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, tinyXAU), Txflags(tfSellNFToken)); env.close(); @@ -2406,7 +2406,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite STAmount const cheapNFT(gwXAU, STAmount::kMinValue, STAmount::kMinOffset + 5); STAmount beckyBalance = env.balance(becky, gwXAU); - uint256 const beckyBuyOfferIndex = + UInt256 const beckyBuyOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftID, cheapNFT), token::Owner(carol)); env.close(); @@ -2445,14 +2445,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // The taxon value should be recoverable from the NFT ID. { - uint256 const nftID = token::getNextID(env, alice, 0u); + UInt256 const nftID = token::getNextID(env, alice, 0u); BEAST_EXPECT(nft::getTaxon(nftID) == nft::toTaxon(0)); } // Make sure the full range of taxon values work. We just tried // the minimum. Now try the largest. { - uint256 const nftID = token::getNextID(env, alice, 0xFFFFFFFFu); + UInt256 const nftID = token::getNextID(env, alice, 0xFFFFFFFFu); BEAST_EXPECT(nft::getTaxon(nftID) == nft::toTaxon((0xFFFFFFFF))); } @@ -2463,7 +2463,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite for (int i = 0; i < 10; ++i) { // lambda to produce a useful message on error. - auto check = [this](std::uint32_t taxon, uint256 const& nftID) { + auto check = [this](std::uint32_t taxon, UInt256 const& nftID) { nft::Taxon const gotTaxon = nft::getTaxon(nftID); if (nft::toTaxon(taxon) == gotTaxon) { @@ -2478,7 +2478,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } }; - uint256 const nftAliceID = token::getID( + UInt256 const nftAliceID = token::getID( env, alice, taxon, @@ -2487,7 +2487,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite randInt()); check(taxon, nftAliceID); - uint256 const nftBeckyID = token::getID( + UInt256 const nftBeckyID = token::getID( env, becky, taxon, @@ -2630,32 +2630,32 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::setMinter(issuer, minter)); env.close(); - uint256 const nftokenID = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(minter, 0), token::Issuer(issuer), Txflags(tfTransferable)); env.close(); // Test how adding a Destination field to an offer affects permissions // for canceling offers. { - uint256 const offerMinterToIssuer = + UInt256 const offerMinterToIssuer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Destination(issuer), Txflags(tfSellNFToken)); - uint256 const offerMinterToBuyer = + UInt256 const offerMinterToBuyer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Destination(buyer), Txflags(tfSellNFToken)); - uint256 const offerIssuerToMinter = + UInt256 const offerIssuerToMinter = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftokenID, drops(1)), token::Owner(minter), token::Destination(minter)); - uint256 const offerIssuerToBuyer = + UInt256 const offerIssuerToBuyer = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftokenID, drops(1)), token::Owner(minter), @@ -2697,7 +2697,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Test how adding a Destination field to a sell offer affects // accepting that offer. { - uint256 const offerMinterSellsToBuyer = + UInt256 const offerMinterSellsToBuyer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Destination(buyer), @@ -2726,7 +2726,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Test how adding a Destination field to a buy offer affects // accepting that offer. { - uint256 const offerMinterBuysFromBuyer = + UInt256 const offerMinterBuysFromBuyer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Owner(buyer), @@ -2754,7 +2754,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // If a destination other than the NFToken owner is set, that // destination must act as a broker. The NFToken owner may not // simply accept the offer. - uint256 const offerBuyerBuysFromMinter = + UInt256 const offerBuyerBuysFromMinter = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID, drops(1)), token::Owner(minter), @@ -2778,13 +2778,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Show that a sell offer's Destination can broker that sell offer // to another account. { - uint256 const offerMinterToBroker = + UInt256 const offerMinterToBroker = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Destination(broker), Txflags(tfSellNFToken)); - uint256 const offerBuyerToMinter = + UInt256 const offerBuyerToMinter = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID, drops(1)), token::Owner(minter)); @@ -2817,17 +2817,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Destination doesn't match, but can complete if the Destination // does match. { - uint256 const offerBuyerToMinter = + UInt256 const offerBuyerToMinter = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID, drops(1)), token::Destination(minter), Txflags(tfSellNFToken)); - uint256 const offerMinterToBuyer = + UInt256 const offerMinterToBuyer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Owner(buyer)); - uint256 const offerIssuerToBuyer = + UInt256 const offerIssuerToBuyer = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftokenID, drops(1)), token::Owner(buyer)); @@ -2876,13 +2876,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Show that if a buy and a sell offer both have the same destination, // then that destination can broker the offers. { - uint256 const offerMinterToBroker = + UInt256 const offerMinterToBroker = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), token::Destination(broker), Txflags(tfSellNFToken)); - uint256 const offerBuyerToBroker = + UInt256 const offerBuyerToBroker = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID, drops(1)), token::Owner(minter), @@ -2927,7 +2927,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::setMinter(issuer, minter)); env.close(); - uint256 const nftokenID = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(minter, 0), token::Issuer(issuer), Txflags(tfTransferable)); env.close(); @@ -2953,7 +2953,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // create offer (allowed now) then cancel { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), @@ -2967,7 +2967,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // create offer, enable flag, then cancel { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), @@ -2987,7 +2987,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // create offer then transfer { - uint256 const offerIndex = + UInt256 const offerIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID, drops(1)), @@ -3061,11 +3061,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::setMinter(issuer, minter)); env.close(); - uint256 const nftokenID0 = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftokenID0 = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(minter, 0), token::Issuer(issuer), Txflags(tfTransferable)); env.close(); - uint256 const nftokenID1 = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftokenID1 = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(minter, 0), token::Issuer(issuer), Txflags(tfTransferable)); env.close(); uint8_t issuerCount = 0, minterCount = 0, buyerCount = 0; @@ -3075,26 +3075,26 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const offerMinterToIssuer = + UInt256 const offerMinterToIssuer = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), token::Destination(issuer), token::Expiration(expiration), Txflags(tfSellNFToken)); - uint256 const offerMinterToAnyone = + UInt256 const offerMinterToAnyone = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); - uint256 const offerIssuerToMinter = + UInt256 const offerIssuerToMinter = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftokenID0, drops(1)), token::Owner(minter), token::Expiration(expiration)); - uint256 const offerBuyerToMinter = + UInt256 const offerBuyerToMinter = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, drops(1)), token::Owner(minter), @@ -3155,14 +3155,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const offer0 = + UInt256 const offer0 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); minterCount++; - uint256 const offer1 = + UInt256 const offer1 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID1, drops(1)), token::Expiration(expiration), @@ -3228,7 +3228,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Transfer nftokenID0 back to minter so we start the next test in // a simple place. - uint256 const offerSellBack = + UInt256 const offerSellBack = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, XRP(0)), Txflags(tfSellNFToken), @@ -3248,14 +3248,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const offer0 = + UInt256 const offer0 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, drops(1)), token::Owner(minter), token::Expiration(expiration)); buyerCount++; - uint256 const offer1 = + UInt256 const offer1 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID1, drops(1)), token::Owner(minter), @@ -3319,7 +3319,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Transfer nftokenID0 back to minter so we start the next test in // a simple place. - uint256 const offerSellBack = + UInt256 const offerSellBack = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, XRP(0)), Txflags(tfSellNFToken), @@ -3339,26 +3339,26 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const sellOffer0 = + UInt256 const sellOffer0 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); minterCount++; - uint256 const sellOffer1 = + UInt256 const sellOffer1 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID1, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); minterCount++; - uint256 const buyOffer0 = + UInt256 const buyOffer0 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, drops(1)), token::Owner(minter)); buyerCount++; - uint256 const buyOffer1 = + UInt256 const buyOffer1 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID1, drops(1)), token::Owner(minter)); buyerCount++; @@ -3418,7 +3418,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Transfer nftokenID0 back to minter so we start the next test in // a simple place. - uint256 const offerSellBack = + UInt256 const offerSellBack = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, XRP(0)), Txflags(tfSellNFToken), @@ -3438,21 +3438,21 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const sellOffer0 = + UInt256 const sellOffer0 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), Txflags(tfSellNFToken)); - uint256 const sellOffer1 = + UInt256 const sellOffer1 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID1, drops(1)), Txflags(tfSellNFToken)); - uint256 const buyOffer0 = + UInt256 const buyOffer0 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, drops(1)), token::Expiration(expiration), token::Owner(minter)); - uint256 const buyOffer1 = + UInt256 const buyOffer1 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID1, drops(1)), token::Expiration(expiration), @@ -3504,7 +3504,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Transfer nftokenID0 back to minter so we start the next test in // a simple place. - uint256 const offerSellBack = + UInt256 const offerSellBack = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, XRP(0)), Txflags(tfSellNFToken), @@ -3524,25 +3524,25 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { std::uint32_t const expiration = lastClose(env) + 25; - uint256 const sellOffer0 = + UInt256 const sellOffer0 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID0, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); - uint256 const sellOffer1 = + UInt256 const sellOffer1 = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftokenID1, drops(1)), token::Expiration(expiration), Txflags(tfSellNFToken)); - uint256 const buyOffer0 = + UInt256 const buyOffer0 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, drops(1)), token::Expiration(expiration), token::Owner(minter)); - uint256 const buyOffer1 = + UInt256 const buyOffer1 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID1, drops(1)), token::Expiration(expiration), @@ -3585,7 +3585,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Transfer nftokenID0 back to minter so we start the next test in // a simple place. - uint256 const offerSellBack = + UInt256 const offerSellBack = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftokenID0, XRP(0)), Txflags(tfSellNFToken), @@ -3619,12 +3619,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::setMinter(alice, minter)); env.close(); - uint256 const nftokenID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0), Txflags(tfTransferable)); env.close(); // Anyone can cancel an expired offer. - uint256 const expiredOfferIndex = + UInt256 const expiredOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftokenID, XRP(1000)), @@ -3647,7 +3647,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Create a couple of offers with a destination. Those offers // should be cancellable by the creator and the destination. - uint256 const dest1OfferIndex = + UInt256 const dest1OfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftokenID, XRP(1000)), @@ -3666,7 +3666,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, alice) == 1); // alice can cancel her own offer, even if becky is the destination. - uint256 const dest2OfferIndex = + UInt256 const dest2OfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftokenID, XRP(1000)), @@ -3682,11 +3682,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // The issuer has no special permissions regarding offer cancellation. // Minter creates a token with alice as issuer. alice cannot cancel // minter's offer. - uint256 const mintersNFTokenID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const mintersNFTokenID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(minter, 0), token::Issuer(alice), Txflags(tfTransferable)); env.close(); - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, mintersNFTokenID, XRP(1000)), Txflags(tfSellNFToken)); @@ -3732,7 +3732,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); std::string const uri(kMaxTokenUriLength, '?'); - std::vector offerIndexes; + std::vector offerIndexes; offerIndexes.reserve(kMaxTokenOfferCancelCount + 1); for (uint32_t i = 0; i < kMaxTokenOfferCancelCount + 1; ++i) { @@ -3741,7 +3741,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.fund(XRP(1000), nftAcct, offerAcct); env.close(); - uint256 const nftokenID = token::getNextID(env, nftAcct, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, nftAcct, 0, tfTransferable); env(token::mint(nftAcct, 0), token::Uri(uri), Txflags(tfTransferable)); env.close(); @@ -3757,7 +3757,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // All offers should be in the ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(env.le(keylet::nftokenOffer(offerIndex))); } @@ -3777,7 +3777,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // But alice adds a sell offer to the list... { - uint256 const nftokenID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftokenID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0), token::Uri(uri), Txflags(tfTransferable)); env.close(); @@ -3810,7 +3810,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Verify that remaining offers are gone from the ledger. - for (uint256 const& offerIndex : offerIndexes) + for (UInt256 const& offerIndex : offerIndexes) { BEAST_EXPECT(!env.le(keylet::nftokenOffer(offerIndex))); } @@ -3873,7 +3873,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Lambda that mints an NFT and returns the nftID. auto mintNFT = [&env, &issuer, &minter](std::uint16_t xferFee = 0) { - uint256 const nftID = token::getNextID(env, issuer, 0, tfTransferable, xferFee); + UInt256 const nftID = token::getNextID(env, issuer, 0, tfTransferable, xferFee); env(token::mint(minter, 0), token::Issuer(issuer), token::XferFee(xferFee), @@ -3890,17 +3890,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); - uint256 const nftID = mintNFT(); + UInt256 const nftID = mintNFT(); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); // buyer creates their offer. Note: a buy offer can never // offer zero. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(1)), token::Owner(minter)); env.close(); @@ -3934,17 +3934,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); - uint256 const nftID = mintNFT(); + UInt256 const nftID = mintNFT(); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); // buyer creates their offer. Note: a buy offer can never // offer zero. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(1)), token::Owner(minter)); env.close(); @@ -3985,17 +3985,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); - uint256 const nftID = mintNFT(kMaxTransferFee); + UInt256 const nftID = mintNFT(kMaxTransferFee); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); // buyer creates their offer. Note: a buy offer can never // offer zero. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(1)), token::Owner(minter)); env.close(); @@ -4029,17 +4029,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); - uint256 const nftID = mintNFT(kMaxTransferFee); + UInt256 const nftID = mintNFT(kMaxTransferFee); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, XRP(0)), Txflags(tfSellNFToken)); env.close(); // buyer creates their offer. Note: a buy offer can never // offer zero. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(1)), token::Owner(minter)); env.close(); @@ -4104,10 +4104,10 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); setXAUBalance({issuer, minter, buyer, broker}, 1000, __LINE__); - uint256 const nftID = mintNFT(); + UInt256 const nftID = mintNFT(); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(1000)), Txflags(tfSellNFToken)); env.close(); @@ -4115,7 +4115,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // buyer creates an offer for more XAU than they currently // own. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1001)), token::Owner(minter)); env.close(); @@ -4133,7 +4133,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // buyer creates an offer for less that what minter is // asking. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(999)), token::Owner(minter)); env.close(); @@ -4150,7 +4150,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } // buyer creates a large enough offer. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1000)), token::Owner(minter)); env.close(); @@ -4185,17 +4185,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); setXAUBalance({issuer, minter, buyer, broker}, 1000, __LINE__); - uint256 const nftID = mintNFT(kMaxTransferFee); + UInt256 const nftID = mintNFT(kMaxTransferFee); // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(900)), Txflags(tfSellNFToken)); env.close(); { // buyer creates an offer for more XAU than they currently // own. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1001)), token::Owner(minter)); env.close(); @@ -4213,7 +4213,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // buyer creates an offer for less that what minter is // asking. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(899)), token::Owner(minter)); env.close(); @@ -4229,7 +4229,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); } // buyer creates a large enough offer. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1000)), token::Owner(minter)); env.close(); @@ -4267,16 +4267,16 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); setXAUBalance({issuer, minter, buyer, broker}, 1000, __LINE__); - uint256 const nftID = mintNFT(kMaxTransferFee / 2); // 25% + UInt256 const nftID = mintNFT(kMaxTransferFee / 2); // 25% // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(900)), Txflags(tfSellNFToken)); env.close(); // buyer creates a large enough offer. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1000)), token::Owner(minter)); env.close(); @@ -4306,16 +4306,16 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite checkOwnerCountIsOne({issuer, minter, buyer, broker}, __LINE__); setXAUBalance({issuer, minter, buyer}, 1000, __LINE__); setXAUBalance({broker}, 500, __LINE__); - uint256 const nftID = mintNFT(kMaxTransferFee / 2); // 25% + UInt256 const nftID = mintNFT(kMaxTransferFee / 2); // 25% // minter creates their offer. - uint256 const minterOfferIndex = + UInt256 const minterOfferIndex = keylet::nftokenOffer(minter, SeqProxy::rawSequence(env.seq(minter))).key; env(token::createOffer(minter, nftID, gwXAU(900)), Txflags(tfSellNFToken)); env.close(); // buyer creates a large enough offer. - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, gwXAU(1000)), token::Owner(minter)); env.close(); @@ -4356,7 +4356,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // issuer creates an NFT. - uint256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0u), Txflags(tfTransferable)); env.close(); @@ -4366,16 +4366,16 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(nftCount(env, buyer2) == 0); // Both buyer1 and buyer2 create buy offers for nftId. - uint256 const buyer1OfferIndex = + UInt256 const buyer1OfferIndex = keylet::nftokenOffer(buyer1, SeqProxy::rawSequence(env.seq(buyer1))).key; env(token::createOffer(buyer1, nftId, XRP(100)), token::Owner(issuer)); - uint256 const buyer2OfferIndex = + UInt256 const buyer2OfferIndex = keylet::nftokenOffer(buyer2, SeqProxy::rawSequence(env.seq(buyer2))).key; env(token::createOffer(buyer2, nftId, XRP(100)), token::Owner(issuer)); env.close(); // Lambda that counts the number of buy offers for a given NFT. - auto nftBuyOfferCount = [&env](uint256 const& nftId) -> std::size_t { + auto nftBuyOfferCount = [&env](UInt256 const& nftId) -> std::size_t { // We know that in this case not very many offers will be // returned, so we skip the marker stuff. json::Value params; @@ -4450,7 +4450,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // NFTokenMint BEAST_EXPECT(ownerCount(env, issuer) == 10); - uint256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0u), Txflags(tfTransferable), ticket::Use(issuerTicketSeq++)); env.close(); BEAST_EXPECT(ownerCount(env, issuer) == 10); @@ -4458,7 +4458,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // NFTokenCreateOffer BEAST_EXPECT(ownerCount(env, buyer) == 10); - uint256 const offerIndex0 = + UInt256 const offerIndex0 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(buyerTicketSeq)).key; env(token::createOffer(buyer, nftId, XRP(1)), token::Owner(issuer), @@ -4474,7 +4474,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ticketCount(env, buyer) == 8); // NFTokenCreateOffer. buyer tries again. - uint256 const offerIndex1 = + UInt256 const offerIndex1 = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(buyerTicketSeq)).key; env(token::createOffer(buyer, nftId, XRP(2)), token::Owner(issuer), @@ -4532,7 +4532,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::setMinter(issuer, minter)); env.close(); - uint256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(minter, 0u), token::Issuer(issuer), Txflags(tfTransferable)); env.close(); @@ -4552,7 +4552,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env(token::createOffer(becky, nftId, XRP(2)), token::Owner(minter)); env.close(); - uint256 const carlaOfferIndex = + UInt256 const carlaOfferIndex = keylet::nftokenOffer(carla, SeqProxy::rawSequence(env.seq(carla))).key; env(token::createOffer(carla, nftId, XRP(3)), token::Owner(minter)); env.close(); @@ -4617,7 +4617,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Create an NFT that we'll make offers for. - uint256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0), Txflags(tfTransferable)); env.close(); @@ -4818,7 +4818,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Mint a transferable NFT. - uint256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0), Txflags(tfTransferable)); env.close(); @@ -4900,40 +4900,40 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Create an NFT that we'll make XRP offers for. - uint256 const nftID0{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftID0{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0), Txflags(tfTransferable)); env.close(); // Create an NFT that we'll make IOU offers for. - uint256 const nftID1{token::getNextID(env, issuer, 1u, tfTransferable)}; + UInt256 const nftID1{token::getNextID(env, issuer, 1u, tfTransferable)}; env(token::mint(issuer, 1), Txflags(tfTransferable)); env.close(); TER const offerCreateTER = temBAD_AMOUNT; // Make offers with negative amounts for the NFTs - uint256 const sellNegXrpOfferIndex = + UInt256 const sellNegXrpOfferIndex = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftID0, XRP(-2)), Txflags(tfSellNFToken), Ter(offerCreateTER)); env.close(); - uint256 const sellNegIouOfferIndex = + UInt256 const sellNegIouOfferIndex = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftID1, gwXAU(-2)), Txflags(tfSellNFToken), Ter(offerCreateTER)); env.close(); - uint256 const buyNegXrpOfferIndex = + UInt256 const buyNegXrpOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID0, XRP(-1)), token::Owner(issuer), Ter(offerCreateTER)); env.close(); - uint256 const buyNegIouOfferIndex = + UInt256 const buyNegIouOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID1, gwXAU(-1)), token::Owner(issuer), @@ -4976,7 +4976,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.fund(XRP(1000000), issuer, buyer); // Create an NFT that we'll make offers for. - uint256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, issuer, 0u, tfTransferable)}; env(token::mint(issuer, 0), Txflags(tfTransferable)); env.close(); @@ -5085,7 +5085,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite }; auto mintNFT = [&env](Account const& minter, int transferFee = 0) { - uint256 const nftID = token::getNextID(env, minter, 0, tfTransferable, transferFee); + UInt256 const nftID = token::getNextID(env, minter, 0, tfTransferable, transferFee); env(token::mint(minter), token::XferFee(transferFee), Txflags(tfTransferable)); env.close(); return nftID; @@ -5094,10 +5094,10 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite auto createBuyOffer = [&env]( Account const& offerer, Account const& owner, - uint256 const& nftID, + UInt256 const& nftID, STAmount const& amount, std::optional const terCode = {}) { - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(offerer, SeqProxy::rawSequence(env.seq(offerer))).key; env(token::createOffer(offerer, nftID, amount), token::Owner(owner), @@ -5108,10 +5108,10 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite auto createSellOffer = [&env]( Account const& offerer, - uint256 const& nftID, + UInt256 const& nftID, STAmount const& amount, std::optional const terCode = {}) { - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(offerer, SeqProxy::rawSequence(env.seq(offerer))).key; env(token::createOffer(offerer, nftID, amount), Txflags(tfSellNFToken), @@ -5619,17 +5619,17 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // 7. Now that bob has both a buy and a sell offer for the same NFT, // a broker can sell the NFT that bob owns to bob and pocket the // difference. - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); // Bob creates a buy offer for 5 XRP. Alice creates a sell offer // for 0 XRP. - uint256 const bobBuyOfferIndex = + UInt256 const bobBuyOfferIndex = keylet::nftokenOffer(bob, SeqProxy::rawSequence(env.seq(bob))).key; env(token::createOffer(bob, nftId, XRP(5)), token::Owner(alice)); - uint256 const aliceSellOfferIndex = + UInt256 const aliceSellOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, XRP(0)), token::Destination(bob), @@ -5644,7 +5644,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(env.le(keylet::nftokenOffer(bobBuyOfferIndex))); // Bob creates a sell offer for the gift NFT from alice. - uint256 const bobSellOfferIndex = + UInt256 const bobSellOfferIndex = keylet::nftokenOffer(bob, SeqProxy::rawSequence(env.seq(bob))).key; env(token::createOffer(bob, nftId, XRP(4)), Txflags(tfSellNFToken)); env.close(); @@ -5717,7 +5717,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // alice mint and burn a NFT - uint256 const prevNFTokenID = token::getNextID(env, alice, 0u); + UInt256 const prevNFTokenID = token::getNextID(env, alice, 0u); env(token::mint(alice)); env.close(); env(token::burn(alice, prevNFTokenID)); @@ -5750,7 +5750,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT((*env.le(alice))[sfMintedNFTokens] == 0); // alice mints a NFT with same params as prevNFTokenID - uint256 const remintNFTokenID = token::getNextID(env, alice, 0u); + UInt256 const remintNFTokenID = token::getNextID(env, alice, 0u); env(token::mint(alice)); env.close(); @@ -5778,11 +5778,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // minter mints 500 NFTs for alice - std::vector nftIDs; + std::vector nftIDs; nftIDs.reserve(500); for (int i = 0; i < 500; i++) { - uint256 const nftokenID = token::getNextID(env, alice, 0u); + UInt256 const nftokenID = token::getNextID(env, alice, 0u); nftIDs.push_back(nftokenID); env(token::mint(minter), token::Issuer(alice)); } @@ -5842,7 +5842,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice mints a NFT with same params as the first one before // the account delete. - uint256 const remintNFTokenID = token::getNextID(env, alice, 0u); + UInt256 const remintNFTokenID = token::getNextID(env, alice, 0u); env(token::mint(alice)); env.close(); @@ -5876,7 +5876,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, alice) == 100); // alice mints 50 NFTs using tickets - std::vector nftIDs; + std::vector nftIDs; nftIDs.reserve(50); for (int i = 0; i < 50; i++) { @@ -5941,7 +5941,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // alice mints a NFT with same params as the first one before // the account delete. - uint256 const remintNFTokenID = token::getNextID(env, alice, 0u); + UInt256 const remintNFTokenID = token::getNextID(env, alice, 0u); env(token::mint(alice)); env.close(); @@ -5979,11 +5979,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite BEAST_EXPECT(ownerCount(env, minter) == 100); // minter mints 50 NFTs for alice using tickets - std::vector nftIDs; + std::vector nftIDs; nftIDs.reserve(50); for (int i = 0; i < 50; i++) { - uint256 const nftokenID = token::getNextID(env, alice, 0u); + UInt256 const nftokenID = token::getNextID(env, alice, 0u); nftIDs.push_back(nftokenID); env(token::mint(minter), token::Issuer(alice), ticket::Use(minterTicketSeq++)); } @@ -6044,7 +6044,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // The new NFT minted will not have the same ID // as any of the NFTs authorized minter minted using tickets - uint256 const remintNFTokenID = token::getNextID(env, alice, 0u); + UInt256 const remintNFTokenID = token::getNextID(env, alice, 0u); env(token::mint(alice)); env.close(); @@ -6262,7 +6262,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite token::Amount(XRP(10)), token::Destination(buyer), token::Expiration(lastClose(env) + 25)); - uint256 const offerAliceSellsToBuyer = + UInt256 const offerAliceSellsToBuyer = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::cancelOffer(alice, {offerAliceSellsToBuyer})); env.close(); @@ -6272,7 +6272,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite token::Amount(XRP(10)), token::Destination(alice), token::Expiration(lastClose(env) + 25)); - uint256 const offerBuyerSellsToAlice = + UInt256 const offerBuyerSellsToAlice = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::cancelOffer(alice, {offerBuyerSellsToAlice})); env.close(); @@ -6422,14 +6422,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Verify `nftoken_id` value equals to the NFTokenID that was // changed in the most recent NFTokenMint or NFTokenAcceptOffer // transaction - auto verifyNFTokenID = [&](uint256 const& actualNftID) { + auto verifyNFTokenID = [&](UInt256 const& actualNftID) { verifyMetaInAllResponses([&](json::Value const& meta) { // Expect nftoken_id field if (!BEAST_EXPECT(meta.isMember(jss::nftoken_id))) return; // Check the value of NFT ID matches - uint256 nftID; + UInt256 nftID; BEAST_EXPECT(nftID.parseHex(meta[jss::nftoken_id].asString())); BEAST_EXPECT(nftID == actualNftID); }); @@ -6437,7 +6437,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Verify `nftoken_ids` value equals to the NFTokenIDs that were // changed in the most recent NFTokenCancelOffer transaction - auto verifyNFTokenIDsInCancelOffer = [&](std::vector actualNftIDs) { + auto verifyNFTokenIDsInCancelOffer = [&](std::vector actualNftIDs) { // Sort to prepare for comparison std::ranges::sort(actualNftIDs); @@ -6446,14 +6446,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite if (!BEAST_EXPECT(meta.isMember(jss::nftoken_ids))) return; - // Convert NFT IDs from json::Value to uint256 - std::vector metaIDs; + // Convert NFT IDs from json::Value to UInt256 + std::vector metaIDs; std::transform( meta[jss::nftoken_ids].begin(), meta[jss::nftoken_ids].end(), std::back_inserter(metaIDs), [this](json::Value id) { - uint256 nftID; + UInt256 nftID; BEAST_EXPECT(nftID.parseHex(id.asString())); return nftID; }); @@ -6473,13 +6473,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Verify `offer_id` value equals to the offerID that was // changed in the most recent NFTokenCreateOffer tx - auto verifyNFTokenOfferID = [&](uint256 const& offerID) { + auto verifyNFTokenOfferID = [&](UInt256 const& offerID) { verifyMetaInAllResponses([&](json::Value const& meta) { // Expect offer_id field and verify the value if (!BEAST_EXPECT(meta.isMember(jss::offer_id))) return; - uint256 metaOfferID; + UInt256 metaOfferID; BEAST_EXPECT(metaOfferID.parseHex(meta[jss::offer_id].asString())); BEAST_EXPECT(metaOfferID == offerID); }); @@ -6489,12 +6489,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // Alice mints 2 NFTs // Verify the NFTokenIDs are correct in the NFTokenMint tx meta - uint256 const nftId1{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId1{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); verifyNFTokenID(nftId1); - uint256 const nftId2{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId2{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); verifyNFTokenID(nftId2); @@ -6502,13 +6502,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Alice creates one sell offer for each NFT // Verify the offer indexes are correct in the NFTokenCreateOffer tx // meta - uint256 const aliceOfferIndex1 = + UInt256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId1, drops(1)), Txflags(tfSellNFToken)); env.close(); verifyNFTokenOfferID(aliceOfferIndex1); - uint256 const aliceOfferIndex2 = + UInt256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId2, drops(1)), Txflags(tfSellNFToken)); env.close(); @@ -6539,13 +6539,13 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Check `nftoken_ids` in brokered mode { // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); verifyNFTokenID(nftId); // Alice creates sell offer and set broker as destination - uint256 const offerAliceToBroker = + UInt256 const offerAliceToBroker = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), token::Destination(broker), @@ -6554,7 +6554,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite verifyNFTokenOfferID(offerAliceToBroker); // Bob creates buy offer - uint256 const offerBobToBroker = + UInt256 const offerBobToBroker = keylet::nftokenOffer(bob, SeqProxy::rawSequence(env.seq(bob))).key; env(token::createOffer(bob, nftId, drops(1)), token::Owner(alice)); env.close(); @@ -6570,19 +6570,19 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // multiple offers are cancelled for the same NFT { // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); verifyNFTokenID(nftId); // Alice creates 2 sell offers for the same NFT - uint256 const aliceOfferIndex1 = + UInt256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken)); env.close(); verifyNFTokenOfferID(aliceOfferIndex1); - uint256 const aliceOfferIndex2 = + UInt256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken)); env.close(); @@ -6597,7 +6597,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite if (features[featureNFTokenMintOffer]) { - uint256 const aliceMintWithOfferIndex1 = + UInt256 const aliceMintWithOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::mint(alice), token::Amount(XRP(0))); env.close(); @@ -6614,14 +6614,14 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // Lambda that mints an NFT and then creates a sell offer auto mintAndCreateSellOffer = - [](test::jtx::Env& env, test::jtx::Account const& acct, STAmount const amt) -> uint256 { + [](test::jtx::Env& env, test::jtx::Account const& acct, STAmount const amt) -> UInt256 { // acct mints a NFT - uint256 const nftId{token::getNextID(env, acct, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, acct, 0u, tfTransferable)}; env(token::mint(acct, 0u), Txflags(tfTransferable)); env.close(); // acct makes an sell offer - uint256 const sellOfferIndex = + UInt256 const sellOfferIndex = keylet::nftokenOffer(acct, SeqProxy::rawSequence(env.seq(acct))).key; env(token::createOffer(acct, nftId, amt), Txflags(tfSellNFToken)); env.close(); @@ -6786,7 +6786,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); @@ -6831,12 +6831,12 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); // Alice creates sell offer and set broker as destination - uint256 const offerAliceToBroker = + UInt256 const offerAliceToBroker = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, XRP(1)), token::Destination(broker), @@ -6844,7 +6844,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Bob creates buy offer - uint256 const offerBobToBroker = + UInt256 const offerBobToBroker = keylet::nftokenOffer(bob, SeqProxy::rawSequence(env.seq(bob))).key; env(token::createOffer(bob, nftId, XRP(1)), token::Owner(alice)); env.close(); @@ -6925,25 +6925,25 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // issuer creates two NFTs: one with and one without AutoTrustLine. std::uint16_t const xferFee = 5000; // 5% - uint256 const nftAutoTrustID{ + UInt256 const nftAutoTrustID{ token::getNextID(env, issuer, 0u, tfTransferable | tfTrustLine, xferFee)}; env(token::mint(issuer, 0u), token::XferFee(xferFee), Txflags(tfTransferable | tfTrustLine)); env.close(); - uint256 const nftNoAutoTrustID{ + UInt256 const nftNoAutoTrustID{ token::getNextID(env, issuer, 0u, tfTransferable, xferFee)}; env(token::mint(issuer, 0u), token::XferFee(xferFee), Txflags(tfTransferable)); env.close(); // becky buys the nfts for 1 drop each. { - uint256 const beckyBuyOfferIndex1 = + UInt256 const beckyBuyOfferIndex1 = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, drops(1)), token::Owner(issuer)); - uint256 const beckyBuyOfferIndex2 = + UInt256 const beckyBuyOfferIndex2 = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, drops(1)), token::Owner(issuer)); @@ -6954,7 +6954,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } // becky creates offers to sell the nfts for AUD. - uint256 const beckyAutoTrustOfferIndex = + UInt256 const beckyAutoTrustOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, gwAUD(100)), Txflags(tfSellNFToken)); env.close(); @@ -6973,7 +6973,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); BEAST_EXPECT(ownerCount(env, issuer) == 1); - uint256 const beckyNoAutoTrustOfferIndex = + UInt256 const beckyNoAutoTrustOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, gwAUD(100)), Txflags(tfSellNFToken)); env.close(); @@ -7085,24 +7085,24 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // issuer creates two NFTs: one with and one without AutoTrustLine. std::uint16_t const xferFee = 5000; // 5% - uint256 const nftAutoTrustID{ + UInt256 const nftAutoTrustID{ token::getNextID(env, issuer, 0u, tfTransferable | tfTrustLine, xferFee)}; env(token::mint(issuer, 0u), token::XferFee(xferFee), Txflags(tfTransferable | tfTrustLine)); env.close(); - uint256 const nftNoAutoTrustID{token::getNextID(env, issuer, 0u, tfTransferable, xferFee)}; + UInt256 const nftNoAutoTrustID{token::getNextID(env, issuer, 0u, tfTransferable, xferFee)}; env(token::mint(issuer, 0u), token::XferFee(xferFee), Txflags(tfTransferable)); env.close(); // becky buys the nfts for 1 drop each. { - uint256 const beckyBuyOfferIndex1 = + UInt256 const beckyBuyOfferIndex1 = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, drops(1)), token::Owner(issuer)); - uint256 const beckyBuyOfferIndex2 = + UInt256 const beckyBuyOfferIndex2 = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, drops(1)), token::Owner(issuer)); @@ -7130,7 +7130,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite // However if the NFToken has the tfTrustLine flag set, // then becky can create the offer. - uint256 const beckyAutoTrustOfferIndex = + UInt256 const beckyAutoTrustOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, isISU(100)), Txflags(tfSellNFToken)); env.close(); @@ -7148,11 +7148,11 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // With featureNFTokenMintOffer things go better. // becky creates offers to sell the nfts for ISU. - uint256 const beckyNoAutoTrustOfferIndex = + UInt256 const beckyNoAutoTrustOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftNoAutoTrustID, isISU(100)), Txflags(tfSellNFToken)); env.close(); - uint256 const beckyAutoTrustOfferIndex = + UInt256 const beckyAutoTrustOfferIndex = keylet::nftokenOffer(becky, SeqProxy::rawSequence(env.seq(becky))).key; env(token::createOffer(becky, nftAutoTrustID, isISU(100)), Txflags(tfSellNFToken)); env.close(); @@ -7207,7 +7207,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // Modify a nftoken - uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; if (modifyEnabled) { env(token::mint(issuer, 0u), Txflags(tfMutable)); @@ -7232,7 +7232,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.fund(XRP(10000), issuer); env.close(); - uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; env(token::mint(issuer, 0u), Txflags(tfMutable)); env.close(); @@ -7264,7 +7264,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite { // NFToken not exists - uint256 const nftIDNotExists{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftIDNotExists{token::getNextID(env, issuer, 0u, tfMutable)}; env.close(); env(token::modify(issuer, nftIDNotExists), Ter(tecNO_ENTRY)); @@ -7272,7 +7272,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } { // Invalid NFToken flag - uint256 const nftIDNotModifiable{token::getNextID(env, issuer, 0u)}; + UInt256 const nftIDNotModifiable{token::getNextID(env, issuer, 0u)}; env(token::mint(issuer, 0u)); env.close(); @@ -7281,7 +7281,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } { // Unauthorized account - uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; env(token::mint(issuer, 0u), Txflags(tfMutable)); env.close(); @@ -7301,7 +7301,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // modify with tfFullyCanonicalSig should success - uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; env(token::mint(issuer, 0u), Txflags(tfMutable), token::Uri("uri")); env.close(); @@ -7364,7 +7364,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite } }; - uint256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; + UInt256 const nftId{token::getNextID(env, issuer, 0u, tfMutable)}; env.close(); env(token::mint(issuer, 0u), Txflags(tfMutable), token::Uri("uri")); @@ -7387,7 +7387,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite checkURI(issuer, "uri", __LINE__); // Account != Owner - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftId, XRP(0)), Txflags(tfSellNFToken)); env.close(); @@ -7455,7 +7455,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.fund(XRP(1000), alice, gw); env.close(); - uint256 const nftID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); @@ -7492,16 +7492,16 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.fund(XRP(1000), alice, buyer, broker, gw); env.close(); - uint256 const nftID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const nftID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0u), Txflags(tfTransferable)); env.close(); - uint256 const sellOfferIndex = + UInt256 const sellOfferIndex = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftID, XRP(10)), Txflags(tfSellNFToken)); env.close(); - uint256 const buyOfferIndex = + UInt256 const buyOfferIndex = keylet::nftokenOffer(buyer, SeqProxy::rawSequence(env.seq(buyer))).key; env(token::createOffer(buyer, nftID, XRP(40)), token::Owner(alice)); env.close(); @@ -7539,7 +7539,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::Suite env.close(); // issuer mints a transferable NFToken. - uint256 const nftID = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftID = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(issuer, 0u), Txflags(tfTransferable)); env.close(); diff --git a/src/test/app/OfferMPT_test.cpp b/src/test/app/OfferMPT_test.cpp index 962e3da22d..dec8f4d88c 100644 --- a/src/test/app/OfferMPT_test.cpp +++ b/src/test/app/OfferMPT_test.cpp @@ -162,7 +162,7 @@ public: auto const offer1Seq = env.seq(alice); - env(offer(alice, XRP(500), usd(100)), Require(offers(alice, 1))); + env(offer(alice, XRP(500), usd(100)), Require(Offers(alice, 1))); env.close(); BEAST_EXPECT(isOffer(env, alice, XRP(500), usd(100))); @@ -172,7 +172,7 @@ public: env(offer(alice, XRP(300), usd(100)), Json(jss::OfferSequence, offer1Seq), - Require(offers(alice, 1))); + Require(Offers(alice, 1))); env.close(); BEAST_EXPECT( @@ -183,7 +183,7 @@ public: env(offer(alice, XRP(400), usd(200)), Json(jss::OfferSequence, offer1Seq), - Require(offers(alice, 2))); + Require(Offers(alice, 2))); env.close(); BEAST_EXPECT( @@ -191,7 +191,7 @@ public: // Test cancellation now with OfferCancel tx auto const offer4Seq = env.seq(alice); - env(offer(alice, XRP(222), usd(111)), Require(offers(alice, 3))); + env(offer(alice, XRP(222), usd(111)), Require(Offers(alice, 3))); env.close(); BEAST_EXPECT(isOffer(env, alice, XRP(222), usd(111))); @@ -203,7 +203,7 @@ public: // Create an offer that both fails with a tecEXPIRED code and removes // an offer. Show that the attempt to remove the offer fails. - env.require(offers(alice, 2)); + env.require(Offers(alice, 2)); env(offer(alice, XRP(5), usd(2)), Json(sfExpiration.fieldName, lastClose(env)), @@ -211,7 +211,7 @@ public: Ter(TER{tecEXPIRED})); env.close(); - env.require(offers(alice, 2)); + env.require(Offers(alice, 2)); BEAST_EXPECT(isOffer(env, alice, XRP(300), usd(100))); // offer2 BEAST_EXPECT(!isOffer(env, alice, XRP(5), usd(2))); // expired } @@ -334,11 +334,11 @@ public: Sendmax(XRP(102)), Txflags(tfNoRippleDirect | tfPartialPayment)); - env.require(offers(carol, 0), offers(dan, 1)); + env.require(Offers(carol, 0), Offers(dan, 1)); // offer was correctly consumed. There is still some // liquidity left on that offer. - env.require(Balance(erin, usd(99'999)), offers(erin, 1)); + env.require(Balance(erin, usd(99'999)), Offers(erin, 1)); } void @@ -377,7 +377,7 @@ public: // offer at a lower quality env(offer(bob, drops(2), usd(1'000), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); // alice places an offer that crosses carol's; depending on // "crossBothOffers" it may cross bob's as well @@ -386,19 +386,19 @@ public: env.close(); env.require( - offers(carol, 0), + Offers(carol, 0), Balance( carol, initialCarolUSD)); // offer is removed but not taken if (crossBothOffers) { env.require( - offers(alice, 0), Balance(alice, usd(1'000))); // alice's offer is crossed + Offers(alice, 0), Balance(alice, usd(1'000))); // alice's offer is crossed } else { env.require( - offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed + Offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed } } @@ -420,7 +420,7 @@ public: env.close(); env(offer(bob, drops(2), usd(2'000), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); std::uint32_t const flags = partialPayment ? (tfNoRippleDirect | tfPartialPayment) : tfNoRippleDirect; @@ -436,7 +436,7 @@ public: if (expectedTer == tesSUCCESS) { - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Balance(carol, initialCarolUSD)); // offer is removed but not taken } @@ -519,7 +519,7 @@ public: // offer at a lower quality env(offer(bob, eur(10), usd(5'000), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); // alice places an offer that crosses carol's; depending on // "crossBothOffers" it may cross bob's as well @@ -530,22 +530,22 @@ public: // carol's offer can be partially crossed when EUR is IOU: // 10e-3EUR/1USD - using tEUR = std::decay_t; - static constexpr bool kIsEuriou = std::is_same_v; + using TEur = std::decay_t; + static constexpr bool kIsEuriou = std::is_same_v; // partially crossed if IOU, removed but not taken if MPT auto const balanceCarolUSD = kIsEuriou ? usd(0) : initialCarolUSD; - env.require(offers(carol, 0), Balance(carol, balanceCarolUSD)); + env.require(Offers(carol, 0), Balance(carol, balanceCarolUSD)); if (crossBothOffers) { env.require( - offers(alice, 0), Balance(alice, usd(1'000))); // alice's offer is crossed + Offers(alice, 0), Balance(alice, usd(1'000))); // alice's offer is crossed } else { // partially crossed if IOU, not crossed if MPT auto const balanceAliceUSD = kIsEuriou ? usd(1) : usd(0); - env.require(offers(alice, 1), Balance(alice, balanceAliceUSD)); + env.require(Offers(alice, 1), Balance(alice, balanceAliceUSD)); } } @@ -580,7 +580,7 @@ public: env.close(); env(offer(bob, eur(20), usd(4'000), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); std::uint32_t const flags = partialPayment ? (tfNoRippleDirect | tfPartialPayment) : tfNoRippleDirect; @@ -598,11 +598,11 @@ public: { // carol's offer can be partially crossed when EUR is IOU: // 10e-3EUR/1USD - using tEUR = std::decay_t; - static constexpr bool kIsEuriou = std::is_same_v; + using TEur = std::decay_t; + static constexpr bool kIsEuriou = std::is_same_v; // partially crossed if IOU, removed but not taken if MPT auto const balanceCarolUSD = kIsEuriou ? usd(0) : initialCarolUSD; - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Balance(carol, balanceCarolUSD)); } else @@ -665,7 +665,7 @@ public: BEAST_EXPECT(env.le(issuerOffer) == nullptr); BEAST_EXPECT(env.le(carolOffer) == nullptr); - env.require(offers(issuer, 0), offers(carol, 0), offers(bob, 0)); + env.require(Offers(issuer, 0), Offers(carol, 0), Offers(bob, 0)); BEAST_EXPECT(env.balance(issuer, musd) == musd(-100)); BEAST_EXPECT(env.balance(carol, musd) == musd(0)); BEAST_EXPECT(env.balance(bob, musd) == musd(100)); @@ -865,7 +865,7 @@ public: BEAST_EXPECT(env.le(aliceOffer) == nullptr); BEAST_EXPECT(env.le(carolOffer) == nullptr); - env.require(offers(alice, 0), offers(carol, 0), offers(bob, 0)); + env.require(Offers(alice, 0), Offers(carol, 0), Offers(bob, 0)); // alice's offer was removed, not consumed: her balances are // unchanged and none of her funded 999'999 drops leaked to bob. @@ -995,7 +995,7 @@ public: offersOnAccount(jtx::Env& env, jtx::Account account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) result.push_back(sle); }); @@ -1035,12 +1035,12 @@ public: // The offer expires (it's not removed yet). env.close(); - env.require(Owners(bob, 1), offers(bob, 1)); + env.require(Owners(bob, 1), Offers(bob, 1)); // bob creates the offer that will be crossed. env(offer(bob, usd(500), XRP(500)), Ter(tesSUCCESS)); env.close(); - env.require(Owners(bob, 2), offers(bob, 2)); + env.require(Owners(bob, 2), Offers(bob, 2)); musd.authorize({.account = alice}); env(pay(gw, alice, usd(1'000)), Ter(tesSUCCESS)); @@ -1052,11 +1052,11 @@ public: Balance(alice, startBalance - (f * 2)), Balance(alice, usd(1'000)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - (f * 2)), Balance(bob, usd(kNone)), Owners(bob, 1), - offers(bob, 1)); + Offers(bob, 1)); // Order that can be filled env(offer(alice, XRP(500), usd(500)), Txflags(tfFillOrKill), Ter(tesSUCCESS)); @@ -1065,11 +1065,11 @@ public: Balance(alice, startBalance - (f * 3) + XRP(500)), Balance(alice, usd(500)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - (f * 2) - XRP(500)), Balance(bob, usd(500)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); } // Immediate or Cancel - cross as much as possible @@ -1096,7 +1096,7 @@ public: Balance(alice, startBalance - f - f), Balance(alice, usd(1000)), Owners(alice, 1), - offers(alice, 0)); + Offers(alice, 0)); // Partially cross: env(offer(bob, usd(50), XRP(50)), Ter(tesSUCCESS)); @@ -1106,11 +1106,11 @@ public: Balance(alice, startBalance - f - f - f + XRP(50)), Balance(alice, usd(950)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - f - XRP(50)), Balance(bob, usd(50)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); // Fully cross: env(offer(bob, usd(50), XRP(50)), Ter(tesSUCCESS)); @@ -1120,11 +1120,11 @@ public: Balance(alice, startBalance - f - f - f - f + XRP(100)), Balance(alice, usd(900)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - f - f - XRP(100)), Balance(bob, usd(100)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); } // tfPassive -- place the offer without crossing it. @@ -1155,7 +1155,7 @@ public: // bob's offer should stay in the ledger. env(offer(bob, XRP(2'000), usd(1'000), tfPassive)); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); auto const bobOffers = offersOnAccount(env, bob); BEAST_EXPECT(bobOffers.size() == 1); @@ -1169,14 +1169,14 @@ public: // It should be possible for gw to cross both of those offers. env(offer(gw, XRP(2'000), usd(1'000))); env.close(); - env.require(offers(alice, 0)); - env.require(offers(gw, 0)); - env.require(offers(bob, 1)); + env.require(Offers(alice, 0)); + env.require(Offers(gw, 0)); + env.require(Offers(bob, 1)); env(offer(gw, usd(1'000), XRP(2'000))); env.close(); - env.require(offers(bob, 0)); - env.require(offers(gw, 0)); + env.require(Offers(bob, 0)); + env.require(Offers(gw, 0)); } // tfPassive -- cross only offers of better quality. @@ -1203,7 +1203,7 @@ public: // other offer untouched. env(offer("bob", XRP(2'000), usd(10'000), tfPassive)); env.close(); - env.require(offers("alice", 1)); + env.require(Offers("alice", 1)); auto const bobOffers = offersOnAccount(env, "bob"); BEAST_EXPECT(bobOffers.size() == 1); @@ -1393,13 +1393,13 @@ public: // Alice tries an MPT to MPT order: env(pay(gw, alice, usd(1'000)), Ter(tesSUCCESS)); env(offer(alice, usd(1'000), usd(1'000)), Ter(temREDUNDANT)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Offers with negative amounts { env(offer(alice, -usd(1'000), XRP(1'000)), Ter(temBAD_AMOUNT)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Bad MPT @@ -1407,7 +1407,7 @@ public: auto const bad = MPT(badMPT()); env(offer(alice, XRP(1'000), bad(1'000)), Ter(temBAD_CURRENCY)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } } @@ -1440,7 +1440,7 @@ public: env.require( Balance(alice, startBalance - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1)); // Place an offer that should have already expired. @@ -1451,7 +1451,7 @@ public: env.require( Balance(alice, startBalance - f - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1)); env.close(); @@ -1462,7 +1462,7 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 1), + Offers(alice, 1), Owners(alice, 2)); // The offer expires (it's not removed yet) @@ -1470,7 +1470,7 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 1), + Offers(alice, 1), Owners(alice, 2)); // Add offer - the expired offer is removed @@ -1479,11 +1479,11 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1), Balance(bob, startBalance - f), Balance(bob, usd(kNone)), - offers(bob, 1), + Offers(bob, 1), Owners(bob, 1)); } @@ -1555,12 +1555,12 @@ public: env.fund(XRP(10'000), gw); auto const usd = issue1({.env = env, .token = "USD", .issuer = gw}); auto const btc = issue2({.env = env, .token = "BTC", .issuer = gw}); - using tUSD = std::decay_t; - using tBTC = std::decay_t; + using TUsd = std::decay_t; + using TBtc = std::decay_t; if (usePartner) { env.fund(XRP(10'000), partner); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { env(trust(partner, usd(100))); } @@ -1569,7 +1569,7 @@ public: MPTTester musd(env, gw, usd); musd.authorize({.account = partner}); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { env(trust(partner, btc(500))); } @@ -1584,20 +1584,20 @@ public: auto const& accountToTest = usePartner ? partner : gw; env.close(); - env.require(offers(accountToTest, 0)); + env.require(Offers(accountToTest, 0)); // PART 1: // we will make two offers that can be used to bridge BTC to USD // through XRP env(offer(accountToTest, btc(250), XRP(1'000))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that the book now shows a BTC for XRP offer BEAST_EXPECT(isOffer(env, accountToTest, btc(250), XRP(1'000))); auto const secondLegSeq = env.seq(accountToTest); env(offer(accountToTest, XRP(1'000), usd(50))); - env.require(offers(accountToTest, 2)); + env.require(Offers(accountToTest, 2)); // validate that the book also shows a XRP for USD offer BEAST_EXPECT(isOffer(env, accountToTest, XRP(1'000), usd(50))); @@ -1633,13 +1633,13 @@ public: // with the next set of offers we test. This will not be needed once // the bridging bug is fixed env(offerCancel(accountToTest, secondLegSeq)); - env.require(offers(accountToTest, 0)); + env.require(Offers(accountToTest, 0)); // PART 2: // simple direct crossing BTC to USD and then USD to BTC which // causes the first offer to be replaced env(offer(accountToTest, btc(250), usd(50))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that the book shows one BTC for USD offer and no USD for // BTC offers @@ -1652,7 +1652,7 @@ public: // this second offer would self-cross directly, so it causes the // first offer by the same owner/taker to be removed env(offer(accountToTest, usd(50), btc(250))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that we now have just the second offer...the first // was removed @@ -2180,18 +2180,18 @@ public: env.require(Balance(bob, usd(7))); env.require(Balance(bob, eur(6))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(6))); env.require(Balance(alice, eur(4))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Owners(alice, 2)); env.require(Balance(carol, usd(0))); env.require(Balance(carol, eur(kNone))); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Owners(carol, 1)); }; testHelper2TokensMix(test); @@ -2506,7 +2506,7 @@ public: env.close(); // Make sure gateway has no current offers. - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); // The gateway optionally creates an offer that would be crossed. auto const book = t.bookAmount; @@ -2539,7 +2539,7 @@ public: }(); BEAST_EXPECT(env.balance(acct, usd) == expBalanceUsd); BEAST_EXPECT(env.balance(acct, xrpIssue()) == t.fundXrp - t.spentXrp); - env.require(offers(acct, t.offers)); + env.require(Offers(acct, t.offers)); env.require(Owners(acct, t.owners)); auto acctOffers = offersOnAccount(env, acct); @@ -2607,7 +2607,7 @@ public: env(pay(gw, alice, usdOffer)); env.close(); - env.require(Balance(alice, usdOffer), offers(alice, 0), offers(bob, 0)); + env.require(Balance(alice, usdOffer), Offers(alice, 0), Offers(bob, 0)); // The scenario: // o alice has USD but wants XRP. @@ -2625,8 +2625,8 @@ public: Balance(bob, usdOffer), Balance(alice, aliceXRP + xrpOffer - fee), Balance(bob, bobsXRP - xrpOffer - fee), - offers(alice, 0), - offers(bob, 0)); + Offers(alice, 0), + Offers(bob, 0)); BEAST_EXPECT(env.balance(bob, usd) == usdOffer); @@ -2637,7 +2637,7 @@ public: env.close(); env.require(Balance(alice, usd(999))); env.require(Balance(bob, usd(1))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); BEAST_EXPECT(env.balance(bob, usd) == usd(1)); { auto const bobsOffers = offersOnAccount(env, bob); @@ -2695,7 +2695,7 @@ public: env.close(); env.require( - Balance(alice, eurOffer), Balance(bob, usdOffer), offers(alice, 0), offers(bob, 0)); + Balance(alice, eurOffer), Balance(bob, usdOffer), Offers(alice, 0), Offers(bob, 0)); // Alice's offer crossing created a default EUR trustline and // Bob's offer crossing created a default USD trustline: @@ -2711,8 +2711,8 @@ public: env(offer(alice, usd(999), eurOffer)); env.close(); - env.require(offers(alice, 0)); - env.require(offers(bob, 1)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 1)); env.require(Balance(alice, usd(999))); env.require(Balance(alice, eur(1))); @@ -2738,8 +2738,8 @@ public: env.require(Balance(alice, eur(kNone))); env.require(Balance(bob, usd(kNone))); env.require(Balance(bob, eur(1'000))); - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); // The two MPT that were generated by the offers still here // Unlike IOU, MPToken is not automatically deleted @@ -2766,8 +2766,8 @@ public: env(offer(bob, usdOffer, eurOffer)); env.close(); - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); env.require(Balance(alice, usd(0))); env.require(Balance(alice, eur(999))); @@ -2825,7 +2825,7 @@ public: Balance(bob, eur(400)), Balance(carol, usd(400)), Balance(bob, bobXrpBalance - XRP(400)), - offers(carol, 0)); + Offers(carol, 0)); BEAST_EXPECT(env.balance(bob, eur) == eur(400)); BEAST_EXPECT(env.balance(carol, usd) == usd(400)); { @@ -2857,8 +2857,8 @@ public: Balance(bob, eurOffer), Balance(carol, usdOffer), Balance(bob, bobXrpBalance - XRP(1'000)), - offers(bob, 0), - offers(carol, 0)); + Offers(bob, 0), + Offers(carol, 0)); BEAST_EXPECT(env.balance(bob, eur) == eur(1'000)); BEAST_EXPECT(env.balance(carol, usd) == usd(1'000)); @@ -3010,7 +3010,7 @@ public: for (auto const& t : tests) { // Make sure gateway has no current offers. - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); auto const acct = Account(t.account); @@ -3040,7 +3040,7 @@ public: // Check results BEAST_EXPECT(env.balance(acct, usd) == t.finalUsd); BEAST_EXPECT(env.balance(acct, xrpIssue()) == t.fundXrp - t.spentXrp); - env.require(offers(acct, t.offers)); + env.require(Offers(acct, t.offers)); env.require(Owners(acct, t.owners)); if (t.offers != 0) @@ -3094,7 +3094,7 @@ public: env(offer(alice, usd(21), XRP(2'100), tfSell | tfFillOrKill), Ter(tecKILLED)); env.close(); env.require(Balance(alice, usd(kNone))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(100))); } { @@ -3103,7 +3103,7 @@ public: env(offer(alice, usd(20), XRP(2'000), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(20))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(80))); } { @@ -3114,7 +3114,7 @@ public: env(offer(alice, usd(10), XRP(1'500), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(35))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(65))); } { @@ -3127,7 +3127,7 @@ public: env(offer(alice, usd(1), XRP(501), tfSell | tfFillOrKill), Ter(tecKILLED)); env.close(); env.require(Balance(alice, usd(35))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(65))); } { @@ -3138,7 +3138,7 @@ public: env(offer(alice, usd(1), XRP(500), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(40))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(60))); } } @@ -3206,14 +3206,14 @@ public: auto const usd = issue1({.env = env, .token = "USD", .issuer = gw1, .transferFee = 25'000}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; { auto const ann = Account("ann"); auto const bob = Account("bob"); env.fund(XRP(100) + reserve(env, 2) + (fee * 2), ann, bob); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = ann}); @@ -3243,11 +3243,11 @@ public: env.require(Balance(ann, usd(10'000))); env.require(Balance(ann, XRP(99) + reserve(env, 2))); - env.require(offers(ann, 0)); + env.require(Offers(ann, 0)); env.require(Balance(bob, usd(0))); env.require(Balance(bob, XRP(101) + reserve(env, 2))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); } { // Reverse the order, so the offer in the books is to sell XRP @@ -3258,7 +3258,7 @@ public: env.fund(XRP(100) + reserve(env, 2) + (fee * 2), che, deb); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = che}); @@ -3282,11 +3282,11 @@ public: env.require(Balance(che, usd(10'000))); env.require(Balance(che, XRP(99) + reserve(env, 2))); - env.require(offers(che, 0)); + env.require(Offers(che, 0)); env.require(Balance(deb, usd(0))); env.require(Balance(deb, XRP(101) + reserve(env, 2))); - env.require(offers(deb, 0)); + env.require(Offers(deb, 0)); } { auto const eve = Account("eve"); @@ -3295,7 +3295,7 @@ public: env.fund(XRP(20'000) + (fee * 2), eve, fyn); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = eve}); @@ -3337,7 +3337,7 @@ public: env.require(Balance(fyn, usd(9'375))); env.require(Balance(fyn, XRP(22'000))); - env.require(offers(fyn, 0)); + env.require(Offers(fyn, 0)); } // Start messing with two non-native currencies. auto const gw2 = Account("gateway2"); @@ -3347,7 +3347,7 @@ public: auto const eur = issue2({.env = env, .token = "EUR", .issuer = gw2, .transferFee = 50'000}); - using tEUR = std::decay_t; + using TEur = std::decay_t; { // Remove XRP from the equation. Give the two currencies two // different transfer rates so we can see both transfer rates @@ -3357,7 +3357,7 @@ public: env.fund(reserve(env, 3) + (fee * 3), gay, hal); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = gay}); @@ -3369,7 +3369,7 @@ public: env(trust(hal, usd(20'000))); env.close(); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto meur = MPTTester(env, gw2, eur); meur.authorize({.account = gay}); @@ -3395,12 +3395,12 @@ public: env.require(Balance(gay, usd(0))); env.require(Balance(gay, eur(100))); env.require(Balance(gay, reserve(env, 3))); - env.require(offers(gay, 0)); + env.require(Offers(gay, 0)); env.require(Balance(hal, usd(10'000))); env.require(Balance(hal, eur(0))); env.require(Balance(hal, reserve(env, 3))); - env.require(offers(hal, 0)); + env.require(Offers(hal, 0)); } { @@ -3414,7 +3414,7 @@ public: // o ova has USD but wants XRP. // o pat has XRP but wants EUR. // o qae has EUR but wants USD. - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = ova}); @@ -3428,7 +3428,7 @@ public: env(trust(qae, usd(20'000))); env.close(); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto meur = MPTTester(env, gw2, eur); meur.authorize({.account = ova}); @@ -3473,12 +3473,12 @@ public: env.require(Balance(pat, usd(0))); env.require(Balance(pat, eur(100))); env.require(Balance(pat, XRP(0) + reserve(env, 3))); - env.require(offers(pat, 0)); + env.require(Offers(pat, 0)); env.require(Balance(qae, usd(10'000))); env.require(Balance(qae, eur(0))); env.require(Balance(qae, XRP(2) + reserve(env, 3))); - env.require(offers(qae, 0)); + env.require(Offers(qae, 0)); } }; testHelper2TokensMix(test); @@ -3882,7 +3882,7 @@ public: env(offer(gw, XRP(1'000), usd(100))); env.close(); env.require(Owners(gw, 2)); - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); env.require(Balance(gw, startBalance)); gwOffers = offersOnAccount(env, gw); @@ -3912,9 +3912,9 @@ public: env.close(); auto const usd = issue1({.env = env, .token = "USD", .issuer = gw1}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; auto const eur = issue2({.env = env, .token = "EUR", .issuer = gw2}); - using tEUR = std::decay_t; + using TEur = std::decay_t; // The fee that's charged for transactions. auto const f = env.current()->fees().base; @@ -3948,7 +3948,7 @@ public: env.fund(t.fundXRP, acct); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw1, usd); musd.authorize({.account = acct}); @@ -3958,7 +3958,7 @@ public: env(trust(acct, usd(1'000))); env.close(); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto meur = MPTTester(env, gw2, eur); meur.authorize({.account = acct}); @@ -4070,7 +4070,7 @@ public: // XRP reserve. env.require(Balance(alice, XRP(250))); env.require(Owners(alice, 1)); - env.require(mptokens(alice, 1)); + env.require(MPTokens(alice, 1)); // However bob's offer should be in the ledger, since it was not // fully crossed. @@ -4127,7 +4127,7 @@ public: env.close(); env.require(Balance(cam, aBux(35))); env.require(Balance(cam, bBux(35))); - env.require(offers(cam, 1)); + env.require(Offers(cam, 1)); // This offer caused the assert. env(offer(cam, bBux(30), aBux(30))); @@ -4136,7 +4136,7 @@ public: env.require(Balance(bob, aBux(30))); env.require(Balance(cam, aBux(5))); env.require(Balance(cam, bBux(65))); - env.require(offers(cam, 0)); + env.require(Offers(cam, 0)); }; testHelper2TokensMix(test); } @@ -4349,14 +4349,14 @@ public: .token = "BTC", .issuer = gw, .transferFee = 25'000}); - using tBTC = std::decay_t; + using TBtc = std::decay_t; env.close(); auto const usd = issue2( {.env = env, .token = "USD", .issuer = gw, .transferFee = 25'000}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; env.close(); // Test cases @@ -4402,7 +4402,7 @@ public: env.fund(XRP(4'000'000), actor.acct); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto mbtc = MPTTester(env, gw, btc); mbtc.authorize({.account = actor.acct}); @@ -4412,7 +4412,7 @@ public: env(trust(actor.acct, btc(400))); env.close(); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw, usd); musd.authorize({.account = actor.acct}); @@ -4525,10 +4525,10 @@ public: auto const btc = issue1( {.env = env, .token = "BTC", .issuer = gw, .limit = 40, .transferFee = 25'000}); - using tBTC = std::decay_t; + using TBtc = std::decay_t; auto const usd = issue2( {.env = env, .token = "USD", .issuer = gw, .limit = 8'000, .transferFee = 25'000}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; env.close(); // Test cases @@ -4572,7 +4572,7 @@ public: env.fund(XRP(4'000'000), actor.acct); env.close(); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto mbtc = MPTTester(env, gw, btc); mbtc.authorize({.account = actor.acct}); @@ -4582,7 +4582,7 @@ public: env(trust(actor.acct, btc(40))); env.close(); } - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { auto musd = MPTTester(env, gw, usd); musd.authorize({.account = actor.acct}); @@ -4675,7 +4675,7 @@ public: env(offer(alice, gwUSD(40), XRP(4'000))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env.require(Balance(alice, gwUSD(0))); env(pay(gw, bob, gwUSD(50))); @@ -4687,10 +4687,10 @@ public: env(offer(bob, XRP(4'000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(40))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); env.require(Balance(bob, gwUSD(10))); } @@ -4730,7 +4730,7 @@ public: env(offer(alice, gwUSD(40), XRP(4'000)), Ter(tecNO_AUTH)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(kNone))); gwMUSD.authorize({.account = bob}); @@ -4746,7 +4746,7 @@ public: env.close(); std::uint32_t const bobOfferSeq = env.seq(bob) - 1; - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); // alice creates MPToken, which is still not authorized. alice // should still not be able to create an offer for USD/gw. @@ -4755,16 +4755,16 @@ public: env(offer(alice, gwUSD(40), XRP(4'000)), Ter(tecNO_AUTH)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(0))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Balance(bob, gwUSD(50))); // Delete bob's offer so alice can create an offer without crossing. env(offerCancel(bob, bobOfferSeq)); env.close(); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); // Finally, gw authorizes alice. Now alice's // offer should succeed. @@ -4773,16 +4773,16 @@ public: env(offer(alice, gwUSD(40), XRP(4'000))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); // Now bob creates his offer again. alice's offer should cross. env(offer(bob, XRP(4'000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(40))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); env.require(Balance(bob, gwUSD(10))); } @@ -4809,12 +4809,12 @@ public: env(offer(gw, gwUSD(40), XRP(4'000))); env.close(); std::uint32_t const gwOfferSeq = env.seq(gw) - 1; - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); // Cancel gw's offer env(offerCancel(gw, gwOfferSeq)); env.close(); - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); // Before DepositPreauth an account with lsfRequireAuth set could not // create an offer to buy their own currency. After DepositPreauth @@ -4822,7 +4822,7 @@ public: env(offer(gw, gwUSD(40), XRP(4'000))); env.close(); - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); // The rest of the test verifies DepositPreauth behavior. @@ -4839,10 +4839,10 @@ public: env(offer(alice, XRP(4'000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(10))); - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); } void @@ -4924,14 +4924,14 @@ public: // the USD issuer is not in the ledger. env(offer(alice, usd(2), XRP(2)), Ter(tecNO_ISSUER)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); BEAST_EXPECT(isOffer(env, becky, XRP(2), usd(2))); BEAST_EXPECT(isOffer(env, becky, bux(3), usd(3))); // alice crosses becky's second offer. Again, the offer create fails // because the USD issuer is not in the ledger. env(offer(alice, usd(3), bux(3)), Ter(tecNO_ISSUER)); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); BEAST_EXPECT(isOffer(env, becky, XRP(2), usd(2))); BEAST_EXPECT(isOffer(env, becky, bux(3), usd(3))); @@ -4961,7 +4961,7 @@ public: sortedOffersOnAccount(jtx::Env& env, jtx::Account const& acct) { std::vector offers{offersOnAccount(env, acct)}; - std::ranges::sort(offers, [](SLE::const_ref rhs, SLE::const_ref lhs) { + std::ranges::sort(offers, [](SLE::ConstRef rhs, SLE::ConstRef lhs) { return (*rhs)[sfSequence] < (*lhs)[sfSequence]; }); return offers; @@ -5102,7 +5102,7 @@ public: MPT const usd = MPTTester({.env = env, .issuer = gw, .holders = {alice}}); - env.require(Owners(alice, 1), tickets(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0)); env(pay(gw, alice, usd(200))); env.close(); @@ -5111,13 +5111,13 @@ public: std::uint32_t const offerSeqId0{env.seq(alice)}; env(offer(alice, XRP(50), usd(50))); env.close(); - env.require(Owners(alice, 2), tickets(alice, 0)); + env.require(Owners(alice, 2), Tickets(alice, 0)); // Create four tickets. std::uint32_t const ticketSeq{env.seq(alice) + 1}; env(ticket::create(alice, 4)); env.close(); - env.require(Owners(alice, 6), tickets(alice, 4)); + env.require(Owners(alice, 6), Tickets(alice, 4)); // Create the second (also sequence-based) offer. std::uint32_t const offerSeqId1{env.seq(alice)}; @@ -5173,7 +5173,7 @@ public: } // All of alice's tickets should now be used up. - env.require(Owners(alice, 3), tickets(alice, 0)); + env.require(Owners(alice, 3), Tickets(alice, 0)); // Use a sequence to cancel an offer created with a ticket. env(offerCancel(alice, offerTixId1)); @@ -5192,7 +5192,7 @@ public: // Verify that offerSeqId_1 was canceled. // All of alice's tickets should now be used up. - env.require(Owners(alice, 1), tickets(alice, 0), offers(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0), Offers(alice, 0)); } void @@ -5447,7 +5447,7 @@ public: env(offer(alice, xts(t.val2), xxx(t.val1)), Json(jss::Flags, tfSell)); std::map> offers; - forEachItem(*env.current(), alice, [&](SLE::const_ref sle) { + forEachItem(*env.current(), alice, [&](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) { offers.emplace( @@ -6226,7 +6226,7 @@ public: BEAST_EXPECT(currency.parseHex("3333333333333333333333333333333333333333")); BEAST_EXPECT(iouIssuer.parseHex("4444444444444444444444444444444444444444")); - uint256 const domainA = uint256::fromVoid( + UInt256 const domainA = UInt256::fromVoid( "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD" "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"); diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 500372bca3..5fb20f3fbf 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -174,7 +174,7 @@ public: auto const offer1Seq = env.seq(alice); - env(offer(alice, XRP(500), usd(100)), Require(offers(alice, 1))); + env(offer(alice, XRP(500), usd(100)), Require(Offers(alice, 1))); env.close(); BEAST_EXPECT(isOffer(env, alice, XRP(500), usd(100))); @@ -184,7 +184,7 @@ public: env(offer(alice, XRP(300), usd(100)), Json(jss::OfferSequence, offer1Seq), - Require(offers(alice, 1))); + Require(Offers(alice, 1))); env.close(); BEAST_EXPECT( @@ -195,7 +195,7 @@ public: env(offer(alice, XRP(400), usd(200)), Json(jss::OfferSequence, offer1Seq), - Require(offers(alice, 2))); + Require(Offers(alice, 2))); env.close(); BEAST_EXPECT( @@ -203,7 +203,7 @@ public: // Test cancellation now with OfferCancel tx auto const offer4Seq = env.seq(alice); - env(offer(alice, XRP(222), usd(111)), Require(offers(alice, 3))); + env(offer(alice, XRP(222), usd(111)), Require(Offers(alice, 3))); env.close(); BEAST_EXPECT(isOffer(env, alice, XRP(222), usd(111))); @@ -215,7 +215,7 @@ public: // Create an offer that both fails with a tecEXPIRED code and removes // an offer. Show that the attempt to remove the offer fails. - env.require(offers(alice, 2)); + env.require(Offers(alice, 2)); env(offer(alice, XRP(5), usd(2)), Json(sfExpiration.fieldName, lastClose(env)), @@ -223,7 +223,7 @@ public: Ter(tecEXPIRED)); env.close(); - env.require(offers(alice, 2)); + env.require(Offers(alice, 2)); BEAST_EXPECT(isOffer(env, alice, XRP(300), usd(100))); // offer2 BEAST_EXPECT(!isOffer(env, alice, XRP(5), usd(2))); // expired } @@ -328,11 +328,11 @@ public: Sendmax(XRP(102)), Txflags(tfNoRippleDirect | tfPartialPayment)); - env.require(offers(carol, 0), offers(dan, 1)); + env.require(Offers(carol, 0), Offers(dan, 1)); // offer was correctly consumed. There is still some // liquidity left on that offer. - env.require(Balance(erin, usd(0.99999)), offers(erin, 1)); + env.require(Balance(erin, usd(0.99999)), Offers(erin, 1)); } void @@ -373,7 +373,7 @@ public: // offer at a lower quality env(offer(bob, drops(2), usd(1), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); // alice places an offer that crosses carol's; depending on // "crossBothOffers" it may cross bob's as well @@ -382,18 +382,18 @@ public: env.close(); env.require( - offers(carol, 0), + Offers(carol, 0), Balance( carol, initialCarolUSD)); // offer is removed but not taken if (crossBothOffers) { - env.require(offers(alice, 0), Balance(alice, usd(1))); // alice's offer is crossed + env.require(Offers(alice, 0), Balance(alice, usd(1))); // alice's offer is crossed } else { env.require( - offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed + Offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed } } @@ -415,7 +415,7 @@ public: env.close(); env(offer(bob, drops(2), usd(2), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); std::uint32_t const flags = partialPayment ? (tfNoRippleDirect | tfPartialPayment) : tfNoRippleDirect; @@ -431,7 +431,7 @@ public: if (isTesSuccess(expectedTer)) { - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Balance(carol, initialCarolUSD)); // offer is removed but not taken } @@ -494,7 +494,7 @@ public: // offer at a lower quality env(offer(bob, eur(1), usd(5), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); // alice places an offer that crosses carol's; depending on // "crossBothOffers" it may cross bob's as well @@ -504,18 +504,18 @@ public: env.close(); env.require( - offers(carol, 0), + Offers(carol, 0), Balance( carol, initialCarolUSD)); // offer is removed but not taken if (crossBothOffers) { - env.require(offers(alice, 0), Balance(alice, usd(1))); // alice's offer is crossed + env.require(Offers(alice, 0), Balance(alice, usd(1))); // alice's offer is crossed } else { env.require( - offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed + Offers(alice, 1), Balance(alice, usd(0))); // alice's offer is not crossed } } @@ -540,7 +540,7 @@ public: env.close(); env(offer(bob, eur(2), usd(4), tfPassive)); env.close(); - env.require(offers(bob, 1), offers(carol, 1)); + env.require(Offers(bob, 1), Offers(carol, 1)); std::uint32_t const flags = partialPayment ? (tfNoRippleDirect | tfPartialPayment) : tfNoRippleDirect; @@ -556,7 +556,7 @@ public: if (isTesSuccess(expectedTer)) { - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Balance(carol, initialCarolUSD)); // offer is removed but not taken } @@ -759,7 +759,7 @@ public: offersOnAccount(jtx::Env& env, jtx::Account const& account) { std::vector result; - forEachItem(*env.current(), account, [&result](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&result](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) result.push_back(sle); }); @@ -797,14 +797,14 @@ public: // The offer expires (it's not removed yet). env.close(); - env.require(Owners(bob, 1), offers(bob, 1)); + env.require(Owners(bob, 1), Offers(bob, 1)); auto const expiredBobOffer = keylet::offer(bob, SeqProxy::rawSequence(env.seq(bob) - 1)); // bob creates the offer that will be crossed. env(offer(bob, usd(500), XRP(500)), Ter(tesSUCCESS)); env.close(); - env.require(Owners(bob, 2), offers(bob, 2)); + env.require(Owners(bob, 2), Offers(bob, 2)); auto const crossedBobOffer = keylet::offer(bob, SeqProxy::rawSequence(env.seq(bob) - 1)); @@ -820,11 +820,11 @@ public: Balance(alice, startBalance - (f * 2)), Balance(alice, usd(1000)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - (f * 2)), Balance(bob, usd(kNone)), Owners(bob, 1), - offers(bob, 1)); + Offers(bob, 1)); BEAST_EXPECT(!env.current()->exists(expiredBobOffer)); BEAST_EXPECT(env.current()->exists(crossedBobOffer)); @@ -835,11 +835,11 @@ public: Balance(alice, startBalance - (f * 3) + XRP(500)), Balance(alice, usd(500)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - (f * 2) - XRP(500)), Balance(bob, usd(500)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); } // A failed Fill-or-Kill may tentatively consume a funded offer before @@ -859,7 +859,7 @@ public: env(pay(gw, alice, usd(1000)), Ter(tesSUCCESS)); env(offer(alice, XRP(1000), usd(1000)), Txflags(tfFillOrKill), Ter(tecKILLED)); - env.require(offers(alice, 0), offers(bob, 1), Balance(alice, usd(1000))); + env.require(Offers(alice, 0), Offers(bob, 1), Balance(alice, usd(1000))); BEAST_EXPECT(env.current()->exists(bobOffer)); } @@ -888,7 +888,7 @@ public: Balance(alice, startBalance - f - f), Balance(alice, usd(1000)), Owners(alice, 1), - offers(alice, 0)); + Offers(alice, 0)); // Partially cross: env(offer(bob, usd(50), XRP(50)), Ter(tesSUCCESS)); @@ -898,11 +898,11 @@ public: Balance(alice, startBalance - f - f - f + XRP(50)), Balance(alice, usd(950)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - f - XRP(50)), Balance(bob, usd(50)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); // Fully cross: env(offer(bob, usd(50), XRP(50)), Ter(tesSUCCESS)); @@ -912,11 +912,11 @@ public: Balance(alice, startBalance - f - f - f - f + XRP(100)), Balance(alice, usd(900)), Owners(alice, 1), - offers(alice, 0), + Offers(alice, 0), Balance(bob, startBalance - f - f - XRP(100)), Balance(bob, usd(100)), Owners(bob, 1), - offers(bob, 0)); + Offers(bob, 0)); } // tfPassive -- place the offer without crossing it. @@ -948,7 +948,7 @@ public: // bob's offer should stay in the ledger. env(offer(bob, XRP(2000), usd(1000), tfPassive)); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); auto const bobOffers = offersOnAccount(env, bob); BEAST_EXPECT(bobOffers.size() == 1); @@ -962,14 +962,14 @@ public: // It should be possible for gw to cross both of those offers. env(offer(gw, XRP(2000), usd(1000))); env.close(); - env.require(offers(alice, 0)); - env.require(offers(gw, 0)); - env.require(offers(bob, 1)); + env.require(Offers(alice, 0)); + env.require(Offers(gw, 0)); + env.require(Offers(bob, 1)); env(offer(gw, usd(1000), XRP(2000))); env.close(); - env.require(offers(bob, 0)); - env.require(offers(gw, 0)); + env.require(Offers(bob, 0)); + env.require(Offers(gw, 0)); } // tfPassive -- cross only offers of better quality. @@ -997,7 +997,7 @@ public: // other offer untouched. env(offer("bob", XRP(2000), usd(1000), tfPassive)); env.close(); - env.require(offers("alice", 1)); + env.require(Offers("alice", 1)); auto const bobOffers = offersOnAccount(env, "bob"); BEAST_EXPECT(bobOffers.size() == 1); @@ -1031,34 +1031,34 @@ public: env(offer(alice, usd(1000), XRP(1000)), Txflags(tfImmediateOrCancel + 1), Ter(temINVALID_FLAG)); - env.require(Balance(alice, startBalance), Owners(alice, 0), offers(alice, 0)); + env.require(Balance(alice, startBalance), Owners(alice, 0), Offers(alice, 0)); // Order with incompatible flags env(offer(alice, usd(1000), XRP(1000)), Txflags(tfImmediateOrCancel | tfFillOrKill), Ter(temINVALID_FLAG)); - env.require(Balance(alice, startBalance), Owners(alice, 0), offers(alice, 0)); + env.require(Balance(alice, startBalance), Owners(alice, 0), Offers(alice, 0)); // Sell and buy the same asset { // Alice tries an XRP to XRP order: env(offer(alice, XRP(1000), XRP(1000)), Ter(temBAD_OFFER)); - env.require(Owners(alice, 0), offers(alice, 0)); + env.require(Owners(alice, 0), Offers(alice, 0)); // Alice tries an IOU to IOU order: env(trust(alice, usd(1000)), Ter(tesSUCCESS)); env(pay(gw, alice, usd(1000)), Ter(tesSUCCESS)); env(offer(alice, usd(1000), usd(1000)), Ter(temREDUNDANT)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Offers with negative amounts { env(offer(alice, -usd(1000), XRP(1000)), Ter(temBAD_OFFER)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); env(offer(alice, usd(1000), -XRP(1000)), Ter(temBAD_OFFER)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Offer with a bad expiration @@ -1066,7 +1066,7 @@ public: env(offer(alice, usd(1000), XRP(1000)), Json(sfExpiration.fieldName, std::uint32_t(0)), Ter(temBAD_EXPIRATION)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Offer with a bad offer sequence @@ -1074,7 +1074,7 @@ public: env(offer(alice, usd(1000), XRP(1000)), Json(jss::OfferSequence, std::uint32_t(0)), Ter(temBAD_SEQUENCE)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } // Use XRP as a currency code @@ -1082,7 +1082,7 @@ public: auto const bad = IOU(gw, badCurrency()); env(offer(alice, XRP(1000), bad(1000)), Ter(temBAD_CURRENCY)); - env.require(Owners(alice, 1), offers(alice, 0)); + env.require(Owners(alice, 1), Offers(alice, 0)); } } @@ -1115,7 +1115,7 @@ public: env.require( Balance(alice, startBalance - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1)); env(offer(alice, xrpOffer, usdOffer), @@ -1125,7 +1125,7 @@ public: env.require( Balance(alice, startBalance - f - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1)); env.close(); @@ -1136,7 +1136,7 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 1), + Offers(alice, 1), Owners(alice, 2)); // The offer expires (it's not removed yet) @@ -1144,7 +1144,7 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 1), + Offers(alice, 1), Owners(alice, 2)); // Add offer - the expired offer is removed @@ -1152,11 +1152,11 @@ public: env.require( Balance(alice, startBalance - f - f - f), Balance(alice, usdOffer), - offers(alice, 0), + Offers(alice, 0), Owners(alice, 1), Balance(bob, startBalance - f), Balance(bob, usd(kNone)), - offers(bob, 1), + Offers(bob, 1), Owners(bob, 1)); } @@ -1247,20 +1247,20 @@ public: auto const& accountToTest = usePartner ? partner : gw; env.close(); - env.require(offers(accountToTest, 0)); + env.require(Offers(accountToTest, 0)); // PART 1: // we will make two offers that can be used to bridge BTC to USD // through XRP env(offer(accountToTest, btc(250), XRP(1000))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that the book now shows a BTC for XRP offer BEAST_EXPECT(isOffer(env, accountToTest, btc(250), XRP(1000))); auto const secondLegSeq = env.seq(accountToTest); env(offer(accountToTest, XRP(1000), usd(50))); - env.require(offers(accountToTest, 2)); + env.require(Offers(accountToTest, 2)); // validate that the book also shows a XRP for USD offer BEAST_EXPECT(isOffer(env, accountToTest, XRP(1000), usd(50))); @@ -1295,13 +1295,13 @@ public: // with the next set of offers we test. This will not be needed once // the bridging bug is fixed env(offerCancel(accountToTest, secondLegSeq)); - env.require(offers(accountToTest, 0)); + env.require(Offers(accountToTest, 0)); // PART 2: // simple direct crossing BTC to USD and then USD to BTC which causes // the first offer to be replaced env(offer(accountToTest, btc(250), usd(50))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that the book shows one BTC for USD offer and no USD for // BTC offers @@ -1314,7 +1314,7 @@ public: // this second offer would self-cross directly, so it causes the first // offer by the same owner/taker to be removed env(offer(accountToTest, usd(50), btc(250))); - env.require(offers(accountToTest, 1)); + env.require(Offers(accountToTest, 1)); // validate that we now have just the second offer...the first // was removed @@ -1925,18 +1925,18 @@ public: env.require(Balance(bob, usd(7))); env.require(Balance(bob, eur(6))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Owners(bob, 3)); env.require(Balance(alice, usd(6))); env.require(Balance(alice, eur(4))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Owners(alice, 2)); env.require(Balance(carol, usd(0))); env.require(Balance(carol, eur(kNone))); - env.require(offers(carol, 0)); + env.require(Offers(carol, 0)); env.require(Owners(carol, 1)); } @@ -2311,7 +2311,7 @@ public: env.close(); // Make sure gateway has no current offers. - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); // The gateway optionally creates an offer that would be crossed. auto const book = t.bookAmount; @@ -2342,7 +2342,7 @@ public: BEAST_EXPECT(env.balance(acct, usd) == t.balanceUsd); BEAST_EXPECT(env.balance(acct, xrpIssue()) == t.fundXrp - t.spentXrp); - env.require(offers(acct, t.offers)); + env.require(Offers(acct, t.offers)); env.require(Owners(acct, t.owners)); auto acctOffers = offersOnAccount(env, acct); @@ -2413,7 +2413,7 @@ public: env(pay(gw, alice, usdOffer)); env.close(); - env.require(Balance(alice, usdOffer), offers(alice, 0), offers(bob, 0)); + env.require(Balance(alice, usdOffer), Offers(alice, 0), Offers(bob, 0)); // The scenario: // o alice has USD but wants XRP. @@ -2431,8 +2431,8 @@ public: Balance(bob, usdOffer), Balance(alice, aliceXRP + xrpOffer - fee), Balance(bob, bobXRP - xrpOffer - fee), - offers(alice, 0), - offers(bob, 0)); + Offers(alice, 0), + Offers(bob, 0)); verifyDefaultTrustline(env, bob, usdOffer); @@ -2443,7 +2443,7 @@ public: env.close(); env.require(Balance(alice, usd(999))); env.require(Balance(bob, usd(1))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); verifyDefaultTrustline(env, bob, usd(1)); { auto const bobOffers = offersOnAccount(env, bob); @@ -2504,7 +2504,7 @@ public: env.close(); env.require( - Balance(alice, eurOffer), Balance(bob, usdOffer), offers(alice, 0), offers(bob, 0)); + Balance(alice, eurOffer), Balance(bob, usdOffer), Offers(alice, 0), Offers(bob, 0)); // Alice's offer crossing created a default EUR trustline and // Bob's offer crossing created a default USD trustline: @@ -2520,8 +2520,8 @@ public: env(offer(alice, usd(999), eurOffer)); env.close(); - env.require(offers(alice, 0)); - env.require(offers(bob, 1)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 1)); env.require(Balance(alice, usd(999))); env.require(Balance(alice, eur(1))); @@ -2547,8 +2547,8 @@ public: env.require(Balance(alice, eur(kNone))); env.require(Balance(bob, usd(kNone))); env.require(Balance(bob, eur(1000))); - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); // The two trustlines that were generated by offers should be gone. BEAST_EXPECT(!env.le(keylet::trustLine(alice.id(), eur))); @@ -2562,8 +2562,8 @@ public: env(offer(bob, usdOffer, eurOffer)); env.close(); - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); env.require(Balance(alice, usd(0))); env.require(Balance(alice, eur(999))); @@ -2620,7 +2620,7 @@ public: Balance(bob, eur(400)), Balance(carol, usd(400)), Balance(bob, bobXrpBalance - XRP(400)), - offers(carol, 0)); + Offers(carol, 0)); verifyDefaultTrustline(env, bob, eur(400)); verifyDefaultTrustline(env, carol, usd(400)); { @@ -2651,8 +2651,8 @@ public: Balance(bob, eurOffer), Balance(carol, usdOffer), Balance(bob, bobXrpBalance - XRP(1000)), - offers(bob, 0), - offers(carol, 0)); + Offers(bob, 0), + Offers(carol, 0)); verifyDefaultTrustline(env, bob, eur(1000)); verifyDefaultTrustline(env, carol, usd(1000)); @@ -2802,7 +2802,7 @@ public: for (auto const& t : tests) { // Make sure gateway has no current offers. - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); auto const acct = Account(t.account); @@ -2832,7 +2832,7 @@ public: // Check results BEAST_EXPECT(env.balance(acct, usd) == t.finalUsd); BEAST_EXPECT(env.balance(acct, xrpIssue()) == t.fundXrp - t.spentXrp); - env.require(offers(acct, t.offers)); + env.require(Offers(acct, t.offers)); env.require(Owners(acct, t.owners)); if (t.offers != 0) @@ -2891,7 +2891,7 @@ public: env(offer(alice, usd(21), XRP(2100), tfSell | tfFillOrKill), Ter(killedCode)); env.close(); env.require(Balance(alice, usd(kNone))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(100))); } { @@ -2900,7 +2900,7 @@ public: env(offer(alice, usd(20), XRP(2000), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(20))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(80))); } { @@ -2911,7 +2911,7 @@ public: env(offer(alice, usd(10), XRP(1500), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(35))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(65))); } { @@ -2924,7 +2924,7 @@ public: env(offer(alice, usd(1), XRP(501), tfSell | tfFillOrKill), Ter(killedCode)); env.close(); env.require(Balance(alice, usd(35))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(65))); } { @@ -2935,7 +2935,7 @@ public: env(offer(alice, usd(1), XRP(500), tfSell | tfFillOrKill)); env.close(); env.require(Balance(alice, usd(40))); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(bob, usd(60))); } } @@ -2986,11 +2986,11 @@ public: env.require(Balance(ann, usd(100))); env.require(Balance(ann, XRP(99) + reserve(env, 2))); - env.require(offers(ann, 0)); + env.require(Offers(ann, 0)); env.require(Balance(bob, usd(0))); env.require(Balance(bob, XRP(101) + reserve(env, 2))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); } { // Reverse the order, so the offer in the books is to sell XRP @@ -3015,11 +3015,11 @@ public: env.require(Balance(che, usd(100))); env.require(Balance(che, XRP(99) + reserve(env, 2))); - env.require(offers(che, 0)); + env.require(Offers(che, 0)); env.require(Balance(deb, usd(0))); env.require(Balance(deb, XRP(101) + reserve(env, 2))); - env.require(offers(deb, 0)); + env.require(Offers(deb, 0)); } { auto const eve = Account("eve"); @@ -3061,7 +3061,7 @@ public: env.require(Balance(fyn, usd(93.75))); env.require(Balance(fyn, XRP(22000))); - env.require(offers(fyn, 0)); + env.require(Offers(fyn, 0)); } // Start messing with two non-native currencies. auto const gw2 = Account("gateway2"); @@ -3099,12 +3099,12 @@ public: env.require(Balance(gay, usd(0))); env.require(Balance(gay, eur(100))); env.require(Balance(gay, reserve(env, 3))); - env.require(offers(gay, 0)); + env.require(Offers(gay, 0)); env.require(Balance(hal, usd(100))); env.require(Balance(hal, eur(0))); env.require(Balance(hal, reserve(env, 3))); - env.require(offers(hal, 0)); + env.require(Offers(hal, 0)); } { // A trust line's QualityIn should not affect offer crossing. @@ -3134,12 +3134,12 @@ public: env.require(Balance(ivy, usd(50))); env.require(Balance(ivy, eur(100))); env.require(Balance(ivy, reserve(env, 3))); - env.require(offers(ivy, 0)); + env.require(Offers(ivy, 0)); env.require(Balance(joe, usd(200))); env.require(Balance(joe, eur(100))); env.require(Balance(joe, reserve(env, 3))); - env.require(offers(joe, 0)); + env.require(Offers(joe, 0)); } { // A trust line's QualityOut should not affect offer crossing. @@ -3239,12 +3239,12 @@ public: env.require(Balance(pat, usd(0))); env.require(Balance(pat, eur(100))); env.require(Balance(pat, XRP(0) + reserve(env, 3))); - env.require(offers(pat, 0)); + env.require(Offers(pat, 0)); env.require(Balance(qae, usd(100))); env.require(Balance(qae, eur(0))); env.require(Balance(qae, XRP(2) + reserve(env, 3))); - env.require(offers(qae, 0)); + env.require(Offers(qae, 0)); } } @@ -3304,7 +3304,7 @@ public: env(offer(gw, XRP(1000), usd(100))); env.close(); env.require(Owners(gw, 1)); - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); env.require(Balance(gw, startBalance)); gwOffers = offersOnAccount(env, gw); @@ -3468,7 +3468,7 @@ public: // XRP reserve. env.require(Balance(alice, XRP(250))); env.require(Owners(alice, 1)); - env.require(lines(alice, 1)); + env.require(Lines(alice, 1)); // However bob's offer should be in the ledger, since it was not // fully crossed. @@ -3595,7 +3595,7 @@ public: env.close(); env.require(Balance(cam, aBux(35))); env.require(Balance(cam, bBux(35))); - env.require(offers(cam, 1)); + env.require(Offers(cam, 1)); // This offer caused the assert. env(offer(cam, bBux(30), aBux(30))); @@ -3604,7 +3604,7 @@ public: env.require(Balance(bob, aBux(30))); env.require(Balance(cam, aBux(5))); env.require(Balance(cam, bBux(65))); - env.require(offers(cam, 0)); + env.require(Offers(cam, 0)); } void @@ -4187,7 +4187,7 @@ public: env(offer(alice, gwUSD(40), XRP(4000))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env.require(Balance(alice, gwUSD(0))); env(pay(gw, bob, gwUSD(50))); @@ -4199,10 +4199,10 @@ public: env(offer(bob, XRP(4000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(40))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); env.require(Balance(bob, gwUSD(10))); } @@ -4245,7 +4245,7 @@ public: env(offer(alice, gwUSD(40), XRP(4000))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env.require(Balance(alice, gwUSD(kNone))); env(fset(gw, asfRequireAuth)); env.close(); @@ -4268,10 +4268,10 @@ public: env.close(); std::uint32_t const bobOfferSeq = env.seq(bob) - 1; - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); // alice's unauthorized offer is deleted & bob's offer not crossed. env.require(Balance(alice, gwUSD(kNone))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Balance(bob, gwUSD(50))); // See if alice can create an offer without authorization. alice @@ -4280,10 +4280,10 @@ public: env(offer(alice, gwUSD(40), XRP(4000)), Ter(tecNO_LINE)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(kNone))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Balance(bob, gwUSD(50))); // Set up a trust line for alice, but don't authorize it. alice @@ -4294,16 +4294,16 @@ public: env(offer(alice, gwUSD(40), XRP(4000)), Ter(tecNO_AUTH)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(0))); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); env.require(Balance(bob, gwUSD(50))); // Delete bob's offer so alice can create an offer without crossing. env(offerCancel(bob, bobOfferSeq)); env.close(); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); // Finally, set up an authorized trust line for alice. Now alice's // offer should succeed. Note that, since this is an offer rather @@ -4314,16 +4314,16 @@ public: env(offer(alice, gwUSD(40), XRP(4000))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); // Now bob creates his offer again. alice's offer should cross. env(offer(bob, XRP(4000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(40))); - env.require(offers(bob, 0)); + env.require(Offers(bob, 0)); env.require(Balance(bob, gwUSD(10))); } @@ -4375,7 +4375,7 @@ public: // Alice creates sell offer env(offer(alice, XRP(4000), gwUSD(40))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); // GW sets DisallowIncomingTrustline flag env(fset(gw, asfDisallowIncomingTrustline)); @@ -4387,8 +4387,8 @@ public: env.close(); // Offer should have crossed - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); env.require(Balance(bob, gwUSD(40))); } @@ -4414,7 +4414,7 @@ public: // Alice creates sell offer env(offer(alice, XRP(4000), gwUSD(40))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env.require(Balance(alice, gwUSD(50))); // GW sets DisallowIncomingTrustline flag @@ -4426,11 +4426,11 @@ public: env.close(); // Alice's offer should still exist - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env.require(Balance(alice, gwUSD(50))); // Dan shouldn't have any offers or balance - env.require(offers(dan, 0)); + env.require(Offers(dan, 0)); BEAST_EXPECT(env.le(keylet::trustLine(dan, gwUSD)) == nullptr); // Bob already has trustline, so his offer should succeed and cross @@ -4438,8 +4438,8 @@ public: env.close(); // Offer should have crossed - env.require(offers(alice, 0)); - env.require(offers(bob, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(bob, 0)); env.require(Balance(alice, gwUSD(10))); env.require(Balance(bob, gwUSD(40))); @@ -4449,14 +4449,14 @@ public: env.close(); env(offer(alice, XRP(1000), gwUSD(10))); env.close(); - env.require(offers(alice, 1)); + env.require(Offers(alice, 1)); env(offer(carol, gwUSD(10), XRP(1000))); env.close(); // Offer should have crossed - env.require(offers(alice, 0)); - env.require(offers(carol, 0)); + env.require(Offers(alice, 0)); + env.require(Offers(carol, 0)); env.require(Balance(alice, gwUSD(50))); env.require(Balance(carol, gwUSD(10))); @@ -4473,15 +4473,15 @@ public: env.close(); env(offer(bob, XRP(5000), gwUSD(50))); env.close(); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); // Eve should now be able to create offer without trustline (flag is cleared) env(offer(eve, gwUSD(50), XRP(5000))); env.close(); // Offer should have crossed - env.require(offers(bob, 0)); - env.require(offers(eve, 0)); + env.require(Offers(bob, 0)); + env.require(Offers(eve, 0)); env.require(Balance(eve, gwUSD(50))); } } @@ -4591,7 +4591,7 @@ public: env(offer(gw, gwUSD(40), XRP(4000))); env.close(); std::uint32_t const gwOfferSeq = env.seq(gw) - 1; - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); // Since gw has an offer out, gw should not be able to set RequireAuth. env(fset(gw, asfRequireAuth), Ter(tecOWNERS)); @@ -4600,7 +4600,7 @@ public: // Cancel gw's offer so we can set RequireAuth. env(offerCancel(gw, gwOfferSeq)); env.close(); - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); // gw now requires authorization for holders of its IOUs env(fset(gw, asfRequireAuth)); @@ -4612,7 +4612,7 @@ public: env(offer(gw, gwUSD(40), XRP(4000)), Ter(tesSUCCESS)); env.close(); - env.require(offers(gw, 1)); + env.require(Offers(gw, 1)); // Set up an authorized trust line and pay alice gwUSD 50. env(trust(gw, aliceUSD(100)), Txflags(tfSetfAuth)); @@ -4628,10 +4628,10 @@ public: env(offer(alice, XRP(4000), gwUSD(40))); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); env.require(Balance(alice, gwUSD(10))); - env.require(offers(gw, 0)); + env.require(Offers(gw, 0)); } void @@ -4707,14 +4707,14 @@ public: // the USD issuer is not in the ledger. env(offer(alice, usd(2), XRP(2)), Ter(tecNO_ISSUER)); env.close(); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); BEAST_EXPECT(isOffer(env, becky, XRP(2), usd(2))); BEAST_EXPECT(isOffer(env, becky, bux(3), usd(3))); // alice crosses becky's second offer. Again, the offer create fails // because the USD issuer is not in the ledger. env(offer(alice, usd(3), bux(3)), Ter(tecNO_ISSUER)); - env.require(offers(alice, 0)); + env.require(Offers(alice, 0)); BEAST_EXPECT(isOffer(env, becky, XRP(2), usd(2))); BEAST_EXPECT(isOffer(env, becky, bux(3), usd(3))); @@ -4809,7 +4809,7 @@ public: env(offer(alice, xts(30), xxx(10)), Json(jss::Flags, tfSell)); std::map> offers; - forEachItem(*env.current(), alice, [&](SLE::const_ref sle) { + forEachItem(*env.current(), alice, [&](SLE::ConstRef sle) { if (sle->getType() == ltOFFER) { offers.emplace( @@ -4848,7 +4848,7 @@ public: sortedOffersOnAccount(jtx::Env& env, jtx::Account const& acct) { std::vector offers{offersOnAccount(env, acct)}; - std::ranges::sort(offers, [](SLE::const_ref rhs, SLE::const_ref lhs) { + std::ranges::sort(offers, [](SLE::ConstRef rhs, SLE::ConstRef lhs) { return (*rhs)[sfSequence] < (*lhs)[sfSequence]; }); return offers; @@ -4993,7 +4993,7 @@ public: env(trust(alice, usd(1000))); env.close(); - env.require(Owners(alice, 1), tickets(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0)); env(pay(gw, alice, usd(200))); env.close(); @@ -5002,13 +5002,13 @@ public: std::uint32_t const offerSeqId0{env.seq(alice)}; env(offer(alice, XRP(50), usd(50))); env.close(); - env.require(Owners(alice, 2), tickets(alice, 0)); + env.require(Owners(alice, 2), Tickets(alice, 0)); // Create four tickets. std::uint32_t const ticketSeq{env.seq(alice) + 1}; env(ticket::create(alice, 4)); env.close(); - env.require(Owners(alice, 6), tickets(alice, 4)); + env.require(Owners(alice, 6), Tickets(alice, 4)); // Create the second (also sequence-based) offer. std::uint32_t const offerSeqId1{env.seq(alice)}; @@ -5064,7 +5064,7 @@ public: } // All of alice's tickets should now be used up. - env.require(Owners(alice, 3), tickets(alice, 0)); + env.require(Owners(alice, 3), Tickets(alice, 0)); // Use a sequence to cancel an offer created with a ticket. env(offerCancel(alice, offerTixId1)); @@ -5083,7 +5083,7 @@ public: // Verify that offerSeqId_1 was canceled. // All of alice's tickets should now be used up. - env.require(Owners(alice, 1), tickets(alice, 0), offers(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0), Offers(alice, 0)); } void diff --git a/src/test/app/PathMPT_test.cpp b/src/test/app/PathMPT_test.cpp index 87da13087f..822b86742b 100644 --- a/src/test/app/PathMPT_test.cpp +++ b/src/test/app/PathMPT_test.cpp @@ -344,7 +344,7 @@ public: env(pay(gw, "alice", usd(70))); env(pay(gw, "bob", usd(50))); - std::optional domainID; + std::optional domainID; if (domainEnabled) domainID = setupDomain(env, {"alice", "bob", gw}); @@ -374,7 +374,7 @@ public: MPT const usd = MPTTester({.env = env, .issuer = gw, .holders = {"bob", "carol"}}); MPT const aud(makeMptID(0, gw)); env(pay(gw, "carol", usd(100))); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "carol", "gateway"}); @@ -449,7 +449,7 @@ public: MPT const usd = MPTTester({.env = env, .issuer = gw, .holders = {"alice", "bob"}}); MPT const gw2Usd = MPTTester( {.env = env, .issuer = gw2, .holders = {"alice", "bob"}, .transferFee = 1'000}); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "gateway", "gateway2"}); @@ -486,7 +486,7 @@ public: MPT const usd = MPTTester({.env = env, .issuer = gw, .holders = {alice, bob, charlie}}); env(pay(gw, charlie, usd(10))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {alice, bob, charlie, gw}); @@ -517,7 +517,7 @@ public: MPT const usd = MPTTester({.env = env, .issuer = gw, .holders = {alice, bob, charlie}}); env(pay(gw, alice, usd(10))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {alice, bob, charlie, gw}); diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index 5ecad1a420..00f75130b6 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -152,7 +152,7 @@ public: STAmount const& saDstAmount, std::optional const& saSendMax = std::nullopt, std::optional const& saSrcCurrency = std::nullopt, - std::optional const& domain = std::nullopt, + std::optional const& domain = std::nullopt, std::optional const& saSrcIssuer = std::nullopt) { using namespace jtx; @@ -219,7 +219,7 @@ public: STAmount const& saDstAmount, std::optional const& saSendMax = std::nullopt, std::optional const& saSrcCurrency = std::nullopt, - std::optional const& domain = std::nullopt, + std::optional const& domain = std::nullopt, std::optional const& saSrcIssuer = std::nullopt) { json::Value result = findPathsRequest( @@ -448,7 +448,7 @@ public: env(pay(gw, "alice", usd(70))); env(pay(gw, "bob", usd(50))); - std::optional domainID; + std::optional domainID; if (domainEnabled) domainID = setupDomain(env, {"alice", "bob", gw}); @@ -469,7 +469,7 @@ public: env.fund(XRP(10000), "alice", "bob"); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) domainID = setupDomain(env, {"alice", "bob"}); @@ -495,7 +495,7 @@ public: env.trust(Account("alice")["USD"](100), "dan"); env.trust(Account("dan")["USD"](100), "edward"); - std::optional domainID; + std::optional domainID; if (domainEnabled) domainID = setupDomain(env, {"alice", "bob", "carol", "dan", "edward"}); @@ -526,7 +526,7 @@ public: env(pay(gw, "carol", usd(100))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "carol", "gateway"}); @@ -597,7 +597,7 @@ public: env.trust(usd(700), "bob"); env.trust(gw2Usd(900), "bob"); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "gateway", "gateway2"}); @@ -644,7 +644,7 @@ public: env.trust(usd(700), "bob"); env.trust(gw2Usd(900), "bob"); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "gateway", "gateway2"}); @@ -729,7 +729,7 @@ public: env(pay(gw, "alice", usd(100))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "carol", "dan", gw, gw2}); @@ -761,7 +761,7 @@ public: env.require(Balance("carol", Account("bob")["USD"](75))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "carol", "dan"}); @@ -856,7 +856,7 @@ public: env(pay(gw, "carol", aud(50))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {"alice", "bob", "carol", gw}); @@ -1079,7 +1079,7 @@ public: env(pay(g3, m1, g3["ABC"](25000))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {a1, a2, a3, g1, g2, g3, m1}); @@ -1169,7 +1169,7 @@ public: env(pay(g3, m1, g3["ABC"](1200))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {a1, a2, g3, m1}); @@ -1236,7 +1236,7 @@ public: env(pay(g2Sw, m1, g2Sw["HKD"](5000))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) domainID = setupDomain(env, {a1, a2, g1Bs, g2Sw, m1}); @@ -1331,7 +1331,7 @@ public: env(pay(g2, m2, g2["HKD"](5000))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {a1, a2, a3, a4, g1, g2, g3, g4, m1, m2}); @@ -1464,7 +1464,7 @@ public: env(pay(g2, m1, g2["HKD"](5000))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {a1, a2, a3, g1, g2, m1}); @@ -1508,7 +1508,7 @@ public: env(pay(gw, charlie, usd(10))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {alice, bob, charlie, gw}); @@ -1543,7 +1543,7 @@ public: env(pay(gw, alice, usd(10))); env.close(); - std::optional domainID; + std::optional domainID; if (domainEnabled) { domainID = setupDomain(env, {alice, bob, charlie, gw}); @@ -1664,7 +1664,7 @@ public: env(pay(g2, m2, g2["HKD"](5000))); env.close(); - std::optional domainID = + std::optional domainID = setupDomain(env, {a1, a2, a3, a4, g1, g2, g3, g4, m1, m2}); BEAST_EXPECT(domainID); @@ -1797,7 +1797,7 @@ public: // order book { testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID), Txflags(tfHybrid)); @@ -1806,7 +1806,7 @@ public: }); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID), Txflags(tfHybrid)); @@ -1817,7 +1817,7 @@ public: }); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID), Txflags(tfHybrid)); @@ -1830,7 +1830,7 @@ public: }); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000))); env(offer(m2, XRP(10000), g2["HKD"](1000))); env(offer(m2, g1["HKD"](1000), XRP(10000)), @@ -1839,7 +1839,7 @@ public: }); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000))); env(offer(m2, XRP(10000), g2["HKD"](1000)), Domain(domainID), @@ -1855,7 +1855,7 @@ public: // order book { testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID), Txflags(tfHybrid)); @@ -1865,7 +1865,7 @@ public: true); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID), Txflags(tfHybrid)); @@ -1877,7 +1877,7 @@ public: true); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID)); env(offer(m2, XRP(10000), g2["HKD"](1000)), Domain(domainID)); env(offer(m2, g1["HKD"](1000), XRP(10000)), @@ -1887,7 +1887,7 @@ public: true); testPathfind( - [](Env& env, Account m1, Account m2, Account g1, Account g2, uint256 domainID) { + [](Env& env, Account m1, Account m2, Account g1, Account g2, UInt256 domainID) { env(offer(m1, g1["HKD"](1000), g2["HKD"](1000)), Domain(domainID)); env(offer(m2, XRP(10000), g2["HKD"](1000)), Domain(domainID), @@ -2140,7 +2140,7 @@ public: BEAST_EXPECT(orderings == 6); BEAST_EXPECT(hashes.size() == orderings); - auto seen = hardened_hash_set{}; + auto seen = HardenedHashSet{}; for (auto const& p : {currencyFirst, mptFirst}) { seen.emplace(p); @@ -2173,7 +2173,7 @@ public: auto const rhsPath = path({rhs}); BEAST_EXPECT(hasher(lhsPath) == hasher(rhsPath)); - auto equal = hardened_hash_set{}; + auto equal = HardenedHashSet{}; equal.emplace(lhsPath); equal.emplace(rhsPath); BEAST_EXPECT(equal.size() == 1); diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index 96fe094c62..a3d48a6014 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -66,7 +66,7 @@ using namespace jtx::paychan; struct PayChan_test : public beast::unit_test::Suite { - static std::pair + static std::pair channelKeyAndSle(ReadView const& view, jtx::Account const& account, jtx::Account const& dst) { auto const sle = view.read(keylet::account(account)); @@ -81,7 +81,7 @@ struct PayChan_test : public beast::unit_test::Suite signClaimAuth( PublicKey const& pk, SecretKey const& sk, - uint256 const& channel, + UInt256 const& channel, STAmount const& authAmt) { Serializer msg; @@ -90,7 +90,7 @@ struct PayChan_test : public beast::unit_test::Suite } static STAmount - channelAmount(ReadView const& view, uint256 const& chan) + channelAmount(ReadView const& view, UInt256 const& chan) { auto const slep = view.read({ltPAYCHAN, chan}); if (!slep) @@ -99,7 +99,7 @@ struct PayChan_test : public beast::unit_test::Suite } static std::optional - channelExpiration(ReadView const& view, uint256 const& chan) + channelExpiration(ReadView const& view, UInt256 const& chan) { auto const slep = view.read({ltPAYCHAN, chan}); if (!slep) @@ -1815,8 +1815,7 @@ struct PayChan_test : public beast::unit_test::Suite auto const settleDelay = 100s; auto const pk = alice.pk(); - auto inOwnerDir = - [](ReadView const& view, Account const& acc, SLE::const_ref chan) -> bool { + auto inOwnerDir = [](ReadView const& view, Account const& acc, SLE::ConstRef chan) -> bool { xrpl::Dir const ownerDir(view, keylet::ownerDir(acc.id())); // NOLINTNEXTLINE(modernize-use-ranges) return std::find(ownerDir.begin(), ownerDir.end(), chan) != ownerDir.end(); @@ -1985,7 +1984,7 @@ struct PayChan_test : public beast::unit_test::Suite env(create(alice, bob, XRP(1000), settleDelay, pk), ticket::Use(aliceTicketSeq++)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == XRP(0)); @@ -1995,7 +1994,7 @@ struct PayChan_test : public beast::unit_test::Suite auto const preAlice = env.balance(alice); env(fund(alice, chan, XRP(1000)), ticket::Use(aliceTicketSeq++)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); auto const feeDrops = env.current()->fees().base; @@ -2016,7 +2015,7 @@ struct PayChan_test : public beast::unit_test::Suite assert(reqBal <= chanAmt); env(claim(alice, chan, reqBal, authAmt), ticket::Use(aliceTicketSeq++)); - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == reqBal); @@ -2035,7 +2034,7 @@ struct PayChan_test : public beast::unit_test::Suite env(claim(bob, chan, reqBal, authAmt, Slice(sig), alice.pk()), ticket::Use(bobTicketSeq++)); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == reqBal); @@ -2051,7 +2050,7 @@ struct PayChan_test : public beast::unit_test::Suite ticket::Use(bobTicketSeq++), Ter(tecUNFUNDED_PAYMENT)); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == chanBal); @@ -2071,7 +2070,7 @@ struct PayChan_test : public beast::unit_test::Suite ticket::Use(bobTicketSeq), Ter(temBAD_AMOUNT)); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == chanBal); @@ -2082,7 +2081,7 @@ struct PayChan_test : public beast::unit_test::Suite // Dst tries to fund the channel env(fund(bob, chan, XRP(1000)), ticket::Use(bobTicketSeq++), Ter(tecNO_PERMISSION)); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); BEAST_EXPECT(channelBalance(*env.current(), chan) == chanBal); @@ -2094,7 +2093,7 @@ struct PayChan_test : public beast::unit_test::Suite auto const preBob = env.balance(bob); env(claim(bob, chan), Txflags(tfClose), ticket::Use(bobTicketSeq++)); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); BEAST_EXPECT(!channelExists(*env.current(), chan)); @@ -2104,9 +2103,9 @@ struct PayChan_test : public beast::unit_test::Suite BEAST_EXPECT(env.balance(alice) == preAlice + delta); BEAST_EXPECT(env.balance(bob) == preBob - feeDrops); } - env.require(tickets(alice, env.seq(alice) - aliceTicketSeq)); + env.require(Tickets(alice, env.seq(alice) - aliceTicketSeq)); BEAST_EXPECT(env.seq(alice) == aliceSeq); - env.require(tickets(bob, env.seq(bob) - bobTicketSeq)); + env.require(Tickets(bob, env.seq(bob) - bobTicketSeq)); BEAST_EXPECT(env.seq(bob) == bobSeq); } diff --git a/src/test/app/PayStrandMPT_test.cpp b/src/test/app/PayStrandMPT_test.cpp index 20e582fbf7..511fe44613 100644 --- a/src/test/app/PayStrandMPT_test.cpp +++ b/src/test/app/PayStrandMPT_test.cpp @@ -166,12 +166,12 @@ struct PayStrandMPT_test : public beast::unit_test::Suite Env env(*this, features); env.fund(XRP(10'000), alice, bob, carol, gw); auto usd = issue1({.env = env, .token = "USD", .issuer = gw, .limit = 1'000}); - using tUSD = std::decay_t; + using TUsd = std::decay_t; auto eur = issue2({.env = env, .token = "EUR", .issuer = gw, .limit = 1'000}); - using tEUR = std::decay_t; + using TEur = std::decay_t; auto const err = [&]() { - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { return tecNO_AUTH; } @@ -182,7 +182,7 @@ struct PayStrandMPT_test : public beast::unit_test::Suite }(); test(env, usd, std::nullopt, STPath(), err); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { MPTTester(env, gw, usd).authorizeHolders({alice, bob, carol}); } @@ -205,7 +205,7 @@ struct PayStrandMPT_test : public beast::unit_test::Suite tesSUCCESS, makeEndpointStep(alice, gw, usd), makeEndpointStep(gw, bob, usd)); - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { MPTTester(env, gw, eur).authorizeHolders({alice, bob}); } diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index fbe942948d..b192e74208 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -75,9 +75,9 @@ class PermissionedDEX_test : public beast::unit_test::Suite uint32_t const flags = 0, bool const domainOffer = false) { - auto offerInDir = [&](uint256 const& directory, + auto offerInDir = [&](UInt256 const& directory, uint64_t const pageIndex, - std::optional domain = std::nullopt) -> bool { + std::optional domain = std::nullopt) -> bool { auto const page = env.le(keylet::page(directory, pageIndex)); if (!page) return false; @@ -141,13 +141,13 @@ class PermissionedDEX_test : public beast::unit_test::Suite return true; } - static uint256 + static UInt256 getBookDirKey(Book const& book, STAmount const& takerPays, STAmount const& takerGets) { return keylet::quality(keylet::book(book), getRate(takerGets, takerPays)).key; } - static std::optional + static std::optional getDefaultOfferDirKey(Env const& env, Account const& account, std::uint32_t offerSeq) { if (auto const sle = env.le(keylet::offer(account.id(), SeqProxy::rawSequence(offerSeq)))) @@ -157,7 +157,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite } [[nodiscard]] static bool - checkDirectorySize(Env const& env, uint256 directory, std::uint32_t dirSize) + checkDirectorySize(Env const& env, UInt256 directory, std::uint32_t dirSize) { std::optional pageIndex{0}; std::uint32_t dirCnt = 0; @@ -210,7 +210,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite auto const& [gw_, domainOwner, alice_, bob_, carol_, USD, domainID, credType] = PermissionedDEX(env); - env(offer(bob_, XRP(10), USD(10)), Domain(uint256{}), Ter(temMALFORMED)); + env(offer(bob_, XRP(10), USD(10)), Domain(UInt256{}), Ter(temMALFORMED)); env.close(); } @@ -289,7 +289,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite Env env(*this, features); auto const& [gw, domainOwner, alice, bob, carol, USD, domainID, credType] = PermissionedDEX(env); - uint256 const badDomain{ + UInt256 const badDomain{ "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134" "E5"}; @@ -428,7 +428,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite env(pay(bob_, alice_, USD(10)), Path(~USD), Sendmax(XRP(10)), - Domain(uint256{}), + Domain(UInt256{}), Ter(temMALFORMED)); env.close(); } @@ -438,7 +438,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite Env env(*this, features); auto const& [gw, domainOwner, alice, bob, carol, USD, domainID, credType] = PermissionedDEX(env); - uint256 const badDomain{ + UInt256 const badDomain{ "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134" "E5"}; @@ -1700,7 +1700,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite auto const& [gw, domainOwner, alice, bob, carol, USD, domainID, credType] = PermissionedDEX(env); - uint256 const badDomain{ + UInt256 const badDomain{ "F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E3370F3649CE134" "E5"}; @@ -2025,7 +2025,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite env.fund(XRP(1000), carol); env.close(); - env(ledger_state_fix::bookExchangeRate(carol, uint256{1}), Ter(temDISABLED)); + env(ledger_state_fix::bookExchangeRate(carol, UInt256{1}), Ter(temDISABLED)); } { @@ -2038,13 +2038,13 @@ class PermissionedDEX_test : public beast::unit_test::Suite env.close(); // BookExchangeRate fixes require sfBookDirectory. - auto missingBookDirectory = ledger_state_fix::bookExchangeRate(carol, uint256{1}); + auto missingBookDirectory = ledger_state_fix::bookExchangeRate(carol, UInt256{1}); missingBookDirectory.removeMember(sfBookDirectory.jsonName); env(missingBookDirectory, Ter(temINVALID)); // BookExchangeRate fixes reject fields that belong to other // LedgerStateFix types. - auto extraOwner = ledger_state_fix::bookExchangeRate(carol, uint256{1}); + auto extraOwner = ledger_state_fix::bookExchangeRate(carol, UInt256{1}); extraOwner[sfOwner.jsonName] = carol.human(); env(extraOwner, Ter(temINVALID)); } @@ -2056,7 +2056,7 @@ class PermissionedDEX_test : public beast::unit_test::Suite { // Preclaim check: the target directory must exist. - env(ledger_state_fix::bookExchangeRate(setup.carol, uint256{1}), + env(ledger_state_fix::bookExchangeRate(setup.carol, UInt256{1}), Fee(fixFee), Ter(tecOBJECT_NOT_FOUND)); } diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 1a2472b397..ea5c3a6071 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -102,13 +102,13 @@ class PermissionedDomains_test : public beast::unit_test::Suite env.fund(XRP(1000), alice); pdomain::Credentials const credentials{{.issuer = alice, .credType = "first credential"}}; env(pdomain::setTx(alice, credentials), Ter(temDISABLED)); - env(pdomain::deleteTx(alice, uint256(75)), Ter(temDISABLED)); + env(pdomain::deleteTx(alice, UInt256(75)), Ter(temDISABLED)); } // Verify that bad inputs fail for each of create new and update // behaviors of PermissionedDomainSet void - testBadData(Account const& account, Env& env, std::optional domain = std::nullopt) + testBadData(Account const& account, Env& env, std::optional domain = std::nullopt) { Account const alice2("alice2"); Account const alice3("alice3"); @@ -214,7 +214,7 @@ class PermissionedDomains_test : public beast::unit_test::Suite env.close(); env(pdomain::setTx(account, sorted, domain)); - uint256 d; + UInt256 d; if (domain) { d = *domain; @@ -247,7 +247,7 @@ class PermissionedDomains_test : public beast::unit_test::Suite BEAST_EXPECT(credentialsSame != pdomain::sortCredentials(credentialsSame)); env(pdomain::setTx(account, credentialsSame, domain)); - uint256 d; + UInt256 d; if (domain) { d = *domain; @@ -360,7 +360,7 @@ class PermissionedDomains_test : public beast::unit_test::Suite {.issuer = alice[10], .credType = "credential9"}, {.issuer = alice[0], .credType = "credential10"}, }; - uint256 domain2; + UInt256 domain2; { BEAST_EXPECT(credentials10.size() == kMaxPermissionedDomainCredentialsArraySize); BEAST_EXPECT(credentials10 != pdomain::sortCredentials(credentials10)); @@ -390,11 +390,11 @@ class PermissionedDomains_test : public beast::unit_test::Suite // Update from the wrong owner. env(pdomain::setTx(alice[2], credentials1, domain2), Ter(tecNO_PERMISSION)); - // Update a uint256(0) domain - env(pdomain::setTx(alice[0], credentials1, uint256(0)), Ter(temMALFORMED)); + // Update a UInt256(0) domain + env(pdomain::setTx(alice[0], credentials1, UInt256(0)), Ter(temMALFORMED)); // Update non-existent domain - env(pdomain::setTx(alice[0], credentials1, uint256(75)), Ter(tecNO_ENTRY)); + env(pdomain::setTx(alice[0], credentials1, UInt256(75)), Ter(tecNO_ENTRY)); // Wrong flag env(pdomain::setTx(alice[0], credentials1), Txflags(tfClawTwoAssets), Ter(temINVALID_FLAG)); @@ -452,16 +452,16 @@ class PermissionedDomains_test : public beast::unit_test::Suite env(pdomain::deleteTx(bob, domain), Ter(tecNO_PERMISSION)); // Delete a non-existent domain. - env(pdomain::deleteTx(alice, uint256(75)), Ter(tecNO_ENTRY)); + env(pdomain::deleteTx(alice, UInt256(75)), Ter(tecNO_ENTRY)); // Test bad fee - env(pdomain::deleteTx(alice, uint256(75)), Ter(temBAD_FEE), Fee(1, true)); + env(pdomain::deleteTx(alice, UInt256(75)), Ter(temBAD_FEE), Fee(1, true)); // Wrong flag env(pdomain::deleteTx(alice, domain), Ter(temINVALID_FLAG), Txflags(tfClawTwoAssets)); // Delete a zero domain. - env(pdomain::deleteTx(alice, uint256(0)), Ter(temMALFORMED)); + env(pdomain::deleteTx(alice, UInt256(0)), Ter(temMALFORMED)); // Make sure owner count reflects the existing domain. BEAST_EXPECT(env.ownerCount(alice) == 1); diff --git a/src/test/app/PseudoTx_test.cpp b/src/test/app/PseudoTx_test.cpp index 9f65daad18..1a531b78c0 100644 --- a/src/test/app/PseudoTx_test.cpp +++ b/src/test/app/PseudoTx_test.cpp @@ -47,7 +47,7 @@ struct PseudoTx_test : public beast::unit_test::Suite res.emplace_back(ttAMENDMENT, [&](auto& obj) { obj.setAccountID(sfAccount, AccountID()); - obj.setFieldH256(sfAmendment, uint256(2)); + obj.setFieldH256(sfAmendment, UInt256(2)); obj.setFieldU32(sfLedgerSequence, seq); }); diff --git a/src/test/app/RCLValidations_test.cpp b/src/test/app/RCLValidations_test.cpp index 9ace2e21af..9dee8db1e1 100644 --- a/src/test/app/RCLValidations_test.cpp +++ b/src/test/app/RCLValidations_test.cpp @@ -72,7 +72,7 @@ class RCLValidations_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); history.push_back(prev); for (auto i = 0; i < ((2 * maxAncestors) + 1); ++i) @@ -238,7 +238,7 @@ class RCLValidations_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); history.push_back(prev); for (auto i = 0; i < (maxAncestors + 10); ++i) diff --git a/src/test/app/ReducedOffer_test.cpp b/src/test/app/ReducedOffer_test.cpp index dea197590c..ed40f26e8d 100644 --- a/src/test/app/ReducedOffer_test.cpp +++ b/src/test/app/ReducedOffer_test.cpp @@ -423,7 +423,7 @@ public: std::uint32_t bobOfferSeq = env.seq(bob); env(offer(bob, eurOffer, usdOffer)); env.close(); - env.require(offers(bob, 1)); + env.require(Offers(bob, 1)); // alice places an offer that crosses bob's. std::uint32_t aliceOfferSeq = env.seq(alice); diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index 6ebde20176..16d4a6ef78 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -89,7 +89,7 @@ struct Regression_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto expectedDrops = kInitialXrp; BEAST_EXPECT(closed->header().drops == expectedDrops); @@ -229,7 +229,7 @@ struct Regression_test : public beast::unit_test::Suite testFeeEscalationExtremeConfig() { testcase("Fee escalation shouldn't allocate extreme memory"); - using clock_type = std::chrono::steady_clock; + using ClockType = std::chrono::steady_clock; using namespace jtx; using namespace std::chrono_literals; @@ -246,9 +246,9 @@ struct Regression_test : public beast::unit_test::Suite env(noop(env.master)); // This test will probably fail if any breakpoints are encountered, // but should pass on even the slowest machines. - auto const start = clock_type::now(); + auto const start = ClockType::now(); env.close(); - BEAST_EXPECT(clock_type::now() - start < 1s); + BEAST_EXPECT(ClockType::now() - start < 1s); } void @@ -295,7 +295,7 @@ struct Regression_test : public beast::unit_test::Suite { auto const bobIndex = keylet::account(bob).key; - auto const digest = [&]() -> std::optional { + auto const digest = [&]() -> std::optional { auto const& state = env.app().getLedgerMaster().getClosedLedger()->stateMap(); SHAMapHash digest; if (!state.peekItem(bobIndex, digest)) diff --git a/src/test/app/Sponsor_test.cpp b/src/test/app/Sponsor_test.cpp index 22b5d0bcdc..6d600fb489 100644 --- a/src/test/app/Sponsor_test.cpp +++ b/src/test/app/Sponsor_test.cpp @@ -1168,7 +1168,7 @@ public: // Pre-fixCleanup3_5_0 path is unreachable so it is not testable. if (features[fixCleanup3_5_0]) { - uint256 const zeroObjectID{}; + UInt256 const zeroObjectID{}; env(sponsor::transfer(alice, tfSponsorshipEnd, zeroObjectID), Ter(temMALFORMED)); @@ -1863,7 +1863,7 @@ public: env.fund(XRP(10000), alice, sponsor); env.close(); - auto const checkBlocked = [&](Account const& account, uint256 const& objectID) { + auto const checkBlocked = [&](Account const& account, UInt256 const& objectID) { env(sponsor::transfer(account, tfSponsorshipCreate, objectID), sponsor::As(sponsor, spfSponsorReserve), Sig(sfSponsorSignature, sponsor), @@ -2207,7 +2207,7 @@ public: BEAST_EXPECT( env.le(keylet::sponsorship(sponsor, alice))->isFieldPresent(sfFeeAmount)); auto sponsorAvailableFee = sponsor::sponsorshipFeeBalance(env, sponsor, alice); - env(check::cancel(alice, uint256(1)), + env(check::cancel(alice, UInt256(1)), Fee(sponsorAvailableFee), sponsor::As(sponsor, spfSponsorFee), Ter(tecNO_ENTRY)); @@ -4087,7 +4087,7 @@ public: // PayChanCreate auto const pk = alice.pk(); auto const settleDelay = 10s; - uint256 chan; + UInt256 chan; testEachSponsorship( env, cosigning, @@ -5315,7 +5315,7 @@ public: checkBlocked(token::mint(alice, 0u)); checkBlocked(sponsor::set(alice, 0, 10, XRP(10))); checkBlocked(acctdelete(alice, bob)); - checkBlocked(loan::set(alice, uint256(1), Number{1})); + checkBlocked(loan::set(alice, UInt256(1), Number{1})); } void diff --git a/src/test/app/TheoreticalQuality_test.cpp b/src/test/app/TheoreticalQuality_test.cpp index 8f7d844019..8d837aef13 100644 --- a/src/test/app/TheoreticalQuality_test.cpp +++ b/src/test/app/TheoreticalQuality_test.cpp @@ -115,7 +115,7 @@ struct RippleCalcTestParams // and initial balance class RandomAccountParams { - beast::xor_shift_engine engine_; + beast::XorShiftEngine engine_; std::uint32_t const trustAmount_; // Balance to set if an account redeems into another account. Otherwise // the balance will be zero. Since we are testing quality measures, the diff --git a/src/test/app/Ticket_test.cpp b/src/test/app/Ticket_test.cpp index f14afd5990..6f4f143209 100644 --- a/src/test/app/Ticket_test.cpp +++ b/src/test/app/Ticket_test.cpp @@ -383,7 +383,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(master, 1), Fee(XRP(10))); checkTicketCreateMeta(env); env.close(); - env.require(Owners(master, 1), tickets(master, 1)); + env.require(Owners(master, 1), Tickets(master, 1)); env(ticket::create(master, 1), Fee(XRP(-1)), Ter(temBAD_FEE)); @@ -392,23 +392,23 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(master, 1), Txflags(tfFullyCanonicalSig)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(master, 2), tickets(master, 2)); + env.require(Owners(master, 2), Tickets(master, 2)); env(ticket::create(master, 1), Txflags(tfSell), Ter(temINVALID_FLAG)); env.close(); - env.require(Owners(master, 2), tickets(master, 2)); + env.require(Owners(master, 2), Tickets(master, 2)); // We successfully created 1 ticket earlier. Verify that we can // create 250 tickets in one shot. We must consume one ticket first. env(noop(master), ticket::Use(ticketSeqA)); checkTicketConsumeMeta(env); env.close(); - env.require(Owners(master, 1), tickets(master, 1)); + env.require(Owners(master, 1), Tickets(master, 1)); env(ticket::create(master, 250), ticket::Use(ticketSeqB)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(master, 250), tickets(master, 250)); + env.require(Owners(master, 250), Tickets(master, 250)); } void @@ -437,31 +437,31 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 250)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); // Note that we can add one more ticket while consuming a ticket // because the final result is still 250 tickets. env(ticket::create(alice, 1), ticket::Use(ticketSeq + 0)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); // Adding one more ticket will exceed the threshold. env(ticket::create(alice, 2), ticket::Use(ticketSeq + 1), Ter(tecDIR_FULL)); env.close(); - env.require(Owners(alice, 249), tickets(alice, 249)); + env.require(Owners(alice, 249), Tickets(alice, 249)); // Now we can successfully add one more ticket. env(ticket::create(alice, 2), ticket::Use(ticketSeq + 2)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); // Since we're at 250, we can't add another ticket using a // sequence. env(ticket::create(alice, 1), Ter(tecDIR_FULL)); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); } { // Explore exceeding the ticket threshold from another angle. @@ -475,25 +475,25 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 2)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); // Adding 250 tickets (while consuming one) will exceed the // threshold. env(ticket::create(alice, 250), ticket::Use(ticketSeqAb + 0), Ter(tecDIR_FULL)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Adding 250 tickets (without consuming one) will exceed the // threshold. env(ticket::create(alice, 250), Ter(tecDIR_FULL)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Alice can now add 250 tickets while consuming one. env(ticket::create(alice, 250), ticket::Use(ticketSeqAb + 1)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); } } @@ -512,7 +512,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 1), Ter(tecINSUFFICIENT_RESERVE)); env.close(); - env.require(Owners(alice, 0), tickets(alice, 0)); + env.require(Owners(alice, 0), Tickets(alice, 0)); // Give alice enough to exactly meet the reserve for one Ticket. env(pay( @@ -522,7 +522,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 1)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Give alice not quite enough to make the reserve for a total of // 250 Tickets. @@ -536,7 +536,7 @@ class Ticket_test : public beast::unit_test::Suite // Tickets, so the transaction fails. env(ticket::create(alice, 249), Ter(tecINSUFFICIENT_RESERVE)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); // Give alice enough so she can make the reserve for all 250 // Tickets. @@ -548,7 +548,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 249)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); BEAST_EXPECT(ticketSeq + 249 == env.seq(alice)); } @@ -569,7 +569,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 2)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); BEAST_EXPECT(ticketSeqAb + 2 == env.seq(alice)); // You can use a ticket to create one ticket ... @@ -577,7 +577,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 1), ticket::Use(ticketSeqAb + 0)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); BEAST_EXPECT(ticketSeqC + 1 == env.seq(alice)); // ... you can use a ticket to create multiple tickets ... @@ -585,26 +585,26 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 2), ticket::Use(ticketSeqAb + 1)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 3), tickets(alice, 3)); + env.require(Owners(alice, 3), Tickets(alice, 3)); BEAST_EXPECT(ticketSeqDe + 2 == env.seq(alice)); // ... and you can use a ticket for other things. env(noop(alice), ticket::Use(ticketSeqDe + 0)); checkTicketConsumeMeta(env); env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); BEAST_EXPECT(ticketSeqDe + 2 == env.seq(alice)); env(pay(alice, env.master, XRP(20)), ticket::Use(ticketSeqDe + 1)); checkTicketConsumeMeta(env); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); BEAST_EXPECT(ticketSeqDe + 2 == env.seq(alice)); env(trust(alice, env.master["USD"](20)), ticket::Use(ticketSeqC)); checkTicketConsumeMeta(env); env.close(); - env.require(Owners(alice, 1), tickets(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0)); BEAST_EXPECT(ticketSeqDe + 2 == env.seq(alice)); // Attempt to use a ticket that has already been used. @@ -620,7 +620,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 1)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 1), tickets(alice, 0)); + env.require(Owners(alice, 1), Tickets(alice, 0)); BEAST_EXPECT(ticketSeqF + 1 == env.seq(alice)); // Try a transaction that combines consuming a ticket with @@ -635,7 +635,7 @@ class Ticket_test : public beast::unit_test::Suite Json(R"({"AccountTxnID": "0"})"), Ter(temINVALID)); env.close(); - env.require(Owners(alice, 2), tickets(alice, 1)); + env.require(Owners(alice, 2), Tickets(alice, 1)); } void @@ -661,7 +661,7 @@ class Ticket_test : public beast::unit_test::Suite env.close(); // Lambda that returns the hash of the most recent transaction. - auto getTxID = [&env, this]() -> uint256 { + auto getTxID = [&env, this]() -> UInt256 { std::shared_ptr const tx{env.tx()}; if (!BEAST_EXPECTS(tx, "Transaction not found")) Throw("Invalid transaction ID"); @@ -681,34 +681,34 @@ class Ticket_test : public beast::unit_test::Suite std::uint32_t ticketSeq{env.seq(alice)}; static constexpr std::uint32_t kTicketCount{10}; env(ticket::create(alice, kTicketCount)); - uint256 const txHash1{getTxID()}; + UInt256 const txHash1{getTxID()}; // Just for grins use the tickets in reverse from largest to smallest. ticketSeq += kTicketCount; env(noop(alice), ticket::Use(--ticketSeq)); - uint256 const txHash2{getTxID()}; + UInt256 const txHash2{getTxID()}; env(pay(alice, env.master, XRP(200)), ticket::Use(--ticketSeq)); - uint256 const txHash3{getTxID()}; + UInt256 const txHash3{getTxID()}; env(deposit::auth(alice, env.master), ticket::Use(--ticketSeq)); - uint256 const txHash4{getTxID()}; + UInt256 const txHash4{getTxID()}; // Close the ledger so we look at transactions from a couple of // different ledgers. env.close(); env(pay(alice, env.master, XRP(300)), ticket::Use(--ticketSeq)); - uint256 const txHash5{getTxID()}; + UInt256 const txHash5{getTxID()}; env(pay(alice, env.master, XRP(400)), ticket::Use(--ticketSeq)); - uint256 const txHash6{getTxID()}; + UInt256 const txHash6{getTxID()}; env(deposit::unauth(alice, env.master), ticket::Use(--ticketSeq)); - uint256 const txHash7{getTxID()}; + UInt256 const txHash7{getTxID()}; env(noop(alice), ticket::Use(--ticketSeq)); - uint256 const txHash8{getTxID()}; + UInt256 const txHash8{getTxID()}; env.close(); @@ -719,7 +719,7 @@ class Ticket_test : public beast::unit_test::Suite // Lambda to verify a transaction pulled from the Transaction database. auto checkTxFromDB = [&env, this]( - uint256 const& txID, + UInt256 const& txID, std::uint32_t ledgerSeq, std::uint32_t txSeq, std::optional ticketSeq, @@ -780,7 +780,7 @@ class Ticket_test : public beast::unit_test::Suite env(ticket::create(alice, 2)); checkTicketCreateMeta(env); env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); BEAST_EXPECT(ticketSeq + 2 == env.seq(alice)); { @@ -809,12 +809,12 @@ class Ticket_test : public beast::unit_test::Suite // "sign" should not have consumed any of alice's tickets. env.close(); - env.require(Owners(alice, 2), tickets(alice, 2)); + env.require(Owners(alice, 2), Tickets(alice, 2)); // "submit" the signed blob and see one of alice's tickets consumed. env.rpc("submit", jr[jss::result][jss::tx_blob].asString()); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); } { // Test that the "submit" RPC command fills in a "Sequence": 0 @@ -842,7 +842,7 @@ class Ticket_test : public beast::unit_test::Suite // "submit" should have consumed the last of alice's tickets. env.close(); - env.require(Owners(alice, 0), tickets(alice, 0)); + env.require(Owners(alice, 0), Tickets(alice, 0)); } } @@ -865,7 +865,7 @@ class Ticket_test : public beast::unit_test::Suite std::uint32_t const ticketSeq = env.seq(alice) + 1; env(ticket::create(alice, 1)); env.close(); - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); BEAST_EXPECT(ticketSeq + 1 == env.seq(alice)); // Create a transaction that includes both a ticket and a non-zero @@ -875,7 +875,7 @@ class Ticket_test : public beast::unit_test::Suite // Verify that the transaction failed by looking at alice's // sequence number and tickets. - env.require(Owners(alice, 1), tickets(alice, 1)); + env.require(Owners(alice, 1), Tickets(alice, 1)); BEAST_EXPECT(ticketSeq + 1 == env.seq(alice)); } diff --git a/src/test/app/TransactionProposalCreate_test.cpp b/src/test/app/TransactionProposalCreate_test.cpp index 96e0e77ba8..f7c806a28f 100644 --- a/src/test/app/TransactionProposalCreate_test.cpp +++ b/src/test/app/TransactionProposalCreate_test.cpp @@ -315,7 +315,7 @@ struct TransactionProposalCreate_test : public beast::unit_test::Suite return proposal::unsignedPayload(env, tx, targetTicketSeq); }; auto loanSet = [&]() { - json::Value tx = loan::set(target, uint256{1}, 1'000 + ++paid); + json::Value tx = loan::set(target, UInt256{1}, 1'000 + ++paid); tx[sfCounterparty.getJsonName()] = bob.human(); return proposal::unsignedPayload(env, tx, targetTicketSeq); }; @@ -1224,7 +1224,7 @@ struct TransactionProposalCreate_test : public beast::unit_test::Suite std::uint32_t const ticketSeq = proposal::createTicket(env, borrower); json::Value const tx = - proposal::unsignedPayload(env, loan::set(borrower, uint256{1}, 1'000), ticketSeq); + proposal::unsignedPayload(env, loan::set(borrower, UInt256{1}, 1'000), ticketSeq); env(proposal::create(borrower, tx, expiration), proposal::verify::create()); env.close(); diff --git a/src/test/app/TrustSet_test.cpp b/src/test/app/TrustSet_test.cpp index e24373fd21..01b2cae11b 100644 --- a/src/test/app/TrustSet_test.cpp +++ b/src/test/app/TrustSet_test.cpp @@ -53,8 +53,8 @@ public: // alice and becky, both of them will be charged an owner reserve // Irrespective of whether the issuer or the customer initiated // the trust-line creation, both will be charged - env.require(lines(alice, 1)); - env.require(lines(becky, 1)); + env.require(Lines(alice, 1)); + env.require(Lines(becky, 1)); // Fetch the trust-lines via RPC for verification json::Value jv; @@ -74,8 +74,8 @@ public: // the reset of the trust line limits deletes the trust-line // this occurs despite the authorization of the trust-line by the // issuer(alice, in this unit test) - env.require(lines(becky, 0)); - env.require(lines(alice, 0)); + env.require(Lines(becky, 0)); + env.require(Lines(alice, 0)); // second verification check via RPC calls jv["account"] = becky.human(); @@ -131,8 +131,8 @@ public: // alice and becky, both of them will be charged an owner reserve // Irrespective of whether the issuer or the customer initiated // the trust-line creation, both will be charged - env.require(lines(alice, 1)); - env.require(lines(becky, 1)); + env.require(Lines(alice, 1)); + env.require(Lines(becky, 1)); // Fetch the trust-lines via RPC for verification json::Value jv; @@ -152,8 +152,8 @@ public: // the reset of the trust line limits deletes the trust-line // this occurs despite the authorization of the trust-line by the // issuer(alice, in this unit test) - env.require(lines(becky, 0)); - env.require(lines(alice, 0)); + env.require(Lines(becky, 0)); + env.require(Lines(alice, 0)); // second verification check via RPC calls jv["account"] = becky.human(); @@ -201,20 +201,20 @@ public: + drops(3 * txFee) /* and to pay for 3 transactions */, creator); - env(trust(creator, gwA["USD"](100)), Require(lines(creator, 1))); - env(trust(creator, gwB["USD"](100)), Require(lines(creator, 2))); + env(trust(creator, gwA["USD"](100)), Require(Lines(creator, 1))); + env(trust(creator, gwB["USD"](100)), Require(Lines(creator, 2))); if (thirdLineCreatesLE) { // creator does not have enough for the third trust line env(trust(creator, assistor["USD"](100)), Ter(tecNO_LINE_INSUF_RESERVE), - Require(lines(creator, 2))); + Require(Lines(creator, 2))); } else { // First establish opposite trust direction from assistor - env(trust(assistor, creator["USD"](100)), Require(lines(creator, 3))); + env(trust(assistor, creator["USD"](100)), Require(Lines(creator, 3))); // creator does not have enough to create the other direction on // the existing trust line ledger entry @@ -226,11 +226,11 @@ public: if (thirdLineCreatesLE) { - env(trust(creator, assistor["USD"](100)), Require(lines(creator, 3))); + env(trust(creator, assistor["USD"](100)), Require(Lines(creator, 3))); } else { - env(trust(creator, assistor["USD"](100)), Require(lines(creator, 3))); + env(trust(creator, assistor["USD"](100)), Require(Lines(creator, 3))); json::Value jv; jv["account"] = creator.human(); @@ -467,10 +467,10 @@ public: BEAST_EXPECT(lines[jss::result][jss::lines][0u][jss::quality_out] == quality); }; - env(tx1, Require(lines(toAcct, 1)), Require(lines(fromAcct, 1))); + env(tx1, Require(Lines(toAcct, 1)), Require(Lines(fromAcct, 1))); checkQuality(createQuality); - env(tx2, Require(lines(toAcct, 1)), Require(lines(fromAcct, 1))); + env(tx2, Require(Lines(toAcct, 1)), Require(Lines(fromAcct, 1))); checkQuality(!createQuality); } diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 5b257449e0..51007c997d 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -408,11 +408,11 @@ public: env(noop(alice), ticket::Use(tkt1 - 2), Ter(tefNO_TICKET)); env(noop(alice), ticket::Use(tkt1 - 1), Ter(terPRE_TICKET)); - env.require(Owners(alice, 0), tickets(alice, 0)); + env.require(Owners(alice, 0), Tickets(alice, 0)); checkMetrics(*this, env, 1, std::nullopt, 4, 3); env.close(); - env.require(Owners(alice, 250), tickets(alice, 250)); + env.require(Owners(alice, 250), Tickets(alice, 250)); checkMetrics(*this, env, 0, 8, 1, 4); BEAST_EXPECT(env.seq(alice) == tkt1 + 250); @@ -445,7 +445,7 @@ public: // o Get tefNO_TICKET if the ticket has already been used. // o Get telCAN_NOT_QUEUE_FEE if the transaction is still in the queue. env.close(); - env.require(Owners(alice, 240), tickets(alice, 240)); + env.require(Owners(alice, 240), Tickets(alice, 240)); // These 4 went straight to the ledger: env(noop(alice), ticket::Use(tkt1 + 1), Ter(tefNO_TICKET)); @@ -510,7 +510,7 @@ public: // o Get telCAN_NOT_QUEUE_FEE if the transaction is still in // the queue. env.close(); - env.require(Owners(alice, 237), tickets(alice, 237)); + env.require(Owners(alice, 237), Tickets(alice, 237)); // The four ticket-based transactions went out first, since // they paid the highest fee. @@ -551,7 +551,7 @@ public: checkMetrics(*this, env, 10, 12, 7, 6); env.close(); - env.require(Owners(alice, 231), tickets(alice, 231)); + env.require(Owners(alice, 231), Tickets(alice, 231)); // These three ticket-based transactions escaped the queue. env(noop(alice), ticket::Use(tkt1 + 14), Ter(tefNO_TICKET)); @@ -601,7 +601,7 @@ public: env(noop(alice), ticket::Use(tkt250 - 4), Fee((baseFee * 2.2 * 1.25) + 1), queued); env.close(); - env.require(Owners(alice, 227), tickets(alice, 227)); + env.require(Owners(alice, 227), Tickets(alice, 227)); // Verify that all remaining transactions made it out of the TxQ. env(noop(alice), ticket::Use(tkt1 + 18), Ter(tefNO_TICKET)); @@ -1668,7 +1668,7 @@ public: // up to Alice's reserve. env(offer(bob, drops(5000), usd(5000)), Fee(openLedgerCost(env)), - Require(Balance(alice, drops(250)), Owners(alice, 1), lines(alice, 1))); + Require(Balance(alice, drops(250)), Owners(alice, 1), Lines(alice, 1))); checkMetrics(*this, env, 4, 6, 5, 3); // Try adding a new transaction. diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index d2e6cb24aa..bd7e8d1096 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -162,10 +162,10 @@ private: return strHex(sign(keys.first, keys.second, makeSlice(data))); } - static hash_set + static HashSet asNodeIDs(std::initializer_list const& pks) { - hash_set res; + HashSet res; res.reserve(pks.size()); for (auto const& pk : pks) res.insert(calcNodeID(pk)); @@ -1132,13 +1132,13 @@ private: env.journal); std::vector const cfgPublishersOuter; - hash_set activeValidatorsOuter; + HashSet activeValidatorsOuter; std::size_t const maxKeys = 40; { std::vector cfgKeys; cfgKeys.reserve(maxKeys); - hash_set unseenValidators; + HashSet unseenValidators; while (cfgKeys.size() != maxKeys) { @@ -1365,8 +1365,8 @@ private: std::size_t const n = 10; std::vector cfgKeys; cfgKeys.reserve(n); - hash_set expectedTrusted; - hash_set activeValidators; + HashSet expectedTrusted; + HashSet activeValidators; NodeID toBeSeen; while (cfgKeys.size() < n) @@ -1432,7 +1432,7 @@ private: BEAST_EXPECT(trustedKeys->load({}, emptyCfgKeys, cfgPublisherKeys)); std::vector list({randomValidator(), randomValidator()}); - hash_set activeValidators( + HashSet activeValidators( asNodeIDs({list[0].masterPublic, list[1].masterPublic})); // do not apply expired list @@ -1517,8 +1517,8 @@ private: env.journal); std::vector const cfgPublishers; - hash_set activeValidators; - hash_set activeKeys; + HashSet activeValidators; + HashSet activeKeys; std::vector cfgKeys; cfgKeys.reserve(9); @@ -1554,8 +1554,8 @@ private: auto const localKey = randomNode(); std::vector const cfgPublishers; - hash_set activeValidators; - hash_set activeKeys; + HashSet activeValidators; + HashSet activeKeys; std::vector cfgKeys{toBase58(TokenType::NodePublic, localKey)}; cfgKeys.reserve(9); @@ -1599,7 +1599,7 @@ private: app.config().legacy(Sections::kDatabasePath), env.journal); - hash_set activeValidators; + HashSet activeValidators; std::vector valKeys; valKeys.reserve(maxKeys); @@ -1668,7 +1668,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(valKeys.size() * 0.8f)); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -1687,7 +1687,7 @@ private: app.config().legacy(Sections::kDatabasePath), env.journal); - hash_set activeValidators; + HashSet activeValidators; std::vector valKeys; valKeys.reserve(maxKeys); @@ -1786,7 +1786,7 @@ private: for (auto const& val : valKeys) BEAST_EXPECT(trustedKeys->listed(val.masterPublic)); - hash_set added; + HashSet added; for (std::size_t i = 0; i < maxKeys; ++i) { auto const& val = valKeys[i]; @@ -1817,7 +1817,7 @@ private: for (auto const& val : valKeys) BEAST_EXPECT(trustedKeys->listed(val.masterPublic)); - hash_set removed; + HashSet removed; for (std::size_t i = 0; i < maxKeys; ++i) { auto const& val = valKeys[i]; @@ -1917,7 +1917,7 @@ private: env.journal); std::vector validators = {randomValidator()}; - hash_set activeValidators; + HashSet activeValidators; for (Validator const& val : validators) activeValidators.insert(calcNodeID(val.masterPublic)); // Store prepared list data to control when it is applied @@ -2060,7 +2060,7 @@ private: std::vector const cfgPublishers; std::vector cfgKeys; - hash_set activeValidators; + HashSet activeValidators; cfgKeys.reserve(vlSize); while (cfgKeys.size() < cfgKeys.capacity()) { @@ -2098,7 +2098,7 @@ private: */ { - hash_set const activeValidators; + HashSet const activeValidators; //== Combinations == std::array const unlSizes = {34, 35, 39, 60}; std::array const nUnlPercent = {0, 20, 30, 50}; @@ -2112,7 +2112,7 @@ private: { std::uint32_t const nUnlSize = us * np / 100; auto unl = validators->getTrustedMasterKeys(); - hash_set nUnl; + HashSet nUnl; auto it = unl.begin(); for (std::uint32_t i = 0; i < nUnlSize; ++i) { @@ -2141,14 +2141,14 @@ private: BEAST_EXPECT(validators); if (validators) { - hash_set activeValidators; + HashSet activeValidators; auto unl = validators->getTrustedMasterKeys(); BEAST_EXPECT(unl.size() == 60); { //-- set == get, //-- check quorum, with nUNL size: 0, 30, 18, 12 auto nUnlChange = [&](std::uint32_t nUnlSize, std::uint32_t quorum) -> bool { - hash_set nUnl; + HashSet nUnl; auto it = unl.begin(); for (std::uint32_t i = 0; i < nUnlSize; ++i) { @@ -2214,8 +2214,8 @@ private: BEAST_EXPECT(validators); if (validators) { - hash_set activeValidators; - hash_set unl = validators->getTrustedMasterKeys(); + HashSet activeValidators; + HashSet unl = validators->getTrustedMasterKeys(); auto it = unl.begin(); for (std::uint32_t i = 0; i < 50; ++i) { @@ -2229,7 +2229,7 @@ private: env.app().getOverlay(), env.app().getHashRouter()); BEAST_EXPECT(validators->quorum() == 30); - hash_set nUnl; + HashSet nUnl; it = unl.begin(); for (std::uint32_t i = 0; i < 20; ++i) { @@ -2490,7 +2490,7 @@ private: auto& app = env.app(); static constexpr std::size_t kMaxKeys = 20; - hash_set activeValidators; + HashSet activeValidators; std::vector valKeys; while (valKeys.size() != kMaxKeys) { @@ -2613,7 +2613,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -2634,7 +2634,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -2672,7 +2672,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -2692,7 +2692,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().empty()); - hash_set removed; + HashSet removed; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->listed(val.masterPublic)); @@ -2737,7 +2737,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -2757,7 +2757,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -2806,7 +2806,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -2827,7 +2827,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -2873,7 +2873,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -2893,7 +2893,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -2940,7 +2940,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -2960,7 +2960,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().empty()); - hash_set removed; + HashSet removed; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->listed(val.masterPublic)); @@ -3005,7 +3005,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3064,7 +3064,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3123,7 +3123,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3179,7 +3179,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3244,7 +3244,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3265,7 +3265,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3311,7 +3311,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3331,7 +3331,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3378,7 +3378,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3398,7 +3398,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().empty()); - hash_set removed; + HashSet removed; for (auto const& val : valKeys) { BEAST_EXPECT(!trustedKeys->listed(val.masterPublic)); @@ -3437,7 +3437,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3458,7 +3458,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3498,7 +3498,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3519,7 +3519,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3560,7 +3560,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3580,7 +3580,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().empty()); - hash_set removed; + HashSet removed; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->listed(val.masterPublic)); @@ -3621,7 +3621,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3642,7 +3642,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3684,7 +3684,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3722,7 +3722,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3768,7 +3768,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; added.insert(calcNodeID(self.masterPublic)); for (auto const& val : valKeys) { @@ -3789,7 +3789,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { @@ -3837,7 +3837,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == std::ceil(keysTotal * 0.8f)); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == keysTotal); - hash_set added; + HashSet added; for (auto const& val : valKeys) { BEAST_EXPECT(trustedKeys->trusted(val.masterPublic)); @@ -3857,7 +3857,7 @@ private: BEAST_EXPECT(trustedKeys->quorum() == kQuorumDisabled); BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1); - hash_set removed; + HashSet removed; BEAST_EXPECT(trustedKeys->trusted(self.masterPublic)); for (auto const& val : valKeys) { diff --git a/src/test/app/XChain_test.cpp b/src/test/app/XChain_test.cpp index d1f9cd2722..986653104d 100644 --- a/src/test/app/XChain_test.cpp +++ b/src/test/app/XChain_test.cpp @@ -82,14 +82,14 @@ struct SEnv } SEnv& - enableFeature(uint256 const feature) + enableFeature(UInt256 const feature) { env.enableFeature(feature); return *this; } SEnv& - disableFeature(uint256 const feature) + disableFeature(UInt256 const feature) { env.app().config().features.erase(feature); return *this; @@ -262,12 +262,12 @@ struct Balance template struct BalanceTransfer { - using balance = Balance; + using BalanceType = Balance; - balance from; - balance to; - balance payer; // pays the rewards - std::vector rewardAccounts; // receives the reward + BalanceType from; + BalanceType to; + BalanceType payer; // pays the rewards + std::vector rewardAccounts; // receives the reward XRPAmount txFees; BalanceTransfer( @@ -282,7 +282,7 @@ struct BalanceTransfer , to(env, toAcct) , payer(env, payer) , rewardAccounts([&]() { - std::vector r; + std::vector r; r.reserve(numPayees); for (size_t i = 0; i < numPayees; ++i) r.emplace_back(env, payees[i]); @@ -307,7 +307,7 @@ struct BalanceTransfer payeesReceived(STAmount const& reward) const { return std::ranges::all_of( - rewardAccounts, [&](balance const& b) { return b.diff() == reward; }); + rewardAccounts, [&](BalanceType const& b) { return b.diff() == reward; }); } bool @@ -3931,7 +3931,7 @@ private: struct BridgeCounters { - using complete_cb = std::function const& signers)>; + using CompleteCb = std::function const& signers)>; uint32_t claimId{0}; uint32_t createCount{0}; // for account create. First should be 1 @@ -3940,7 +3940,7 @@ private: uint32_t numCreateAttnSent{0}; // for current claimCount std::vector signers; - std::vector createCallbacks; + std::vector createCallbacks; }; struct Claims diff --git a/src/test/app/invariants/InvariantsAMM_test.cpp b/src/test/app/invariants/InvariantsAMM_test.cpp index 498c35c653..520205a17d 100644 --- a/src/test/app/invariants/InvariantsAMM_test.cpp +++ b/src/test/app/invariants/InvariantsAMM_test.cpp @@ -56,7 +56,7 @@ class InvariantsAMM_test : public InvariantsBase STAmount const nonZeroLP{lptIssue, 1}; auto const makeAMM = [](STAmount const& lptBalance) { - auto sleAMM = std::make_shared(keylet::amm(uint256(1))); + auto sleAMM = std::make_shared(keylet::amm(UInt256(1))); sleAMM->setFieldAmount(sfLPTokenBalance, lptBalance); return sleAMM; }; @@ -129,7 +129,7 @@ class InvariantsAMM_test : public InvariantsBase using namespace jtx; MPTID mptID{}; - uint256 ammID{}; + UInt256 ammID{}; AccountID ammAccountID{}; Account const gw{"gw"}; Issue lptIssue{}; diff --git a/src/test/app/invariants/InvariantsBase.cpp b/src/test/app/invariants/InvariantsBase.cpp index 650a21cb07..55230b2409 100644 --- a/src/test/app/invariants/InvariantsBase.cpp +++ b/src/test/app/invariants/InvariantsBase.cpp @@ -187,7 +187,7 @@ InvariantsBase::createLoanBroker( // accepts closed-ended vaults. Build one with a comfortable // subscription window; LoanBrokerSet itself is not phase-gated, // so leaving the vault in the Subscription phase is fine here. - uint256 vaultID; + UInt256 vaultID; Vault const vault{env}; auto [tx, vKeylet, _] = vault.createClosedEnded( {.owner = a, @@ -211,7 +211,7 @@ InvariantsBase::createLoanBroker( SLE::pointer InvariantsBase::makeLoanSle( - uint256 const& loanBrokerID, + UInt256 const& loanBrokerID, std::uint32_t loanSeq, AccountID const& borrower) { diff --git a/src/test/app/invariants/InvariantsBase.h b/src/test/app/invariants/InvariantsBase.h index 6b4327eb78..ea686a9761 100644 --- a/src/test/app/invariants/InvariantsBase.h +++ b/src/test/app/invariants/InvariantsBase.h @@ -128,7 +128,7 @@ protected: // rawInsert-based tests don't accidentally trip an unrelated invariant // or throw from a missing SoeDefault field. static SLE::pointer - makeLoanSle(uint256 const& loanBrokerID, std::uint32_t loanSeq, AccountID const& borrower); + makeLoanSle(UInt256 const& loanBrokerID, std::uint32_t loanSeq, AccountID const& borrower); }; } // namespace xrpl::test diff --git a/src/test/app/invariants/InvariantsEscrowNFT_test.cpp b/src/test/app/invariants/InvariantsEscrowNFT_test.cpp index f0afa2377c..6990020714 100644 --- a/src/test/app/invariants/InvariantsEscrowNFT_test.cpp +++ b/src/test/app/invariants/InvariantsEscrowNFT_test.cpp @@ -215,13 +215,13 @@ class InvariantsEscrowNFT_test : public InvariantsBase testcase << "NFTokenPage"; // lambda that returns an STArray of NFTokenIDs. - uint256 const firstNFTID( + UInt256 const firstNFTID( "0000000000000000000000000000000000000001FFFFFFFFFFFFFFFF00000000"); auto makeNFTokenIDs = [&firstNFTID](unsigned int nftCount) { SOTemplate const* nfTokenTemplate = InnerObjectFormats::getInstance().findSOTemplateBySField(sfNFToken); - uint256 nftID(firstNFTID); + UInt256 nftID(firstNFTID); STArray ret; for (int i = 0; i < nftCount; ++i) { diff --git a/src/test/app/invariants/InvariantsMPT_test.cpp b/src/test/app/invariants/InvariantsMPT_test.cpp index 91984f2021..866170dd99 100644 --- a/src/test/app/invariants/InvariantsMPT_test.cpp +++ b/src/test/app/invariants/InvariantsMPT_test.cpp @@ -1048,7 +1048,7 @@ class InvariantsMPT_test : public InvariantsBase return false; MPTIssue const mpt{makeMptID(sleAcct->getFieldU32(sfSequence), a1)}; auto sleNew = std::make_shared(keylet::mptokenIssuance(mpt.getMptID())); - sleNew->setFieldH256(sfReferenceHolding, uint256{1}); + sleNew->setFieldH256(sfReferenceHolding, UInt256{1}); ac.view().insert(sleNew); return true; }, @@ -1061,7 +1061,7 @@ class InvariantsMPT_test : public InvariantsBase // sfReferenceHolding), then mutate it in precheck to produce a // before/after pair. { - uint256 vaultKey; + UInt256 vaultKey; doInvariantCheck( {{"sfReferenceHolding was modified on an existing " "MPTokenIssuance"}}, @@ -1073,7 +1073,7 @@ class InvariantsMPT_test : public InvariantsBase ac.view().peek(keylet::mptokenIssuance(sleVault->at(sfShareMPTID))); if (!sleIssuance) return false; - sleIssuance->setFieldH256(sfReferenceHolding, uint256{2}); + sleIssuance->setFieldH256(sfReferenceHolding, UInt256{2}); ac.view().update(sleIssuance); return true; }, @@ -1103,7 +1103,7 @@ class InvariantsMPT_test : public InvariantsBase // other than a VaultDelete transaction. Set up a vault, then have // an arbitrary tx erase the pseudo's MPToken in precheck. { - uint256 vaultKey; + UInt256 vaultKey; doInvariantCheck( {{"vault pseudo-account holding deleted by a " "non-VaultDelete transaction"}}, diff --git a/src/test/app/invariants/InvariantsMisc_test.cpp b/src/test/app/invariants/InvariantsMisc_test.cpp index a0084ac530..ae5a7b23dd 100644 --- a/src/test/app/invariants/InvariantsMisc_test.cpp +++ b/src/test/app/invariants/InvariantsMisc_test.cpp @@ -329,7 +329,7 @@ class InvariantsMisc_test : public InvariantsBase // AMM special cases AccountID ammAcctID; - uint256 ammKey; + UInt256 ammKey; Issue ammIssue; doInvariantCheck( {{"account deletion left behind a DirectoryNode object"}}, @@ -656,7 +656,7 @@ class InvariantsMisc_test : public InvariantsBase Keylet const acctKeylet = keylet::account(a3); auto const sleNew = std::make_shared(acctKeylet); sleNew->setFieldU32(sfSequence, 0); - sleNew->setFieldH256(sfAMMID, uint256(1)); + sleNew->setFieldH256(sfAMMID, UInt256(1)); sleNew->setFieldU32(sfFlags, lsfDisableMaster | lsfDefaultRipple); ac.view().insert(sleNew); return true; @@ -671,7 +671,7 @@ class InvariantsMisc_test : public InvariantsBase Keylet const acctKeylet = keylet::account(a3); auto const sleNew = std::make_shared(acctKeylet); sleNew->setFieldU32(sfSequence, ac.view().seq()); - sleNew->setFieldH256(sfAMMID, uint256(1)); + sleNew->setFieldH256(sfAMMID, UInt256(1)); sleNew->setFieldU32(sfFlags, lsfDisableMaster | lsfDefaultRipple | lsfDepositAuth); ac.view().insert(sleNew); return true; @@ -686,7 +686,7 @@ class InvariantsMisc_test : public InvariantsBase Keylet const acctKeylet = keylet::account(a3); auto const sleNew = std::make_shared(acctKeylet); sleNew->setFieldU32(sfSequence, 0); - sleNew->setFieldH256(sfAMMID, uint256(1)); + sleNew->setFieldH256(sfAMMID, UInt256(1)); sleNew->setFieldU32(sfFlags, lsfDisableMaster | lsfDefaultRipple); ac.view().insert(sleNew); return true; @@ -701,7 +701,7 @@ class InvariantsMisc_test : public InvariantsBase Keylet const acctKeylet = keylet::account(a3); auto const sleNew = std::make_shared(acctKeylet); sleNew->setFieldU32(sfSequence, 0); - sleNew->setFieldH256(sfAMMID, uint256(1)); + sleNew->setFieldH256(sfAMMID, UInt256(1)); sleNew->setFieldU32( sfFlags, lsfDisableMaster | lsfDefaultRipple | lsfDepositAuth | lsfRequireDestTag); @@ -732,7 +732,7 @@ class InvariantsMisc_test : public InvariantsBase [](SLE::pointer& sle) { sle->at(sfSequence) += 1; }, [](SLE::pointer& sle) { sle->at(sfOwnerNode) += 1; }, [](SLE::pointer& sle) { sle->at(sfVaultNode) += 1; }, - [](SLE::pointer& sle) { sle->at(sfVaultID) = uint256(1u); }, + [](SLE::pointer& sle) { sle->at(sfVaultID) = UInt256(1u); }, [](SLE::pointer& sle) { sle->at(sfAccount) = sle->at(sfOwner); }, [](SLE::pointer& sle) { sle->at(sfOwner) = sle->at(sfAccount); }, [](SLE::pointer& sle) { sle->at(sfManagementFeeRate) += 1; }, @@ -1062,7 +1062,7 @@ class InvariantsMisc_test : public InvariantsBase { auto const mods = std::to_array>({ [](SLE::pointer& sle) { sle->at(sfLedgerEntryType) += 1; }, - [](SLE::pointer& sle) { sle->at(sfLedgerIndex) = uint256(1u); }, + [](SLE::pointer& sle) { sle->at(sfLedgerIndex) = UInt256(1u); }, }); for (auto const& mod : mods) @@ -1266,7 +1266,7 @@ class InvariantsMisc_test : public InvariantsBase { auto const expectMessage = "SponsoredObjectOwnerCount does not equal SponsoredOwnerCount delta."; - uint256 checkID; + UInt256 checkID; doInvariantCheck( {{expectMessage}}, @@ -1350,7 +1350,7 @@ class InvariantsMisc_test : public InvariantsBase // AMM: object deleted without its pseudo-account { - uint256 ammID{}; + UInt256 ammID{}; Account const gw{"gw"}; doInvariantCheck( Env{*this, amendments}, @@ -1457,7 +1457,7 @@ class InvariantsMisc_test : public InvariantsBase } void - visitEntry(bool, SLE::const_ref, SLE::const_ref) override + visitEntry(bool, SLE::ConstRef, SLE::ConstRef) override { if (throwFrom == ThrowFrom::VisitEntry) throw std::runtime_error("test-injected visitEntry exception"); @@ -1521,7 +1521,7 @@ class InvariantsMisc_test : public InvariantsBase struct FailingTxInvariantCheck : TxInvariantCheck { void - visitEntry(bool, SLE::const_ref, SLE::const_ref) override + visitEntry(bool, SLE::ConstRef, SLE::ConstRef) override { } diff --git a/src/test/app/invariants/InvariantsPermissioned_test.cpp b/src/test/app/invariants/InvariantsPermissioned_test.cpp index 87349fb9e1..9924da4bc7 100644 --- a/src/test/app/invariants/InvariantsPermissioned_test.cpp +++ b/src/test/app/invariants/InvariantsPermissioned_test.cpp @@ -420,7 +420,7 @@ class InvariantsPermissioned_test : public InvariantsBase [](STObject& tx) { tx.setFieldH256( sfDomainID, - uint256{"F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E33" + UInt256{"F10D0CC9A0F9A3CBF585B80BE09A186483668FDBDD39AA7E33" "70F3649CE134E5"}); Account const a1{"A1"}; tx.setFieldAmount(sfTakerPays, a1["USD"](10)); @@ -736,7 +736,7 @@ class InvariantsPermissioned_test : public InvariantsBase auto sleDir = std::make_shared(dir); sleDir->setFieldH256(sfRootIndex, dir.key); STVector256 indexes; - indexes.pushBack(uint256{1}); + indexes.pushBack(UInt256{1}); sleDir->setFieldV256(sfIndexes, indexes); sleDir->setFieldU64(sfExchangeRate, exchangeRate); return sleDir; @@ -748,7 +748,7 @@ class InvariantsPermissioned_test : public InvariantsBase auto sleDir = std::make_shared(keylet::page(rootDir, 1)); sleDir->setFieldH256(sfRootIndex, rootDir.key); STVector256 indexes; - indexes.pushBack(uint256{2}); + indexes.pushBack(UInt256{2}); sleDir->setFieldV256(sfIndexes, indexes); return sleDir; }; @@ -916,7 +916,7 @@ class InvariantsPermissioned_test : public InvariantsBase return sle; } - static std::pair + static std::pair createPermissionedDomainEnv( test::jtx::Env& env, test::jtx::Account const& a1, @@ -935,7 +935,7 @@ class InvariantsPermissioned_test : public InvariantsBase std::uint32_t const seq = env.seq(a1); env(pdomain::setTx(a1, credentials)); - uint256 const key = pdomain::getNewDomain(env.meta()); + UInt256 const key = pdomain::getNewDomain(env.meta()); return {seq, key}; } diff --git a/src/test/app/invariants/InvariantsVault_test.cpp b/src/test/app/invariants/InvariantsVault_test.cpp index e264b91cb1..0c239a1270 100644 --- a/src/test/app/invariants/InvariantsVault_test.cpp +++ b/src/test/app/invariants/InvariantsVault_test.cpp @@ -85,7 +85,7 @@ class InvariantsVault_test : public InvariantsBase AccountID borrower = beast::kZero; // Broker the created loan references. Left unset when the test does // not depend on the broker resolving to a real ledger entry. - uint256 brokerKey = beast::kZero; + UInt256 brokerKey = beast::kZero; }; struct Adjustments { @@ -217,7 +217,7 @@ class InvariantsVault_test : public InvariantsBase lp.totalValueOutstanding != 0 || lp.managementFeeOutstanding != 0; // The vault key stands in for an unset broker: it keeps the loan // keylet distinct per vault while resolving to no broker. - uint256 const brokerKey = lp.brokerKey != beast::kZero ? lp.brokerKey : keylet.key; + UInt256 const brokerKey = lp.brokerKey != beast::kZero ? lp.brokerKey : keylet.key; for (std::uint32_t seq = 1; seq <= static_cast(args.loanCount); ++seq) { @@ -494,7 +494,7 @@ class InvariantsVault_test : public InvariantsBase return false; // Note, such an "orphaned" update of MPT issuance attached to a // vault is invalid; ttVAULT_SET must also update Vault object. - sleShares->setFieldH256(sfDomainID, uint256(13)); + sleShares->setFieldH256(sfDomainID, UInt256(13)); ac.view().update(sleShares); return true; }, @@ -1672,7 +1672,7 @@ class InvariantsVault_test : public InvariantsBase doInvariantCheck( {"Loan broker does not exist"}, [&](Account const& a1, Account const& a2, ApplyContext& ac) { - auto sleLoan = makeLoanSle(uint256{}, 1, a2.id()); + auto sleLoan = makeLoanSle(UInt256{}, 1, a2.id()); ac.view().insert(sleLoan); return true; }, @@ -2042,7 +2042,7 @@ class InvariantsVault_test : public InvariantsBase sfFlags, lsfDisableMaster | lsfDefaultRipple | lsfDepositAuth); // sleAccount->setFieldH256(sfVaultID, vaultKeylet.key); // Setting wrong vault key - sleAccount->setFieldH256(sfVaultID, uint256(42)); + sleAccount->setFieldH256(sfVaultID, UInt256(42)); ac.view().insert(sleAccount); auto const sharesMptId = makeMptID(sequence, pseudoId); @@ -2665,8 +2665,8 @@ class InvariantsVault_test : public InvariantsBase // dates and satisfy the redemption-buffer gap), deposit only in Subscription / NoPhase, // withdraw not in Investment, loan origination only in Investment. - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; auto const closedEnded = std::to_underlying(VaultKind::ClosedEnded); @@ -2700,7 +2700,7 @@ class InvariantsVault_test : public InvariantsBase env(vault.deposit({.depositor = a3, .id = keylet.key, .amount = XRP(10)})); } if (advanceBySub >= 0) - env.close(tp{d{sub + advanceBySub}}); + env.close(Tp{D{sub + advanceBySub}}); return true; }; }; @@ -2936,7 +2936,7 @@ class InvariantsVault_test : public InvariantsBase // Advance parent close time into Investment so // ValidVault::finalizeLoanSet is satisfied. - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); return true; }); } @@ -3064,7 +3064,7 @@ class InvariantsVault_test : public InvariantsBase // Variant 1: L = (T - A) * 2. Fires under both settings. { - Keylet vaultKeylet = keylet::vault(uint256{}); + Keylet vaultKeylet = keylet::vault(UInt256{}); Account const issuer{"issuer_loss_gap"}; Account const borrower{"borrower_loss_gap"}; @@ -3102,7 +3102,7 @@ class InvariantsVault_test : public InvariantsBase // regression that widened it to two units would silently accept // this state. { - Keylet vaultKeylet = keylet::vault(uint256{}); + Keylet vaultKeylet = keylet::vault(UInt256{}); Account const issuer{"issuer_loss_gap2"}; Account const borrower{"borrower_loss_gap2"}; diff --git a/src/test/app/lending/LendingHelpers_test.cpp b/src/test/app/lending/LendingHelpers_test.cpp index c509469de9..fe796d3244 100644 --- a/src/test/app/lending/LendingHelpers_test.cpp +++ b/src/test/app/lending/LendingHelpers_test.cpp @@ -1594,7 +1594,7 @@ class LendingHelpers_test : public beast::unit_test::Suite Number const& principalOutstanding, Number const& managementFeeOutstanding) { - auto sle = std::make_shared(ltLOAN, uint256{1u}); + auto sle = std::make_shared(ltLOAN, UInt256{1u}); sle->at(sfTotalValueOutstanding) = totalValueOutstanding; sle->at(sfPrincipalOutstanding) = principalOutstanding; sle->at(sfManagementFeeOutstanding) = managementFeeOutstanding; @@ -1609,7 +1609,7 @@ class LendingHelpers_test : public beast::unit_test::Suite std::optional assetsMaximum = std::nullopt, std::optional assetsTotal = std::nullopt) { - auto sle = std::make_shared(ltVAULT, uint256{2u}); + auto sle = std::make_shared(ltVAULT, UInt256{2u}); if (leVersion) sle->at(sfLEVersion) = std::to_underlying(*leVersion); if (assetsMaximum) @@ -1861,7 +1861,7 @@ public: for (auto const& tc : testCases) { testcase("canApplyToBrokerCover: " + tc.name); - auto sle = std::make_shared(ltLOAN_BROKER, uint256{1u}); + auto sle = std::make_shared(ltLOAN_BROKER, UInt256{1u}); sle->at(sfCoverAvailable) = tc.coverAvailable; BEAST_EXPECT( canApplyToBrokerCover(*env.current(), sle, iou, tc.amount, env.journal, "test") == @@ -1872,7 +1872,7 @@ public: { testcase("canApplyToBrokerCover: amendment disabled"); Env const envOff{*this, testableAmendments() - fixCleanup3_2_0}; - auto sle = std::make_shared(ltLOAN_BROKER, uint256{1u}); + auto sle = std::make_shared(ltLOAN_BROKER, UInt256{1u}); sle->at(sfCoverAvailable) = Number{10}; BEAST_EXPECT( canApplyToBrokerCover( diff --git a/src/test/app/lending/LoanBroker_test.cpp b/src/test/app/lending/LoanBroker_test.cpp index 3bcda42c7e..2f8f71c060 100644 --- a/src/test/app/lending/LoanBroker_test.cpp +++ b/src/test/app/lending/LoanBroker_test.cpp @@ -133,9 +133,9 @@ class LoanBroker_test : public beast::unit_test::Suite struct VaultInfo { jtx::PrettyAsset asset; - uint256 vaultID; + UInt256 vaultID; jtx::Account pseudoAccount; - VaultInfo(jtx::PrettyAsset const& asset, uint256 const& vaultId, AccountID const& pseudo) + VaultInfo(jtx::PrettyAsset const& asset, UInt256 const& vaultId, AccountID const& pseudo) : asset(asset), vaultID(vaultId), pseudoAccount("vault", pseudo) { } @@ -152,9 +152,9 @@ class LoanBroker_test : public beast::unit_test::Suite VaultInfo const& vault, VaultInfo const& badVault, std::function modifyJTx, - std::function checkBroker, - std::function changeBroker, - std::function checkChangedBroker) + std::function checkBroker, + std::function changeBroker, + std::function checkChangedBroker) { { auto const& asset = vault.asset.raw(); @@ -307,7 +307,7 @@ class LoanBroker_test : public beast::unit_test::Suite }; // Test Cover funding before allowing alterations - env(coverDeposit(alice, uint256(0), vault.asset(10)), Ter(temINVALID)); + env(coverDeposit(alice, UInt256(0), vault.asset(10)), Ter(temINVALID)); env(coverDeposit(evan, keylet.key, vault.asset(10)), Ter(tecNO_PERMISSION)); env(coverDeposit(evan, keylet.key, vault.asset(0)), Ter(temBAD_AMOUNT)); env(coverDeposit(evan, keylet.key, vault.asset(-10)), Ter(temBAD_AMOUNT)); @@ -318,7 +318,7 @@ class LoanBroker_test : public beast::unit_test::Suite // Test cover clawback failure cases BEFORE depositing any cover // Need one of brokerID or amount env(coverClawback(alice), Ter(temINVALID)); - env(coverClawback(alice), kLoanBrokerId(uint256(0)), Ter(temINVALID)); + env(coverClawback(alice), kLoanBrokerId(UInt256(0)), Ter(temINVALID)); env(coverClawback(alice), kAmount(XRP(1000)), Ter(temBAD_AMOUNT)); env(coverClawback(alice), kAmount(vault.asset(-10)), Ter(temBAD_AMOUNT)); // Clawbacks with an MPT need to specify the broker ID @@ -377,7 +377,7 @@ class LoanBroker_test : public beast::unit_test::Suite verifyCoverAmount(10); // Test withdrawal failure cases - env(coverWithdraw(alice, uint256(0), vault.asset(10)), Ter(temINVALID)); + env(coverWithdraw(alice, UInt256(0), vault.asset(10)), Ter(temINVALID)); env(coverWithdraw(evan, keylet.key, vault.asset(10)), Ter(tecNO_PERMISSION)); env(coverWithdraw(evan, keylet.key, vault.asset(0)), Ter(temBAD_AMOUNT)); env(coverWithdraw(evan, keylet.key, vault.asset(-10)), Ter(temBAD_AMOUNT)); @@ -736,7 +736,7 @@ class LoanBroker_test : public beast::unit_test::Suite badVault, // No modifications {}, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Extra checks BEAST_EXPECT(!broker->isFieldPresent(sfManagementFeeRate)); BEAST_EXPECT(!broker->isFieldPresent(sfCoverRateMinimum)); @@ -749,7 +749,7 @@ class LoanBroker_test : public beast::unit_test::Suite BEAST_EXPECT(env.ownerCount(alice) == aliceOriginalCount + 4); }, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Modifications // Update the fields @@ -810,7 +810,7 @@ class LoanBroker_test : public beast::unit_test::Suite kData(testData), kDebtMaximum(debtMax)); }, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Check the updated fields BEAST_EXPECT(checkVL(broker->at(sfData), testData)); Number const expected = STAmount{vault.asset, Number(175, -1)}; @@ -841,7 +841,7 @@ class LoanBroker_test : public beast::unit_test::Suite kCoverRateMinimum(TenthBips32(100)), kCoverRateLiquidation(TenthBips32(200))); }, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Extra checks BEAST_EXPECT(broker->at(sfManagementFeeRate) == 123); BEAST_EXPECT(broker->at(sfCoverRateMinimum) == 100); @@ -849,14 +849,14 @@ class LoanBroker_test : public beast::unit_test::Suite BEAST_EXPECT(broker->at(sfDebtMaximum) == Number(9)); BEAST_EXPECT(checkVL(broker->at(sfData), testData)); }, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Reset Data & Debt maximum to default values env(set(alice, vault.vaultID), kLoanBrokerId(broker->key()), kData(""), kDebtMaximum(Number(0))); }, - [&](SLE::const_ref broker) { + [&](SLE::ConstRef broker) { // Check the updated fields BEAST_EXPECT(!broker->isFieldPresent(sfData)); BEAST_EXPECT(!broker->isFieldPresent(sfDebtMaximum)); @@ -904,7 +904,7 @@ class LoanBroker_test : public beast::unit_test::Suite return VaultInfo{asset, vaultKeylet.key, le->at(sfAccount)}; return VaultInfo{asset, {}, {}}; }(); - if (vaultInfo.vaultID == uint256{}) + if (vaultInfo.vaultID == UInt256{}) return; env(vault.deposit({.depositor = alice, .id = vaultKeylet.key, .amount = asset(50)})); @@ -925,7 +925,7 @@ class LoanBroker_test : public beast::unit_test::Suite jv[sfLoanBrokerID] = ""; env(jv, Ter(temINVALID)); // zero broker ID - jv[sfLoanBrokerID] = to_string(uint256{}); + jv[sfLoanBrokerID] = to_string(UInt256{}); // needs a flag to distinguish the parsed STTx from the prior // test env(jv, Txflags(tfFullyCanonicalSig), Ter(temINVALID)); @@ -936,7 +936,7 @@ class LoanBroker_test : public beast::unit_test::Suite jv[sfVaultID] = ""; env(jv, Ter(temINVALID)); // zero broker ID - jv[sfVaultID] = to_string(uint256{}); + jv[sfVaultID] = to_string(UInt256{}); // needs a flag to distinguish the parsed STTx from the prior // test env(jv, Txflags(tfFullyCanonicalSig), Ter(temINVALID)); @@ -1304,7 +1304,7 @@ class LoanBroker_test : public beast::unit_test::Suite return VaultInfo{asset, vaultKeylet.key, le->at(sfAccount)}; return VaultInfo{asset, {}, {}}; }(); - if (vaultInfo.vaultID == uint256{}) + if (vaultInfo.vaultID == UInt256{}) return; // Can't unauthorize Vault pseudo-account @@ -1411,7 +1411,7 @@ class LoanBroker_test : public beast::unit_test::Suite return VaultInfo{asset, vaultKeylet.key, le->at(sfAccount)}; return VaultInfo{asset, {}, {}}; }(); - if (vaultInfo.vaultID == uint256{}) + if (vaultInfo.vaultID == UInt256{}) return; env(vault.deposit({.depositor = alice, .id = vaultKeylet.key, .amount = asset(50)})); diff --git a/src/test/app/lending/LoanCashBasis_test.cpp b/src/test/app/lending/LoanCashBasis_test.cpp index f9f5948db9..63a4050ed2 100644 --- a/src/test/app/lending/LoanCashBasis_test.cpp +++ b/src/test/app/lending/LoanCashBasis_test.cpp @@ -265,7 +265,7 @@ private: using namespace jtx; using namespace loan; using namespace std::chrono_literals; - using tp = NetClock::time_point; + using Tp = NetClock::time_point; PrettyAsset const xrpAsset{xrpIssue(), 1'000'000}; BrokerParameters const brokerParams{ @@ -295,7 +295,7 @@ private: auto runPayment = [&](FeatureBitset features, std::uint32_t loanSetFlags, std::uint32_t payFlags, - std::function const& advanceTime, + std::function const& advanceTime, std::function const& paymentAmount) { Env env(*this, features); @@ -410,7 +410,7 @@ private: // ---- Regular, on-time payment ---- { - auto const noAdvance = [](Env& env, tp const&) { env.close(); }; + auto const noAdvance = [](Env& env, Tp const&) { env.close(); }; auto const regularAmount = [&](LoanState const& state) { return STAmount{ xrpAsset, @@ -436,7 +436,7 @@ private: // ---- Late payment ---- { - auto const advancePastDue = [&](Env& env, tp const& startDate) { + auto const advancePastDue = [&](Env& env, Tp const& startDate) { env.close(startDate + std::chrono::seconds(paymentInterval + 1)); }; auto const lateAmount = [&](LoanState const& state) { @@ -459,7 +459,7 @@ private: // ---- Overpayment ---- { - auto const noAdvance = [](Env& env, tp const&) { env.close(); }; + auto const noAdvance = [](Env& env, Tp const&) { env.close(); }; auto const overpayAmount = [&](LoanState const& state) { // One regular period, plus a generous extra principal // paydown. @@ -483,7 +483,7 @@ private: // ---- Full payment ---- { - auto const noAdvance = [](Env& env, tp const&) { env.close(); }; + auto const noAdvance = [](Env& env, Tp const&) { env.close(); }; auto const fullAmount = [&](LoanState const&) { // Generously large: full payment only ever consumes exactly // what's due (principal + accrued interest; close fee/ diff --git a/src/test/app/lending/LoanCoverFreezeAuth_test.cpp b/src/test/app/lending/LoanCoverFreezeAuth_test.cpp index f8bdb5a3d7..06b3d1107d 100644 --- a/src/test/app/lending/LoanCoverFreezeAuth_test.cpp +++ b/src/test/app/lending/LoanCoverFreezeAuth_test.cpp @@ -400,13 +400,13 @@ private: auto const loanKeylet = keylet::loan(brokerInfo.brokerID, SeqProxy::rawSequence(1)); - using tp = NetClock::time_point; - using d = NetClock::duration; + using Tp = NetClock::time_point; + using D = NetClock::duration; // Get past the grace period so the loan is defaultable. if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { - env.close(tp{d{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); + env.close(Tp{D{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); } // Global freeze trips the post-apply TransfersNotFrozen invariant. @@ -476,11 +476,11 @@ private: env(pay(borrower, loanKeylet.key, debtMaximumRequest), Ter(tecLOCKED)); env.close(); - using tp = NetClock::time_point; - using d = NetClock::duration; + using Tp = NetClock::time_point; + using D = NetClock::duration; if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { - env.close(tp{d{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); + env.close(Tp{D{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); } // Pre-fixCleanup3_4_0 the ValidMPTTransfer invariant blocks the @@ -525,13 +525,13 @@ private: auto const loanKeylet = keylet::loan(brokerInfo.brokerID, SeqProxy::rawSequence(1)); - using tp = NetClock::time_point; - using d = NetClock::duration; + using Tp = NetClock::time_point; + using D = NetClock::duration; // Get past the grace period so the loan is defaultable. if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { - env.close(tp{d{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); + env.close(Tp{D{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); } // The default moves First-Loss Capital off the broker pseudo-account, diff --git a/src/test/app/lending/LoanLifecycle_test.cpp b/src/test/app/lending/LoanLifecycle_test.cpp index 45420529c6..ed96b22b2b 100644 --- a/src/test/app/lending/LoanLifecycle_test.cpp +++ b/src/test/app/lending/LoanLifecycle_test.cpp @@ -274,7 +274,7 @@ private: return loan["index"].asString(); }(); - auto const loanKeylet{keylet::loan(uint256{std::string_view(loanID)})}; + auto const loanKeylet{keylet::loan(UInt256{std::string_view(loanID)})}; env.close(startDate); diff --git a/src/test/app/lending/LoanMisc_test.cpp b/src/test/app/lending/LoanMisc_test.cpp index 7c4db3e2bf..c17d7a7e53 100644 --- a/src/test/app/lending/LoanMisc_test.cpp +++ b/src/test/app/lending/LoanMisc_test.cpp @@ -438,7 +438,7 @@ public: class LoanBatch_test : public LoanTestBase { protected: - beast::xor_shift_engine engine_; + beast::XorShiftEngine engine_; std::uniform_int_distribution<> assetDist_{0, 2}; std::uniform_int_distribution principalDist_{100'000, 1'000'000'000}; diff --git a/src/test/app/lending/LoanPay_test.cpp b/src/test/app/lending/LoanPay_test.cpp index 7cd31b7988..30362bdd9a 100644 --- a/src/test/app/lending/LoanPay_test.cpp +++ b/src/test/app/lending/LoanPay_test.cpp @@ -104,9 +104,9 @@ private: if (!BEAST_EXPECT(state1.paymentRemaining > 1)) return; - using d = NetClock::duration; - using tp = NetClock::time_point; - auto const overdueClose = tp{d{state1.nextPaymentDate + state1.paymentInterval}}; + using D = NetClock::duration; + using Tp = NetClock::time_point; + auto const overdueClose = Tp{D{state1.nextPaymentDate + state1.paymentInterval}}; env.close(overdueClose); auto const brokerSle = env.le(keylet::loanBroker(broker.brokerID)); @@ -526,9 +526,9 @@ private: auto const loanSetFee = Fee(env.current()->fees().base * 2); - using timeType = decltype(sfNextPaymentDueDate)::type::value_type; - static_assert(std::is_same_v); - constexpr timeType kMaxTime = std::numeric_limits::max(); + using TimeType = decltype(sfNextPaymentDueDate)::type::value_type; + static_assert(std::is_same_v); + constexpr TimeType kMaxTime = std::numeric_limits::max(); static_assert(kMaxTime == 4'294'967'295); auto const baseJson = [&]() { diff --git a/src/test/app/lending/LoanSecurity_test.cpp b/src/test/app/lending/LoanSecurity_test.cpp index 54c972b505..1fbb694d1b 100644 --- a/src/test/app/lending/LoanSecurity_test.cpp +++ b/src/test/app/lending/LoanSecurity_test.cpp @@ -239,7 +239,7 @@ private: closePaymentFee}; // Collect vault NAV before closing payment - auto const vaultId2 = brokerSle2 ? brokerSle2->at(sfVaultID) : uint256{}; + auto const vaultId2 = brokerSle2 ? brokerSle2->at(sfVaultID) : UInt256{}; auto const vaultKey2 = keylet::vault(vaultId2); auto const vaultBefore = env.le(vaultKey2); BEAST_EXPECT(vaultBefore); @@ -331,13 +331,13 @@ private: auto broker = std::get(*loanResult); auto loanKeylet = std::get(*loanResult); - using tp = NetClock::time_point; - using d = NetClock::duration; + using Tp = NetClock::time_point; + using D = NetClock::duration; auto state = getCurrentState(env, broker, loanKeylet); if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { - env.close(tp{d{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); + env.close(Tp{D{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); } topUpBorrower(env, broker, issuer, borrower, state, loanParams.serviceFee); @@ -681,7 +681,7 @@ private: auto createNewLoan = [&]() { auto const sleBroker = env.le(keylet::loanBroker(broker.brokerID)); if (!BEAST_EXPECT(sleBroker)) - return keylet::loan(uint256{}); + return keylet::loan(UInt256{}); auto const lk = keylet::loan(broker.brokerID, SeqProxy::rawSequence(sleBroker->at(sfLoanSequence))); env(set(borrower, broker.brokerID, broker.asset(principalRequest).value()), diff --git a/src/test/app/lending/LoanSet_test.cpp b/src/test/app/lending/LoanSet_test.cpp index 469c1662ad..a7ea44be07 100644 --- a/src/test/app/lending/LoanSet_test.cpp +++ b/src/test/app/lending/LoanSet_test.cpp @@ -704,8 +704,8 @@ private: testcase("LoanSet closed-ended: phase and maturity bound"); using namespace jtx; using namespace loan; - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; Account const issuer{"issuer"}; Account const lender{"lender"}; @@ -754,9 +754,9 @@ private: auto const broker = createVaultAndBroker( env, asset, lender, BrokerParameters{.vaultKind = VaultKind::ClosedEnded}); BEAST_EXPECT(broker.redemptionDate.has_value()); - using d = NetClock::duration; - using tp = NetClock::time_point; - env.close(tp{d{*broker.redemptionDate + 1}}); + using D = NetClock::duration; + using Tp = NetClock::time_point; + env.close(Tp{D{*broker.redemptionDate + 1}}); setLoan(env, broker, tecEXPIRED); }); @@ -852,7 +852,7 @@ private: }; // First Investment ledger: the minimum schedule still clears the buffer. - env.close(tp{d{*broker.subscriptionDate + 1}}); + env.close(Tp{D{*broker.subscriptionDate + 1}}); BEAST_EXPECT(startDate() > *broker.subscriptionDate); BEAST_EXPECT(startDate() + LoanSet::kMinPaymentInterval + kLoanRedemptionBuffer <= red); minLoan(tesSUCCESS); diff --git a/src/test/app/lending/LoanTestBase.h b/src/test/app/lending/LoanTestBase.h index ab74ab6811..481b5e020c 100644 --- a/src/test/app/lending/LoanTestBase.h +++ b/src/test/app/lending/LoanTestBase.h @@ -150,8 +150,8 @@ protected: struct BrokerInfo { jtx::PrettyAsset asset; - uint256 brokerID; - uint256 vaultID; + UInt256 brokerID; + UInt256 vaultID; BrokerParameters params; // Absolute dates resolved by createVaultAndBroker when params.vaultKind // is ClosedEnded; std::nullopt for open-ended vaults. @@ -553,9 +553,9 @@ protected: // run in the Investment phase (unless the caller explicitly asked to stay in Subscription). if (subscriptionDate && !params.skipPhaseAdvance) { - using d = NetClock::duration; - using tp = NetClock::time_point; - env.close(tp{d{*subscriptionDate + 1}}); + using D = NetClock::duration; + using Tp = NetClock::time_point; + env.close(Tp{D{*subscriptionDate + 1}}); } auto const keylet = keylet::loanBroker(lender.id(), SeqProxy::rawSequence(env.seq(lender))); @@ -582,15 +582,15 @@ protected: LoanState getCurrentState(jtx::Env const& env, BrokerInfo const& broker, Keylet const& loanKeylet) { - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; // Lookup the current loan state if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { return LoanState{ .previousPaymentDate = loan->at(sfPreviousPaymentDueDate), - .startDate = tp{d{loan->at(sfStartDate)}}, + .startDate = Tp{D{loan->at(sfStartDate)}}, .nextPaymentDate = loan->at(sfNextPaymentDueDate), .paymentRemaining = loan->at(sfPaymentRemaining), .loanScale = loan->at(sfLoanScale), @@ -618,12 +618,12 @@ protected: VerifyLoanStatus const& verifyLoanStatus) { using namespace std::chrono_literals; - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; auto const state = getCurrentState(env, broker, loanKeylet); BEAST_EXPECT(state.previousPaymentDate == 0); - BEAST_EXPECT(tp{d{state.nextPaymentDate}} == state.startDate + 600s); + BEAST_EXPECT(Tp{D{state.nextPaymentDate}} == state.startDate + 600s); BEAST_EXPECT(state.paymentRemaining == 12); BEAST_EXPECT(state.principalOutstanding == broker.asset(1000).value()); BEAST_EXPECT( @@ -1020,7 +1020,7 @@ protected: using namespace jtx; using namespace jtx::loan; using namespace std::chrono_literals; - using d = NetClock::duration; + using D = NetClock::duration; bool const showStepBalances = paymentParams.showStepBalances; @@ -1226,7 +1226,7 @@ protected: // Make the payment env(pay(borrower, loanKeylet.key, transactionAmount, paymentParams.flags)); - env.close(d{state.paymentInterval / 2}); + env.close(D{state.paymentInterval / 2}); if (paymentParams.validateBalances) { @@ -1759,8 +1759,8 @@ protected: using namespace loan; using namespace std::chrono_literals; - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; Account const issuer{"issuer"}; // For simplicity, lender will be the sole actor for the vault & @@ -2163,7 +2163,7 @@ protected: // Finally! Create a loan - auto coverAvailable = [&env, this](uint256 const& brokerID, Number const& expected) { + auto coverAvailable = [&env, this](UInt256 const& brokerID, Number const& expected) { if (auto const brokerSle = env.le(keylet::loanBroker(brokerID)); BEAST_EXPECT(brokerSle)) { @@ -2252,7 +2252,7 @@ protected: verifyLoanStatus(state); } - auto const nextDueDate = tp{d{state.nextPaymentDate}}; + auto const nextDueDate = Tp{D{state.nextPaymentDate}}; // Can't default the loan yet. The grace period hasn't // expired @@ -2300,7 +2300,7 @@ protected: verifyLoanStatus(state); // Send some bogus pay transactions - env(pay(borrower, keylet::loan(uint256(0)).key, broker.asset(10), txFlags), + env(pay(borrower, keylet::loan(UInt256(0)).key, broker.asset(10), txFlags), Ter(temINVALID)); // broker.asset(80) is less than a single payment, but all these // checks fail before that matters @@ -2967,13 +2967,13 @@ protected: if (!BEAST_EXPECT(timed)) return; - using clock_type = std::chrono::steady_clock; - using duration_type = std::chrono::milliseconds; + using ClockType = std::chrono::steady_clock; + using DurationType = std::chrono::milliseconds; - auto const start = clock_type::now(); + auto const start = ClockType::now(); timed(); auto const duration = - std::chrono::duration_cast(clock_type::now() - start); + std::chrono::duration_cast(ClockType::now() - start); log << label << " took " << duration.count() << "ms" << std::endl; diff --git a/src/test/app/lending/LoanValidation_test.cpp b/src/test/app/lending/LoanValidation_test.cpp index 566633b690..701f2cad2b 100644 --- a/src/test/app/lending/LoanValidation_test.cpp +++ b/src/test/app/lending/LoanValidation_test.cpp @@ -158,7 +158,7 @@ private: } // empty/zero broker ID { - auto jv = set(borrower, uint256{}, debtMaximumRequest); + auto jv = set(borrower, UInt256{}, debtMaximumRequest); auto testZeroBrokerID = [&](std::string const& id, std::uint32_t flags = 0) { // empty broker ID @@ -174,7 +174,7 @@ private: // zero broker ID // needs a flag to distinguish the parsed STTx from the prior // test - testZeroBrokerID(to_string(uint256{}), tfFullyCanonicalSig); + testZeroBrokerID(to_string(UInt256{}), tfFullyCanonicalSig); } // preflightCheckSigningKey() failure: diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index 39289a6264..fa424c53de 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -158,7 +158,7 @@ public: // ledger, so a placeholder LoanBrokerID is enough. checkBothDirections([&](Env& env) { return env.jt( - loan::set(alice, uint256{1}, Number{1}), + loan::set(alice, UInt256{1}, Number{1}), loan::kCounterparty(counterparty), Fee(XRP(1)), Sig(sfCounterpartySignature, counterparty)); diff --git a/src/test/app/vault/VaultBugs_test.cpp b/src/test/app/vault/VaultBugs_test.cpp index 43f2b0354c..a32c09ebbf 100644 --- a/src/test/app/vault/VaultBugs_test.cpp +++ b/src/test/app/vault/VaultBugs_test.cpp @@ -2440,7 +2440,7 @@ private: // Inclusive SubscriptionDate boundary: still Subscription, so an // ordinary withdrawal is allowed. - closeToTime(env, tp{d{subscriptionDate}}); + closeToTime(env, Tp{D{subscriptionDate}}); auto const vaultBefore = env.le(vaultKeylet); if (!BEAST_EXPECT(vaultBefore)) diff --git a/src/test/app/vault/VaultClosedEnded_test.cpp b/src/test/app/vault/VaultClosedEnded_test.cpp index 6909a1bffa..8fbc40277f 100644 --- a/src/test/app/vault/VaultClosedEnded_test.cpp +++ b/src/test/app/vault/VaultClosedEnded_test.cpp @@ -430,21 +430,21 @@ private: // Boundary: parent close time exactly at SubscriptionDate must still // be Subscription. - closeToTime(env, tp{d{sub}}); + closeToTime(env, Tp{D{sub}}); runTest(tesSUCCESS, tesSUCCESS); // One second past SubscriptionDate: Investment. - closeToTime(env, tp{d{sub}} + getLedgerTimeResolution(env)); + closeToTime(env, Tp{D{sub}} + getLedgerTimeResolution(env)); runTest(tecEXPIRED, tecTOO_SOON); // Any point strictly before RedemptionDate remains Investment. - closeToTime(env, tp{d{red}} - getLedgerTimeResolution(env)); + closeToTime(env, Tp{D{red}} - getLedgerTimeResolution(env)); runTest(tecEXPIRED, tecTOO_SOON); // Boundary: parent close time == RedemptionDate is Redemption (per // spec table: now >= RedemptionDate). Deposits are rejected but // withdrawals succeed. - closeToTime(env, tp{d{red}}); + closeToTime(env, Tp{D{red}}); runTest(tecEXPIRED, tesSUCCESS); env.close(); } @@ -479,7 +479,7 @@ private: // Advance the clock through a wide range of ledger times: an open-ended vault's phase // must be NoPhase at every one of them, because the derivation short-circuits on // VaultKind::OpenEnded before it looks at any dates. - auto const ledgerTime = tp{d{30}} + env.closed()->header().closeTimeResolution; + auto const ledgerTime = Tp{D{30}} + env.closed()->header().closeTimeResolution; checkPhaseAt(ledgerTime); checkPhaseAt(ledgerTime + std::chrono::seconds{kMinInvestmentPeriod}); checkPhaseAt( @@ -520,11 +520,11 @@ private: deposit(tesSUCCESS); // Investment: rejected. - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); deposit(tecEXPIRED); // Redemption: rejected. - env.close(tp{d{red}}); + env.close(Tp{D{red}}); deposit(tecEXPIRED); } @@ -581,7 +581,7 @@ private: withdraw(XRP(1).value(), tesSUCCESS); // Investment: rejected. - closeToTime(env, tp{d{sub}} + getLedgerTimeResolution(env)); + closeToTime(env, Tp{D{sub}} + getLedgerTimeResolution(env)); withdraw(XRP(1).value(), tecTOO_SOON); // Deploy capital: borrower takes a loan of XRP(60) against the @@ -600,7 +600,7 @@ private: // withdrawal within AssetsAvailable succeeds. A withdrawal within the depositor's share // value but exceeding the vault's liquid balance fails with tecINSUFFICIENT_FUNDS from the // vault-shortage guard (not the insufficient-shares guard). - closeToTime(env, tp{d{red}}); + closeToTime(env, Tp{D{red}}); withdraw(XRP(10).value(), tesSUCCESS); withdraw(XRP(80).value(), tecINSUFFICIENT_FUNDS); } @@ -687,7 +687,7 @@ private: env.close(); // ---- Investment phase (now == sub + 1) ---- - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); // Deposits into a closed-ended vault past SubscriptionDate return tecEXPIRED. env(vault.deposit({.depositor = alice, .id = keylet.key, .amount = XRP(10).value()}), @@ -729,7 +729,7 @@ private: sharesEq(bob, 200'000'000); // ---- Redemption phase (now == red) ---- - env.close(tp{d{red}}); + env.close(Tp{D{red}}); // Deposits into a closed-ended vault past SubscriptionDate return tecEXPIRED, in both // Investment and Redemption. @@ -800,7 +800,7 @@ private: // Investment phase: originate a zero-interest, single-payment loan // with a 300s payment interval and 60s grace. The payment is due // shortly after origination and well before RedemptionDate. - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); env(loan::set(borrower, brokerKeylet.key, XRP(60).value()), loan::kInterestRate(TenthBips32(0)), kGracePeriod(60), @@ -814,7 +814,7 @@ private: // Advance to Redemption. The payment is now past its due date and // grace, and the vault is no longer in Investment. - closeToTime(env, tp{d{red}}); + closeToTime(env, Tp{D{red}}); env(loan::pay(borrower, loanKeylet.key, XRP(60).value(), tfLoanLatePayment)); env.close(); @@ -866,7 +866,7 @@ private: env(loan_broker::set(owner, keylet.key)); env.close(); - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); auto const originate = [&](Account const& b, STAmount const& principal) { env(loan::set(b, brokerKeylet.key, principal), @@ -922,7 +922,7 @@ private: } // Redemption: both depositors withdraw in full. - env.close(tp{d{red}}); + env.close(Tp{D{red}}); env(vault.withdraw({.depositor = alice, .id = keylet.key, .amount = XRP(100).value()})); env.close(); env(vault.withdraw({.depositor = bob, .id = keylet.key, .amount = XRP(100).value()})); @@ -973,14 +973,14 @@ private: totalsEq(iou(290).value()); // Investment phase clawback. - env.close(tp{d{sub + 1}}); + env.close(Tp{D{sub + 1}}); env(vault.clawback( {.issuer = issuer, .id = keylet.key, .holder = alice, .amount = iou(10).value()})); env.close(); totalsEq(iou(280).value()); // Redemption phase clawback. - env.close(tp{d{red}}); + env.close(Tp{D{red}}); env(vault.clawback( {.issuer = issuer, .id = keylet.key, .holder = alice, .amount = iou(10).value()})); env.close(); diff --git a/src/test/app/vault/VaultDomain_test.cpp b/src/test/app/vault/VaultDomain_test.cpp index 5e058a13a8..c7bbbcaa2c 100644 --- a/src/test/app/vault/VaultDomain_test.cpp +++ b/src/test/app/vault/VaultDomain_test.cpp @@ -496,7 +496,7 @@ private: env.close(); auto const [vaultAccount, issuanceId] = - [&env, keylet = keylet, this]() -> std::tuple { + [&env, keylet = keylet, this]() -> std::tuple { auto const vault = env.le(keylet); BEAST_EXPECT(vault != nullptr); return {vault->at(sfAccount), vault->at(sfShareMPTID)}; diff --git a/src/test/app/vault/VaultHelpers_test.cpp b/src/test/app/vault/VaultHelpers_test.cpp index d52b732a60..b044ac6934 100644 --- a/src/test/app/vault/VaultHelpers_test.cpp +++ b/src/test/app/vault/VaultHelpers_test.cpp @@ -66,7 +66,7 @@ private: static std::shared_ptr makeVault(Asset const& asset, Number const& assetsTotal) { - auto vault = std::make_shared(keylet::vault(uint256(1))); + auto vault = std::make_shared(keylet::vault(UInt256(1))); vault->setFieldIssue(sfAsset, STIssue{sfAsset, asset}); vault->at(sfAssetsTotal) = assetsTotal; associateAsset(*vault, asset); diff --git a/src/test/app/vault/VaultPrecisionFixture.h b/src/test/app/vault/VaultPrecisionFixture.h index 22a3276fdf..bab6070b3c 100644 --- a/src/test/app/vault/VaultPrecisionFixture.h +++ b/src/test/app/vault/VaultPrecisionFixture.h @@ -65,10 +65,10 @@ protected: // Keylet has no default constructor. Fill with an obviously // meaningless placeholder; setupSingleLoanVault overwrites the // fields that matter. - Keylet vaultKeylet{ltACCOUNT_ROOT, uint256{}}; - Keylet loan1Keylet{ltACCOUNT_ROOT, uint256{}}; + Keylet vaultKeylet{ltACCOUNT_ROOT, UInt256{}}; + Keylet loan1Keylet{ltACCOUNT_ROOT, UInt256{}}; // Only meaningful when impairAndPaySibling == true. - Keylet loan2Keylet{ltACCOUNT_ROOT, uint256{}}; + Keylet loan2Keylet{ltACCOUNT_ROOT, UInt256{}}; jtx::Account vaultAccount{"vp_vault_pseudo_placeholder"}; MPTID share; }; diff --git a/src/test/app/vault/VaultRPC_test.cpp b/src/test/app/vault/VaultRPC_test.cpp index dbceb1cb9c..7404e584ab 100644 --- a/src/test/app/vault/VaultRPC_test.cpp +++ b/src/test/app/vault/VaultRPC_test.cpp @@ -169,7 +169,7 @@ private: testcase("RPC ledger_entry cannot find vault by key"); json::Value jvParams; jvParams[jss::ledger_index] = jss::validated; - jvParams[jss::vault] = to_string(uint256(42)); + jvParams[jss::vault] = to_string(UInt256(42)); auto jvVault = env.rpc("json", "ledger_entry", to_string(jvParams)); BEAST_EXPECT(jvVault[jss::result][jss::error].asString() == "entryNotFound"); } @@ -333,7 +333,7 @@ private: testcase("RPC vault_info json all zero vault_id"); json::Value jvParams; jvParams[jss::ledger_index] = jss::validated; - jvParams[jss::vault_id] = strHex(uint256(beast::kZero)); + jvParams[jss::vault_id] = strHex(UInt256(beast::kZero)); auto jv = env.rpc("json", "vault_info", to_string(jvParams)); checkError(jv[jss::result], "entryNotFound", RpcEntryNotFound, "Entry not found."); } @@ -511,7 +511,7 @@ private: { testcase("RPC vault_info command line unknown index"); - json::Value jv = env.rpc("vault_info", strHex(uint256(42)), "validated"); + json::Value jv = env.rpc("vault_info", strHex(UInt256(42)), "validated"); checkError(jv[jss::result], "entryNotFound", RpcEntryNotFound, "Entry not found."); } diff --git a/src/test/app/vault/VaultShares_test.cpp b/src/test/app/vault/VaultShares_test.cpp index 037ee3e057..b27d6d45f7 100644 --- a/src/test/app/vault/VaultShares_test.cpp +++ b/src/test/app/vault/VaultShares_test.cpp @@ -324,7 +324,7 @@ private: using namespace test::jtx; auto readReferenceHolding = [&](Env const& env, - Keylet const& vaultKeylet) -> std::optional { + Keylet const& vaultKeylet) -> std::optional { auto const sleVault = env.le(vaultKeylet); if (!sleVault) return std::nullopt; diff --git a/src/test/app/vault/VaultSoleShareholder_test.cpp b/src/test/app/vault/VaultSoleShareholder_test.cpp index 92d5dd04d4..0d1dd65877 100644 --- a/src/test/app/vault/VaultSoleShareholder_test.cpp +++ b/src/test/app/vault/VaultSoleShareholder_test.cpp @@ -56,7 +56,7 @@ private: test::jtx::Account borrower{"borrower"}; std::optional asset; std::optional vaultKeylet; - uint256 brokerID; + UInt256 brokerID; std::optional loanKeylet; MPTID shareAsset; std::uint64_t sharesLender = 0; diff --git a/src/test/app/vault/VaultTestBase.h b/src/test/app/vault/VaultTestBase.h index 538f3b72d8..bdc8151c11 100644 --- a/src/test/app/vault/VaultTestBase.h +++ b/src/test/app/vault/VaultTestBase.h @@ -72,8 +72,8 @@ protected: loc.line()); } - using d = NetClock::duration; - using tp = NetClock::time_point; + using D = NetClock::duration; + using Tp = NetClock::time_point; // Vault holds an Env& so no default initializer is possible; the // struct is always aggregate-initialized by makeClosedEndedVault. diff --git a/src/test/app/vault/VaultValidation_test.cpp b/src/test/app/vault/VaultValidation_test.cpp index 45f6d1deaf..51c3a184ae 100644 --- a/src/test/app/vault/VaultValidation_test.cpp +++ b/src/test/app/vault/VaultValidation_test.cpp @@ -1122,7 +1122,7 @@ private: TER const expected = withFix ? TER(tecPSEUDO_ACCOUNT) : TER(tecNO_PERMISSION); - auto const withdrawToPseudo = [&](uint256 const& vaultId) { + auto const withdrawToPseudo = [&](UInt256 const& vaultId) { auto tx = vault.withdraw({.depositor = depositor, .id = vaultId, .amount = asset(1)}); tx[sfDestination] = pseudoDestination.human(); return tx; diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index 5e790810f7..cda5a76eb3 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -41,7 +41,7 @@ class PerfLog_test : public beast::unit_test::Suite { enum class WithFile : bool { No = false, Yes = true }; - using path = std::filesystem::path; + using Path = std::filesystem::path; // The method names to count. PerfLog treats them as opaque keys, so these are // made up rather than taken from the dispatch table: this test then needs no @@ -106,14 +106,14 @@ class PerfLog_test : public beast::unit_test::Suite stopSignaled = true; } - static path + static Path logDir() { using namespace std::filesystem; return temp_directory_path() / "perf_log_test_dir"; } - static path + static Path logFile() { return logDir() / "perf_log.txt"; diff --git a/src/test/beast/.clang-tidy b/src/test/beast/.clang-tidy new file mode 100644 index 0000000000..11bceeac0d --- /dev/null +++ b/src/test/beast/.clang-tidy @@ -0,0 +1,11 @@ +# the beast container tests define allocators and iterators modelling +# std concepts, which mandate +# snake_case member type names. +# +# clang-tidy replaces rather than merges this option, so the list is the +# top-level one restated plus the 3 name(s) needed only here: +# const_reverse_iterator other reverse_iterator +InheritParentConfig: true +CheckOptions: + readability-identifier-naming.TypeAliasIgnoredRegexp: "^(const_iterator|const_reference|const_reverse_iterator|difference_type|duration|iterator|iterator_category|key_type|mapped_type|other|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" + readability-identifier-naming.TypedefIgnoredRegexp: "^(const_iterator|const_reference|const_reverse_iterator|difference_type|duration|iterator|iterator_category|key_type|mapped_type|other|period|pointer|reference|rep|result_type|reverse_iterator|size_type|time_point|value_type)$" diff --git a/src/test/beast/aged_associative_container_test.cpp b/src/test/beast/aged_associative_container_test.cpp index 76be44b793..b9c042ebb6 100644 --- a/src/test/beast/aged_associative_container_test.cpp +++ b/src/test/beast/aged_associative_container_test.cpp @@ -301,15 +301,15 @@ public: //-------------------------------------------------------------------------- // ordered - template + template struct ContType { template < class Compare = std::less, class Allocator = std::allocator> using Cont = detail::AgedOrderedContainer< - Base::is_multi::value, - Base::is_map::value, + Base::IsMultiType::value, + Base::IsMapType::value, typename Base::Key, typename Base::T, typename Base::Clock, @@ -326,8 +326,8 @@ public: class KeyEqual = std::equal_to, class Allocator = std::allocator> using Cont = detail::AgedUnorderedContainer< - Base::is_multi::value, - Base::is_map::value, + Base::IsMultiType::value, + Base::IsMapType::value, typename Base::Key, typename Base::T, typename Base::Clock, @@ -356,9 +356,9 @@ public: public: using typename Base::Key; - using is_unordered = std::integral_constant; - using is_multi = std::integral_constant; - using is_map = std::integral_constant; + using IsUnorderedType = std::integral_constant; + using IsMultiType = std::integral_constant; + using IsMapType = std::integral_constant; using Alloc = std::allocator; using MyAlloc = AllocT; @@ -381,7 +381,7 @@ public: static std::string name(Cont const&) { - return TestTraits::name(); + return TestTraits::name(); } template @@ -406,12 +406,12 @@ public: template void checkMapContents(Container& c, Values const& v) - requires(Container::is_map::value && !Container::is_multi::value); + requires(Container::IsMapType::value && !Container::IsMultiType::value); template void checkMapContents(Container, Values const&) - requires(!(Container::is_map::value && !Container::is_multi::value)) + requires(!(Container::IsMapType::value && !Container::IsMultiType::value)) { } @@ -419,12 +419,12 @@ public: template void checkUnorderedContentsRefRef(C&& c, Values const& v) - requires(std::remove_reference_t::is_unordered::value); + requires(std::remove_reference_t::IsUnorderedType::value); template void checkUnorderedContentsRefRef(C&&, Values const&) - requires(!std::remove_reference_t::is_unordered::value) + requires(!std::remove_reference_t::IsUnorderedType::value) { } @@ -636,7 +636,7 @@ public: template void AgedAssociativeContainerTestBase::checkMapContents(Container& c, Values const& v) - requires(Container::is_map::value && !Container::is_multi::value) + requires(Container::IsMapType::value && !Container::IsMultiType::value) { if (v.empty()) { @@ -663,11 +663,11 @@ AgedAssociativeContainerTestBase::checkMapContents(Container& c, Values const& v template void AgedAssociativeContainerTestBase::checkUnorderedContentsRefRef(C&& c, Values const& v) - requires(std::remove_reference_t::is_unordered::value) + requires(std::remove_reference_t::IsUnorderedType::value) { using Cont = std::remove_reference_t; using Traits = - TestTraits; + TestTraits; using size_type = Cont::size_type; auto const hash(c.hashFunction()); auto const keyEq(c.keyEq()); @@ -722,7 +722,7 @@ void AgedAssociativeContainerTestBase::checkContents(Cont& c) { using Traits = - TestTraits; + TestTraits; using Values = Traits::Values; checkContents(c, Values()); } @@ -1361,7 +1361,7 @@ AgedAssociativeContainerTestBase::testChronological() { // Because touch (reverse_iterator pos) is not allowed, the following - // lines should not compile for any aged_container type. + // lines should not compile for any aged container type. // c.touch (c.rbegin()); // c.touch (c.crbegin()); } @@ -1463,7 +1463,7 @@ AgedAssociativeContainerTestBase::nextToEndIter(Iter beginIter, Iter const endIt // This implementation does not declare a pass, since it wants to allow // the caller to examine the size of the container and the returned iterator // -// Note that this test works on the aged_associative containers because an +// Note that this test works on the aged associative containers because an // erase only invalidates references and iterators to the erased element // (see 23.2.4/13). Therefore the passed-in end iterator stays valid through // the whole test. @@ -1575,7 +1575,7 @@ AgedAssociativeContainerTestBase::testElementErase() auto tempContainer(c); BEAST_EXPECT(tempContainer.size() > 4); // erase(reverse_iterator) is not allowed. None of the following - // should compile for any aged_container type. + // should compile for any aged container type. // c.erase (c.rbegin()); // c.erase (c.crbegin()); // c.erase(c.rbegin(), ++c.rbegin()); @@ -1763,44 +1763,44 @@ public: using T = int; static_assert( - std::is_same_v, detail::AgedOrderedContainer>, - "bad alias: aged_set"); + std::is_same_v, detail::AgedOrderedContainer>, + "bad alias: AgedSet"); static_assert( - std::is_same_v, detail::AgedOrderedContainer>, - "bad alias: aged_multiset"); + std::is_same_v, detail::AgedOrderedContainer>, + "bad alias: AgedMultiset"); static_assert( - std::is_same_v, detail::AgedOrderedContainer>, - "bad alias: aged_map"); + std::is_same_v, detail::AgedOrderedContainer>, + "bad alias: AgedMap"); static_assert( - std::is_same_v, detail::AgedOrderedContainer>, - "bad alias: aged_multimap"); + std::is_same_v, detail::AgedOrderedContainer>, + "bad alias: AgedMultimap"); static_assert( std::is_same_v< - aged_unordered_set, + AgedUnorderedSet, detail::AgedUnorderedContainer>, - "bad alias: aged_unordered_set"); + "bad alias: AgedUnorderedSet"); static_assert( std::is_same_v< - aged_unordered_multiset, + AgedUnorderedMultiset, detail::AgedUnorderedContainer>, - "bad alias: aged_unordered_multiset"); + "bad alias: AgedUnorderedMultiset"); static_assert( std::is_same_v< - aged_unordered_map, + AgedUnorderedMap, detail::AgedUnorderedContainer>, - "bad alias: aged_unordered_map"); + "bad alias: AgedUnorderedMap"); static_assert( std::is_same_v< - aged_unordered_multimap, + AgedUnorderedMultimap, detail::AgedUnorderedContainer>, - "bad alias: aged_unordered_multimap"); + "bad alias: AgedUnorderedMultimap"); void run() override diff --git a/src/test/beast/beast_abstract_clock_test.cpp b/src/test/beast/beast_abstract_clock_test.cpp index 5fb44ae637..b6c23f04e2 100644 --- a/src/test/beast/beast_abstract_clock_test.cpp +++ b/src/test/beast/beast_abstract_clock_test.cpp @@ -35,13 +35,13 @@ public: { testcase("manual"); - using clock_type = ManualClock; - clock_type c; + using ClockType = ManualClock; + ClockType c; auto c1 = c.now().time_since_epoch(); - c.set(clock_type::time_point(std::chrono::seconds(1))); + c.set(ClockType::time_point(std::chrono::seconds(1))); auto c2 = c.now().time_since_epoch(); - c.set(clock_type::time_point(std::chrono::seconds(2))); + c.set(ClockType::time_point(std::chrono::seconds(2))); auto c3 = c.now().time_since_epoch(); log << "[" << c1.count() << "," << c2.count() << "," << c3.count() << "]" << std::endl; diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index 142077a42f..ecc8032ce1 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -90,7 +90,7 @@ applyAndTestResult(jtx::Env& env, OpenView& view, STTx const& tx, bool pass); bool verifyPubKeyAndSeq( std::shared_ptr const& l, - hash_map nUnlLedgerSeq); + HashMap nUnlLedgerSeq); /** * Count the number of Tx in a TxSet @@ -240,12 +240,12 @@ class NegativeUNL_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); // Record the public keys and ledger sequences of expected negative UNL // validators when we build the ledger history - hash_map nUnlLedgerSeq; + HashMap nUnlLedgerSeq; { //(1) the ledger after genesis, not a flag ledger @@ -288,7 +288,7 @@ class NegativeUNL_test : public beast::unit_test::Suite { BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]); //++ first ToDisable Tx in ledger's TxSet - uint256 const txID = txDisable0.getTransactionID(); + UInt256 const txID = txDisable0.getTransactionID(); BEAST_EXPECT(l->txExists(txID)); } } @@ -570,12 +570,12 @@ struct NetworkHistory bool createLedgerHistory() { - static uint256 kFakeAmendment; // So we have different genesis ledgers + static UInt256 kFakeAmendment; // So we have different genesis ledgers auto l = std::make_shared( kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{kFakeAmendment++}, + std::vector{kFakeAmendment++}, env.app().getNodeFamily()); history.push_back(l); @@ -683,9 +683,9 @@ struct NetworkHistory Parameter param; RCLValidations& validations; std::vector unlKeys; - hash_set unlKeySet; + HashSet unlKeySet; std::vector unlNodeIDs; - hash_set unlNodeIdSet; + HashSet unlNodeIdSet; LedgerHistory history; bool goodHistory; }; @@ -755,8 +755,8 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite NodeID const myId(0xA0); NegativeUNLVote const vote(myId, env.journal); - uint256 const pad0(0); - uint256 const padF = ~pad0; + UInt256 const pad0(0); + UInt256 const padF = ~pad0; NodeID const n1(1); NodeID const n2(2); NodeID const n3(3); @@ -958,9 +958,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite static bool checkCandidateSizes( NegativeUNLVote& vote, - hash_set const& unl, - hash_set const& negUnl, - hash_map const& scoreTable, + HashSet const& unl, + HashSet const& negUnl, + HashMap const& scoreTable, std::size_t numDisable, std::size_t numReEnable) { @@ -999,12 +999,12 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite .hasToReEnable = false, .numLedgers = 0}}; - hash_set negUnl012; + HashSet negUnl012; for (std::uint32_t i = 0; i < 3; ++i) negUnl012.insert(history.unlNodeIDs[i]); // build a good scoreTable to use, or copy and modify - hash_map goodScoreTable; + HashMap goodScoreTable; for (auto const& n : history.unlNodeIDs) goodScoreTable[n] = NegativeUNLVote::kNegativeUnlHighWaterMark + 1; @@ -1017,7 +1017,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite } { // all bad scores - hash_map scoreTable; + HashMap scoreTable; for (auto& n : history.unlNodeIDs) scoreTable[n] = NegativeUNLVote::kNegativeUnlLowWaterMark - 1; BEAST_EXPECT( @@ -1025,7 +1025,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite } { // all between watermarks - hash_map scoreTable; + HashMap scoreTable; for (auto& n : history.unlNodeIDs) scoreTable[n] = NegativeUNLVote::kNegativeUnlLowWaterMark + 1; BEAST_EXPECT( @@ -1052,7 +1052,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite { // 2 in negUnl but not in unl, have a remove candidate from score // table - hash_set unlTemp = history.unlNodeIdSet; + HashSet unlTemp = history.unlNodeIdSet; unlTemp.erase(history.unlNodeIDs[0]); unlTemp.erase(history.unlNodeIDs[1]); BEAST_EXPECT(checkCandidateSizes(vote, unlTemp, negUnl012, goodScoreTable, 0, 3)); @@ -1064,7 +1064,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite scoreTable.erase(history.unlNodeIDs[0]); scoreTable.erase(history.unlNodeIDs[1]); scoreTable[history.unlNodeIDs[2]] = NegativeUNLVote::kNegativeUnlLowWaterMark + 1; - hash_set unlTemp = history.unlNodeIdSet; + HashSet unlTemp = history.unlNodeIdSet; unlTemp.erase(history.unlNodeIDs[0]); unlTemp.erase(history.unlNodeIDs[1]); BEAST_EXPECT(checkCandidateSizes(vote, unlTemp, negUnl012, scoreTable, 0, 2)); @@ -1074,8 +1074,8 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite // 2 new validators NodeID const new1(0xbead); NodeID const new2(0xbeef); - hash_set const nowTrusted = {new1, new2}; - hash_set unlTemp = history.unlNodeIdSet; + HashSet const nowTrusted = {new1, new2}; + HashSet unlTemp = history.unlNodeIdSet; unlTemp.insert(new1); unlTemp.insert(new2); vote.newValidators(256, nowTrusted); @@ -1084,7 +1084,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite auto scoreTable = goodScoreTable; scoreTable[new1] = NegativeUNLVote::kNegativeUnlHighWaterMark + 1; scoreTable[new2] = NegativeUNLVote::kNegativeUnlHighWaterMark + 1; - hash_set negUnlTemp = negUnl012; + HashSet negUnlTemp = negUnl012; negUnlTemp.insert(new1); negUnlTemp.insert(new2); BEAST_EXPECT(checkCandidateSizes(vote, unlTemp, negUnlTemp, scoreTable, 0, 3 + 2)); @@ -1149,9 +1149,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite auto fillScoreTable = [&](std::uint32_t unlSize, std::uint32_t nUnlSize, std::uint32_t score, - hash_set& unl, - hash_set& negUnl, - hash_map& scoreTable) { + HashSet& unl, + HashSet& negUnl, + HashMap& scoreTable) { std::vector nodeIDs; std::vector const keys = createPublicKeys(unlSize); for (auto const& k : keys) @@ -1170,9 +1170,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite { for (auto score : scores) { - hash_set unl; - hash_set negUnl; - hash_map scoreTable; + HashSet unl; + HashSet negUnl; + HashMap scoreTable; fillScoreTable(us, us * np / 100, score, unl, negUnl, scoreTable); BEAST_EXPECT(unl.size() == us); BEAST_EXPECT(negUnl.size() == us * np / 100); @@ -1211,9 +1211,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite { auto fillScoreTable = [&](std::uint32_t unlSize, std::uint32_t nUnlPercent, - hash_set& unl, - hash_set& negUnl, - hash_map& scoreTable) { + HashSet& unl, + HashSet& negUnl, + HashMap& scoreTable) { std::vector nodeIDs; std::vector const keys = createPublicKeys(unlSize); for (auto const& k : keys) @@ -1248,9 +1248,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::Suite { for (auto np : nUnlPercent) { - hash_set unl; - hash_set negUnl; - hash_map scoreTable; + HashSet unl; + HashSet negUnl; + HashMap scoreTable; fillScoreTable(us, np, unl, negUnl, scoreTable); BEAST_EXPECT(unl.size() == us); @@ -1750,7 +1750,7 @@ class NegativeUNLVoteNewValidator_test : public beast::unit_test::Suite auto extraKey2 = randomKeyPair(KeyType::Ed25519).first; history.unlKeySet.insert(extraKey1); history.unlKeySet.insert(extraKey2); - hash_set nowTrusted; + HashSet nowTrusted; nowTrusted.insert(calcNodeID(extraKey1)); nowTrusted.insert(calcNodeID(extraKey2)); vote.newValidators(history.lastLedger()->seq(), nowTrusted); @@ -1781,7 +1781,7 @@ class NegativeUNLVoteNewValidator_test : public beast::unit_test::Suite auto extraKey2 = randomKeyPair(KeyType::Ed25519).first; history.unlKeySet.insert(extraKey1); history.unlKeySet.insert(extraKey2); - hash_set nowTrusted; + HashSet nowTrusted; nowTrusted.insert(calcNodeID(extraKey1)); nowTrusted.insert(calcNodeID(extraKey2)); vote.newValidators(256, nowTrusted); @@ -1808,7 +1808,7 @@ class NegativeUNLVoteFilterValidations_test : public beast::unit_test::Suite kCreateGenesis, Rules{env.app().config().features}, env.app().config().fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto createSTVal = [&](std::pair const& keys) { @@ -1828,8 +1828,8 @@ class NegativeUNLVoteFilterValidations_test : public beast::unit_test::Suite std::uint32_t const numNodes = 10; std::uint32_t const negUnlSize = 3; std::vector cfgKeys; - hash_set activeValidators; - hash_set nUnlKeys; + HashSet activeValidators; + HashSet nUnlKeys; std::vector> vals; for (int i = 0; i < numNodes; ++i) { @@ -1914,7 +1914,7 @@ applyAndTestResult(jtx::Env& env, OpenView& view, STTx const& tx, bool pass) bool verifyPubKeyAndSeq( std::shared_ptr const& l, - hash_map nUnlLedgerSeq) + HashMap nUnlLedgerSeq) { auto sle = l->read(keylet::negativeUNL()); if (!sle) diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 5ed5ef4049..e3327c8c57 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -128,7 +128,7 @@ backend=sqlite class FileCfgGuard : public xrpl::detail::FileDirGuard { private: - path dataDir_; + Path dataDir_; bool rmDataDir_{false}; @@ -137,10 +137,10 @@ private: public: FileCfgGuard( beast::unit_test::Suite& test, - path subDir, - path const& dbPath, - path const& configFile, - path const& validatorsFile, + Path subDir, + Path const& dbPath, + Path const& configFile, + Path const& validatorsFile, bool useCounter = true, std::string confContents = "") : FileDirGuard( @@ -153,7 +153,7 @@ public: , dataDir_(dbPath) { if (dbPath.empty()) - dataDir_ = subdir() / path(Config::kDatabaseDirName); + dataDir_ = subdir() / Path(Config::kDatabaseDirName); rmDataDir_ = !exists(dataDir_); config_.setup( @@ -241,13 +241,13 @@ class ValidatorsTxtGuard : public detail::FileDirGuard public: ValidatorsTxtGuard( beast::unit_test::Suite& test, - path subDir, - path const& validatorsFileName, + Path subDir, + Path const& validatorsFileName, bool useCounter = true) : FileDirGuard( test, std::move(subDir), - path(validatorsFileName.empty() ? Config::kValidatorsFileName : validatorsFileName), + Path(validatorsFileName.empty() ? Config::kValidatorsFileName : validatorsFileName), valFileContents(), useCounter) { @@ -272,7 +272,7 @@ public: class Config_test final : public TestSuite { private: - using path = std::filesystem::path; + using Path = std::filesystem::path; public: void @@ -320,7 +320,7 @@ port_wss_admin // Use a temporary directory for testing. TempDir const td; current_path(td.path()); - path const f = td.file(std::string{configFile}); + Path const f = td.file(std::string{configFile}); std::ofstream o(f.string()); o << detail::configContents("", ""); o.close(); @@ -357,7 +357,7 @@ port_wss_admin setenv("XDG_CONFIG_HOME", tc.path().c_str(), 1); // Create the config file in '${XDG_CONFIG_HOME}/[systemName]'. - path p = tc.file(systemName()); + Path p = tc.file(systemName()); create_directory(p); p = tc.file(systemName() + "/" + std::string{configFile}); std::ofstream o(p.string()); @@ -390,7 +390,7 @@ port_wss_admin // Create the config file in '${HOME}/.config/[systemName]'. std::string s = ".config"; - path p = tc.file(s); + Path p = tc.file(s); create_directory(p); s += "/" + systemName(); p = tc.file(s); @@ -429,8 +429,8 @@ port_wss_admin constexpr char const* cc = "[database_path]\n{}\n"; auto const cwd = current_path(); - path const dataDirRel("test_data_dir"); - path const dataDirAbs(cwd / dataDirRel); + Path const dataDirRel("test_data_dir"); + Path const dataDirAbs(cwd / dataDirRel); { // Dummy test - do we get back what we put in Config c; @@ -456,8 +456,8 @@ port_wss_admin // read from file absolute path auto const cwd = current_path(); detail::DirGuard const g0(*this, "test_db"); - path const dataDirRel("test_data_dir"); - path const dataDirAbs(cwd / g0.subdir() / dataDirRel); + Path const dataDirRel("test_data_dir"); + Path const dataDirAbs(cwd / g0.subdir() / dataDirRel); detail::FileCfgGuard const g( *this, g0.subdir(), dataDirAbs, Config::kConfigFileName, "", false); auto const& c(g.config()); @@ -470,7 +470,7 @@ port_wss_admin std::string const dbPath("my_db"); detail::FileCfgGuard const g(*this, "test_db", dbPath, Config::kConfigFileName, ""); auto const& c(g.config()); - std::string const nativeDbPath = absolute(path(dbPath)).string(); + std::string const nativeDbPath = absolute(Path(dbPath)).string(); BEAST_EXPECT(g.dataDirExists()); BEAST_EXPECT(g.configFileExists()); BEAST_EXPECT(c.legacy(Sections::kDatabasePath) == nativeDbPath); @@ -480,7 +480,7 @@ port_wss_admin detail::FileCfgGuard const g(*this, "test_db", "", Config::kConfigFileName, ""); auto const& c(g.config()); std::string const nativeDbPath = - absolute(g.subdir() / path(Config::kDatabaseDirName)).string(); + absolute(g.subdir() / Path(Config::kDatabaseDirName)).string(); BEAST_EXPECT(g.dataDirExists()); BEAST_EXPECT(g.configFileExists()); BEAST_EXPECT(c.legacy(Sections::kDatabasePath) == nativeDbPath); @@ -622,7 +622,7 @@ main { // load should throw for invalid [validators_file] detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg"); - path const invalidFile = current_path() / vtg.subdir(); + Path const invalidFile = current_path() / vtg.subdir(); constexpr char const* cc = "[validators_file]\n{}\n"; std::string error; auto const expectedError = diff --git a/src/test/jtx/AMM.h b/src/test/jtx/AMM.h index 435e32b7b4..d8bb995331 100644 --- a/src/test/jtx/AMM.h +++ b/src/test/jtx/AMM.h @@ -140,7 +140,7 @@ class AMM Account const creatorAccount_; STAmount const asset1_; STAmount const asset2_; - uint256 const ammID_; + UInt256 const ammID_; bool log_; bool doClose_; // Predict next purchase price @@ -426,7 +426,7 @@ public: doClose_ = close; } - [[nodiscard]] uint256 + [[nodiscard]] UInt256 ammID() const { return ammID_; diff --git a/src/test/jtx/Account.h b/src/test/jtx/Account.h index 60d07beebd..de8dc41e7a 100644 --- a/src/test/jtx/Account.h +++ b/src/test/jtx/Account.h @@ -98,7 +98,7 @@ public: /** * Returns the Account ID. * - * The Account ID is the uint160 hash of the public key. + * The Account ID is the UInt160 hash of the public key. */ [[nodiscard]] AccountID id() const diff --git a/src/test/jtx/ConfidentialTransfer.h b/src/test/jtx/ConfidentialTransfer.h index 21e1929902..fcda397c0d 100644 --- a/src/test/jtx/ConfidentialTransfer.h +++ b/src/test/jtx/ConfidentialTransfer.h @@ -195,7 +195,7 @@ protected: getForgedBulletproof( std::array const& values, std::array const& blindingFactors, - uint256 const& contextHash); + UInt256 const& contextHash); // Generate a forged single bulletproof for a single value and blinding factor. // Used to test ConvertBack overdraft prevention via bulletproof verification. @@ -203,7 +203,7 @@ protected: getForgedSingleBulletproof( uint64_t value, Buffer const& blindingFactor, - uint256 const& contextHash); + UInt256 const& contextHash); // Forges a ConvertBack proof (compact sigma + single bulletproof) whose // sigma component claims claimedBalance (which may be wrong) while binding @@ -222,7 +222,7 @@ protected: Buffer const& pedersenCommitment, Buffer const& encryptedSpendingBalance, Buffer const& pcBlindingFactor, - uint256 const& contextHash); + UInt256 const& contextHash); // Forges a ConfidentialMPTSend proof (compact sigma + double bulletproof) // for setup.sendAmount against setup's real balance commitment/ciphertext. diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 25ab5c383b..4cbf75d341 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -93,7 +93,7 @@ testableAmendments() { static FeatureBitset const kIds = [] { auto const& sa = allAmendments(); - std::vector feats; + std::vector feats; feats.reserve(sa.size()); for (auto const& [s, vote] : sa) { @@ -120,7 +120,7 @@ testableAmendments() * so that each case is exercised both with and without each feature. */ inline std::vector -amendmentCombinations(std::initializer_list features, FeatureBitset seed) +amendmentCombinations(std::initializer_list features, FeatureBitset seed) { std::vector result{seed}; for (auto const& f : features) @@ -234,7 +234,7 @@ public: { memoize(Account::kMaster); Pathfinder::initPathTable(); - foreachFeature(features, [&appFeats = app().config().features](uint256 const& f) { + foreachFeature(features, [&appFeats = app().config().features](UInt256 const& f) { appFeats.insert(f); }); } @@ -877,13 +877,13 @@ public: tx() const; void - enableFeature(uint256 const feature); + enableFeature(UInt256 const feature); void - disableFeature(uint256 const feature); + disableFeature(UInt256 const feature); [[nodiscard]] bool - enabled(uint256 feature) const + enabled(UInt256 feature) const { return current()->rules().enabled(feature); } @@ -1004,7 +1004,7 @@ public: protected: int trace_ = 0; TestStopwatch stopwatch_; - uint256 txid_; + UInt256 txid_; TER ter_ = tesSUCCESS; bool parseFailureExpected_ = false; unsigned retries_ = 5; diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index 47cfb604f4..1a9da803d8 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -208,7 +208,7 @@ public: Env env(*this); env.fund(n, "alice", "bob", gw); env.close(); - env(trust("alice", usd(100)), Require(lines("alice", 1))); + env(trust("alice", usd(100)), Require(Lines("alice", 1))); } // balance @@ -335,7 +335,7 @@ public: env(pay(env.master, "dilbert", XRP(1000)), Sig(env.master)); env.trust(usd(100), "alice", "bob", "carol"); - env.require(Owners("alice", 1), lines("alice", 1)); + env.require(Owners("alice", 1), Lines("alice", 1)); env(rate(gw, 1.05)); env(pay(gw, "carol", usd(50))); @@ -482,8 +482,8 @@ public: { Env env(*this); env.fund(XRP(10000), "alice"); - env(noop("alice"), Require(Owners("alice", 0), tickets("alice", 0))); - env(ticket::create("alice", 1), Require(Owners("alice", 1), tickets("alice", 1))); + env(noop("alice"), Require(Owners("alice", 0), Tickets("alice", 0))); + env(ticket::create("alice", 1), Require(Owners("alice", 1), Tickets("alice", 1))); } } @@ -754,7 +754,7 @@ public: // the supported amendments list and tests that it can be // enabled explicitly - auto const neverSupportedFeat = [&]() -> std::optional { + auto const neverSupportedFeat = [&]() -> std::optional { auto const n = supported.size(); for (size_t i = 0; i < n; ++i) { @@ -772,7 +772,7 @@ public: return; } - auto hasFeature = [](Env& env, uint256 const& f) { + auto hasFeature = [](Env& env, UInt256 const& f) { return (env.app().config().features.contains(f)); }; @@ -781,14 +781,14 @@ public: Env env{*this}; BEAST_EXPECT(supported.count() == env.app().config().features.size()); foreachFeature( - supported, [&](uint256 const& f) { this->BEAST_EXPECT(hasFeature(env, f)); }); + supported, [&](UInt256 const& f) { this->BEAST_EXPECT(hasFeature(env, f)); }); } { // a Env FeatureBitset has *only* those features Env env{*this, FeatureBitset{featureDynamicMPT | featureTokenEscrow}}; BEAST_EXPECT(env.app().config().features.size() == 2); - foreachFeature(supported, [&](uint256 const& f) { + foreachFeature(supported, [&](UInt256 const& f) { bool const has = (f == featureDynamicMPT || f == featureTokenEscrow); this->BEAST_EXPECT(has == hasFeature(env, f)); }); @@ -801,7 +801,7 @@ public: // a Env supported_features_except is missing *only* those features Env env{*this, missingSomeFeatures}; BEAST_EXPECT(env.app().config().features.size() == (supported.count() - 2)); - foreachFeature(supported, [&](uint256 const& f) { + foreachFeature(supported, [&](UInt256 const& f) { bool const hasnot = (f == featureDynamicMPT || f == featureTokenEscrow); this->BEAST_EXPECT(hasnot != hasFeature(env, f)); }); @@ -820,7 +820,7 @@ public: BEAST_EXPECT(env.app().config().features.size() == (2 + 1)); BEAST_EXPECT(hasFeature(env, *neverSupportedFeat)); - foreachFeature(supported, [&](uint256 const& f) { + foreachFeature(supported, [&](UInt256 const& f) { bool const has = (f == featureDynamicMPT || f == featureTokenEscrow); this->BEAST_EXPECT(has == hasFeature(env, f)); }); @@ -836,7 +836,7 @@ public: // one additional never supported feature flag BEAST_EXPECT(env.app().config().features.size() == (supported.count() - 2 + 1)); BEAST_EXPECT(hasFeature(env, *neverSupportedFeat)); - foreachFeature(supported, [&](uint256 const& f) { + foreachFeature(supported, [&](UInt256 const& f) { bool const hasnot = (f == featureDynamicMPT || f == featureTokenEscrow); this->BEAST_EXPECT(hasnot != hasFeature(env, f)); }); @@ -853,7 +853,7 @@ public: BEAST_EXPECT(env.app().config().features.size() == (supported.count() + 1)); BEAST_EXPECT(hasFeature(env, *neverSupportedFeat)); foreachFeature( - supported, [&](uint256 const& f) { this->BEAST_EXPECT(hasFeature(env, f)); }); + supported, [&](UInt256 const& f) { this->BEAST_EXPECT(hasFeature(env, f)); }); } } diff --git a/src/test/jtx/JTx.h b/src/test/jtx/JTx.h index 794334bec7..b1b879bdd5 100644 --- a/src/test/jtx/JTx.h +++ b/src/test/jtx/JTx.h @@ -26,7 +26,7 @@ class Env; struct JTx { json::Value jv; - requires_t require; + RequiresT require; std::optional ter = TER{tesSUCCESS}; std::optional> rpcCode = std::nullopt; std::optional>> rpcException = std::nullopt; diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index 42d391c46f..e3eb0209db 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -29,7 +29,7 @@ countOffers( Asset const& takerGets) { size_t count = 0; - forEachItem(*env.current(), account, [&](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&](SLE::ConstRef sle) { if (sle->getType() == ltOFFER && sle->getFieldAmount(sfTakerPays).asset() == takerPays && sle->getFieldAmount(sfTakerGets).asset() == takerGets) ++count; @@ -45,7 +45,7 @@ countOffers( STAmount const& takerGets) { size_t count = 0; - forEachItem(*env.current(), account, [&](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&](SLE::ConstRef sle) { if (sle->getType() == ltOFFER && sle->getFieldAmount(sfTakerPays) == takerPays && sle->getFieldAmount(sfTakerGets) == takerGets) ++count; diff --git a/src/test/jtx/PeerStub.h b/src/test/jtx/PeerStub.h index cabe94f351..dcaaac9041 100644 --- a/src/test/jtx/PeerStub.h +++ b/src/test/jtx/PeerStub.h @@ -33,7 +33,7 @@ public: /** * @param id The connection id reported by `id()`. */ - explicit PeerStub(id_t id = 0) + explicit PeerStub(ID id = 0) : id_(id), nodePublicKey_(derivePublicKey(KeyType::Ed25519, randomSecretKey())) { } @@ -57,12 +57,12 @@ public: } void - addTxQueue(uint256 const&) override + addTxQueue(UInt256 const&) override { } void - removeTxQueue(uint256 const&) override + removeTxQueue(UInt256 const&) override { } @@ -71,7 +71,7 @@ public: { } - [[nodiscard]] id_t + [[nodiscard]] ID id() const override { return id_; @@ -130,14 +130,14 @@ public: return fingerprint_; } - [[nodiscard]] uint256 + [[nodiscard]] UInt256 getClosedLedgerHash() const override { return {}; } [[nodiscard]] bool - hasLedger(uint256 const&, std::uint32_t) const override + hasLedger(UInt256 const&, std::uint32_t) const override { return false; } @@ -148,7 +148,7 @@ public: } [[nodiscard]] bool - hasTxSet(uint256 const&) const override + hasTxSet(UInt256 const&) const override { return false; } @@ -177,7 +177,7 @@ public: } private: - id_t const id_; + ID const id_; PublicKey const nodePublicKey_; std::string const fingerprint_; }; diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 382a6fe333..0739357030 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -118,10 +118,10 @@ struct TimePointField : public JTxField; + using Base = JTxField; protected: - using base::value_; + using Base::value_; public: explicit TimePointField(SF const& sfield, SV const& value) : JTxField(sfield, value) @@ -135,15 +135,15 @@ public: } }; -struct UInt256Field : public JTxField +struct UInt256Field : public JTxField { using SF = SF_UINT256; - using SV = uint256; + using SV = UInt256; using OV = std::string; - using base = JTxField; + using Base = JTxField; protected: - using base::value_; + using Base::value_; public: explicit UInt256Field(SF const& sfield, SV const& value) : JTxField(sfield, value) @@ -162,10 +162,10 @@ struct AccountIdField : public JTxField using SF = SF_ACCOUNT; using SV = AccountID; using OV = std::string; - using base = JTxField; + using Base = JTxField; protected: - using base::value_; + using Base::value_; public: explicit AccountIdField(SF const& sfield, SV const& value) : JTxField(sfield, value) @@ -184,10 +184,10 @@ struct StAmountField : public JTxField using SF = SF_AMOUNT; using SV = STAmount; using OV = json::Value; - using base = JTxField; + using Base = JTxField; protected: - using base::value_; + using Base::value_; public: explicit StAmountField(SF const& sfield, SV const& value) : JTxField(sfield, value) @@ -205,7 +205,7 @@ struct BlobField : public JTxField { using SF = SF_VL; using SV = std::string; - using base = JTxField; + using Base = JTxField; using JTxField::JTxField; @@ -226,12 +226,12 @@ struct ValueUnitField : public JTxField; using OV = ValueType; - using base = JTxField; + using Base = JTxField; static_assert(std::is_same_v); protected: - using base::value_; + using Base::value_; public: using JTxField::JTxField; @@ -302,11 +302,11 @@ public: // NOLINTNEXTLINE(readability-redundant-typename): typename required by MSVC template -using valueUnitWrapper = JTxFieldWrapper>; +using ValueUnitWrapper = JTxFieldWrapper>; // NOLINTNEXTLINE(readability-redundant-typename): typename required by MSVC template -using simpleField = JTxFieldWrapper>; +using SimpleField = JTxFieldWrapper>; /** * General field definitions, or fields used in multiple transaction namespaces @@ -390,7 +390,7 @@ checkVL(Slice const& result, std::string const& expected) [[nodiscard]] inline bool -checkVL(SLE::const_ref sle, SField const& field, std::string const& expected) +checkVL(SLE::ConstRef sle, SField const& field, std::string const& expected) { return strHex(expected) == strHex(sle->getFieldVL(field)); } @@ -503,7 +503,7 @@ findPathsRequest( std::optional const& saSendMax = std::nullopt, std::optional const& srcAsset = std::nullopt, std::optional const& srcIssuer = std::nullopt, - std::optional const& domain = std::nullopt); + std::optional const& domain = std::nullopt); std::tuple findPaths( @@ -514,7 +514,7 @@ findPaths( std::optional const& saSendMax = std::nullopt, std::optional const& srcAsset = std::nullopt, std::optional const& srcIssuer = std::nullopt, - std::optional const& domain = std::nullopt); + std::optional const& domain = std::nullopt); std::tuple findPathsByElement( @@ -525,7 +525,7 @@ findPathsByElement( std::optional const& saSendMax = std::nullopt, std::optional const& srcElement = std::nullopt, std::optional const& srcIssuer = std::nullopt, - std::optional const& domain = std::nullopt); + std::optional const& domain = std::nullopt); /******************************************************************************/ @@ -613,33 +613,33 @@ create( json::Value fund( AccountID const& account, - uint256 const& channel, + UInt256 const& channel, STAmount const& amount, std::optional const& expiration = std::nullopt); json::Value claim( AccountID const& account, - uint256 const& channel, + UInt256 const& channel, std::optional const& balance = std::nullopt, std::optional const& amount = std::nullopt, std::optional const& signature = std::nullopt, std::optional const& pk = std::nullopt); -uint256 +UInt256 channel(AccountID const& account, AccountID const& dst, std::uint32_t seqProxyValue); -inline uint256 +inline UInt256 channel(Account const& account, Account const& dst, std::uint32_t seqProxyValue) { return channel(account.id(), dst.id(), seqProxyValue); } STAmount -channelBalance(ReadView const& view, uint256 const& chan); +channelBalance(ReadView const& view, UInt256 const& chan); bool -channelExists(ReadView const& view, uint256 const& chan); +channelExists(ReadView const& view, UInt256 const& chan); } // namespace paychan @@ -764,7 +764,7 @@ create(jtx::Account const& account, jtx::Account const& dest, STAmount const& se inline constexpr FeeLevel64 kBaseFeeLevel{TxQ::kBaseLevel}; inline constexpr FeeLevel64 kMinEscalationFeeLevel = kBaseFeeLevel * 500; -inline uint256 +inline UInt256 getCheckIndex(AccountID const& account, std::uint32_t const sequence) { return keylet::check(account, SeqProxy::rawSequence(sequence)).key; @@ -865,23 +865,23 @@ checkMetrics( namespace loan_broker { json::Value -set(AccountID const& account, uint256 const& vaultId, std::uint32_t flags = 0); +set(AccountID const& account, UInt256 const& vaultId, std::uint32_t flags = 0); // Use "del" because "delete" is a reserved word in C++. json::Value -del(AccountID const& account, uint256 const& brokerID, std::uint32_t flags = 0); +del(AccountID const& account, UInt256 const& brokerID, std::uint32_t flags = 0); json::Value coverDeposit( AccountID const& account, - uint256 const& brokerID, + UInt256 const& brokerID, STAmount const& amount, std::uint32_t flags = 0); json::Value coverWithdraw( AccountID const& account, - uint256 const& brokerID, + UInt256 const& brokerID, STAmount const& amount, std::uint32_t flags = 0); @@ -892,14 +892,14 @@ coverClawback(AccountID const& account, std::uint32_t flags = 0); auto const kLoanBrokerId = JTxFieldWrapper(sfLoanBrokerID); auto const kManagementFeeRate = - valueUnitWrapper(sfManagementFeeRate); + ValueUnitWrapper(sfManagementFeeRate); -auto const kDebtMaximum = simpleField(sfDebtMaximum); +auto const kDebtMaximum = SimpleField(sfDebtMaximum); -auto const kCoverRateMinimum = valueUnitWrapper(sfCoverRateMinimum); +auto const kCoverRateMinimum = ValueUnitWrapper(sfCoverRateMinimum); auto const kCoverRateLiquidation = - valueUnitWrapper(sfCoverRateLiquidation); + ValueUnitWrapper(sfCoverRateLiquidation); auto const kDestination = JTxFieldWrapper(sfDestination); @@ -911,7 +911,7 @@ namespace loan { json::Value set(AccountID const& account, - uint256 const& loanBrokerID, + UInt256 const& loanBrokerID, Number principalRequested, std::uint32_t flags = 0); @@ -919,41 +919,41 @@ auto const kCounterparty = JTxFieldWrapper(sfCounterparty); // For `CounterPartySignature`, use `Sig(sfCounterpartySignature, ...)` -auto const kLoanOriginationFee = simpleField(sfLoanOriginationFee); +auto const kLoanOriginationFee = SimpleField(sfLoanOriginationFee); -auto const kLoanServiceFee = simpleField(sfLoanServiceFee); +auto const kLoanServiceFee = SimpleField(sfLoanServiceFee); -auto const kLatePaymentFee = simpleField(sfLatePaymentFee); +auto const kLatePaymentFee = SimpleField(sfLatePaymentFee); -auto const kClosePaymentFee = simpleField(sfClosePaymentFee); +auto const kClosePaymentFee = SimpleField(sfClosePaymentFee); -auto const kOverpaymentFee = valueUnitWrapper(sfOverpaymentFee); +auto const kOverpaymentFee = ValueUnitWrapper(sfOverpaymentFee); -auto const kInterestRate = valueUnitWrapper(sfInterestRate); +auto const kInterestRate = ValueUnitWrapper(sfInterestRate); -auto const kLateInterestRate = valueUnitWrapper(sfLateInterestRate); +auto const kLateInterestRate = ValueUnitWrapper(sfLateInterestRate); auto const kCloseInterestRate = - valueUnitWrapper(sfCloseInterestRate); + ValueUnitWrapper(sfCloseInterestRate); auto const kOverpaymentInterestRate = - valueUnitWrapper(sfOverpaymentInterestRate); + ValueUnitWrapper(sfOverpaymentInterestRate); -auto const kPaymentTotal = simpleField(sfPaymentTotal); +auto const kPaymentTotal = SimpleField(sfPaymentTotal); -auto const kPaymentInterval = simpleField(sfPaymentInterval); +auto const kPaymentInterval = SimpleField(sfPaymentInterval); -auto const kGracePeriod = simpleField(sfGracePeriod); +auto const kGracePeriod = SimpleField(sfGracePeriod); json::Value -manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags); +manage(AccountID const& account, UInt256 const& loanID, std::uint32_t flags); json::Value -del(AccountID const& account, uint256 const& loanID, std::uint32_t flags = 0); +del(AccountID const& account, UInt256 const& loanID, std::uint32_t flags = 0); json::Value pay(AccountID const& account, - uint256 const& loanID, + UInt256 const& loanID, STAmount const& amount, std::uint32_t flags = 0); diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 941af374ef..6dadccaf98 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -45,16 +45,16 @@ namespace xrpl::test { class TrustedPublisherServer : public std::enable_shared_from_this { - using endpoint_type = boost::asio::ip::tcp::endpoint; - using address_type = boost::asio::ip::address; - using socket_type = boost::asio::ip::tcp::socket; + using EndpointType = boost::asio::ip::tcp::endpoint; + using AddressType = boost::asio::ip::address; + using SocketType = boost::asio::ip::tcp::socket; - using req_type = boost::beast::http::request; - using resp_type = boost::beast::http::response; - using error_code = boost::system::error_code; + using ReqType = boost::beast::http::request; + using RespType = boost::beast::http::response; + using ErrorCode = boost::system::error_code; - socket_type sock_; - endpoint_type ep_; + SocketType sock_; + EndpointType ep_; boost::asio::ip::tcp::acceptor acceptor_; // Generates a version 1 validator list, using the int parameter as the // actual version. @@ -252,13 +252,13 @@ public: void start() { - error_code ec; + ErrorCode ec; acceptor_.open(ep_.protocol()); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true), ec); acceptor_.bind(ep_); acceptor_.listen(boost::asio::socket_base::max_listen_connections); acceptor_.async_accept( - sock_, [wp = std::weak_ptr{shared_from_this()}](error_code ec) { + sock_, [wp = std::weak_ptr{shared_from_this()}](ErrorCode ec) { if (auto p = wp.lock()) { p->onAccept(ec); @@ -269,7 +269,7 @@ public: void stop() { - error_code ec; + ErrorCode ec; acceptor_.close(ec); // TODO: consider making this join // any running do_peer threads @@ -280,7 +280,7 @@ public: stop(); } - endpoint_type + EndpointType localEndpoint() const { return acceptor_.local_endpoint(); @@ -469,11 +469,11 @@ private: { int id; TrustedPublisherServer& self; - socket_type sock; + SocketType sock; boost::asio::executor_work_guard work; bool ssl; - Lambda(int id, TrustedPublisherServer& self, socket_type&& sock, bool ssl) + Lambda(int id, TrustedPublisherServer& self, SocketType&& sock, bool ssl) : id(id), self(self), sock(std::move(sock)), work(this->sock.get_executor()), ssl(ssl) { } @@ -486,7 +486,7 @@ private: }; void - onAccept(error_code ec) + onAccept(ErrorCode ec) { if (ec || !acceptor_.is_open()) return; @@ -494,7 +494,7 @@ private: static int nextId = 0; // NOLINT(readability-identifier-naming) std::thread{Lambda{++nextId, *this, std::move(sock_), useSSL_}}.detach(); acceptor_.async_accept( - sock_, [wp = std::weak_ptr{shared_from_this()}](error_code ec) { + sock_, [wp = std::weak_ptr{shared_from_this()}](ErrorCode ec) { if (auto p = wp.lock()) { p->onAccept(ec); @@ -503,13 +503,13 @@ private: } void - doPeer(int id, socket_type&& s, bool ssl) + doPeer(int id, SocketType&& s, bool ssl) { using namespace boost::beast; using namespace boost::asio; - socket_type sock(std::move(s)); + SocketType sock(std::move(s)); flat_buffer sb; - error_code ec; + ErrorCode ec; std::optional> sslStream; if (ssl) @@ -524,8 +524,8 @@ private: for (;;) { - resp_type res; - req_type req; + RespType res; + ReqType req; try { if (ssl) diff --git a/src/test/jtx/account_txn_id.h b/src/test/jtx/account_txn_id.h index ffee4123aa..bb93f144a7 100644 --- a/src/test/jtx/account_txn_id.h +++ b/src/test/jtx/account_txn_id.h @@ -10,10 +10,10 @@ namespace xrpl::test::jtx { struct AccountTxnId { private: - uint256 hash_; + UInt256 hash_; public: - explicit AccountTxnId(uint256 const& hash) : hash_(hash) + explicit AccountTxnId(UInt256 const& hash) : hash_(hash) { } diff --git a/src/test/jtx/check.h b/src/test/jtx/check.h index a5d1f079c4..b6c5ffadfa 100644 --- a/src/test/jtx/check.h +++ b/src/test/jtx/check.h @@ -21,7 +21,7 @@ namespace check { * Cash a check requiring that a specific amount be delivered. */ json::Value -cash(jtx::Account const& dest, uint256 const& checkId, STAmount const& amount); +cash(jtx::Account const& dest, UInt256 const& checkId, STAmount const& amount); /** * Type used to specify DeliverMin for cashing a check. @@ -38,19 +38,19 @@ struct DeliverMin * Cash a check requiring that at least a minimum amount be delivered. */ json::Value -cash(jtx::Account const& dest, uint256 const& checkId, DeliverMin const& atLeast); +cash(jtx::Account const& dest, UInt256 const& checkId, DeliverMin const& atLeast); /** * Cancel a check. */ json::Value -cancel(jtx::Account const& dest, uint256 const& checkId); +cancel(jtx::Account const& dest, UInt256 const& checkId); } // namespace check /** * Match the number of checks on the account. */ -using checks = OwnerCount; +using Checks = OwnerCount; } // namespace xrpl::test::jtx diff --git a/src/test/jtx/directory.h b/src/test/jtx/directory.h index 294cfcc43c..9fe0204723 100644 --- a/src/test/jtx/directory.h +++ b/src/test/jtx/directory.h @@ -42,7 +42,7 @@ bumpLastPage( Env& env, std::uint64_t newLastPage, Keylet directory, - std::function adjust) -> std::expected; + std::function adjust) -> std::expected; /** * Implementation of adjust for the most common ledger entry, i.e. one where @@ -51,7 +51,7 @@ bumpLastPage( * of this kind (e.g. ticket, DID, offer, deposit preauth, MPToken etc.) */ bool -adjustOwnerNode(ApplyView& view, uint256 key, std::uint64_t page); +adjustOwnerNode(ApplyView& view, UInt256 key, std::uint64_t page); inline auto maximumPageIndex(Env const& env) -> std::uint64_t diff --git a/src/test/jtx/domain.h b/src/test/jtx/domain.h index c6061c9795..c64c52b296 100644 --- a/src/test/jtx/domain.h +++ b/src/test/jtx/domain.h @@ -13,10 +13,10 @@ namespace xrpl::test::jtx { class Domain { private: - uint256 v_; + UInt256 v_; public: - explicit Domain(uint256 const& v) : v_(v) + explicit Domain(UInt256 const& v) : v_(v) { } diff --git a/src/test/jtx/impl/ConfidentialTransfer.cpp b/src/test/jtx/impl/ConfidentialTransfer.cpp index 0bc98778f6..d25e538eae 100644 --- a/src/test/jtx/impl/ConfidentialTransfer.cpp +++ b/src/test/jtx/impl/ConfidentialTransfer.cpp @@ -363,7 +363,7 @@ Buffer ConfidentialTransferTestBase::getForgedBulletproof( std::array const& values, std::array const& blindingFactors, - uint256 const& contextHash) + UInt256 const& contextHash) { auto* const ctx = mpt_secp256k1_context(); @@ -388,7 +388,7 @@ Buffer ConfidentialTransferTestBase::getForgedSingleBulletproof( uint64_t value, Buffer const& blindingFactor, - uint256 const& contextHash) + UInt256 const& contextHash) { auto* const ctx = mpt_secp256k1_context(); @@ -422,7 +422,7 @@ ConfidentialTransferTestBase::getForgedConvertBackProof( Buffer const& pedersenCommitment, Buffer const& encryptedSpendingBalance, Buffer const& pcBlindingFactor, - uint256 const& contextHash) + UInt256 const& contextHash) { if (pedersenCommitment.size() != kCompressedEcPointLength) Throw("getForgedConvertBackProof: bad pedersenCommitment length"); diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 35553bdeb2..58191de71b 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -706,7 +706,7 @@ Env::doRpc( } void -Env::enableFeature(uint256 const feature) +Env::enableFeature(UInt256 const feature) { // Env::close() must be called for feature // enable to take place. @@ -714,7 +714,7 @@ Env::enableFeature(uint256 const feature) } void -Env::disableFeature(uint256 const feature) +Env::disableFeature(UInt256 const feature) { // Env::close() must be called for feature // enable to take place. diff --git a/src/test/jtx/impl/TestHelpers.cpp b/src/test/jtx/impl/TestHelpers.cpp index 2fa2aebcda..61f6422a7b 100644 --- a/src/test/jtx/impl/TestHelpers.cpp +++ b/src/test/jtx/impl/TestHelpers.cpp @@ -207,7 +207,7 @@ findPathsRequest( std::optional const& saSendMax, std::optional const& srcAsset, std::optional const& srcIssuer, - std::optional const& domain) + std::optional const& domain) { using namespace jtx; @@ -272,7 +272,7 @@ findPaths( std::optional const& saSendMax, std::optional const& srcAsset, std::optional const& srcIssuer, - std::optional const& domain) + std::optional const& domain) { json::Value result = findPathsRequest(env, src, dst, saDstAmount, saSendMax, srcAsset, srcIssuer, domain); @@ -321,7 +321,7 @@ findPathsByElement( std::optional const& saSendMax, std::optional const& srcElement, std::optional const& srcIssuer, - std::optional const& domain) + std::optional const& domain) { // srcElement is optional but is expected to always be present XRPL_ASSERT( @@ -421,7 +421,7 @@ expectOffers( { std::uint16_t cnt = 0; std::uint16_t matched = 0; - forEachItem(*env.current(), account, [&](SLE::const_ref sle) { + forEachItem(*env.current(), account, [&](SLE::ConstRef sle) { if (!sle) return false; if (sle->getType() == ltOFFER) @@ -531,7 +531,7 @@ create( json::Value fund( AccountID const& account, - uint256 const& channel, + UInt256 const& channel, STAmount const& amount, std::optional const& expiration) { @@ -548,7 +548,7 @@ fund( json::Value claim( AccountID const& account, - uint256 const& channel, + UInt256 const& channel, std::optional const& balance, std::optional const& amount, std::optional const& signature, @@ -569,7 +569,7 @@ claim( return jv; } -uint256 +UInt256 channel(AccountID const& account, AccountID const& dst, std::uint32_t seqProxyValue) { auto const seqProxy = SeqProxy::rawSequence(seqProxyValue); @@ -578,7 +578,7 @@ channel(AccountID const& account, AccountID const& dst, std::uint32_t seqProxyVa } STAmount -channelBalance(ReadView const& view, uint256 const& chan) +channelBalance(ReadView const& view, UInt256 const& chan) { auto const slep = view.read({ltPAYCHAN, chan}); if (!slep) @@ -587,7 +587,7 @@ channelBalance(ReadView const& view, uint256 const& chan) } bool -channelExists(ReadView const& view, uint256 const& chan) +channelExists(ReadView const& view, UInt256 const& chan) { auto const slep = view.read({ltPAYCHAN, chan}); return bool(slep); @@ -748,7 +748,7 @@ issueHelperMPT(IssuerArgs const& args) namespace loan_broker { json::Value -set(AccountID const& account, uint256 const& vaultId, uint32_t flags) +set(AccountID const& account, UInt256 const& vaultId, uint32_t flags) { json::Value jv; jv[sfTransactionType] = jss::LoanBrokerSet; @@ -759,7 +759,7 @@ set(AccountID const& account, uint256 const& vaultId, uint32_t flags) } json::Value -del(AccountID const& account, uint256 const& brokerID, uint32_t flags) +del(AccountID const& account, UInt256 const& brokerID, uint32_t flags) { json::Value jv; jv[sfTransactionType] = jss::LoanBrokerDelete; @@ -772,7 +772,7 @@ del(AccountID const& account, uint256 const& brokerID, uint32_t flags) json::Value coverDeposit( AccountID const& account, - uint256 const& brokerID, + UInt256 const& brokerID, STAmount const& amount, uint32_t flags) { @@ -788,7 +788,7 @@ coverDeposit( json::Value coverWithdraw( AccountID const& account, - uint256 const& brokerID, + UInt256 const& brokerID, STAmount const& amount, uint32_t flags) { @@ -819,7 +819,7 @@ namespace loan { json::Value set(AccountID const& account, - uint256 const& loanBrokerID, + UInt256 const& loanBrokerID, Number principalRequested, std::uint32_t flags) { @@ -833,7 +833,7 @@ set(AccountID const& account, } json::Value -manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags) +manage(AccountID const& account, UInt256 const& loanID, std::uint32_t flags) { json::Value jv; jv[sfTransactionType] = jss::LoanManage; @@ -844,7 +844,7 @@ manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags) } json::Value -del(AccountID const& account, uint256 const& loanID, std::uint32_t flags) +del(AccountID const& account, UInt256 const& loanID, std::uint32_t flags) { json::Value jv; jv[sfTransactionType] = jss::LoanDelete; @@ -855,7 +855,7 @@ del(AccountID const& account, uint256 const& loanID, std::uint32_t flags) } json::Value -pay(AccountID const& account, uint256 const& loanID, STAmount const& amount, std::uint32_t flags) +pay(AccountID const& account, UInt256 const& loanID, STAmount const& amount, std::uint32_t flags) { json::Value jv; jv[sfTransactionType] = jss::LoanPay; diff --git a/src/test/jtx/impl/WSClient.cpp b/src/test/jtx/impl/WSClient.cpp index a8702c12d9..cc8f23999a 100644 --- a/src/test/jtx/impl/WSClient.cpp +++ b/src/test/jtx/impl/WSClient.cpp @@ -49,7 +49,7 @@ namespace xrpl::test { class WSClientImpl : public WSClient { - using error_code = boost::system::error_code; + using ErrorCode = boost::system::error_code; struct Msg { @@ -136,7 +136,7 @@ class WSClientImpl : public WSClient { ws_.async_close( {}, // - boost::asio::bind_executor(strand_, [&](error_code) { + boost::asio::bind_executor(strand_, [&](ErrorCode) { try { stream_.cancel(); @@ -178,7 +178,7 @@ public: })); ws_.handshake(ep.address().to_string() + ":" + std::to_string(ep.port()), "/"); ws_.async_read( - rb_, boost::asio::bind_executor(strand_, [this](error_code const& ec, std::size_t) { + rb_, boost::asio::bind_executor(strand_, [this](ErrorCode const& ec, std::size_t) { onReadMsg(ec); })); } @@ -220,7 +220,7 @@ public: // Use the error_code overload to avoid an unhandled exception // when the server closes the WebSocket connection (e.g. after // booting a client that exceeded resource thresholds). - error_code ec; + ErrorCode ec; ws_.write_some(true, buffer(s), ec); if (ec) return {}; @@ -310,7 +310,7 @@ public: { ws_.async_close( boost::beast::websocket::close_code::normal, - boost::asio::bind_executor(strand_, [](error_code) {})); + boost::asio::bind_executor(strand_, [](ErrorCode) {})); } })); @@ -334,7 +334,7 @@ public: private: void - onReadMsg(error_code const& ec) + onReadMsg(ErrorCode const& ec) { if (ec) { @@ -361,7 +361,7 @@ private: } ws_.async_read( - rb_, boost::asio::bind_executor(strand_, [this](error_code const& ec, std::size_t) { + rb_, boost::asio::bind_executor(strand_, [this](ErrorCode const& ec, std::size_t) { onReadMsg(ec); })); } diff --git a/src/test/jtx/impl/check.cpp b/src/test/jtx/impl/check.cpp index 936cdcb818..a10acffe37 100644 --- a/src/test/jtx/impl/check.cpp +++ b/src/test/jtx/impl/check.cpp @@ -12,7 +12,7 @@ namespace xrpl::test::jtx::check { // Cash a check requiring that a specific amount be delivered. json::Value -cash(jtx::Account const& dest, uint256 const& checkId, STAmount const& amount) +cash(jtx::Account const& dest, UInt256 const& checkId, STAmount const& amount) { json::Value jv; jv[sfAccount.jsonName] = dest.human(); @@ -24,7 +24,7 @@ cash(jtx::Account const& dest, uint256 const& checkId, STAmount const& amount) // Cash a check requiring that at least a minimum amount be delivered. json::Value -cash(jtx::Account const& dest, uint256 const& checkId, DeliverMin const& atLeast) +cash(jtx::Account const& dest, UInt256 const& checkId, DeliverMin const& atLeast) { json::Value jv; jv[sfAccount.jsonName] = dest.human(); @@ -36,7 +36,7 @@ cash(jtx::Account const& dest, uint256 const& checkId, DeliverMin const& atLeast // Cancel a check. json::Value -cancel(jtx::Account const& dest, uint256 const& checkId) +cancel(jtx::Account const& dest, UInt256 const& checkId) { json::Value jv; jv[sfAccount.jsonName] = dest.human(); diff --git a/src/test/jtx/impl/directory.cpp b/src/test/jtx/impl/directory.cpp index 5eaf0be196..191099385f 100644 --- a/src/test/jtx/impl/directory.cpp +++ b/src/test/jtx/impl/directory.cpp @@ -28,7 +28,7 @@ bumpLastPage( Env& env, std::uint64_t newLastPage, Keylet directory, - std::function adjust) -> std::expected + std::function adjust) -> std::expected { std::expected res{}; env.app().getOpenLedger().modify([&](OpenView& view, beast::Journal j) -> bool { @@ -125,7 +125,7 @@ bumpLastPage( } bool -adjustOwnerNode(ApplyView& view, uint256 key, std::uint64_t page) +adjustOwnerNode(ApplyView& view, UInt256 key, std::uint64_t page) { auto sle = view.peek({ltANY, key}); if (sle && sle->isFieldPresent(sfOwnerNode)) diff --git a/src/test/jtx/impl/ledgerStateFixes.cpp b/src/test/jtx/impl/ledgerStateFixes.cpp index ae195021b8..10dcc20d4c 100644 --- a/src/test/jtx/impl/ledgerStateFixes.cpp +++ b/src/test/jtx/impl/ledgerStateFixes.cpp @@ -25,7 +25,7 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner) // Fix sfExchangeRate on a book directory. acct pays fee. json::Value -bookExchangeRate(jtx::Account const& acct, uint256 const& bookDir) +bookExchangeRate(jtx::Account const& acct, UInt256 const& bookDir) { json::Value jv; jv[sfAccount.jsonName] = acct.human(); diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index 16e108c597..26a3f01246 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -684,7 +684,7 @@ MPTTester::forObject( } [[nodiscard]] bool -MPTTester::checkDomainID(std::optional expected) const +MPTTester::checkDomainID(std::optional expected) const { return forObject([&](SLEP const& sle) -> bool { if (sle->isFieldPresent(sfDomainID)) @@ -952,7 +952,7 @@ MPTTester::getClawbackProof( Account const& holder, std::uint64_t amount, Buffer const& privateKey, - uint256 const& contextHash) const + UInt256 const& contextHash) const { if (!id_) Throw("MPT has not been created"); @@ -988,7 +988,7 @@ MPTTester::getClawbackProof( } std::optional -MPTTester::getSchnorrProof(Account const& account, uint256 const& ctxHash) const +MPTTester::getSchnorrProof(Account const& account, UInt256 const& ctxHash) const { auto const pubKey = getPubKey(account); if (!pubKey || pubKey->size() != kEcPubKeyLength) @@ -1016,7 +1016,7 @@ MPTTester::getConfidentialSendProof( std::uint64_t const amount, std::vector const& recipients, Slice const& blindingFactor, - uint256 const& contextHash, + UInt256 const& contextHash, PedersenProofParams const& amountParams, PedersenProofParams const& balanceParams) const { @@ -1101,7 +1101,7 @@ std::optional MPTTester::getConvertBackProof( Account const& holder, std::uint64_t const amount, - uint256 const& contextHash, + UInt256 const& contextHash, PedersenProofParams const& pcParams) const { // Expected total proof length: compact sigma proof (128 bytes) + single bulletproof (688 bytes) diff --git a/src/test/jtx/impl/owners.cpp b/src/test/jtx/impl/owners.cpp index ed10ca6930..b20205e29c 100644 --- a/src/test/jtx/impl/owners.cpp +++ b/src/test/jtx/impl/owners.cpp @@ -17,7 +17,7 @@ std::uint32_t ownedCountOf(ReadView const& view, AccountID const& id, LedgerEntryType type) { std::uint32_t count = 0; - forEachItem(view, id, [&count, type](SLE::const_ref sle) { + forEachItem(view, id, [&count, type](SLE::ConstRef sle) { if (sle->getType() == type) ++count; }); diff --git a/src/test/jtx/impl/paths.cpp b/src/test/jtx/impl/paths.cpp index eb4b36ae4f..4c79e1e5e1 100644 --- a/src/test/jtx/impl/paths.cpp +++ b/src/test/jtx/impl/paths.cpp @@ -30,12 +30,12 @@ Paths::operator()(Env& env, JTx& jt) const auto const to = env.lookup(jv[jss::Destination].asString()); auto const amount = amountFromJson(sfAmount, jv[jss::Amount]); - std::optional domain; + std::optional domain; if (jv.isMember(sfDomainID.jsonName)) { if (!jv[sfDomainID.jsonName].isString()) return; - uint256 num; + UInt256 num; auto const s = jv[sfDomainID.jsonName].asString(); if (num.parseHex(s)) domain = num; diff --git a/src/test/jtx/impl/permissioned_dex.cpp b/src/test/jtx/impl/permissioned_dex.cpp index a6b24d7ac6..568a5ffb62 100644 --- a/src/test/jtx/impl/permissioned_dex.cpp +++ b/src/test/jtx/impl/permissioned_dex.cpp @@ -15,7 +15,7 @@ namespace xrpl::test::jtx { -uint256 +UInt256 setupDomain( jtx::Env& env, std::vector const& accounts, diff --git a/src/test/jtx/impl/permissioned_domains.cpp b/src/test/jtx/impl/permissioned_domains.cpp index 385008be43..93a27fceb6 100644 --- a/src/test/jtx/impl/permissioned_domains.cpp +++ b/src/test/jtx/impl/permissioned_domains.cpp @@ -27,7 +27,7 @@ namespace xrpl::test::jtx::pdomain { // helpers // Make json for PermissionedDomainSet transaction json::Value -setTx(AccountID const& account, Credentials const& credentials, std::optional domain) +setTx(AccountID const& account, Credentials const& credentials, std::optional domain) { json::Value jv; jv[sfTransactionType] = jss::PermissionedDomainSet; @@ -49,7 +49,7 @@ setTx(AccountID const& account, Credentials const& credentials, std::optional +std::map getObjects(Account const& account, Env& env, bool withType) { - std::map ret; + std::map ret; json::Value params; params[jss::account] = account.human(); if (withType) @@ -84,7 +84,7 @@ getObjects(Account const& account, Env& env, bool withType) continue; } - uint256 index; + UInt256 index; std::ignore = index.parseHex(object[jss::index].asString()); ret[index] = object; } @@ -94,7 +94,7 @@ getObjects(Account const& account, Env& env, bool withType) // Check if ledger object is there bool -objectExists(uint256 const& objID, Env& env) +objectExists(UInt256 const& objID, Env& env) { json::Value params; params[jss::index] = to_string(objID); @@ -148,10 +148,10 @@ sortCredentials(Credentials const& input) return {credentialsSet.begin(), credentialsSet.end()}; } -uint256 +UInt256 getNewDomain(std::shared_ptr const& meta) { - uint256 ret; + UInt256 ret; auto metaJson = meta->getJson(JsonOptions::Values::None); json::Value a(json::ValueType::Array); a = metaJson["AffectedNodes"]; diff --git a/src/test/jtx/impl/proposal.cpp b/src/test/jtx/impl/proposal.cpp index 58a6d7873d..681350c3e3 100644 --- a/src/test/jtx/impl/proposal.cpp +++ b/src/test/jtx/impl/proposal.cpp @@ -147,10 +147,10 @@ namespace { // The keys an account's owner directory lists, each with the page it sits on. // The pages are read directly, so a key with nothing behind it is still seen. -std::map +std::map ownerDirKeys(ReadView const& view, AccountID const& account) { - std::map keys; + std::map keys; auto const root = keylet::ownerDir(account); std::uint64_t page = 0; diff --git a/src/test/jtx/impl/sponsor.cpp b/src/test/jtx/impl/sponsor.cpp index 453ccebcb9..399164b32f 100644 --- a/src/test/jtx/impl/sponsor.cpp +++ b/src/test/jtx/impl/sponsor.cpp @@ -49,7 +49,7 @@ del(jtx::Account const& account) } json::Value -transfer(jtx::Account const& account, uint32_t flags, std::optional const& index) +transfer(jtx::Account const& account, uint32_t flags, std::optional const& index) { json::Value jv; jv[jss::TransactionType] = jss::SponsorshipTransfer; diff --git a/src/test/jtx/impl/token.cpp b/src/test/jtx/impl/token.cpp index 8604b077c4..5ed4ab784e 100644 --- a/src/test/jtx/impl/token.cpp +++ b/src/test/jtx/impl/token.cpp @@ -53,7 +53,7 @@ Amount::operator()(Env& env, JTx& jt) const jt.jv[sfAmount.jsonName] = amount_.getJson(JsonOptions::Values::None); } -uint256 +UInt256 getNextID( jtx::Env const& env, jtx::Account const& issuer, @@ -66,7 +66,7 @@ getNextID( return token::getID(env, issuer, nfTokenTaxon, nftSeq, flags, xferFee); } -uint256 +UInt256 getID( jtx::Env const& env, jtx::Account const& issuer, @@ -83,7 +83,7 @@ getID( } json::Value -burn(jtx::Account const& account, uint256 const& nftokenID) +burn(jtx::Account const& account, UInt256 const& nftokenID) { json::Value jv; jv[sfAccount.jsonName] = account.human(); @@ -93,7 +93,7 @@ burn(jtx::Account const& account, uint256 const& nftokenID) } json::Value -createOffer(jtx::Account const& account, uint256 const& nftokenID, STAmount const& amount) +createOffer(jtx::Account const& account, UInt256 const& nftokenID, STAmount const& amount) { json::Value jv; jv[sfAccount.jsonName] = account.human(); @@ -130,7 +130,7 @@ cancelOfferImpl(jtx::Account const& account, T const& nftokenOffers) if (!empty(nftokenOffers)) { jv[sfNFTokenOffers.jsonName] = json::ValueType::Array; - for (uint256 const& nftokenOffer : nftokenOffers) + for (UInt256 const& nftokenOffer : nftokenOffers) jv[sfNFTokenOffers.jsonName].append(to_string(nftokenOffer)); } jv[jss::TransactionType] = jss::NFTokenCancelOffer; @@ -138,13 +138,13 @@ cancelOfferImpl(jtx::Account const& account, T const& nftokenOffers) } json::Value -cancelOffer(jtx::Account const& account, std::initializer_list const& nftokenOffers) +cancelOffer(jtx::Account const& account, std::initializer_list const& nftokenOffers) { return cancelOfferImpl(account, nftokenOffers); } json::Value -cancelOffer(jtx::Account const& account, std::vector const& nftokenOffers) +cancelOffer(jtx::Account const& account, std::vector const& nftokenOffers) { return cancelOfferImpl(account, nftokenOffers); } @@ -156,7 +156,7 @@ RootIndex::operator()(Env& env, JTx& jt) const } json::Value -acceptBuyOffer(jtx::Account const& account, uint256 const& offerIndex) +acceptBuyOffer(jtx::Account const& account, UInt256 const& offerIndex) { json::Value jv; jv[sfAccount.jsonName] = account.human(); @@ -166,7 +166,7 @@ acceptBuyOffer(jtx::Account const& account, uint256 const& offerIndex) } json::Value -acceptSellOffer(jtx::Account const& account, uint256 const& offerIndex) +acceptSellOffer(jtx::Account const& account, UInt256 const& offerIndex) { json::Value jv; jv[sfAccount.jsonName] = account.human(); @@ -178,8 +178,8 @@ acceptSellOffer(jtx::Account const& account, uint256 const& offerIndex) json::Value brokerOffers( jtx::Account const& account, - uint256 const& buyOfferIndex, - uint256 const& sellOfferIndex) + UInt256 const& buyOfferIndex, + UInt256 const& sellOfferIndex) { json::Value jv; jv[sfAccount.jsonName] = account.human(); @@ -210,7 +210,7 @@ clearMinter(jtx::Account const& account) } json::Value -modify(jtx::Account const& account, uint256 const& nftokenID) +modify(jtx::Account const& account, UInt256 const& nftokenID) { json::Value jv; jv[sfAccount.jsonName] = account.human(); diff --git a/src/test/jtx/invoice_id.h b/src/test/jtx/invoice_id.h index b2f13a1d96..06dae953a8 100644 --- a/src/test/jtx/invoice_id.h +++ b/src/test/jtx/invoice_id.h @@ -10,10 +10,10 @@ namespace xrpl::test::jtx { struct InvoiceId { private: - uint256 hash_; + UInt256 hash_; public: - explicit InvoiceId(uint256 const& hash) : hash_(hash) + explicit InvoiceId(UInt256 const& hash) : hash_(hash) { } diff --git a/src/test/jtx/ledgerStateFix.h b/src/test/jtx/ledgerStateFix.h index 4ae22f891e..8be984c806 100644 --- a/src/test/jtx/ledgerStateFix.h +++ b/src/test/jtx/ledgerStateFix.h @@ -20,6 +20,6 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner); * Repair sfExchangeRate on a book directory's first page. */ json::Value -bookExchangeRate(jtx::Account const& acct, uint256 const& bookDir); +bookExchangeRate(jtx::Account const& acct, UInt256 const& bookDir); } // namespace xrpl::test::jtx::ledger_state_fix diff --git a/src/test/jtx/mpt.h b/src/test/jtx/mpt.h index 96af3dac2b..17a52f58e3 100644 --- a/src/test/jtx/mpt.h +++ b/src/test/jtx/mpt.h @@ -178,7 +178,7 @@ struct MPTCreate std::optional flags = {0}; std::optional immutableFlags = std::nullopt; bool authHolder = false; - std::optional domainID = std::nullopt; + std::optional domainID = std::nullopt; std::optional err = std::nullopt; }; @@ -262,7 +262,7 @@ struct MPTSet std::optional transferFee = std::nullopt; std::optional metadata = std::nullopt; std::optional delegate = std::nullopt; - std::optional domainID = std::nullopt; + std::optional domainID = std::nullopt; std::optional issuerPubKey = std::nullopt; std::optional auditorPubKey = std::nullopt; std::optional ticketSeq = std::nullopt; @@ -660,7 +660,7 @@ public: std::source_location const& loc = std::source_location::current()); [[nodiscard]] bool - checkDomainID(std::optional expected) const; + checkDomainID(std::optional expected) const; [[nodiscard]] bool checkMPTokenAmount(Account const& holder, std::int64_t expectedAmount) const; @@ -804,10 +804,10 @@ public: Account const& holder, std::uint64_t amount, Buffer const& privateKey, - uint256 const& txHash) const; + UInt256 const& txHash) const; [[nodiscard]] std::optional - getSchnorrProof(Account const& account, uint256 const& ctxHash) const; + getSchnorrProof(Account const& account, UInt256 const& ctxHash) const; [[nodiscard]] std::optional getConfidentialSendProof( @@ -815,7 +815,7 @@ public: std::uint64_t const amount, std::vector const& recipients, Slice const& blindingFactor, - uint256 const& contextHash, + UInt256 const& contextHash, PedersenProofParams const& amountParams, PedersenProofParams const& balanceParams) const; @@ -823,7 +823,7 @@ public: getConvertBackProof( Account const& holder, std::uint64_t const amount, - uint256 const& contextHash, + UInt256 const& contextHash, PedersenProofParams const& pcParams) const; [[nodiscard]] std::uint32_t diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index 65e39f971d..63fd2d47c8 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -27,9 +27,9 @@ struct Signer { std::uint32_t weight; Account account; - std::optional tag; + std::optional tag; - Signer(Account account, std::uint32_t weight = 1, std::optional tag = std::nullopt) + Signer(Account account, std::uint32_t weight = 1, std::optional tag = std::nullopt) : weight(weight), account(std::move(account)), tag(tag) { } @@ -115,6 +115,6 @@ public: /** * The number of signer lists matches. */ -using siglists = OwnerCount; +using SigLists = OwnerCount; } // namespace xrpl::test::jtx diff --git a/src/test/jtx/owners.h b/src/test/jtx/owners.h index 1e12603429..631510ee1f 100644 --- a/src/test/jtx/owners.h +++ b/src/test/jtx/owners.h @@ -129,17 +129,17 @@ public: /** * Match the number of trust lines in the account's owner directory */ -using lines = OwnerCount; +using Lines = OwnerCount; /** * Match the number of offers in the account's owner directory */ -using offers = OwnerCount; +using Offers = OwnerCount; /** * Match the number of MPToken in the account's owner directory */ -using mptokens = OwnerCount; +using MPTokens = OwnerCount; } // namespace test::jtx diff --git a/src/test/jtx/permissioned_dex.h b/src/test/jtx/permissioned_dex.h index a8afcac2eb..65d73a611a 100644 --- a/src/test/jtx/permissioned_dex.h +++ b/src/test/jtx/permissioned_dex.h @@ -10,7 +10,7 @@ namespace xrpl::test::jtx { -uint256 +UInt256 setupDomain( jtx::Env& env, std::vector const& accounts, @@ -26,7 +26,7 @@ public: Account bob; Account carol; IOU usd; - uint256 domainID; + UInt256 domainID; std::string credType; PermissionedDEX(Env& env); diff --git a/src/test/jtx/permissioned_domains.h b/src/test/jtx/permissioned_domains.h index f4dc080cbf..0d985c50bd 100644 --- a/src/test/jtx/permissioned_domains.h +++ b/src/test/jtx/permissioned_domains.h @@ -28,19 +28,19 @@ json::Value setTx( AccountID const& account, Credentials const& credentials, - std::optional domain = std::nullopt); + std::optional domain = std::nullopt); // Make json for PermissionedDomainDelete transaction json::Value -deleteTx(AccountID const& account, uint256 const& domain); +deleteTx(AccountID const& account, UInt256 const& domain); // Get PermissionedDomain objects from account_objects rpc call -std::map +std::map getObjects(Account const& account, Env& env, bool withType = true); // Check if ledger object is there bool -objectExists(uint256 const& objID, Env& env); +objectExists(UInt256 const& objID, Env& env); // Extract credentials from account_object object Credentials @@ -53,7 +53,7 @@ Credentials sortCredentials(Credentials const& input); // Get newly created domain from transaction metadata. -uint256 +UInt256 getNewDomain(std::shared_ptr const& meta); } // namespace xrpl::test::jtx::pdomain diff --git a/src/test/jtx/require.h b/src/test/jtx/require.h index eba20b613c..97b47decf5 100644 --- a/src/test/jtx/require.h +++ b/src/test/jtx/require.h @@ -12,7 +12,7 @@ namespace detail { template inline void -requireArgs(test::jtx::requires_t& vec, Cond const& cond, Args const&... args) +requireArgs(test::jtx::RequiresT& vec, Cond const& cond, Args const&... args) { vec.push_back(cond); if constexpr (sizeof...(args) > 0) @@ -27,10 +27,10 @@ namespace test::jtx { * Compose many condition functors into one */ template -require_t +RequireT required(Args const&... args) { - requires_t vec; + RequiresT vec; detail::requireArgs(vec, args...); return [vec](Env& env) { for (auto const& f : vec) @@ -48,7 +48,7 @@ required(Args const&... args) class Require { private: - require_t cond_; + RequireT cond_; public: template diff --git a/src/test/jtx/requires.h b/src/test/jtx/requires.h index d41d0cd0b0..4cbdd7c9b2 100644 --- a/src/test/jtx/requires.h +++ b/src/test/jtx/requires.h @@ -7,7 +7,7 @@ namespace xrpl::test::jtx { class Env; -using require_t = std::function; -using requires_t = std::vector; +using RequireT = std::function; +using RequiresT = std::vector; } // namespace xrpl::test::jtx diff --git a/src/test/jtx/sponsor.h b/src/test/jtx/sponsor.h index f87a13c462..ecad1062b7 100644 --- a/src/test/jtx/sponsor.h +++ b/src/test/jtx/sponsor.h @@ -51,7 +51,7 @@ json::Value transfer( jtx::Account const& account, uint32_t flags, - std::optional const& index = std::nullopt); + std::optional const& index = std::nullopt); struct CounterpartySponsor { diff --git a/src/test/jtx/ticket.h b/src/test/jtx/ticket.h index 9c9a698eaa..aa3115508a 100644 --- a/src/test/jtx/ticket.h +++ b/src/test/jtx/ticket.h @@ -51,6 +51,6 @@ public: /** * Match the number of tickets on the account. */ -using tickets = OwnerCount; +using Tickets = OwnerCount; } // namespace xrpl::test::jtx diff --git a/src/test/jtx/token.h b/src/test/jtx/token.h index e94cfd2e12..13bea4b48c 100644 --- a/src/test/jtx/token.h +++ b/src/test/jtx/token.h @@ -93,7 +93,7 @@ public: /** * Get the next NFTokenID that will be issued. */ -uint256 +UInt256 getNextID( jtx::Env const& env, jtx::Account const& account, @@ -104,7 +104,7 @@ getNextID( /** * Get the NFTokenID for a particular nftSequence. */ -uint256 +UInt256 getID( jtx::Env const& env, jtx::Account const& account, @@ -117,13 +117,13 @@ getID( * Burn an NFToken. */ json::Value -burn(jtx::Account const& account, uint256 const& nftokenID); +burn(jtx::Account const& account, UInt256 const& nftokenID); /** * Create an NFTokenOffer. */ json::Value -createOffer(jtx::Account const& account, uint256 const& nftokenID, STAmount const& amount); +createOffer(jtx::Account const& account, UInt256 const& nftokenID, STAmount const& amount); /** * Sets the optional Owner on an NFTokenOffer. @@ -180,10 +180,10 @@ public: * Cancel NFTokenOffers. */ json::Value -cancelOffer(jtx::Account const& account, std::initializer_list const& nftokenOffers = {}); +cancelOffer(jtx::Account const& account, std::initializer_list const& nftokenOffers = {}); json::Value -cancelOffer(jtx::Account const& account, std::vector const& nftokenOffers); +cancelOffer(jtx::Account const& account, std::vector const& nftokenOffers); /** * Sets the optional RootIndex field when canceling NFTokenOffers. @@ -194,7 +194,7 @@ private: std::string rootIndex_; public: - explicit RootIndex(uint256 const& index) : rootIndex_(to_string(index)) + explicit RootIndex(UInt256 const& index) : rootIndex_(to_string(index)) { } @@ -206,13 +206,13 @@ public: * Accept an NFToken buy offer. */ json::Value -acceptBuyOffer(jtx::Account const& account, uint256 const& offerIndex); +acceptBuyOffer(jtx::Account const& account, UInt256 const& offerIndex); /** * Accept an NFToken sell offer. */ json::Value -acceptSellOffer(jtx::Account const& account, uint256 const& offerIndex); +acceptSellOffer(jtx::Account const& account, UInt256 const& offerIndex); /** * Broker two NFToken offers. @@ -220,8 +220,8 @@ acceptSellOffer(jtx::Account const& account, uint256 const& offerIndex); json::Value brokerOffers( jtx::Account const& account, - uint256 const& buyOfferIndex, - uint256 const& sellOfferIndex); + UInt256 const& buyOfferIndex, + UInt256 const& sellOfferIndex); /** * Sets the optional NFTokenBrokerFee field in a brokerOffer transaction. @@ -256,6 +256,6 @@ clearMinter(jtx::Account const& account); * Modify an NFToken. */ json::Value -modify(jtx::Account const& account, uint256 const& nftokenID); +modify(jtx::Account const& account, UInt256 const& nftokenID); } // namespace xrpl::test::jtx::token diff --git a/src/test/jtx/vault.h b/src/test/jtx/vault.h index 000e8a20ea..5befd03a33 100644 --- a/src/test/jtx/vault.h +++ b/src/test/jtx/vault.h @@ -79,7 +79,7 @@ struct Vault struct SetArgs { Account owner; - uint256 id; + UInt256 id; }; static json::Value @@ -88,7 +88,7 @@ struct Vault struct DeleteArgs { Account owner; - uint256 id; + UInt256 id; }; static json::Value @@ -97,7 +97,7 @@ struct Vault struct DepositArgs { Account depositor; - uint256 id; + UInt256 id; STAmount amount; }; @@ -107,7 +107,7 @@ struct Vault struct WithdrawArgs { Account depositor; - uint256 id; + UInt256 id; STAmount amount; }; @@ -117,7 +117,7 @@ struct Vault struct ClawbackArgs { Account issuer; - uint256 id; + UInt256 id; Account holder; std::optional amount = std::nullopt; // NOLINT(readability-redundant-member-init) }; diff --git a/src/test/ledger/Directory_test.cpp b/src/test/ledger/Directory_test.cpp index a207b83f30..d877ffe325 100644 --- a/src/test/ledger/Directory_test.cpp +++ b/src/test/ledger/Directory_test.cpp @@ -69,7 +69,7 @@ struct Directory_test : public beast::unit_test::Suite // Insert n empty pages, numbered [0, ... n - 1], in the // specified directory: static void - makePages(Sandbox& sb, uint256 const& base, std::uint64_t n) + makePages(Sandbox& sb, UInt256 const& base, std::uint64_t n) { for (std::uint64_t i = 0; i < n; ++i) { @@ -314,7 +314,7 @@ struct Directory_test : public beast::unit_test::Suite // should have no entries and be empty: { Sandbox const sb(env.closed().get(), TapNone); - uint256 const bookBase = getBookBase({xrpIssue(), usd, std::nullopt}); + UInt256 const bookBase = getBookBase({xrpIssue(), usd, std::nullopt}); BEAST_EXPECT(dirIsEmpty(sb, keylet::page(bookBase))); BEAST_EXPECT(!sb.succ(bookBase, getQualityNext(bookBase))); @@ -346,9 +346,9 @@ struct Directory_test : public beast::unit_test::Suite env.fund(XRP(10000), alice); env.close(); - constexpr uint256 kBase("fb71c9aa3310141da4b01d6c744a98286af2d72ab5448d5adc0910ca0c910880"); + constexpr UInt256 kBase("fb71c9aa3310141da4b01d6c744a98286af2d72ab5448d5adc0910ca0c910880"); - constexpr uint256 kItem("bad0f021aa3b2f6754a8fe82a5779730aa0bbbab82f17201ef24900efc2c7312"); + constexpr UInt256 kItem("bad0f021aa3b2f6754a8fe82a5779730aa0bbbab82f17201ef24900efc2c7312"); { // Create a chain of three pages: @@ -530,7 +530,7 @@ struct Directory_test : public beast::unit_test::Suite env, lastPage, keylet::ownerDir(alice.id()), - [lastPage, this](ApplyView& view, uint256 key, std::uint64_t page) { + [lastPage, this](ApplyView& view, UInt256 key, std::uint64_t page) { auto sle = view.peek({ltCREDENTIAL, key}); if (!BEAST_EXPECT(sle)) return false; diff --git a/src/test/ledger/SkipList_test.cpp b/src/test/ledger/SkipList_test.cpp index fd3cc2f214..719b5d9d02 100644 --- a/src/test/ledger/SkipList_test.cpp +++ b/src/test/ledger/SkipList_test.cpp @@ -26,7 +26,7 @@ class SkipList_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); history.push_back(prev); for (auto i = 0; i < 1023; ++i) diff --git a/src/test/ledger/View_test.cpp b/src/test/ledger/View_test.cpp index b62061d38d..717d361ada 100644 --- a/src/test/ledger/View_test.cpp +++ b/src/test/ledger/View_test.cpp @@ -57,7 +57,7 @@ class View_test : public beast::unit_test::Suite static Keylet k(std::uint64_t id) { - return Keylet{ltACCOUNT_ROOT, uint256(id)}; + return Keylet{ltACCOUNT_ROOT, UInt256(id)}; } // Create SLE with key and payload @@ -79,7 +79,7 @@ class View_test : public beast::unit_test::Suite // Set payload on SLE static void - seq(SLE::ref le, std::uint32_t seq) + seq(SLE::Ref le, std::uint32_t seq) { le->setFieldU32(sfSequence, seq); } @@ -90,7 +90,7 @@ class View_test : public beast::unit_test::Suite { openLedger.modify([](OpenView& view, beast::Journal) { // HACK! - std::optional next; + std::optional next; next.emplace(0); for (;;) { @@ -107,7 +107,7 @@ class View_test : public beast::unit_test::Suite wipe(Ledger& ledger) { // HACK! - std::optional next; + std::optional next; next.emplace(0); for (;;) { @@ -154,7 +154,7 @@ class View_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto const ledger = std::make_shared(*genesis, env.app().getTimeKeeper().closeTime()); @@ -393,10 +393,10 @@ class View_test : public beast::unit_test::Suite } // Return a list of keys found via sles - static std::vector + static std::vector sles(ReadView const& ledger) { - std::vector v; + std::vector v; v.reserve(32); for (auto const& sle : ledger.sles) v.push_back(sle->key()); @@ -404,10 +404,10 @@ class View_test : public beast::unit_test::Suite } template - static std::vector + static std::vector list(Args... args) { - return std::vector({uint256(args)...}); + return std::vector({UInt256(args)...}); } void @@ -422,7 +422,7 @@ class View_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto const ledger = std::make_shared(*genesis, env.app().getTimeKeeper().closeTime()); @@ -439,20 +439,20 @@ class View_test : public beast::unit_test::Suite BEAST_EXPECT(sles(*ledger) == list(1, 2, 3)); auto e = ledger->stateMap().end(); auto b1 = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(1)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(2)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(1)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(2)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(3)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(3)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(4)) == b1); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(5)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(4)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(5)) == b1); b1 = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(0)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(0)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(1)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(1)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(2)) == b1); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(3)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(2)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(3)) == e); } { @@ -460,77 +460,77 @@ class View_test : public beast::unit_test::Suite BEAST_EXPECT(sles(*ledger) == list(2, 4, 6)); auto e = ledger->stateMap().end(); auto b1 = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(1)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(2)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(3)) == b1); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(4)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(1)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(2)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(3)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(4)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(5)) == b1); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(6)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(5)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(6)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(7)) == b1); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(7)) == b1); b1 = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(1)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(1)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(2)) == b1); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(3)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(2)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(3)) == b1); ++b1; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(4)) == b1); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(5)) == b1); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(6)) == e); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(7)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(4)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(5)) == b1); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(6)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(7)) == e); } { setup({2, 3, 5, 6, 10, 15}); BEAST_EXPECT(sles(*ledger) == list(2, 3, 5, 6, 10, 15)); auto e = ledger->stateMap().end(); auto b = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(1)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(2)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(3)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(1)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(2)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(4)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(5)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(4)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(5)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(6)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(6)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(7)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(8)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(9)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(10)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(7)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(8)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(9)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(10)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(11)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(12)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(13)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(14)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(15)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(11)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(12)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(13)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(14)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(15)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(16)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(16)) == b); b = ledger->stateMap().begin(); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(0)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(1)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(0)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(1)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(2)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(2)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(3)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(4)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(3)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(5)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(5)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(6)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(7)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(8)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(9)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(6)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(7)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(8)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(9)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(10)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(11)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(12)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(13)) == b); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(14)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(10)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(11)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(12)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(13)) == b); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(14)) == b); ++b; - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(15)) == e); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(16)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(15)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(16)) == e); } { // some full trees, some empty trees, etc @@ -580,42 +580,42 @@ class View_test : public beast::unit_test::Suite 100)); auto b = ledger->stateMap().begin(); auto e = ledger->stateMap().end(); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(0)) == e); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(1)) == b); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(5))->key() == uint256(4)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(15))->key() == uint256(14)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(16))->key() == uint256(15)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(19))->key() == uint256(16)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(20))->key() == uint256(16)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(24))->key() == uint256(20)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(31))->key() == uint256(30)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(32))->key() == uint256(30)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(40))->key() == uint256(39)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(47))->key() == uint256(46)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(48))->key() == uint256(47)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(64))->key() == uint256(48)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(0)) == e); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(1)) == b); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(5))->key() == UInt256(4)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(15))->key() == UInt256(14)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(16))->key() == UInt256(15)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(19))->key() == UInt256(16)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(20))->key() == UInt256(16)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(24))->key() == UInt256(20)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(31))->key() == UInt256(30)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(32))->key() == UInt256(30)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(40))->key() == UInt256(39)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(47))->key() == UInt256(46)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(48))->key() == UInt256(47)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(64))->key() == UInt256(48)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(90))->key() == uint256(66)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(96))->key() == uint256(66)); - BEAST_EXPECT(ledger->stateMap().lowerBound(uint256(100))->key() == uint256(66)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(90))->key() == UInt256(66)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(96))->key() == UInt256(66)); + BEAST_EXPECT(ledger->stateMap().lowerBound(UInt256(100))->key() == UInt256(66)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(0))->key() == uint256(1)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(5))->key() == uint256(6)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(15))->key() == uint256(16)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(16))->key() == uint256(20)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(18))->key() == uint256(20)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(20))->key() == uint256(25)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(31))->key() == uint256(32)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(32))->key() == uint256(33)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(47))->key() == uint256(48)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(48))->key() == uint256(66)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(53))->key() == uint256(66)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(66))->key() == uint256(100)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(70))->key() == uint256(100)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(85))->key() == uint256(100)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(98))->key() == uint256(100)); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(100)) == e); - BEAST_EXPECT(ledger->stateMap().upperBound(uint256(155)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(0))->key() == UInt256(1)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(5))->key() == UInt256(6)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(15))->key() == UInt256(16)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(16))->key() == UInt256(20)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(18))->key() == UInt256(20)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(20))->key() == UInt256(25)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(31))->key() == UInt256(32)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(32))->key() == UInt256(33)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(47))->key() == UInt256(48)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(48))->key() == UInt256(66)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(53))->key() == UInt256(66)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(66))->key() == UInt256(100)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(70))->key() == UInt256(100)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(85))->key() == UInt256(100)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(98))->key() == UInt256(100)); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(100)) == e); + BEAST_EXPECT(ledger->stateMap().upperBound(UInt256(155)) == e); } } @@ -631,7 +631,7 @@ class View_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto const ledger = std::make_shared(*genesis, env.app().getTimeKeeper().closeTime()); @@ -651,15 +651,15 @@ class View_test : public beast::unit_test::Suite view.rawInsert(sle(5)); BEAST_EXPECT(sles(view) == list(2, 3, 4, 5)); auto b = view.sles.begin(); - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); } { setup123(); @@ -670,14 +670,14 @@ class View_test : public beast::unit_test::Suite view.rawInsert(sle(5)); BEAST_EXPECT(sles(view) == list(3, 4, 5)); auto b = view.sles.begin(); - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); } { setup123(); @@ -689,13 +689,13 @@ class View_test : public beast::unit_test::Suite view.rawInsert(sle(5)); BEAST_EXPECT(sles(view) == list(4, 5)); auto b = view.sles.begin(); - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); } { setup123(); @@ -706,14 +706,14 @@ class View_test : public beast::unit_test::Suite BEAST_EXPECT(sles(view) == list(1, 2, 4, 5)); auto b = view.sles.begin(); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); } { setup123(); @@ -729,12 +729,12 @@ class View_test : public beast::unit_test::Suite BEAST_EXPECT(sles(view) == list(1, 2)); auto b = view.sles.begin(); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); view.rawInsert(sle(5)); view.rawInsert(sle(4)); @@ -742,15 +742,15 @@ class View_test : public beast::unit_test::Suite BEAST_EXPECT(sles(view) == list(1, 2, 3, 4, 5)); b = view.sles.begin(); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(1)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(1)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(2)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(2)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(3)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(3)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(4)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(4)) == b); ++b; - BEAST_EXPECT(view.sles.upperBound(uint256(5)) == b); + BEAST_EXPECT(view.sles.upperBound(UInt256(5)) == b); } } @@ -1021,7 +1021,7 @@ class View_test : public beast::unit_test::Suite kCreateGenesis, Rules{config.features}, config.fees.toFees(), - std::vector{}, + std::vector{}, env.app().getNodeFamily()); auto const ledger = std::make_shared(*genesis, env.app().getTimeKeeper().closeTime()); diff --git a/src/test/nodestore/import_test.cpp b/src/test/nodestore/import_test.cpp index c30d77029d..02a9be8714 100644 --- a/src/test/nodestore/import_test.cpp +++ b/src/test/nodestore/import_test.cpp @@ -107,8 +107,8 @@ prettyTime(std::ostream& os, std::chrono::duration d) if (d < nanoseconds{100}) { // use floating - using ns = duration; - os << std::fixed << std::setprecision(1) << ns(d).count(); + using Ns = duration; + os << std::fixed << std::setprecision(1) << Ns(d).count(); } else { @@ -123,8 +123,8 @@ prettyTime(std::ostream& os, std::chrono::duration d) if (d < microseconds{100}) { // use floating - using ms = duration; - os << std::fixed << std::setprecision(1) << ms(d).count(); + using Ms = duration; + os << std::fixed << std::setprecision(1) << Ms(d).count(); } else { @@ -139,8 +139,8 @@ prettyTime(std::ostream& os, std::chrono::duration d) if (d < milliseconds{100}) { // use floating - using ms = duration; - os << std::fixed << std::setprecision(1) << ms(d).count(); + using Ms = duration; + os << std::fixed << std::setprecision(1) << Ms(d).count(); } else { @@ -155,8 +155,8 @@ prettyTime(std::ostream& os, std::chrono::duration d) if (d < seconds{100}) { // use floating - using s = duration; - os << std::fixed << std::setprecision(1) << s(d).count(); + using S = duration; + os << std::fixed << std::setprecision(1) << S(d).count(); } else { @@ -171,8 +171,8 @@ prettyTime(std::ostream& os, std::chrono::duration d) if (d < minutes{100}) { // use floating - using m = duration>; - os << std::fixed << std::setprecision(1) << m(d).count(); + using M = duration>; + os << std::fixed << std::setprecision(1) << M(d).count(); } else { @@ -202,12 +202,12 @@ namespace node_store { class Progress { private: - using clock_type = beast::BasicSecondsClock; + using ClockType = beast::BasicSecondsClock; std::size_t const work_; - clock_type::time_point start_ = clock_type::now(); - clock_type::time_point now_ = clock_type::now(); - clock_type::time_point report_ = clock_type::now(); + ClockType::time_point start_ = ClockType::now(); + ClockType::time_point now_ = ClockType::now(); + ClockType::time_point report_ = ClockType::now(); std::size_t prev_ = 0; bool estimate_ = false; @@ -221,7 +221,7 @@ public: operator()(Log& log, std::size_t work) { using namespace std::chrono; - auto const now = clock_type::now(); + auto const now = ClockType::now(); if (now == now_) return; now_ = now; @@ -237,8 +237,8 @@ public: return; } auto const rate = elapsed.count() / double(work); - clock_type::duration const remain( - static_cast((work_ - work) * rate)); + ClockType::duration const remain( + static_cast((work_ - work) * rate)); log << "Remaining: " << detail::fmtdur(remain) << " (" << work << " of " << work_ << " in " << detail::fmtdur(elapsed) << ", " << (work - prev_) << " in " << detail::fmtdur(now - report_) << ")"; @@ -250,7 +250,7 @@ public: void finish(Log& log) { - log << "Total time: " << detail::fmtdur(clock_type::now() - start_); + log << "Total time: " << detail::fmtdur(ClockType::now() - start_); } }; @@ -337,7 +337,7 @@ public: auto const fromPath = args.at("from"); auto const toPath = args.at("to"); - using hash_type = nudb::xxhasher; + using HashType = nudb::xxhasher; auto const bulkSize = 64 * 1024 * 1024; float const loadFactor = 0.5; @@ -442,7 +442,7 @@ public: kh.appnum = dh.appnum; kh.key_size = 32; kh.salt = make_salt(); - kh.pepper = pepper(kh.salt); + kh.pepper = pepper(kh.salt); kh.block_size = block_size(kp); kh.load_factor = std::min(65536.0 * loadFactor, 65535); kh.buckets = std::ceil(nitems / (bucket_capacity(kh.block_size) * loadFactor)); @@ -510,7 +510,7 @@ public: if (ec) Throw(ec); std::uint8_t const* const key = is.data(dh.key_size); - auto const h = hash(key, kh.key_size, kh.salt); + auto const h = hash(key, kh.key_size, kh.salt); auto const n = bucket_index(h, kh.buckets, kh.modulus); p(log, (npass * dfSize) + r.offset()); if (n < b0 || n >= b1) diff --git a/src/test/overlay/CapturePeer.h b/src/test/overlay/CapturePeer.h index 28a26d01e7..6ab7cc787e 100644 --- a/src/test/overlay/CapturePeer.h +++ b/src/test/overlay/CapturePeer.h @@ -67,9 +67,9 @@ public: */ CapturePeer( Application& app, - Peer::id_t id, + Peer::ID id, std::shared_ptr const& slot, - http_request_type request, + HttpRequestType request, PublicKey const& publicKey, ProtocolVersion protocol, resource::Consumer consumer, @@ -153,10 +153,10 @@ inline constexpr std::uint16_t kCapturePeerPort = 51235; * * @return The next unused connection id. */ -inline Peer::id_t +inline Peer::ID nextCapturePeerId() { - static Peer::id_t id{0}; + static Peer::ID id{0}; return ++id; } @@ -209,7 +209,7 @@ std::shared_ptr makeCapturePeer( jtx::Env& env, std::optional key = std::nullopt, - http_request_type request = {}) + HttpRequestType request = {}) { auto& overlay = dynamic_cast(env.app().getOverlay()); auto streamPtr = std::make_unique( diff --git a/src/test/overlay/TMGetLedger_test.cpp b/src/test/overlay/TMGetLedger_test.cpp index eac1a24e24..d95d60a847 100644 --- a/src/test/overlay/TMGetLedger_test.cpp +++ b/src/test/overlay/TMGetLedger_test.cpp @@ -48,8 +48,8 @@ class TMGetLedger_test : public beast::unit_test::Suite auto request = std::make_shared(); request->set_itype(protocol::liTX_NODE); - // A uint256-sized ledger hash, as a well-formed request carries. - uint256 const ledgerHash{1}; + // A UInt256-sized ledger hash, as a well-formed request carries. + UInt256 const ledgerHash{1}; request->set_ledgerhash(ledgerHash.data(), ledgerHash.size()); // Valid, deserializable SHAMap node IDs. diff --git a/src/test/overlay/TMGetObjectByHash_test.cpp b/src/test/overlay/TMGetObjectByHash_test.cpp index 1aafd77f2f..a5b0212915 100644 --- a/src/test/overlay/TMGetObjectByHash_test.cpp +++ b/src/test/overlay/TMGetObjectByHash_test.cpp @@ -55,11 +55,11 @@ class TMGetObjectByHash_test : public beast::unit_test::Suite auto& nodeStore = env.app().getNodeStore(); // Create and store objects - std::vector hashes; + std::vector hashes; hashes.reserve(numObjects); for (int i = 0; i < numObjects; ++i) { - uint256 const hash(xrpl::sha512Half(i)); + UInt256 const hash(xrpl::sha512Half(i)); hashes.push_back(hash); Blob data(100, static_cast(i % 256)); diff --git a/src/test/overlay/TMTransactions_test.cpp b/src/test/overlay/TMTransactions_test.cpp index 87c09498f2..617f0d5fec 100644 --- a/src/test/overlay/TMTransactions_test.cpp +++ b/src/test/overlay/TMTransactions_test.cpp @@ -49,7 +49,7 @@ class TMTransactions_test : public beast::unit_test::Suite // `PeerImp` decides `txReduceRelayEnabled()` in its constructor, from // the config and the handshake header, so set this first. env.app().config().txReduceRelayEnable = true; - http_request_type request; + HttpRequestType request; request.insert("X-Protocol-Ctl", makeFeaturesRequestHeader(false, false, true, false)); auto peer = makeCapturePeer(env, std::nullopt, std::move(request)); diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 40dee96c75..2712ca2d07 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -55,7 +55,7 @@ namespace xrpl::test { using namespace xrpl::test; using namespace xrpl::test::jtx; -static uint256 +static UInt256 ledgerHash(LedgerHeader const& info) { return xrpl::sha512Half( @@ -218,7 +218,7 @@ public: auto getLedger = std::make_shared(); getLedger->set_itype(protocol::liTS_CANDIDATE); getLedger->set_ltype(protocol::TMLedgerType::ltACCEPTED); - uint256 const hash(xrpl::sha512Half(123456789)); + UInt256 const hash(xrpl::sha512Half(123456789)); getLedger->set_ledgerhash(hash.begin(), hash.size()); getLedger->set_ledgerseq(123456789); xrpl::SHAMapNodeID const sha(64, hash); @@ -233,14 +233,14 @@ public: buildLedgerData(uint32_t n, Logs& logs) { auto ledgerData = std::make_shared(); - uint256 const hash(xrpl::sha512Half(12356789)); + UInt256 const hash(xrpl::sha512Half(12356789)); ledgerData->set_ledgerhash(hash.data(), hash.size()); ledgerData->set_ledgerseq(123456789); ledgerData->set_type(protocol::TMLedgerInfoType::liAS_NODE); ledgerData->set_requestcookie(123456789); ledgerData->set_error(protocol::TMReplyError::reNO_LEDGER); ledgerData->mutable_nodes()->Reserve(n); - uint256 parentHash(0); + UInt256 parentHash(0); NetClock::duration const resolution{10}; NetClock::time_point ct{resolution}; @@ -275,12 +275,12 @@ public: getObject->set_type( protocol::TMGetObjectByHash_ObjectType::TMGetObjectByHash_ObjectType_otTRANSACTION); getObject->set_query(true); - uint256 hash(xrpl::sha512Half(123456789)); + UInt256 hash(xrpl::sha512Half(123456789)); getObject->set_ledgerhash(hash.data(), hash.size()); getObject->set_fat(true); for (int i = 0; i < 100; i++) { - uint256 hash(xrpl::sha512Half(i)); + UInt256 hash(xrpl::sha512Half(i)); auto object = getObject->add_objects(); object->set_hash(hash.data(), hash.size()); xrpl::SHAMapNodeID const sha(64, hash); @@ -392,7 +392,7 @@ public: false, env->app().config().txReduceRelayEnable, env->app().config().vpReduceRelayBaseSquelchEnable); - http_request_type httpRequest; + HttpRequestType httpRequest; httpRequest.version(request.version()); httpRequest.base() = request.base(); // feature enabled on the peer's connection only if both sides are @@ -407,7 +407,7 @@ public: env.reset(); env = getEnv(inboundEnable); auto httpResp = xrpl::makeResponse( - true, httpRequest, addr, addr, uint256{1}, 1, {1, 0}, env->app()); + true, httpRequest, addr, addr, UInt256{1}, 1, {1, 0}, env->app()); // outbound is enabled if the response's header has the feature // enabled and the peer's configuration is enabled auto const outboundEnabled = diff --git a/src/test/overlay/reduce_relay_test.cpp b/src/test/overlay/reduce_relay_test.cpp index ff3eb51a4d..291635c939 100644 --- a/src/test/overlay/reduce_relay_test.cpp +++ b/src/test/overlay/reduce_relay_test.cpp @@ -145,15 +145,15 @@ public: virtual void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - Peer::id_t id, + Peer::ID id, SquelchCB f, protocol::MessageType type = protocol::mtVALIDATION) = 0; virtual void deleteIdlePeers(UnsquelchCB) = 0; - virtual void deletePeer(Peer::id_t, UnsquelchCB) = 0; + virtual void deletePeer(Peer::ID, UnsquelchCB) = 0; }; class Validator; @@ -194,7 +194,7 @@ public: { up_ = linkUp; } - Peer::id_t + Peer::ID peerId() { auto p = peer_.lock(); @@ -221,7 +221,7 @@ private: */ class Validator { - using Links = std::unordered_map; + using Links = std::unordered_map; public: Validator() : pkey_(std::get<0>(randomKeyPair(KeyType::Ed25519))), id_(sid++) @@ -271,13 +271,13 @@ public: } void - deletePeer(Peer::id_t id) + deletePeer(Peer::ID id) { links_.erase(id); } void - forLinks(std::vector peers, LinkIterCB f) + forLinks(std::vector peers, LinkIterCB f) { for (auto id : peers) { @@ -305,7 +305,7 @@ public: * Send to specific peers */ void - send(std::vector peers, SquelchCB f) + send(std::vector peers, SquelchCB f) { forLinks(peers, [&](Link& link, MessageSPtr m) { link.send(m, f); }); } @@ -332,7 +332,7 @@ public: } void - linkUp(Peer::id_t id) + linkUp(Peer::ID id) { auto it = links_.find(id); assert(it != links_.end()); @@ -340,7 +340,7 @@ public: } void - linkDown(Peer::id_t id) + linkDown(Peer::ID id) { auto it = links_.find(id); assert(it != links_.end()); @@ -358,7 +358,7 @@ private: class PeerSim : public PeerPartial, public std::enable_shared_from_this { public: - using id_t = Peer::id_t; + using ID = Peer::ID; PeerSim(Overlay& overlay, beast::Journal journal) : PeerPartial(sid++), overlay_(overlay), squelch_(journal) { @@ -406,18 +406,18 @@ public: } private: - inline static id_t sid = 0; + inline static ID sid = 0; Overlay& overlay_; reduce_relay::Squelch squelch_; }; class OverlaySim : public Overlay, public reduce_relay::SquelchHandler { - using Peers = std::unordered_map; + using Peers = std::unordered_map; public: - using id_t = Peer::id_t; - using clock_type = ManualClock; + using ID = Peer::ID; + using ClockType = ManualClock; OverlaySim(Application& app) : slots_(app, *this, app.config()), registry_(app) { } @@ -441,9 +441,9 @@ public: void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - Peer::id_t id, + Peer::ID id, SquelchCB f, protocol::MessageType type = protocol::mtVALIDATION) override { @@ -452,7 +452,7 @@ public: } void - deletePeer(id_t id, UnsquelchCB f) override + deletePeer(ID id, UnsquelchCB f) override { unsquelch_ = f; slots_.deletePeer(id, true); @@ -469,7 +469,7 @@ public: addPeer(bool useCache = true) { PeerSPtr peer{}; - Peer::id_t id = 0; + Peer::ID id = 0; if (peersCache_.empty() || !useCache) { peer = std::make_shared(*this, registry_.getJournal("Squelch")); @@ -487,7 +487,7 @@ public: } void - deletePeer(Peer::id_t id, bool useCache = true) + deletePeer(Peer::ID id, bool useCache = true) { auto it = peers_.find(id); assert(it != peers_.end()); @@ -506,7 +506,7 @@ public: addPeer(); } - std::optional + std::optional deleteLastPeer() { if (peers_.empty()) @@ -531,20 +531,20 @@ public: return slots_.inState(validator, reduce_relay::SlotState::Counting); } - std::set + std::set getSelected(PublicKey const& validator) { return slots_.getSelected(validator); } bool - isSelected(PublicKey const& validator, Peer::id_t peer) + isSelected(PublicKey const& validator, Peer::ID peer) { auto selected = slots_.getSelected(validator); return selected.contains(peer); } - id_t + ID getSelectedPeer(PublicKey const& validator) { auto selected = slots_.getSelected(validator); @@ -553,7 +553,7 @@ public: } std::unordered_map< - id_t, + ID, std::tuple> getPeers(PublicKey const& validator) { @@ -568,13 +568,13 @@ public: private: void - squelch(PublicKey const& validator, Peer::id_t id, std::uint32_t squelchDuration) const override + squelch(PublicKey const& validator, Peer::ID id, std::uint32_t squelchDuration) const override { if (auto it = peers_.find(id); it != peers_.end()) squelch_(validator, it->second, squelchDuration); } void - unsquelch(PublicKey const& validator, Peer::id_t id) const override + unsquelch(PublicKey const& validator, Peer::ID id) const override { if (auto it = peers_.find(id); it != peers_.end()) unsquelch_(validator, it->second); @@ -619,7 +619,7 @@ public: init(); } - Peer::id_t + Peer::ID addPeer() { auto peer = overlay_.addPeer(); @@ -661,7 +661,7 @@ public: } void - enableLink(std::uint16_t validatorId, Peer::id_t peer, bool enable) + enableLink(std::uint16_t validatorId, Peer::ID peer, bool enable) { auto it = std::ranges::find_if(validators_, [&](auto& v) { return v.id() == validatorId; }); assert(it != validators_.end()); @@ -676,7 +676,7 @@ public: } void - onDisconnectPeer(Peer::id_t peer) + onDisconnectPeer(Peer::ID peer) { // Send unsquelch to the Peer on all links. This way when // the Peer "reconnects" it starts sending messages on the link. @@ -736,7 +736,7 @@ public: * Is peer in Selected state in any of the slots */ bool - isSelected(Peer::id_t id) + isSelected(Peer::ID id) { return std::ranges::any_of( validators_, [&](auto& v) { return overlay_.isSelected(v, id); }); @@ -748,7 +748,7 @@ public: * in those slots. */ bool - allCounting(Peer::id_t peer) + allCounting(Peer::ID peer) { for (auto& v : validators_) { @@ -773,7 +773,7 @@ private: class reduce_relay_test : public beast::unit_test::Suite { using Slot = reduce_relay::Slot; - using id_t = Peer::id_t; + using ID = Peer::ID; protected: void @@ -790,7 +790,7 @@ protected: /** * Send squelch (if duration is set) or unsquelch (if duration not set) */ - static Peer::id_t + static Peer::ID sendSquelch( PublicKey const& validator, PeerWPtr const& peerPtr, @@ -820,7 +820,7 @@ protected: std::uint32_t cnt = 0; std::uint32_t handledCnt = 0; bool isSelected = false; - Peer::id_t peer{}; + Peer::ID peer{}; std::uint16_t validator{}; std::optional key; time_point time; @@ -1359,7 +1359,7 @@ vp_base_squelch_max_selected_peers=2 std::int16_t const nMessages = 5; for (int i = 0; i < nMessages; i++) { - uint256 const key(i); + UInt256 const key(i); network_.overlay().updateSlotAndSquelch( key, network_.validator(0), 0, [&](PublicKey const&, PeerWPtr, std::uint32_t) { }); @@ -1369,7 +1369,7 @@ vp_base_squelch_max_selected_peers=2 // hence '-1'. BEAST_EXPECT(std::get<1>(peers[0]) == (nMessages - 1)); // add duplicate - uint256 const key(nMessages - 1); + UInt256 const key(nMessages - 1); network_.overlay().updateSlotAndSquelch( key, network_.validator(0), 0, [&](PublicKey const&, PeerWPtr, std::uint32_t) {}); // confirm the same number of messages @@ -1389,12 +1389,12 @@ vp_base_squelch_max_selected_peers=2 { Handler() = default; void - squelch(PublicKey const&, Peer::id_t, std::uint32_t duration) const override + squelch(PublicKey const&, Peer::ID, std::uint32_t duration) const override { maxDuration = std::max(duration, maxDuration); } void - unsquelch(PublicKey const&, Peer::id_t) const override + unsquelch(PublicKey const&, Peer::ID) const override { } mutable int maxDuration{0}; @@ -1421,7 +1421,7 @@ vp_base_squelch_max_selected_peers=2 // make unique message hash to make the // slot's internal hash router accept the message std::uint64_t const mid = (m * 1000) + peer; - uint256 const message{mid}; + UInt256 const message{mid}; slots.updateSlotAndSquelch( message, validator, peer, protocol::MessageType::mtVALIDATION); } @@ -1499,7 +1499,7 @@ vp_base_squelch_max_selected_peers=2 false, env_.app().config().txReduceRelayEnable, env_.app().config().vpReduceRelayBaseSquelchEnable); - http_request_type httpRequest; + HttpRequestType httpRequest; httpRequest.version(request.version()); httpRequest.base() = request.base(); // feature enabled on the peer's connection only if both sides @@ -1513,7 +1513,7 @@ vp_base_squelch_max_selected_peers=2 setEnv(inboundEnable); auto httpResp = xrpl::makeResponse( - true, httpRequest, addr, addr, uint256{1}, 1, {1, 0}, env_.app()); + true, httpRequest, addr, addr, UInt256{1}, 1, {1, 0}, env_.app()); // outbound is enabled if the response's header has the feature // enabled and the peer's configuration is enabled auto const outboundEnabled = diff --git a/src/test/overlay/short_read_test.cpp b/src/test/overlay/short_read_test.cpp index d856231b8d..bc5a1e4499 100644 --- a/src/test/overlay/short_read_test.cpp +++ b/src/test/overlay/short_read_test.cpp @@ -51,17 +51,17 @@ will complete with eof. class short_read_test : public beast::unit_test::Suite { private: - using io_context_type = boost::asio::io_context; - using strand_type = boost::asio::strand; - using timer_type = boost::asio::basic_waitable_timer; - using acceptor_type = boost::asio::ip::tcp::acceptor; - using socket_type = boost::asio::ip::tcp::socket; - using stream_type = boost::asio::ssl::stream; - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using address_type = boost::asio::ip::address; + using IoContextType = boost::asio::io_context; + using StrandType = boost::asio::strand; + using TimerType = boost::asio::basic_waitable_timer; + using AcceptorType = boost::asio::ip::tcp::acceptor; + using SocketType = boost::asio::ip::tcp::socket; + using StreamType = boost::asio::ssl::stream; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using AddressType = boost::asio::ip::address; - io_context_type ioContext_; + IoContextType ioContext_; boost::optional> work_; std::thread thread_; std::shared_ptr context_; @@ -169,15 +169,15 @@ private: { private: short_read_test& test_; - endpoint_type endpoint_; + EndpointType endpoint_; struct Acceptor : Child, std::enable_shared_from_this { Server& server; short_read_test& test; - acceptor_type acceptor; - socket_type socket; - strand_type strand; + AcceptorType acceptor; + SocketType socket; + StrandType strand; explicit Acceptor(Server& server) : Child(server) @@ -185,7 +185,7 @@ private: , test(server.test_) , acceptor( test.ioContext_, - endpoint_type(boost::asio::ip::make_address(test::getEnvLocalhostAddr()), 0)) + EndpointType(boost::asio::ip::make_address(test::getEnvLocalhostAddr()), 0)) , socket(test.ioContext_) , strand(boost::asio::make_strand(test.ioContext_)) { @@ -208,14 +208,13 @@ private: run() { acceptor.async_accept( - socket, - bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + socket, bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onAccept(ec); })); } void - fail(std::string const& what, error_code ec) + fail(std::string const& what, ErrorCode ec) { if (acceptor.is_open()) { @@ -226,7 +225,7 @@ private: } void - onAccept(error_code ec) + onAccept(ErrorCode ec) { if (ec) { @@ -237,8 +236,7 @@ private: server.add(p); p->run(); acceptor.async_accept( - socket, - bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + socket, bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onAccept(ec); })); } @@ -248,13 +246,13 @@ private: { Server& server; short_read_test& test; - socket_type socket; - stream_type stream; - strand_type strand; - timer_type timer; + SocketType socket; + StreamType stream; + StrandType strand; + TimerType timer; boost::asio::streambuf buf; - Connection(Server& inServer, socket_type&& inSocket) + Connection(Server& inServer, SocketType&& inSocket) : Child(inServer) , server(inServer) , test(server.test_) @@ -286,16 +284,16 @@ private: timer.expires_after(std::chrono::seconds(3)); timer.async_wait(bind_executor( strand, - [self = shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); stream.async_handshake( - stream_type::server, - bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + StreamType::server, + bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onHandshake(ec); })); } void - fail(std::string const& what, error_code ec) + fail(std::string const& what, ErrorCode ec) { if (socket.is_open()) { @@ -307,7 +305,7 @@ private: } void - onTimer(error_code ec) + onTimer(ErrorCode ec) { if (ec == boost::asio::error::operation_aborted) return; @@ -321,7 +319,7 @@ private: } void - onHandshake(error_code ec) + onHandshake(ErrorCode ec) { if (ec) { @@ -335,19 +333,19 @@ private: bind_executor( strand, [self = shared_from_this()]( - error_code const& ec, std::size_t bytesTransferred) { + ErrorCode const& ec, std::size_t bytesTransferred) { self->onRead(ec, bytesTransferred); })); } void - onRead(error_code ec, std::size_t bytesTransferred) + onRead(ErrorCode ec, std::size_t bytesTransferred) { if (ec == boost::asio::error::eof) { server.test_.log << "[server] read: EOF" << std::endl; stream.async_shutdown( - bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); return; @@ -367,13 +365,13 @@ private: bind_executor( strand, [self = shared_from_this()]( - error_code const& ec, std::size_t bytesTransferred) { + ErrorCode const& ec, std::size_t bytesTransferred) { self->onWrite(ec, bytesTransferred); })); } void - onWrite(error_code ec, std::size_t bytesTransferred) + onWrite(ErrorCode ec, std::size_t bytesTransferred) { buf.consume(bytesTransferred); if (ec) @@ -383,11 +381,11 @@ private: } stream.async_shutdown(bind_executor( strand, - [self = shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); } void - onShutdown(error_code ec) + onShutdown(ErrorCode ec) { if (ec) { @@ -413,7 +411,7 @@ private: wait(); } - [[nodiscard]] endpoint_type const& + [[nodiscard]] EndpointType const& endpoint() const { return endpoint_; @@ -431,14 +429,14 @@ private: { Client& client; short_read_test& test; - socket_type socket; - stream_type stream; - strand_type strand; - timer_type timer; + SocketType socket; + StreamType stream; + StrandType strand; + TimerType timer; boost::asio::streambuf buf; - endpoint_type const& ep; + EndpointType const& ep; - Connection(Client& client, endpoint_type const& ep) + Connection(Client& client, EndpointType const& ep) : Child(client) , client(client) , test(client.test_) @@ -466,20 +464,20 @@ private: } void - run(endpoint_type const& ep) + run(EndpointType const& ep) { timer.expires_after(std::chrono::seconds(3)); timer.async_wait(bind_executor( strand, - [self = shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); socket.async_connect( - ep, bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + ep, bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onConnect(ec); })); } void - fail(std::string const& what, error_code ec) + fail(std::string const& what, ErrorCode ec) { if (socket.is_open()) { @@ -491,7 +489,7 @@ private: } void - onTimer(error_code ec) + onTimer(ErrorCode ec) { if (ec == boost::asio::error::operation_aborted) return; @@ -505,7 +503,7 @@ private: } void - onConnect(error_code ec) + onConnect(ErrorCode ec) { if (ec) { @@ -513,14 +511,14 @@ private: return; } stream.async_handshake( - stream_type::client, - bind_executor(strand, [self = shared_from_this()](error_code const& ec) { + StreamType::client, + bind_executor(strand, [self = shared_from_this()](ErrorCode const& ec) { self->onHandshake(ec); })); } void - onHandshake(error_code ec) + onHandshake(ErrorCode ec) { if (ec) { @@ -535,13 +533,13 @@ private: bind_executor( strand, [self = shared_from_this()]( - error_code const& ec, std::size_t bytesTransferred) { + ErrorCode const& ec, std::size_t bytesTransferred) { self->onWrite(ec, bytesTransferred); })); } void - onWrite(error_code ec, std::size_t bytesTransferred) + onWrite(ErrorCode ec, std::size_t bytesTransferred) { buf.consume(bytesTransferred); if (ec) @@ -556,13 +554,13 @@ private: bind_executor( strand, [self = shared_from_this()]( - error_code const& ec, std::size_t bytesTransferred) { + ErrorCode const& ec, std::size_t bytesTransferred) { self->onRead(ec, bytesTransferred); })); } void - onRead(error_code ec, std::size_t bytesTransferred) + onRead(ErrorCode ec, std::size_t bytesTransferred) { if (ec) { @@ -572,11 +570,11 @@ private: buf.commit(bytesTransferred); stream.async_shutdown(bind_executor( strand, - [self = shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); } void - onShutdown(error_code ec) + onShutdown(ErrorCode ec) { if (ec) { @@ -589,7 +587,7 @@ private: }; public: - Client(short_read_test& test, endpoint_type const& ep) : test_(test) + Client(short_read_test& test, EndpointType const& ep) : test_(test) { auto const p = std::make_shared(*this, ep); add(p); diff --git a/src/test/overlay/tx_reduce_relay_test.cpp b/src/test/overlay/tx_reduce_relay_test.cpp index 597494b5f6..780f9dc1b1 100644 --- a/src/test/overlay/tx_reduce_relay_test.cpp +++ b/src/test/overlay/tx_reduce_relay_test.cpp @@ -106,7 +106,7 @@ class tx_reduce_relay_test : public beast::unit_test::Suite using CapturePeer::CapturePeer; void - addTxQueue(uint256 const&) override + addTxQueue(UInt256 const&) override { ++queued_; } @@ -150,7 +150,7 @@ class tx_reduce_relay_test : public beast::unit_test::Suite if (disabled) --nDisabled; - http_request_type request; + HttpRequestType request; if (!disabled) request.insert("X-Protocol-Ctl", makeFeaturesRequestHeader(false, false, true, false)); @@ -203,7 +203,7 @@ class tx_reduce_relay_test : public beast::unit_test::Suite // Skip the peers built first, so the skip set overlaps the disabled // peers as the expected counts assume. - std::set toSkip; + std::set toSkip; for (std::size_t i = 0; i < nSkip; ++i) toSkip.insert(peers[i]->id()); @@ -216,7 +216,7 @@ class tx_reduce_relay_test : public beast::unit_test::Suite m.set_rawtransaction(s.data(), s.size()); m.set_deferred(false); m.set_status(protocol::TransactionStatus::tsNEW); - env.app().getOverlay().relay(uint256{0}, m, toSkip); + env.app().getOverlay().relay(UInt256{0}, m, toSkip); std::size_t sendTx = 0; std::size_t queueTx = 0; diff --git a/src/test/protocol/Issue_test.cpp b/src/test/protocol/Issue_test.cpp index a6a1fdd341..8b876b9858 100644 --- a/src/test/protocol/Issue_test.cpp +++ b/src/test/protocol/Issue_test.cpp @@ -25,7 +25,7 @@ namespace xrpl { class Issue_test : public beast::unit_test::Suite { public: - using Domain = uint256; + using Domain = UInt256; // Comparison, hash tests for uint60 (via base_uint) template @@ -230,8 +230,8 @@ public: AccountID const i2(2); Issue const a1(c1, i1); Issue const a2(c2, i2); - uint256 const domain1{1}; - uint256 const domain2{2}; + UInt256 const domain1{1}; + UInt256 const domain2{2}; Set c; @@ -267,8 +267,8 @@ public: AccountID const i2(2); Issue const a1(c1, i1); Issue const a2(c2, i2); - uint256 const domain1{1}; - uint256 const domain2{2}; + UInt256 const domain1{1}; + UInt256 const domain2{2}; Map c; @@ -304,10 +304,10 @@ public: testIssueDomainSet>>(); testcase("hash_set >"); - testIssueDomainSet>>(); + testIssueDomainSet>>(); testcase("hash_set >"); - testIssueDomainSet>>(); + testIssueDomainSet>>(); } void @@ -321,16 +321,16 @@ public: #if XRPL_ASSETS_ENABLE_STD_HASH testcase("hash_map , int>"); - testIssueDomainMap, int>>(); + testIssueDomainMap, int>>(); testcase("hash_map , int>"); - testIssueDomainMap, int>>(); + testIssueDomainMap, int>>(); testcase("hardened_hash_map , int>"); - testIssueDomainMap, int>>(); + testIssueDomainMap, int>>(); testcase("hardened_hash_map , int>"); - testIssueDomainMap, int>>(); + testIssueDomainMap, int>>(); #endif } @@ -352,10 +352,10 @@ public: #endif testcase("hash_set "); - testIssueSet>(); + testIssueSet>(); testcase("hash_set "); - testIssueSet>(); + testIssueSet>(); } void @@ -375,10 +375,10 @@ public: testIssueMap>(); testcase("hash_map "); - testIssueMap>(); + testIssueMap>(); testcase("hash_map "); - testIssueMap>(); + testIssueMap>(); #endif } @@ -401,8 +401,8 @@ public: Issue const a2(c1, i2); Issue const a3(c2, i2); Issue const a4(c3, i2); - uint256 const domain1{1}; - uint256 const domain2{2}; + UInt256 const domain1{1}; + UInt256 const domain2{2}; // Books without domains BEAST_EXPECT(Book(a1, a2, std::nullopt) != Book(a2, a3, std::nullopt)); @@ -562,8 +562,8 @@ public: Book const b1(a1, a2, std::nullopt); Book const b2(a2, a1, std::nullopt); - uint256 const domain1{1}; - uint256 const domain2{2}; + UInt256 const domain1{1}; + UInt256 const domain2{2}; Book const b1D1(a1, a2, domain1); Book const b2D1(a2, a1, domain1); @@ -693,8 +693,8 @@ public: Book const b1(a1, a2, std::nullopt); Book const b2(a2, a1, std::nullopt); - uint256 const domain1{1}; - uint256 const domain2{2}; + UInt256 const domain1{1}; + UInt256 const domain2{2}; Book const b1D1(a1, a2, domain1); Book const b2D1(a2, a1, domain1); @@ -833,10 +833,10 @@ public: #endif testcase("hash_set "); - testBookSet>(); + testBookSet>(); testcase("hash_set "); - testBookSet>(); + testBookSet>(); } void @@ -856,10 +856,10 @@ public: testBookMap>(); testcase("hash_map "); - testBookMap>(); + testBookMap>(); testcase("hash_map "); - testBookMap>(); + testBookMap>(); #endif } diff --git a/src/test/protocol/PublicKey_test.cpp b/src/test/protocol/PublicKey_test.cpp index 1494e57a5e..f826893f4c 100644 --- a/src/test/protocol/PublicKey_test.cpp +++ b/src/test/protocol/PublicKey_test.cpp @@ -19,7 +19,7 @@ namespace xrpl { class PublicKey_test : public beast::unit_test::Suite { public: - using blob = std::vector; + using Blob = std::vector; template static void @@ -56,10 +56,10 @@ public: } } - static blob + static Blob sig(std::string const& hex) { - blob b; + Blob b; hexToBinary(hex.begin(), hex.end(), b); return b; } diff --git a/src/test/protocol/STAmount_test.cpp b/src/test/protocol/STAmount_test.cpp index c3a681cf01..58d901b03a 100644 --- a/src/test/protocol/STAmount_test.cpp +++ b/src/test/protocol/STAmount_test.cpp @@ -1009,8 +1009,8 @@ public: auto rules = [](bool const mptV2) { // Rules keeps a reference to the presets set, so use static // storage here rather than a local temporary. - static std::unordered_set> const kNoFeatures; - static std::unordered_set> const kMptV2Features{ + static std::unordered_set> const kNoFeatures; + static std::unordered_set> const kMptV2Features{ featureMPTokensV2}; return Rules{mptV2 ? kMptV2Features : kNoFeatures}; }; diff --git a/src/test/protocol/STObject_test.cpp b/src/test/protocol/STObject_test.cpp index 8b7db632c5..bc3ffd3882 100644 --- a/src/test/protocol/STObject_test.cpp +++ b/src/test/protocol/STObject_test.cpp @@ -100,7 +100,7 @@ public: unexpected(!object1.isFieldPresent(sfTestH256), "STObject Error 2"); - unexpected(object1.getFieldH256(sfTestH256) != uint256(), "STObject error 3"); + unexpected(object1.getFieldH256(sfTestH256) != UInt256(), "STObject error 3"); if (object1.getSerializer() == object2.getSerializer()) { @@ -151,7 +151,7 @@ public: } { - std::vector uints; + std::vector uints; uints.reserve(5); for (int i = 0; i < uints.capacity(); ++i) { @@ -365,10 +365,10 @@ public: STObject st(sfGeneric); st[sfAmount] = STAmount{}; st[sfAccount] = AccountID{}; - st[sfDigest] = uint256{}; + st[sfDigest] = UInt256{}; [&](STAmount) {}(st[sfAmount]); [&](AccountID) {}(st[sfAccount]); - [&](uint256) {}(st[sfDigest]); + [&](UInt256) {}(st[sfDigest]); } // STBlob and slice @@ -420,7 +420,7 @@ public: { auto const& sf = sfIndexes; STObject st(sfGeneric); - std::vector v; + std::vector v; v.emplace_back(1); v.emplace_back(2); st[sf] = v; @@ -430,7 +430,7 @@ public: BEAST_EXPECT(cst[~sf]->size() == 2); // NOLINT(bugprone-unchecked-optional-access) BEAST_EXPECT(cst[sf][0] == 1); BEAST_EXPECT(cst[sf][1] == 2); - static_assert(std::is_same_v const&>); + static_assert(std::is_same_v const&>); } // Default by reference field @@ -450,20 +450,20 @@ public: BEAST_EXPECT(cst[sf1].empty()); BEAST_EXPECT(!cst[~sf2]); BEAST_EXPECT(cst[sf3].empty()); - std::vector v; + std::vector v; v.emplace_back(1); st[sf1] = v; BEAST_EXPECT(cst[sf1].size() == 1); - BEAST_EXPECT(cst[sf1][0] == uint256{1}); + BEAST_EXPECT(cst[sf1][0] == UInt256{1}); st[sf2] = v; BEAST_EXPECT(cst[sf2].size() == 1); - BEAST_EXPECT(cst[sf2][0] == uint256{1}); + BEAST_EXPECT(cst[sf2][0] == UInt256{1}); st[~sf2] = std::nullopt; BEAST_EXPECT(!st[~sf2]); st[sf3] = v; BEAST_EXPECT(cst[sf3].size() == 1); - BEAST_EXPECT(cst[sf3][0] == uint256{1}); - st[sf3] = std::vector{}; + BEAST_EXPECT(cst[sf3][0] == UInt256{1}); + st[sf3] = std::vector{}; BEAST_EXPECT(cst[sf3].empty()); } } // namespace xrpl diff --git a/src/test/protocol/STParsedJSON_test.cpp b/src/test/protocol/STParsedJSON_test.cpp index c2030627c7..3acfa64e32 100644 --- a/src/test/protocol/STParsedJSON_test.cpp +++ b/src/test/protocol/STParsedJSON_test.cpp @@ -395,7 +395,7 @@ class STParsedJSON_test : public beast::unit_test::Suite 0xCD, 0xEF}; // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - BEAST_EXPECT(obj.object->getFieldH128(sfEmailHash) == uint128::fromRaw(expected)); + BEAST_EXPECT(obj.object->getFieldH128(sfEmailHash) == UInt128::fromRaw(expected)); } // Valid lowercase hex string for UInt128 @@ -492,7 +492,7 @@ class STParsedJSON_test : public beast::unit_test::Suite 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67}; BEAST_EXPECT( // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - obj.object->getFieldH160(sfTakerPaysCurrency) == uint160::fromRaw(expected)); + obj.object->getFieldH160(sfTakerPaysCurrency) == UInt160::fromRaw(expected)); } // Valid lowercase hex string for UInt160 { @@ -580,7 +580,7 @@ class STParsedJSON_test : public beast::unit_test::Suite 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; BEAST_EXPECT( // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - obj.object->getFieldH192(sfMPTokenIssuanceID) == uint192::fromRaw(expected)); + obj.object->getFieldH192(sfMPTokenIssuanceID) == UInt192::fromRaw(expected)); } // Valid lowercase hex string for UInt192 @@ -680,7 +680,7 @@ class STParsedJSON_test : public beast::unit_test::Suite 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - BEAST_EXPECT(obj.object->getFieldH256(sfLedgerHash) == uint256::fromRaw(expected)); + BEAST_EXPECT(obj.object->getFieldH256(sfLedgerHash) == UInt256::fromRaw(expected)); } // Valid lowercase hex string for UInt256 { @@ -1012,7 +1012,7 @@ class STParsedJSON_test : public beast::unit_test::Suite { json::Value j; json::Value arr(json::ValueType::Array); - arr.append("0123456789ABCDEF"); // too short for uint256 + arr.append("0123456789ABCDEF"); // too short for UInt256 j[sfHashes] = arr; STParsedJSONObject const obj("Test", j); BEAST_EXPECT(!obj.object.has_value()); diff --git a/src/test/protocol/STTx_test.cpp b/src/test/protocol/STTx_test.cpp index f310274e56..6d79ee4a89 100644 --- a/src/test/protocol/STTx_test.cpp +++ b/src/test/protocol/STTx_test.cpp @@ -72,8 +72,8 @@ public: // outlive the Rules; both are returned together. struct RulesFixture { - std::unordered_set> const noPresets; - std::unordered_set> const fixPresets{fixCleanup3_4_0}; + std::unordered_set> const noPresets; + std::unordered_set> const fixPresets{fixCleanup3_4_0}; Rules const legacy{noPresets}; Rules const fixed{fixPresets}; }; @@ -201,7 +201,7 @@ public: obj.setFieldVL(sfSigningPubKey, keypair.first.slice()); if (counterparty) { - obj.setFieldH256(sfLoanBrokerID, uint256{1}); + obj.setFieldH256(sfLoanBrokerID, UInt256{1}); obj.setFieldNumber( sfPrincipalRequested, STNumber{sfPrincipalRequested, Number{1}}); } @@ -276,7 +276,7 @@ public: obj.setFieldVL(sfSigningPubKey, Slice{}); if (counterparty) { - obj.setFieldH256(sfLoanBrokerID, uint256{1}); + obj.setFieldH256(sfLoanBrokerID, UInt256{1}); obj.setFieldNumber( sfPrincipalRequested, STNumber{sfPrincipalRequested, Number{1}}); } @@ -1391,7 +1391,7 @@ public: // Make an STObject that nests objects ten levels deep. There's // a minimum transaction size we must meet, so include a hash256. - uint256 const hash{42u}; + UInt256 const hash{42u}; auto inner = std::make_unique(recurse, sfTransactionMetaData); inner->setFieldH256(sfTransactionHash, hash); @@ -1453,7 +1453,7 @@ public: // Make an STObject that nests ten levels deep alternating objects // and arrays. Include a hash256 to meet the minimum transaction // size. - uint256 const hash{42u}; + UInt256 const hash{42u}; STObject inner = {recurse, sfTransactionMetaData}; inner.setFieldH256(sfTransactionHash, hash); @@ -1617,7 +1617,7 @@ public: // Rules store a reference to the presets. Create a local to guarantee // proper lifetime. - std::unordered_set> const presets; + std::unordered_set> const presets; Rules const defaultRules{presets}; BEAST_EXPECT(!defaultRules.enabled(featureAMM)); diff --git a/src/test/protocol/STValidation_test.cpp b/src/test/protocol/STValidation_test.cpp index eb9aefd0ed..20d28ee48d 100644 --- a/src/test/protocol/STValidation_test.cpp +++ b/src/test/protocol/STValidation_test.cpp @@ -289,7 +289,7 @@ public: for (auto c : kPayload8) v.push_back(c); - beast::xor_shift_engine g(148979842); + beast::XorShiftEngine g(148979842); for (std::size_t i = 0; i != v.size(); ++i) { diff --git a/src/test/protocol/SecretKey_test.cpp b/src/test/protocol/SecretKey_test.cpp index 967c4417eb..dc014dbe67 100644 --- a/src/test/protocol/SecretKey_test.cpp +++ b/src/test/protocol/SecretKey_test.cpp @@ -33,7 +33,7 @@ class SecretKey_test : public beast::unit_test::Suite }; public: - using blob = std::vector; + using Blob = std::vector; // Ensure that verification does the right thing with // respect to the matrix of canonicality variables. @@ -73,7 +73,7 @@ public: 0x89, 0x1C, 0x60, 0xBA, 0x63, 0x74, 0x44, 0xF7, 0x1A, 0x12, 0x9E, 0x47, 0x13, 0x5D, 0x36, 0xD9, 0x2A, 0xFD, 0x39, 0xB8, 0x56, 0x60, 0x1A, 0x01}; - auto const digest = uint256::fromVoid(digestData.data()); + auto const digest = UInt256::fromVoid(digestData.data()); PublicKey const pk{makeSlice(pkData)}; SecretKey const sk{makeSlice(skData)}; @@ -116,7 +116,7 @@ public: for (std::size_t j = 0; j < 32; j++) { - uint256 digest; + UInt256 digest; beast::rngfill(digest.data(), digest.size(), cryptoPrng()); auto sig = signDigest(pk, sk, digest); diff --git a/src/test/protocol/Seed_test.cpp b/src/test/protocol/Seed_test.cpp index ef4719fd3e..2d13ddd2e8 100644 --- a/src/test/protocol/Seed_test.cpp +++ b/src/test/protocol/Seed_test.cpp @@ -43,7 +43,7 @@ public: for (int i = 0; i < 64; i++) { - uint128 src; + UInt128 src; beast::rngfill(src.data(), src.size(), defaultPrng()); Seed const seed(src); BEAST_EXPECT(memcmp(seed.data(), src.data(), src.size()) == 0); diff --git a/src/test/protocol/TER_test.cpp b/src/test/protocol/TER_test.cpp index 77f12ff2b7..b59fbc41eb 100644 --- a/src/test/protocol/TER_test.cpp +++ b/src/test/protocol/TER_test.cpp @@ -48,21 +48,20 @@ struct TER_test : public beast::unit_test::Suite { // Entries in the tuple should not be convertible or assignable // unless they are the same types. - using To_t = std::decay_t(tup))>; - using From_t = std::decay_t(tup))>; + using ToT = std::decay_t(tup))>; + using FromT = std::decay_t(tup))>; static_assert( - std::is_same_v == std::is_convertible_v, "Convert err"); + std::is_same_v == std::is_convertible_v, "Convert err"); static_assert( - std::is_same_v == std::is_constructible_v, - "Construct err"); + std::is_same_v == std::is_constructible_v, "Construct err"); static_assert( - std::is_same_v == std::is_assignable_v, + std::is_same_v == std::is_assignable_v, "Assign err"); // Assignment or conversion from integer to type should never work. - static_assert(!std::is_convertible_v, "Convert err"); - static_assert(!std::is_constructible_v, "Construct err"); - static_assert(!std::is_assignable_v, "Assign err"); + static_assert(!std::is_convertible_v, "Convert err"); + static_assert(!std::is_constructible_v, "Construct err"); + static_assert(!std::is_assignable_v, "Assign err"); } }; @@ -126,11 +125,11 @@ struct TER_test : public beast::unit_test::Suite // Lambda that verifies assignability and convertibility. auto isConvertible = [](auto from, auto to) { - using From_t = std::decay_t; - using To_t = std::decay_t; - static_assert(std::is_convertible_v, "Convert err"); - static_assert(std::is_constructible_v, "Construct err"); - static_assert(std::is_assignable_v, "Assign err"); + using FromT = std::decay_t; + using ToT = std::decay_t; + static_assert(std::is_convertible_v, "Convert err"); + static_assert(std::is_constructible_v, "Construct err"); + static_assert(std::is_assignable_v, "Assign err"); }; // Verify the right types convert to NotTEC. @@ -144,11 +143,11 @@ struct TER_test : public beast::unit_test::Suite // Lambda that verifies types and not assignable or convertible. auto notConvertible = [](auto from, auto to) { - using To_t = std::decay_t; - using From_t = std::decay_t; - static_assert(!std::is_convertible_v, "Convert err"); - static_assert(!std::is_constructible_v, "Construct err"); - static_assert(!std::is_assignable_v, "Assign err"); + using ToT = std::decay_t; + using FromT = std::decay_t; + static_assert(!std::is_convertible_v, "Convert err"); + static_assert(!std::is_constructible_v, "Construct err"); + static_assert(!std::is_assignable_v, "Assign err"); }; // Verify types that shouldn't convert to NotTEC. diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index 3de2bdefa3..dc00183bad 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -580,10 +580,10 @@ public: env(payChan(becky, alice, XRP(1000), 100s, becky.pk())); // Mint NFTs, for each account - uint256 const aliceNFtokenID = token::getNextID(env, alice, 0, tfTransferable); + UInt256 const aliceNFtokenID = token::getNextID(env, alice, 0, tfTransferable); env(token::mint(alice, 0), Txflags(tfTransferable)); - uint256 const beckyNFtokenID = token::getNextID(env, becky, 0, tfTransferable); + UInt256 const beckyNFtokenID = token::getNextID(env, becky, 0, tfTransferable); env(token::mint(becky, 0), Txflags(tfTransferable)); // NFT Offers, for each other's NFTs diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index d9ad957db1..be108603de 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -633,7 +633,7 @@ public: BEAST_EXPECT(acctObjsTypeIsInvalid(acctObjs(gw, jss::NegativeUNL))); // gw mints an NFT so we can find it. - uint256 const nftID{token::getNextID(env, gw, 0u, tfTransferable)}; + UInt256 const nftID{token::getNextID(env, gw, 0u, tfTransferable)}; env(token::mint(gw, 0u), Txflags(tfTransferable)); env.close(); { diff --git a/src/test/rpc/BookChanges_test.cpp b/src/test/rpc/BookChanges_test.cpp index f0b4a4e187..4e6ba951c2 100644 --- a/src/test/rpc/BookChanges_test.cpp +++ b/src/test/rpc/BookChanges_test.cpp @@ -175,7 +175,7 @@ public: auto tx = std::make_shared(ttOFFER_CREATE, [](STObject&) {}); - auto const test = [&](std::unordered_set> const& features) { + auto const test = [&](std::unordered_set> const& features) { auto ledger = std::make_shared( 2, NetClock::time_point{}, @@ -189,7 +189,7 @@ public: auto metaSerializer = std::make_shared(); metadata->add(*metaSerializer); - ledger->rawTxInsert(uint256{1}, txSerializer, metaSerializer); + ledger->rawTxInsert(UInt256{1}, txSerializer, metaSerializer); ledger->setImmutable(); ledger->setValidated(); @@ -206,8 +206,8 @@ public: } }; - test(std::unordered_set>{}); - test(std::unordered_set>{featureMPTokensV2}); + test(std::unordered_set>{}); + test(std::unordered_set>{featureMPTokensV2}); } // Build a ledger whose transactions are OfferCreates carrying the supplied @@ -219,7 +219,7 @@ public: auto ledger = std::make_shared( 2, NetClock::time_point{}, - Rules{std::unordered_set>{featureMPTokensV2}}, + Rules{std::unordered_set>{featureMPTokensV2}}, env.current()->fees(), env.app().getNodeFamily()); @@ -257,7 +257,7 @@ public: auto metaSerializer = std::make_shared(); metadata->add(*metaSerializer); - ledger->rawTxInsert(uint256{seq}, txSerializer, metaSerializer); + ledger->rawTxInsert(UInt256{seq}, txSerializer, metaSerializer); } ledger->setImmutable(); diff --git a/src/test/rpc/Book_test.cpp b/src/test/rpc/Book_test.cpp index 646cf190ff..2efb1c6c05 100644 --- a/src/test/rpc/Book_test.cpp +++ b/src/test/rpc/Book_test.cpp @@ -42,7 +42,7 @@ class Book_test : public beast::unit_test::Suite jtx::Env& env, Issue const& in, Issue const& out, - std::optional const& domain = std::nullopt) + std::optional const& domain = std::nullopt) { std::string dir; auto uBookBase = getBookBase({in, out, domain}); @@ -52,7 +52,7 @@ class Book_test : public beast::unit_test::Suite if (key) { auto sleOfferDir = view->read(keylet::page(key.value())); - uint256 offerIndex; + UInt256 offerIndex; unsigned int bookEntry = 0; cdirFirst(*view, sleOfferDir->key(), sleOfferDir, bookEntry, offerIndex); auto sleOffer = view->read(keylet::offer(offerIndex)); @@ -1113,7 +1113,7 @@ public: // Charlie places an offer that crosses Alice and Charlie's offers env(offer(charlie, usd(1000), XRP(1000))); env.close(); - env.require(offers(alice, 0), offers(bob, 0), offers(charlie, 0)); + env.require(Offers(alice, 0), Offers(bob, 0), Offers(charlie, 0)); using namespace std::chrono_literals; BEAST_EXPECT(offerOnlyOnceInStream(wsc, 1s, XRP(1000), usd(1000))); diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 1e2504bf7f..3304435afd 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -121,7 +121,7 @@ class Feature_test : public beast::unit_test::Suite } // Test an arbitrary unknown feature - uint256 const zero{0}; + UInt256 const zero{0}; BEAST_EXPECT(featureToName(zero) == to_string(zero)); BEAST_EXPECT( featureToName(zero) == @@ -291,7 +291,7 @@ class Feature_test : public beast::unit_test::Suite BEAST_EXPECT(result[jss::features].size() >= 50); for (auto it = result[jss::features].begin(); it != result[jss::features].end(); ++it) { - uint256 id; + UInt256 id; (void)id.parseHex(it.key().asString().c_str()); if (!BEAST_EXPECT((*it).isMember(jss::name))) return; @@ -352,7 +352,7 @@ class Feature_test : public beast::unit_test::Suite return; for (auto it = jrr[jss::features].begin(); it != jrr[jss::features].end(); ++it) { - uint256 id; + UInt256 id; (void)id.parseHex(it.key().asString().c_str()); if (!BEAST_EXPECT((*it).isMember(jss::name))) return; diff --git a/src/test/rpc/GetAggregatePrice_test.cpp b/src/test/rpc/GetAggregatePrice_test.cpp index 58c2e8b996..c1ef7d1f80 100644 --- a/src/test/rpc/GetAggregatePrice_test.cpp +++ b/src/test/rpc/GetAggregatePrice_test.cpp @@ -413,7 +413,7 @@ public: // any ledger. sfPreviousTxnLgrSeq still points to a valid closed // ledger, so getLedgerBySeq succeeds but txRead returns null. auto const oracleKeylet = keylet::oracle(owner, oracle.documentID()); - uint256 const bogusTxnID{0xABCABCAB}; + UInt256 const bogusTxnID{0xABCABCAB}; bool const modified = env.app().getOpenLedger().modify( [&oracleKeylet, &bogusTxnID](OpenView& view, beast::Journal) -> bool { auto const sle = view.read(oracleKeylet); diff --git a/src/test/rpc/Handler_test.cpp b/src/test/rpc/Handler_test.cpp index 16838d3f5a..304301b90d 100644 --- a/src/test/rpc/Handler_test.cpp +++ b/src/test/rpc/Handler_test.cpp @@ -43,7 +43,7 @@ class Handler_test : public beast::unit_test::Suite auto time(std::size_t n, auto f, auto prng) -> auto { - using clock = std::chrono::steady_clock; + using Clock = std::chrono::steady_clock; assert(n > 0); double sum = 0; double sumSquared = 0; @@ -78,8 +78,8 @@ class Handler_test : public beast::unit_test::Suite double const meanSquared = (sum * sum) / (j * j); return std::make_tuple( - clock::duration{static_cast(sum / j)}, - clock::duration{static_cast(std::sqrt((sumSquared / j) - meanSquared))}, + Clock::duration{static_cast(sum / j)}, + Clock::duration{static_cast(std::sqrt((sumSquared / j) - meanSquared))}, j); } diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index efba4075c7..021f50025d 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -2759,7 +2759,7 @@ public: ProcessTransactionFn const processTxn = fakeProcessTransaction; // A list of all the functions we want to test. - using signFunc = json::Value (*)( + using SignFunc = json::Value (*)( json::Value params, unsigned int apiVersion, NetworkOPs::FailHard failType, @@ -2767,7 +2767,7 @@ public: std::chrono::seconds validatedLedgerAge, Application& app); - using submitFunc = json::Value (*)( + using SubmitFunc = json::Value (*)( json::Value params, unsigned int apiVersion, NetworkOPs::FailHard failType, @@ -2776,7 +2776,7 @@ public: Application& app, ProcessTransactionFn const& processTransaction); - using TestStuff = std::tuple; + using TestStuff = std::tuple; static TestStuff const kTestFuncs[] = { TestStuff{transactionSign, nullptr, "sign", 0}, diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 3abe83153b..341e694b8e 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -675,21 +675,21 @@ class LedgerEntry_test : public beast::unit_test::Suite auto const sle = std::make_shared(keylet); // Create Amendments vector (enabled amendments) - std::vector enabledAmendments; + std::vector enabledAmendments; enabledAmendments.push_back( - uint256::fromVoid( + UInt256::fromVoid( "42426C4D4F1009EE67080A9B7965B44656D7" "714D104A72F9B4369F97ABF044EE")); enabledAmendments.push_back( - uint256::fromVoid( + UInt256::fromVoid( "4C97EBA926031A7CF7D7B36FDE3ED66DDA54" "21192D63DE53FFB46E43B9DC8373")); enabledAmendments.push_back( - uint256::fromVoid( + UInt256::fromVoid( "03BDC0099C4E14163ADA272C1B6F6FABB448" "CC3E51F522F978041E4B57D9158C")); enabledAmendments.push_back( - uint256::fromVoid( + UInt256::fromVoid( "35291ADD2D79EB6991343BDA0912269C817D" "0F094B02226C1C14AD2858962ED4")); sle->setFieldV256(sfAmendments, STVector256(enabledAmendments)); @@ -700,7 +700,7 @@ class LedgerEntry_test : public beast::unit_test::Suite auto majority1 = STObject::makeInnerObject(sfMajority); majority1.setFieldH256( sfAmendment, - uint256::fromVoid( + UInt256::fromVoid( "7BB62DC13EC72B775091E9C71BF8CF97E122" "647693B50C5E87A80DFD6FCFAC50")); majority1.setFieldU32(sfCloseTime, 779561310); @@ -709,7 +709,7 @@ class LedgerEntry_test : public beast::unit_test::Suite auto majority2 = STObject::makeInnerObject(sfMajority); majority2.setFieldH256( sfAmendment, - uint256::fromVoid( + UInt256::fromVoid( "755C971C29971C9F20C6F080F2ED96F87884" "E40AD19554A5EBECDCEC8A1F77FE")); majority2.setFieldU32(sfCloseTime, 779561310); @@ -1530,10 +1530,10 @@ class LedgerEntry_test : public beast::unit_test::Suite Account const buyer{"buyer"}; env.fund(XRP(1000), issuer, buyer); - uint256 const nftokenID0 = token::getNextID(env, issuer, 0, tfTransferable); + UInt256 const nftokenID0 = token::getNextID(env, issuer, 0, tfTransferable); env(token::mint(issuer, 0), Txflags(tfTransferable)); env.close(); - uint256 const offerID = + UInt256 const offerID = keylet::nftokenOffer(issuer, SeqProxy::rawSequence(env.seq(issuer))).key; env(token::createOffer(issuer, nftokenID0, drops(1)), token::Destination(buyer), @@ -1613,7 +1613,7 @@ class LedgerEntry_test : public beast::unit_test::Suite sle->setFieldArray(sfDisabledValidators, disabledValidators); sle->setFieldH256( sfPreviousTxnID, - uint256::fromVoid( + UInt256::fromVoid( "8D47FFE664BE6C335108DF689537625855A6" "A95160CC6D351341B9" "2624D9C5E3")); @@ -1718,7 +1718,7 @@ class LedgerEntry_test : public beast::unit_test::Suite std::string const ledgerHash{to_string(env.closed()->header().hash)}; - uint256 const payChanIndex{ + UInt256 const payChanIndex{ keylet::payChannel(alice, env.master, SeqProxy::rawSequence(env.seq(alice) - 1)).key}; { // Request the payment channel using its index. @@ -2489,7 +2489,7 @@ class LedgerEntry_test : public beast::unit_test::Suite json::Value params; // "field":[incorrect index hash] - auto const badKey = strHex(expectedKey.key + uint256{1}); + auto const badKey = strHex(expectedKey.key + UInt256{1}); params[jss::ledger_index] = jss::validated; params[field] = badKey; auto const jv = env.rpc("json", "ledger_entry", to_string(params)); @@ -2707,7 +2707,7 @@ class LedgerEntry_test : public beast::unit_test::Suite // "hashes":[incorrect index hash] { json::Value params; - auto const badKey = strHex(expectedKey.key + uint256{1}); + auto const badKey = strHex(expectedKey.key + UInt256{1}); params[jss::ledger_index] = jss::validated; params[jss::hashes] = badKey; auto const jv = env.rpc("json", "ledger_entry", to_string(params)); diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index deb19e3a3f..82918a39c0 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -637,7 +637,7 @@ class LedgerRPC_test : public beast::unit_test::Suite BEAST_EXPECT(tx[jss::Account] == alice.human()); BEAST_EXPECT(tx[jss::TransactionType] == jss::OfferCreate); auto const txid0 = tx[jss::hash].asString(); - uint256 tx0, tx1; + UInt256 tx0, tx1; BEAST_EXPECT(tx0.parseHex(txid0)); BEAST_EXPECT(tx1.parseHex(txid1)); BEAST_EXPECT((tx0 ^ parentHash) < (tx1 ^ parentHash)); @@ -670,7 +670,7 @@ class LedgerRPC_test : public beast::unit_test::Suite BEAST_EXPECT(txj["last_result"] == "terPRE_SEQ"); BEAST_EXPECT(txj.isMember(jss::tx)); BEAST_EXPECT(txj[jss::tx] == txid0); - uint256 tx0, tx1; + UInt256 tx0, tx1; BEAST_EXPECT(tx0.parseHex(txid0)); BEAST_EXPECT(tx1.parseHex(txid1)); BEAST_EXPECT((tx0 ^ parentHash) < (tx1 ^ parentHash)); diff --git a/src/test/rpc/LedgerRequest_test.cpp b/src/test/rpc/LedgerRequest_test.cpp index 98bde4e5a5..91c22d693b 100644 --- a/src/test/rpc/LedgerRequest_test.cpp +++ b/src/test/rpc/LedgerRequest_test.cpp @@ -279,7 +279,7 @@ public: // the purpose in this test is to force the ledger expiration/out of // date check to trigger - env.timeKeeper().adjustCloseTime(weeks{3}); + env.timeKeeper().adjustCloseTime(Weeks{3}); auto const result = env.rpc(apiVersion, "ledger_request", "1")[jss::result]; BEAST_EXPECT(result[jss::status] == "error"); if (apiVersion == 1) diff --git a/src/test/rpc/NoRippleCheck_test.cpp b/src/test/rpc/NoRippleCheck_test.cpp index 3a4ddcf5c4..8ad09690b4 100644 --- a/src/test/rpc/NoRippleCheck_test.cpp +++ b/src/test/rpc/NoRippleCheck_test.cpp @@ -301,9 +301,9 @@ class NoRippleCheckLimits_test : public beast::unit_test::Suite // if we go above the warning threshold, reset if (c.balance() > kWarningThreshold) { - using ct = beast::AbstractClock; + using Ct = beast::AbstractClock; c.entry().localBalance = - DecayingSample{steady_clock::now()}; + DecayingSample{steady_clock::now()}; } }; diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 47c2245fa5..4152b53fec 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -957,7 +957,7 @@ public: if (sizeCompare && accountVec.size() != (txHistoryVec.size())) return false; - hash_map txHistoryMap; + HashMap txHistoryMap; for (auto const& tx : txHistoryVec) { txHistoryMap.emplace(std::get<1>(tx), std::get<0>(tx)); @@ -1390,9 +1390,9 @@ public: // Verify `nftoken_id` value equals to the NFTokenID that was // changed in the most recent NFTokenMint or NFTokenAcceptOffer // transaction - auto verifyNFTokenID = [&](uint256 const& actualNftID) { + auto verifyNFTokenID = [&](UInt256 const& actualNftID) { BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - uint256 nftID; + UInt256 nftID; BEAST_EXPECT(nftID.parseHex(jv[jss::meta][jss::nftoken_id].asString())); return nftID == actualNftID; })); @@ -1400,15 +1400,15 @@ public: // Verify `nftoken_ids` value equals to the NFTokenIDs that were // changed in the most recent NFTokenCancelOffer transaction - auto verifyNFTokenIDsInCancelOffer = [&](std::vector actualNftIDs) { + auto verifyNFTokenIDsInCancelOffer = [&](std::vector actualNftIDs) { BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - std::vector metaIDs; + std::vector metaIDs; std::transform( jv[jss::meta][jss::nftoken_ids].begin(), jv[jss::meta][jss::nftoken_ids].end(), std::back_inserter(metaIDs), [this](json::Value id) { - uint256 nftID; + UInt256 nftID; BEAST_EXPECT(nftID.parseHex(id.asString())); return nftID; }); @@ -1429,9 +1429,9 @@ public: // Verify `offer_id` value equals to the offerID that was // changed in the most recent NFTokenCreateOffer tx - auto verifyNFTokenOfferID = [&](uint256 const& offerID) { + auto verifyNFTokenOfferID = [&](UInt256 const& offerID) { BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - uint256 metaOfferID; + UInt256 metaOfferID; BEAST_EXPECT(metaOfferID.parseHex(jv[jss::meta][jss::offer_id].asString())); return metaOfferID == offerID; })); @@ -1441,12 +1441,12 @@ public: { // Alice mints 2 NFTs // Verify the NFTokenIDs are correct in the NFTokenMint tx meta - uint256 const nftId1{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId1{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); BEAST_EXPECT(env.syncClose()); verifyNFTokenID(nftId1); - uint256 const nftId2{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId2{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); BEAST_EXPECT(env.syncClose()); verifyNFTokenID(nftId2); @@ -1454,13 +1454,13 @@ public: // Alice creates one sell offer for each NFT // Verify the offer indexes are correct in the NFTokenCreateOffer tx // meta - uint256 const aliceOfferIndex1 = + UInt256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId1, drops(1)), Txflags(tfSellNFToken)); BEAST_EXPECT(env.syncClose()); verifyNFTokenOfferID(aliceOfferIndex1); - uint256 const aliceOfferIndex2 = + UInt256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId2, drops(1)), Txflags(tfSellNFToken)); BEAST_EXPECT(env.syncClose()); @@ -1491,13 +1491,13 @@ public: // Check `nftoken_ids` in brokered mode { // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); BEAST_EXPECT(env.syncClose()); verifyNFTokenID(nftId); // Alice creates sell offer and set broker as destination - uint256 const offerAliceToBroker = + UInt256 const offerAliceToBroker = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), token::Destination(broker), @@ -1506,7 +1506,7 @@ public: verifyNFTokenOfferID(offerAliceToBroker); // Bob creates buy offer - uint256 const offerBobToBroker = + UInt256 const offerBobToBroker = keylet::nftokenOffer(bob, SeqProxy::rawSequence(env.seq(bob))).key; env(token::createOffer(bob, nftId, drops(1)), token::Owner(alice)); BEAST_EXPECT(env.syncClose()); @@ -1522,19 +1522,19 @@ public: // multiple offers are cancelled for the same NFT { // Alice mints a NFT - uint256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; + UInt256 const nftId{token::getNextID(env, alice, 0u, tfTransferable)}; env(token::mint(alice, 0u), Txflags(tfTransferable)); BEAST_EXPECT(env.syncClose()); verifyNFTokenID(nftId); // Alice creates 2 sell offers for the same NFT - uint256 const aliceOfferIndex1 = + UInt256 const aliceOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken)); BEAST_EXPECT(env.syncClose()); verifyNFTokenOfferID(aliceOfferIndex1); - uint256 const aliceOfferIndex2 = + UInt256 const aliceOfferIndex2 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::createOffer(alice, nftId, drops(1)), Txflags(tfSellNFToken)); BEAST_EXPECT(env.syncClose()); @@ -1549,7 +1549,7 @@ public: if (features[featureNFTokenMintOffer]) { - uint256 const aliceMintWithOfferIndex1 = + UInt256 const aliceMintWithOfferIndex1 = keylet::nftokenOffer(alice, SeqProxy::rawSequence(env.seq(alice))).key; env(token::mint(alice), token::Amount(XRP(0))); BEAST_EXPECT(env.syncClose()); @@ -1573,7 +1573,7 @@ public: // live subscriber, rather than by reading a count to zero. // Build `count` distinct, valid, base58-encoded account strings cheaply by - // incrementing an AccountID. parseAccountIds dedups into a hash_set, so the + // incrementing an AccountID. parseAccountIds dedups into a HashSet, so the // strings MUST be distinct for the cap arithmetic to be exact; incrementing // guarantees distinctness without deriving `count` keypairs. static std::vector diff --git a/src/test/rpc/ValidatorRPC_test.cpp b/src/test/rpc/ValidatorRPC_test.cpp index 360cf13c75..495373c702 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -132,7 +132,7 @@ public: } // Negative UNL update { - hash_set disabledKeys; + HashSet disabledKeys; auto k1 = randomKeyPair(KeyType::Ed25519).first; auto k2 = randomKeyPair(KeyType::Ed25519).first; disabledKeys.insert(k1); @@ -332,7 +332,7 @@ public: env.app().getValidatorSites().start(); env.app().getValidatorSites().join(); - hash_set startKeys; + HashSet startKeys; for (auto const& val : validators) startKeys.insert(calcNodeID(val.masterPublic)); @@ -425,7 +425,7 @@ public: env.app().getValidatorSites().start(); env.app().getValidatorSites().join(); - hash_set startKeys; + HashSet startKeys; for (auto const& val : validators) startKeys.insert(calcNodeID(val.masterPublic)); diff --git a/src/test/server/Server_test.cpp b/src/test/server/Server_test.cpp index 9ff0015b5d..88e3ffdfae 100644 --- a/src/test/server/Server_test.cpp +++ b/src/test/server/Server_test.cpp @@ -40,8 +40,8 @@ namespace xrpl::test { -using socket_type = boost::beast::tcp_stream; -using stream_type = boost::beast::ssl_stream; +using SocketType = boost::beast::tcp_stream; +using StreamType = boost::beast::ssl_stream; class Server_test : public beast::unit_test::Suite { @@ -115,8 +115,8 @@ public: static Handoff onHandoff( Session& session, - std::unique_ptr const& bundle, - http_request_type const& request, + std::unique_ptr const& bundle, + HttpRequestType const& request, boost::asio::ip::tcp::endpoint remoteAddress) { return Handoff{}; @@ -125,7 +125,7 @@ public: static Handoff onHandoff( Session& session, - http_request_type const& request, + HttpRequestType const& request, boost::asio::ip::tcp::endpoint remoteAddress) { return Handoff{}; @@ -235,8 +235,8 @@ public: testRequest(boost::asio::ip::tcp::endpoint const& ep) { boost::asio::io_context ios; - using socket = boost::asio::ip::tcp::socket; - socket s(ios); + using Socket = boost::asio::ip::tcp::socket; + Socket s(ios); if (!connect(s, ep)) return; @@ -252,7 +252,7 @@ public: return; boost::system::error_code ec; - s.shutdown(socket::shutdown_both, ec); // NOLINT(bugprone-unused-return-value) + s.shutdown(Socket::shutdown_both, ec); // NOLINT(bugprone-unused-return-value) std::this_thread::sleep_for(std::chrono::seconds(1)); } @@ -261,8 +261,8 @@ public: testKeepalive(boost::asio::ip::tcp::endpoint const& ep) { boost::asio::io_context ios; - using socket = boost::asio::ip::tcp::socket; - socket s(ios); + using Socket = boost::asio::ip::tcp::socket; + Socket s(ios); if (!connect(s, ep)) return; @@ -288,7 +288,7 @@ public: return; boost::system::error_code ec; - s.shutdown(socket::shutdown_both, ec); // NOLINT(bugprone-unused-return-value) + s.shutdown(Socket::shutdown_both, ec); // NOLINT(bugprone-unused-return-value) } void @@ -328,8 +328,8 @@ public: static Handoff onHandoff( Session& session, - std::unique_ptr const& bundle, - http_request_type const& request, + std::unique_ptr const& bundle, + HttpRequestType const& request, boost::asio::ip::tcp::endpoint remoteAddress) { return Handoff{}; @@ -338,7 +338,7 @@ public: static Handoff onHandoff( Session& session, - http_request_type const& request, + HttpRequestType const& request, boost::asio::ip::tcp::endpoint remoteAddress) { return Handoff{}; diff --git a/src/test/unit_test/FileDirGuard.h b/src/test/unit_test/FileDirGuard.h index 2e6b3fd179..9f35044c83 100644 --- a/src/test/unit_test/FileDirGuard.h +++ b/src/test/unit_test/FileDirGuard.h @@ -19,17 +19,17 @@ namespace xrpl::detail { class DirGuard { protected: - using path = std::filesystem::path; + using Path = std::filesystem::path; private: - path subDir_; + Path subDir_; bool rmSubDir_{false}; protected: beast::unit_test::Suite& test_; auto - rmDir(path const& toRm) + rmDir(Path const& toRm) { if (is_directory(toRm) && is_empty(toRm)) { @@ -43,7 +43,7 @@ protected: } public: - DirGuard(beast::unit_test::Suite& test, path subDir, bool useCounter = true) + DirGuard(beast::unit_test::Suite& test, Path subDir, bool useCounter = true) : subDir_(std::move(subDir)), test_(test) { using namespace std::filesystem; @@ -84,7 +84,7 @@ public: }; } - [[nodiscard]] path const& + [[nodiscard]] Path const& subdir() const { return subDir_; @@ -97,14 +97,14 @@ public: class FileDirGuard : public DirGuard { protected: - path const file_; + Path const file_; bool created_ = false; public: FileDirGuard( beast::unit_test::Suite& test, - path subDir, - path file, + Path subDir, + Path file, std::string const& contents, bool useCounter = true, bool create = true) @@ -150,7 +150,7 @@ public: }; } - [[nodiscard]] path const& + [[nodiscard]] Path const& file() const { return file_; diff --git a/src/test/unit_test/multi_runner.cpp b/src/test/unit_test/multi_runner.cpp index 918fc7c89f..4b39d899e8 100644 --- a/src/test/unit_test/multi_runner.cpp +++ b/src/test/unit_test/multi_runner.cpp @@ -30,7 +30,7 @@ namespace xrpl { namespace detail { std::string -fmtdur(typename clock_type::duration const& d) +fmtdur(typename ClockType::duration const& d) { using namespace std::chrono; auto const ms = duration_cast(d); @@ -60,33 +60,32 @@ Results::add(SuiteResults const& r) total += r.total; cases += r.cases; failed += r.failed; - auto const elapsed = clock_type::now() - r.start; + auto const elapsed = ClockType::now() - r.start; if (elapsed >= std::chrono::seconds{1}) { // NOLINTNEXTLINE(modernize-use-ranges) auto const iter = std::lower_bound( - top.begin(), - top.end(), - elapsed, - [](run_time const& t1, clock_type::duration const& t2) { return t1.second > t2; }); + top.begin(), top.end(), elapsed, [](RunTime const& t1, ClockType::duration const& t2) { + return t1.second > t2; + }); if (iter != top.end()) { if (top.size() == kMaxTop && iter == top.end() - 1) { // avoid invalidating the iterator - *iter = run_time{static_string{static_string::string_view_type{r.name}}, elapsed}; + *iter = RunTime{StaticString{StaticString::string_view_type{r.name}}, elapsed}; } else { if (top.size() == kMaxTop) top.resize(top.size() - 1); - top.emplace(iter, static_string{static_string::string_view_type{r.name}}, elapsed); + top.emplace(iter, StaticString{StaticString::string_view_type{r.name}}, elapsed); } } else if (top.size() < kMaxTop) { - top.emplace_back(static_string{static_string::string_view_type{r.name}}, elapsed); + top.emplace_back(StaticString{StaticString::string_view_type{r.name}}, elapsed); } } } @@ -100,9 +99,9 @@ Results::merge(Results const& r) failed += r.failed; // combine the two top collections - boost::container::static_vector topResult; + boost::container::static_vector topResult; topResult.resize(top.size() + r.top.size()); - std::ranges::merge(top, r.top, topResult.begin(), [](run_time const& t1, run_time const& t2) { + std::ranges::merge(top, r.top, topResult.begin(), [](RunTime const& t1, RunTime const& t2) { return t1.second > t2.second; }); @@ -125,7 +124,7 @@ Results::print(S& s) s << std::setw(8) << fmtdur(dur) << " " << name << '\n'; } - auto const elapsed = clock_type::now() - start; + auto const elapsed = ClockType::now() - start; s << fmtdur(elapsed) << ", " << Amount{suites, "suite"} << ", " << Amount{cases, "case"} << ", " << Amount{total, "test"} << " total, " << Amount{failed, "failure"} << std::endl; } diff --git a/src/test/unit_test/multi_runner.h b/src/test/unit_test/multi_runner.h index c17fdf3bf0..5ebe7b0a64 100644 --- a/src/test/unit_test/multi_runner.h +++ b/src/test/unit_test/multi_runner.h @@ -28,7 +28,7 @@ namespace xrpl { namespace detail { -using clock_type = std::chrono::steady_clock; +using ClockType = std::chrono::steady_clock; struct CaseResults { @@ -47,7 +47,7 @@ struct SuiteResults std::size_t cases = 0; std::size_t total = 0; std::size_t failed = 0; - clock_type::time_point start = clock_type::now(); + ClockType::time_point start = ClockType::now(); explicit SuiteResults(std::string name = "") : name(std::move(name)) { @@ -59,10 +59,10 @@ struct SuiteResults struct Results { - using static_string = boost::beast::static_string<256>; + using StaticString = boost::beast::static_string<256>; // results may be stored in shared memory. Use `static_string` to ensure // pointers from different memory spaces do not co-mingle - using run_time = std::pair; + using RunTime = std::pair; static constexpr auto kMaxTop = 10; @@ -70,8 +70,8 @@ struct Results std::size_t cases = 0; std::size_t total = 0; std::size_t failed = 0; - boost::container::static_vector top; - clock_type::time_point start = clock_type::now(); + boost::container::static_vector top; + ClockType::time_point start = ClockType::now(); void add(SuiteResults const& r); diff --git a/src/tests/libxrpl/basics/Units.cpp b/src/tests/libxrpl/basics/Units.cpp index 1cf7024fe0..af75d5f91a 100644 --- a/src/tests/libxrpl/basics/Units.cpp +++ b/src/tests/libxrpl/basics/Units.cpp @@ -20,14 +20,14 @@ TEST(UnitsTest, types) { XRPAmount const x{100}; EXPECT_EQ(x.drops(), 100); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); auto y = 4u * x; EXPECT_EQ(y.value(), 400); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); auto z = 4 * y; EXPECT_EQ(z.value(), 1600); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); FeeLevel32 const f{10}; FeeLevel32 const baseFee{100}; @@ -37,17 +37,17 @@ TEST(UnitsTest, types) EXPECT_TRUE(drops); EXPECT_EQ(drops.value(), 1000); // NOLINT(bugprone-unchecked-optional-access) EXPECT_TRUE( - (std::is_same_v::unit_type, unit::dropTag>)); + (std::is_same_v::UnitType, unit::dropTag>)); EXPECT_TRUE((std::is_same_v, XRPAmount>)); } { XRPAmount const x{100}; EXPECT_EQ(x.value(), 100); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); auto y = 4u * x; EXPECT_EQ(y.value(), 400); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); FeeLevel64 const f{10}; FeeLevel64 const baseFee{100}; @@ -57,17 +57,17 @@ TEST(UnitsTest, types) EXPECT_TRUE(drops); EXPECT_EQ(drops.value(), 1000); // NOLINT(bugprone-unchecked-optional-access) EXPECT_TRUE( - (std::is_same_v::unit_type, unit::dropTag>)); + (std::is_same_v::UnitType, unit::dropTag>)); EXPECT_TRUE((std::is_same_v, XRPAmount>)); } { FeeLevel64 const x{1024}; EXPECT_EQ(x.value(), 1024); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); std::uint64_t const m = 4; auto y = m * x; EXPECT_EQ(y.value(), 4096); - EXPECT_TRUE((std::is_same_v)); + EXPECT_TRUE((std::is_same_v)); XRPAmount const basefee{10}; FeeLevel64 const referencefee{256}; @@ -77,7 +77,7 @@ TEST(UnitsTest, types) EXPECT_TRUE(drops); EXPECT_EQ(drops.value(), 40); // NOLINT(bugprone-unchecked-optional-access) EXPECT_TRUE( - (std::is_same_v::unit_type, unit::dropTag>)); + (std::is_same_v::UnitType, unit::dropTag>)); EXPECT_TRUE((std::is_same_v, XRPAmount>)); } } diff --git a/src/tests/libxrpl/basics/hardened_hash.cpp b/src/tests/libxrpl/basics/hardened_hash.cpp index 4f51ce4305..212f904016 100644 --- a/src/tests/libxrpl/basics/hardened_hash.cpp +++ b/src/tests/libxrpl/basics/hardened_hash.cpp @@ -68,16 +68,16 @@ namespace xrpl { namespace detail { template -using test_hardened_unordered_set = std::unordered_set>; +using TestHardenedUnorderedSet = std::unordered_set>; template -using test_hardened_unordered_map = std::unordered_map>; +using TestHardenedUnorderedMap = std::unordered_map>; template -using test_hardened_unordered_multiset = std::unordered_multiset>; +using TestHardenedUnorderedMultiset = std::unordered_multiset>; template -using test_hardened_unordered_multimap = std::unordered_multimap>; +using TestHardenedUnorderedMultimap = std::unordered_multimap>; } // namespace detail @@ -143,10 +143,10 @@ public: } }; -using sha256_t = UnsignedInteger<256, std::size_t>; +using Sha256T = UnsignedInteger<256, std::size_t>; #ifndef __INTELLISENSE__ -static_assert(sha256_t::kBits == 256, "sha256_t must have 256 bits"); +static_assert(Sha256T::kBits == 256, "sha256_t must have 256 bits"); #endif } // namespace xrpl @@ -218,10 +218,10 @@ TEST_F(HardenedHashTest, user_types) TEST_F(HardenedHashTest, containers) { - checkContainer(); - checkContainer(); - checkContainer(); - checkContainer(); + checkContainer(); + checkContainer(); + checkContainer(); + checkContainer(); } } // namespace xrpl diff --git a/src/tests/libxrpl/basics/join.cpp b/src/tests/libxrpl/basics/join.cpp index 427f0b42bc..1e8008a3e8 100644 --- a/src/tests/libxrpl/basics/join.cpp +++ b/src/tests/libxrpl/basics/join.cpp @@ -59,10 +59,10 @@ TEST_F(JoinTest, join) test(CollectionAndDelimiter(std::vector{"master"}, "xxx"), "master"); // vector with one non-trivial streamable item edge case test( - CollectionAndDelimiter(std::vector{uint256{1}}, "xxx"), + CollectionAndDelimiter(std::vector{UInt256{1}}, "xxx"), "0000000000000000000000000000000000000000000000000000000000000001"); // empty vector edge case - test(CollectionAndDelimiter(std::vector{}, ","), ""); + test(CollectionAndDelimiter(std::vector{}, ","), ""); // C-style string test(CollectionAndDelimiter("string", " "), "s t r i n g"); // Empty C-style string edge case diff --git a/src/tests/libxrpl/beast/LexicalCast.cpp b/src/tests/libxrpl/beast/LexicalCast.cpp index d18af4e1cd..bf9acca16d 100644 --- a/src/tests/libxrpl/beast/LexicalCast.cpp +++ b/src/tests/libxrpl/beast/LexicalCast.cpp @@ -189,7 +189,7 @@ TYPED_TEST(LexicalCastIntegers, round_trips_random_values) { static constexpr auto kSampleCount = 1000uz; - xor_shift_engine r{50}; // seeded per test so a failure reproduces on its own + XorShiftEngine r{50}; // seeded per test so a failure reproduces on its own for (auto i = 0uz; i < kSampleCount; ++i) expectRoundTrip(static_cast(r())); diff --git a/src/tests/libxrpl/consensus/Consensus.cpp b/src/tests/libxrpl/consensus/Consensus.cpp index d303d28e89..365721b60b 100644 --- a/src/tests/libxrpl/consensus/Consensus.cpp +++ b/src/tests/libxrpl/consensus/Consensus.cpp @@ -1068,7 +1068,7 @@ TEST(ConsensusTest, pause_for_laggards) PeerGroup const ahead = sim.createGroup(2); PeerGroup network = ahead + behind; - hash_set trustedKeys; + HashSet trustedKeys; for (Peer const* p : network) trustedKeys.insert(p->key); for (Peer* p : network) diff --git a/src/tests/libxrpl/consensus/LedgerTiming.cpp b/src/tests/libxrpl/consensus/LedgerTiming.cpp index 0cab895fda..67fbc3e03c 100644 --- a/src/tests/libxrpl/consensus/LedgerTiming.cpp +++ b/src/tests/libxrpl/consensus/LedgerTiming.cpp @@ -67,39 +67,39 @@ TEST(LedgerTimingTest, round_close_time) { using namespace std::chrono_literals; // A closeTime equal to the epoch is not modified - using tp = NetClock::time_point; - tp const def; + using Tp = NetClock::time_point; + Tp const def; EXPECT_TRUE(def == roundCloseTime(def, 30s)); // Otherwise, the closeTime is rounded to the nearest // rounding up on ties - EXPECT_TRUE(tp{0s} == roundCloseTime(tp{29s}, 60s)); - EXPECT_TRUE(tp{30s} == roundCloseTime(tp{30s}, 1s)); - EXPECT_TRUE(tp{60s} == roundCloseTime(tp{31s}, 60s)); - EXPECT_TRUE(tp{60s} == roundCloseTime(tp{30s}, 60s)); - EXPECT_TRUE(tp{60s} == roundCloseTime(tp{59s}, 60s)); - EXPECT_TRUE(tp{60s} == roundCloseTime(tp{60s}, 60s)); - EXPECT_TRUE(tp{60s} == roundCloseTime(tp{61s}, 60s)); + EXPECT_TRUE(Tp{0s} == roundCloseTime(Tp{29s}, 60s)); + EXPECT_TRUE(Tp{30s} == roundCloseTime(Tp{30s}, 1s)); + EXPECT_TRUE(Tp{60s} == roundCloseTime(Tp{31s}, 60s)); + EXPECT_TRUE(Tp{60s} == roundCloseTime(Tp{30s}, 60s)); + EXPECT_TRUE(Tp{60s} == roundCloseTime(Tp{59s}, 60s)); + EXPECT_TRUE(Tp{60s} == roundCloseTime(Tp{60s}, 60s)); + EXPECT_TRUE(Tp{60s} == roundCloseTime(Tp{61s}, 60s)); } TEST(LedgerTimingTest, eff_close_time) { using namespace std::chrono_literals; - using tp = NetClock::time_point; - tp close = effCloseTime(tp{10s}, 30s, tp{0s}); - EXPECT_TRUE(close == tp{1s}); + using Tp = NetClock::time_point; + Tp close = effCloseTime(Tp{10s}, 30s, Tp{0s}); + EXPECT_TRUE(close == Tp{1s}); - close = effCloseTime(tp{16s}, 30s, tp{0s}); - EXPECT_TRUE(close == tp{30s}); + close = effCloseTime(Tp{16s}, 30s, Tp{0s}); + EXPECT_TRUE(close == Tp{30s}); - close = effCloseTime(tp{16s}, 30s, tp{30s}); - EXPECT_TRUE(close == tp{31s}); + close = effCloseTime(Tp{16s}, 30s, Tp{30s}); + EXPECT_TRUE(close == Tp{31s}); - close = effCloseTime(tp{16s}, 30s, tp{60s}); - EXPECT_TRUE(close == tp{61s}); + close = effCloseTime(Tp{16s}, 30s, Tp{60s}); + EXPECT_TRUE(close == Tp{61s}); - close = effCloseTime(tp{31s}, 30s, tp{0s}); - EXPECT_TRUE(close == tp{30s}); + close = effCloseTime(Tp{31s}, 30s, Tp{0s}); + EXPECT_TRUE(close == Tp{30s}); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/consensus/Validations.cpp b/src/tests/libxrpl/consensus/Validations.cpp index 56964f56a6..75c52f4666 100644 --- a/src/tests/libxrpl/consensus/Validations.cpp +++ b/src/tests/libxrpl/consensus/Validations.cpp @@ -38,12 +38,12 @@ expireValidations(ValidationStore& validations) validations.expire(j); } -using clock_type = beast::AbstractClock const; +using ClockType = beast::AbstractClock const; // Helper to convert steady_clock to a reasonable NetClock // This allows a single manual clock in the unit tests NetClock::time_point -toNetClock(clock_type const& c) +toNetClock(ClockType const& c) { // We don't care about the actual epochs, but do want the // generated NetClock time to be well past its epoch to ensure @@ -56,14 +56,14 @@ toNetClock(clock_type const& c) // Represents a node that can issue validations class Node { - clock_type const& c_; + ClockType const& c_; PeerID nodeID_; bool trusted_ = true; std::size_t signIdx_{1}; std::optional loadFee_; public: - Node(PeerID nodeID, clock_type const& c) : c_(c), nodeID_(nodeID) + Node(PeerID nodeID, ClockType const& c) : c_(c), nodeID_(nodeID) { } @@ -155,7 +155,7 @@ public: // Generic Validations adaptor class Adaptor { - clock_type& c_; + ClockType& c_; LedgerOracle& oracle_; public: @@ -176,7 +176,7 @@ public: using Validation = csf::Validation; using Ledger = csf::Ledger; - Adaptor(clock_type& c, LedgerOracle& o) : c_{c}, oracle_{o} + Adaptor(ClockType& c, LedgerOracle& o) : c_{c}, oracle_{o} { } @@ -515,7 +515,7 @@ TEST(ValidationsTest, get_current_public_keys) EXPECT_TRUE(ValStatus::Current == harness.add(node.validate(ledgerA))); { - hash_set const expectedKeys = {a.nodeID(), b.nodeID()}; + HashSet const expectedKeys = {a.nodeID(), b.nodeID()}; EXPECT_TRUE(harness.vals().getCurrentNodeIDs() == expectedKeys); } @@ -529,7 +529,7 @@ TEST(ValidationsTest, get_current_public_keys) EXPECT_TRUE(ValStatus::Current == harness.add(node.partial(ledgerAC))); { - hash_set const expectedKeys = {a.nodeID(), b.nodeID()}; + HashSet const expectedKeys = {a.nodeID(), b.nodeID()}; EXPECT_TRUE(harness.vals().getCurrentNodeIDs() == expectedKeys); } @@ -563,7 +563,7 @@ TEST(ValidationsTest, trusted_by_ledger_functions) c.setLoadFee(12); e.setLoadFee(12); - hash_map, std::vector> trustedValidations; + HashMap, std::vector> trustedValidations; //---------------------------------------------------------------------- // checkers @@ -709,7 +709,7 @@ TEST(ValidationsTest, flush) Ledger const ledgerA = h["a"]; Ledger const ledgerAB = h["ab"]; - hash_map expected; + HashMap expected; for (auto const& node : {trustedNode1, trustedNode2, notTrustedNode}) { auto const val = node.validate(ledgerA); @@ -808,7 +808,7 @@ TEST(ValidationsTest, get_preferred_lcl) using ID = Ledger::ID; using Seq = Ledger::Seq; - hash_map peerCounts; + HashMap peerCounts; // No trusted validations or counts sticks with current ledger EXPECT_TRUE(harness.vals().getPreferredLCL(ledgerA, Seq{0}, peerCounts) == ledgerA.id()); @@ -942,7 +942,7 @@ TEST(ValidationsTest, trust_changed) using namespace std::chrono; auto checker = [&](TestValidations& vals, - hash_set const& listed, + HashSet const& listed, std::vector const& trustedVals) { Ledger::ID const testID = trustedVals.empty() ? kGenesisLedger.id() : trustedVals[0].ledgerID(); @@ -972,7 +972,7 @@ TEST(ValidationsTest, trust_changed) Validation const v = a.validate(ledgerAB); EXPECT_TRUE(ValStatus::Current == harness.add(v)); - hash_set const listed({a.nodeID()}); + HashSet const listed({a.nodeID()}); std::vector trustedVals({v}); checker(harness.vals(), listed, trustedVals); @@ -991,7 +991,7 @@ TEST(ValidationsTest, trust_changed) Validation const v = a.validate(ledgerAB); EXPECT_TRUE(ValStatus::Current == harness.add(v)); - hash_set const listed({a.nodeID()}); + HashSet const listed({a.nodeID()}); std::vector trustedVals; checker(harness.vals(), listed, trustedVals); @@ -1008,7 +1008,7 @@ TEST(ValidationsTest, trust_changed) Validation const v = a.validate(Ledger::ID{2}, Ledger::Seq{2}, 0s, 0s, true); EXPECT_TRUE(ValStatus::Current == harness.add(v)); - hash_set const listed({a.nodeID()}); + HashSet const listed({a.nodeID()}); std::vector trustedVals({v}); auto& vals = harness.vals(); EXPECT_TRUE(vals.currentTrusted() == trustedVals); diff --git a/src/tests/libxrpl/csf/BasicNetwork.h b/src/tests/libxrpl/csf/BasicNetwork.h index 2c68bd282d..0181449d35 100644 --- a/src/tests/libxrpl/csf/BasicNetwork.h +++ b/src/tests/libxrpl/csf/BasicNetwork.h @@ -62,13 +62,13 @@ namespace xrpl::test::csf { template class BasicNetwork { - using peer_type = Peer; + using PeerType = Peer; - using clock_type = Scheduler::clock_type; + using ClockType = Scheduler::ClockType; - using duration = clock_type::duration; + using duration = ClockType::duration; - using time_point = clock_type::time_point; + using time_point = ClockType::time_point; struct LinkType { diff --git a/src/tests/libxrpl/csf/CollectorRef.h b/src/tests/libxrpl/csf/CollectorRef.h index b1da962f3d..c8f04a5316 100644 --- a/src/tests/libxrpl/csf/CollectorRef.h +++ b/src/tests/libxrpl/csf/CollectorRef.h @@ -53,7 +53,7 @@ namespace xrpl::test::csf { */ class CollectorRef { - using tp = SimTime; + using Tp = SimTime; // Interface for type-erased collector instance struct ICollector @@ -61,67 +61,67 @@ class CollectorRef virtual ~ICollector() = default; virtual void - on(PeerID node, tp when, Share const&) = 0; + on(PeerID node, Tp when, Share const&) = 0; virtual void - on(PeerID node, tp when, Share const&) = 0; + on(PeerID node, Tp when, Share const&) = 0; virtual void - on(PeerID node, tp when, Share const&) = 0; + on(PeerID node, Tp when, Share const&) = 0; virtual void - on(PeerID node, tp when, Share const&) = 0; + on(PeerID node, Tp when, Share const&) = 0; virtual void - on(PeerID node, tp when, Share const&) = 0; + on(PeerID node, Tp when, Share const&) = 0; virtual void - on(PeerID node, tp when, Receive const&) = 0; + on(PeerID node, Tp when, Receive const&) = 0; virtual void - on(PeerID node, tp when, Receive const&) = 0; + on(PeerID node, Tp when, Receive const&) = 0; virtual void - on(PeerID node, tp when, Receive const&) = 0; + on(PeerID node, Tp when, Receive const&) = 0; virtual void - on(PeerID node, tp when, Receive const&) = 0; + on(PeerID node, Tp when, Receive const&) = 0; virtual void - on(PeerID node, tp when, Receive const&) = 0; + on(PeerID node, Tp when, Receive const&) = 0; virtual void - on(PeerID node, tp when, Relay const&) = 0; + on(PeerID node, Tp when, Relay const&) = 0; virtual void - on(PeerID node, tp when, Relay const&) = 0; + on(PeerID node, Tp when, Relay const&) = 0; virtual void - on(PeerID node, tp when, Relay const&) = 0; + on(PeerID node, Tp when, Relay const&) = 0; virtual void - on(PeerID node, tp when, Relay const&) = 0; + on(PeerID node, Tp when, Relay const&) = 0; virtual void - on(PeerID node, tp when, Relay const&) = 0; + on(PeerID node, Tp when, Relay const&) = 0; virtual void - on(PeerID node, tp when, SubmitTx const&) = 0; + on(PeerID node, Tp when, SubmitTx const&) = 0; virtual void - on(PeerID node, tp when, StartRound const&) = 0; + on(PeerID node, Tp when, StartRound const&) = 0; virtual void - on(PeerID node, tp when, CloseLedger const&) = 0; + on(PeerID node, Tp when, CloseLedger const&) = 0; virtual void - on(PeerID node, tp when, AcceptLedger const&) = 0; + on(PeerID node, Tp when, AcceptLedger const&) = 0; virtual void - on(PeerID node, tp when, WrongPrevLedger const&) = 0; + on(PeerID node, Tp when, WrongPrevLedger const&) = 0; virtual void - on(PeerID node, tp when, FullyValidateLedger const&) = 0; + on(PeerID node, Tp when, FullyValidateLedger const&) = 0; }; // Bridge between type-ful collector T and type erased instance @@ -145,127 +145,127 @@ class CollectorRef operator=(Any&&) = default; void - on(PeerID node, tp when, Share const& e) override + on(PeerID node, Tp when, Share const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Share const& e) override + on(PeerID node, Tp when, Share const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Share const& e) override + on(PeerID node, Tp when, Share const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Share const& e) override + on(PeerID node, Tp when, Share const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Share const& e) override + on(PeerID node, Tp when, Share const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Receive const& e) override + on(PeerID node, Tp when, Receive const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Receive const& e) override + on(PeerID node, Tp when, Receive const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Receive const& e) override + on(PeerID node, Tp when, Receive const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Receive const& e) override + on(PeerID node, Tp when, Receive const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Receive const& e) override + on(PeerID node, Tp when, Receive const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Relay const& e) override + on(PeerID node, Tp when, Relay const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Relay const& e) override + on(PeerID node, Tp when, Relay const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Relay const& e) override + on(PeerID node, Tp when, Relay const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Relay const& e) override + on(PeerID node, Tp when, Relay const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, Relay const& e) override + on(PeerID node, Tp when, Relay const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, SubmitTx const& e) override + on(PeerID node, Tp when, SubmitTx const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, StartRound const& e) override + on(PeerID node, Tp when, StartRound const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, CloseLedger const& e) override + on(PeerID node, Tp when, CloseLedger const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, AcceptLedger const& e) override + on(PeerID node, Tp when, AcceptLedger const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, WrongPrevLedger const& e) override + on(PeerID node, Tp when, WrongPrevLedger const& e) override { t_.on(node, when, e); } void - on(PeerID node, tp when, FullyValidateLedger const& e) override + on(PeerID node, Tp when, FullyValidateLedger const& e) override { t_.on(node, when, e); } @@ -290,7 +290,7 @@ public: template void - on(PeerID node, tp when, E const& e) + on(PeerID node, Tp when, E const& e) { impl_->on(node, when, e); } diff --git a/src/tests/libxrpl/csf/Peer.h b/src/tests/libxrpl/csf/Peer.h index d4b6f42bdb..e35a869e93 100644 --- a/src/tests/libxrpl/csf/Peer.h +++ b/src/tests/libxrpl/csf/Peer.h @@ -175,11 +175,11 @@ struct Peer /** * Type definitions for generic consensus */ - using Ledger_t = Ledger; - using NodeID_t = PeerID; - using NodeKey_t = PeerKey; - using TxSet_t = TxSet; - using PeerPosition_t = Position; + using LedgerT = Ledger; + using NodeIDT = PeerID; + using NodeKeyT = PeerKey; + using TxSetT = TxSet; + using PeerPositionT = Position; using Result = ConsensusResult; using NodeKey = Validation::NodeKey; @@ -237,7 +237,7 @@ struct Peer /** * Ledgers this node has closed or loaded from the network */ - hash_map ledgers; + HashMap ledgers; /** * Validations from trusted nodes @@ -303,7 +303,7 @@ struct Peer // TODO: Use the logic in ValidatorList to set this dynamically std::size_t quorum = 0; - hash_set trustedKeys; + HashSet trustedKeys; // Simulation parameters ConsensusParms consensusParms; @@ -880,17 +880,17 @@ struct Peer return earliestAllowedSeq(); } - std::pair> + std::pair> getQuorumKeys() { - hash_set keys; + HashSet keys; for (auto const p : trustGraph.trustedPeers(this)) keys.insert(p->key); return {quorum, keys}; } std::size_t - laggards(Ledger::Seq const seq, hash_set& trusted) + laggards(Ledger::Seq const seq, HashSet& trusted) { return validations.laggards(seq, trusted); } @@ -952,7 +952,7 @@ struct Peer issue(StartRound{.bestLedger = bestLCL, .prevLedger = lastClosedLedger}); // Not yet modeling dynamic UNL. - hash_set const nowUntrusted; + HashSet const nowUntrusted; consensus.startRound(now(), bestLCL, lastClosedLedger, nowUntrusted, runAsValidator, {}); } @@ -993,7 +993,7 @@ struct Peer // which a node generates the wrong ledger, even when consensus worked // properly. // TODO: Make this more robust - hash_map txInjections; + HashMap txInjections; /** * Inject non-consensus Tx diff --git a/src/tests/libxrpl/csf/PeerGroup.h b/src/tests/libxrpl/csf/PeerGroup.h index ff99b779a3..7a505a32f0 100644 --- a/src/tests/libxrpl/csf/PeerGroup.h +++ b/src/tests/libxrpl/csf/PeerGroup.h @@ -28,14 +28,14 @@ namespace xrpl::test::csf { */ class PeerGroup { - using peers_type = std::vector; - peers_type peers_; + using PeersType = std::vector; + PeersType peers_; public: - using iterator = peers_type::iterator; - using const_iterator = peers_type::const_iterator; - using reference = peers_type::reference; - using const_reference = peers_type::const_reference; + using iterator = PeersType::iterator; + using const_iterator = PeersType::const_iterator; + using reference = PeersType::reference; + using const_reference = PeersType::const_reference; PeerGroup() = default; PeerGroup(Peer* peer) : peers_{1, peer} diff --git a/src/tests/libxrpl/csf/Scheduler.h b/src/tests/libxrpl/csf/Scheduler.h index b1ac2bb5d4..4582ab1168 100644 --- a/src/tests/libxrpl/csf/Scheduler.h +++ b/src/tests/libxrpl/csf/Scheduler.h @@ -27,17 +27,17 @@ namespace xrpl::test::csf { class Scheduler { public: - using clock_type = beast::ManualClock; + using ClockType = beast::ManualClock; - using duration = clock_type::duration; + using duration = ClockType::duration; - using time_point = clock_type::time_point; + using time_point = ClockType::time_point; private: - using by_when_hook = + using ByWhenHook = boost::intrusive::set_base_hook>; - struct Event : by_when_hook + struct Event : ByWhenHook { time_point when; @@ -89,14 +89,14 @@ private: class QueueType { private: - using by_when_set = boost::intrusive:: + using ByWhenSet = boost::intrusive:: make_multiset>::type; // alloc_ is owned by the scheduler boost::container::pmr::monotonic_buffer_resource* alloc_; - by_when_set byWhen_; + ByWhenSet byWhen_; public: - using iterator = by_when_set::iterator; + using iterator = ByWhenSet::iterator; QueueType(QueueType const&) = delete; QueueType& @@ -116,7 +116,7 @@ private: end(); template - by_when_set::iterator + ByWhenSet::iterator emplace(time_point when, Handler&& h); iterator @@ -127,7 +127,7 @@ private: QueueType queue_; // Aged containers that rely on this clock take a non-const reference =( - mutable clock_type clock_; + mutable ClockType clock_; public: Scheduler(Scheduler const&) = delete; @@ -137,9 +137,9 @@ public: Scheduler(); /** - * Return the clock. (aged_containers want a non-const ref =( + * Return the clock. (aged containers want a non-const ref =( */ - clock_type& + ClockType& clock() const; /** @@ -300,16 +300,16 @@ Scheduler::QueueType::end() -> iterator template inline auto -Scheduler::QueueType::emplace(time_point when, Handler&& h) -> by_when_set::iterator +Scheduler::QueueType::emplace(time_point when, Handler&& h) -> ByWhenSet::iterator { - using event_type = EventImpl>; - auto const p = alloc_->allocate(sizeof(event_type)); - auto& e = *new (p) event_type(when, std::forward(h)); + using EventType = EventImpl>; + auto const p = alloc_->allocate(sizeof(EventType)); + auto& e = *new (p) EventType(when, std::forward(h)); return byWhen_.insert(e); } inline auto -Scheduler::QueueType::erase(iterator iter) -> by_when_set::iterator +Scheduler::QueueType::erase(iterator iter) -> ByWhenSet::iterator { auto& e = *iter; auto next = byWhen_.erase(iter); @@ -343,7 +343,7 @@ inline Scheduler::Scheduler() : queue_(&alloc_) } inline auto -Scheduler::clock() const -> clock_type& +Scheduler::clock() const -> ClockType& { return clock_; } diff --git a/src/tests/libxrpl/csf/Sim.h b/src/tests/libxrpl/csf/Sim.h index 774537138a..ea8fc2ecea 100644 --- a/src/tests/libxrpl/csf/Sim.h +++ b/src/tests/libxrpl/csf/Sim.h @@ -26,10 +26,10 @@ namespace xrpl::test::csf { */ class BasicSink : public beast::Journal::Sink { - Scheduler::clock_type const& clock_; + Scheduler::ClockType const& clock_; public: - BasicSink(Scheduler::clock_type const& clock) + BasicSink(Scheduler::ClockType const& clock) : Sink(beast::Severity::Disabled, false), clock_{clock} { } diff --git a/src/tests/libxrpl/csf/collectors.h b/src/tests/libxrpl/csf/collectors.h index 05b63f592b..26dceb96af 100644 --- a/src/tests/libxrpl/csf/collectors.h +++ b/src/tests/libxrpl/csf/collectors.h @@ -186,7 +186,7 @@ struct TxCollector } }; - hash_map txs; + HashMap txs; using Hist = Histogram; Hist submitToAccept; @@ -412,7 +412,7 @@ struct LedgerCollector } }; - hash_map ledgers; + HashMap ledgers; using Hist = Histogram; Hist acceptToFullyValid; diff --git a/src/tests/libxrpl/csf/random.h b/src/tests/libxrpl/csf/random.h index 56838bb280..c146aa5902 100644 --- a/src/tests/libxrpl/csf/random.h +++ b/src/tests/libxrpl/csf/random.h @@ -80,9 +80,9 @@ public: Selector(RAIter first, RAIter last, std::vector const& w, Generator& g) : first_{first}, last_{last}, dd_{w.begin(), w.end()}, g_{g} { - using tag = std::iterator_traits::iterator_category; + using Tag = std::iterator_traits::iterator_category; static_assert( - std::is_same_v, + std::is_same_v, "Selector only supports random access iterators."); // TODO: Allow for forward iterators } diff --git a/src/tests/libxrpl/helpers/TestFamily.h b/src/tests/libxrpl/helpers/TestFamily.h index 8a599ab4da..7d44354cb0 100644 --- a/src/tests/libxrpl/helpers/TestFamily.h +++ b/src/tests/libxrpl/helpers/TestFamily.h @@ -92,13 +92,13 @@ public: } void - missingNodeAcquireBySeq(std::uint32_t refNum, uint256 const& nodeHash) override + missingNodeAcquireBySeq(std::uint32_t refNum, UInt256 const& nodeHash) override { Throw("TestFamily: missing node (by seq)"); } void - missingNodeAcquireByHash(uint256 const& refHash, std::uint32_t refNum) override + missingNodeAcquireByHash(UInt256 const& refHash, std::uint32_t refNum) override { Throw("TestFamily: missing node (by hash)"); } diff --git a/src/tests/libxrpl/helpers/TestServiceRegistry.h b/src/tests/libxrpl/helpers/TestServiceRegistry.h index e763c8bde4..425afeae61 100644 --- a/src/tests/libxrpl/helpers/TestServiceRegistry.h +++ b/src/tests/libxrpl/helpers/TestServiceRegistry.h @@ -90,7 +90,7 @@ class TestServiceRegistry : public ServiceRegistry stopwatch(), logs_.journal("TaggedCache")}; PendingSaves pendingSaves_; - std::optional trapTxID_; + std::optional trapTxID_; public: TestServiceRegistry() = default; @@ -251,7 +251,7 @@ public: throw std::logic_error("TestServiceRegistry::getInboundTransactions() not implemented"); } - TaggedCache& + TaggedCache& getAcceptedLedgerCache() override { throw std::logic_error("TestServiceRegistry::getAcceptedLedgerCache() not implemented"); @@ -362,7 +362,7 @@ public: return logs_; } - std::optional const& + std::optional const& getTrapTxID() const override { return trapTxID_; diff --git a/src/tests/libxrpl/helpers/TxTest.cpp b/src/tests/libxrpl/helpers/TxTest.cpp index 4b4f407eeb..a22c9b8079 100644 --- a/src/tests/libxrpl/helpers/TxTest.cpp +++ b/src/tests/libxrpl/helpers/TxTest.cpp @@ -43,7 +43,7 @@ allFeatures() { static FeatureBitset const kFeatures = [] { auto const& sa = allAmendments(); - std::vector feats; + std::vector feats; feats.reserve(sa.size()); for ([[maybe_unused]] auto const& [name, _] : sa) { @@ -63,7 +63,7 @@ TxTest::TxTest(std::optional features) { // Convert FeatureBitset to unordered_set for Rules constructor auto const featureBits = features.value_or(allFeatures()); - foreachFeature(featureBits, [&](uint256 const& f) { featureSet_.insert(f); }); + foreachFeature(featureBits, [&](UInt256 const& f) { featureSet_.insert(f); }); // Create rules with the specified features rules_.emplace(featureSet_); @@ -77,7 +77,7 @@ TxTest::TxTest(std::optional features) // NOLINTNEXTLINE(bugprone-unchecked-optional-access) *rules_, fees, - std::vector{featureSet_.begin(), featureSet_.end()}, + std::vector{featureSet_.begin(), featureSet_.end()}, registry_.getNodeFamily()); // Initialize time from the genesis ledger. closedLedger_ is created above @@ -91,7 +91,7 @@ TxTest::TxTest(std::optional features) } bool -TxTest::isEnabled(uint256 const& feature) const +TxTest::isEnabled(UInt256 const& feature) const { // NOLINTNEXTLINE(bugprone-unchecked-optional-access) return rules_->enabled(feature); diff --git a/src/tests/libxrpl/helpers/TxTest.h b/src/tests/libxrpl/helpers/TxTest.h index 98198e45f8..200b0b6dcb 100644 --- a/src/tests/libxrpl/helpers/TxTest.h +++ b/src/tests/libxrpl/helpers/TxTest.h @@ -200,7 +200,7 @@ public: * @return True if the feature is enabled. */ [[nodiscard]] bool - isEnabled(uint256 const& feature) const; + isEnabled(UInt256 const& feature) const; /** * @brief Get the current rules. @@ -355,7 +355,7 @@ public: private: TestServiceRegistry registry_; - std::unordered_set> featureSet_; + std::unordered_set> featureSet_; std::optional rules_; std::shared_ptr closedLedger_; std::shared_ptr openLedger_; diff --git a/src/tests/libxrpl/ledger/AMMEntry.cpp b/src/tests/libxrpl/ledger/AMMEntry.cpp index 6013d0f38f..3625ba90f8 100644 --- a/src/tests/libxrpl/ledger/AMMEntry.cpp +++ b/src/tests/libxrpl/ledger/AMMEntry.cpp @@ -19,7 +19,7 @@ TEST(AMMEntryTests, constructors) expectKeylet(e, keylet::amm(xrp, usd), "amm(asset, asset)", xrp, usd); - expectKeylet(e, keylet::amm(e.someID()), "amm(uint256)", e.someID()); + expectKeylet(e, keylet::amm(e.someID()), "amm(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/CheckEntry.cpp b/src/tests/libxrpl/ledger/CheckEntry.cpp index 58f6250b20..d5e272a26d 100644 --- a/src/tests/libxrpl/ledger/CheckEntry.cpp +++ b/src/tests/libxrpl/ledger/CheckEntry.cpp @@ -17,7 +17,7 @@ TEST(CheckEntryTests, constructors) expectKeylet( e, keylet::check(e.alice.id(), seq), "check(id, seq)", e.alice.id(), seq); - expectKeylet(e, keylet::check(e.someID()), "check(uint256)", e.someID()); + expectKeylet(e, keylet::check(e.someID()), "check(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/CredentialEntry.cpp b/src/tests/libxrpl/ledger/CredentialEntry.cpp index 16b877858b..419c087eca 100644 --- a/src/tests/libxrpl/ledger/CredentialEntry.cpp +++ b/src/tests/libxrpl/ledger/CredentialEntry.cpp @@ -27,7 +27,7 @@ TEST(CredentialEntryTests, constructors) credType); expectKeylet( - e, keylet::credential(e.someID()), "credential(uint256)", e.someID()); + e, keylet::credential(e.someID()), "credential(UInt256)", e.someID()); // Subject and issuer are both AccountIDs, so the assertion above only // has teeth if their order matters. diff --git a/src/tests/libxrpl/ledger/DepositPreauthEntry.cpp b/src/tests/libxrpl/ledger/DepositPreauthEntry.cpp index 115baa741d..24e0726251 100644 --- a/src/tests/libxrpl/ledger/DepositPreauthEntry.cpp +++ b/src/tests/libxrpl/ledger/DepositPreauthEntry.cpp @@ -36,7 +36,7 @@ TEST(DepositPreauthEntryTests, constructors) authCreds); expectKeylet( - e, keylet::depositPreauth(e.someID()), "depositPreauth(uint256)", e.someID()); + e, keylet::depositPreauth(e.someID()), "depositPreauth(UInt256)", e.someID()); // Owner and preauthorized are both AccountIDs, so the assertion above // only has teeth if their order matters. diff --git a/src/tests/libxrpl/ledger/EntryTestHelpers.h b/src/tests/libxrpl/ledger/EntryTestHelpers.h index d98b40795e..90221192a3 100644 --- a/src/tests/libxrpl/ledger/EntryTestHelpers.h +++ b/src/tests/libxrpl/ledger/EntryTestHelpers.h @@ -20,7 +20,7 @@ namespace xrpl::test { * * Each of those suites needs the same three things: a ledger with a few funded * accounts, a throwaway ApplyView that is never applied, and some arbitrary - * uint256 to stand in for an object ID. Build one of these per test case -- + * UInt256 to stand in for an object ID. Build one of these per test case -- * TxTest construction dominates the runtime of these tests by a wide margin, * and none of the assertions mutate the ledger. */ @@ -54,11 +54,11 @@ public: } /** - * An arbitrary but stable uint256, for the entry constructors that take + * An arbitrary but stable UInt256, for the entry constructors that take * an object ID directly. Nothing in the ledger has this key, which is the * point: those overloads should resolve to a non-existent entry. */ - [[nodiscard]] uint256 + [[nodiscard]] UInt256 someID() const { return read().header().parentHash; diff --git a/src/tests/libxrpl/ledger/LoanBrokerEntry.cpp b/src/tests/libxrpl/ledger/LoanBrokerEntry.cpp index ab0ced00c0..e34404804d 100644 --- a/src/tests/libxrpl/ledger/LoanBrokerEntry.cpp +++ b/src/tests/libxrpl/ledger/LoanBrokerEntry.cpp @@ -18,7 +18,7 @@ TEST(LoanBrokerEntryTests, constructors) e, keylet::loanBroker(e.alice.id(), seq), "loanBroker(owner, seq)", e.alice.id(), seq); expectKeylet( - e, keylet::loanBroker(e.someID()), "loanBroker(uint256)", e.someID()); + e, keylet::loanBroker(e.someID()), "loanBroker(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/LoanEntry.cpp b/src/tests/libxrpl/ledger/LoanEntry.cpp index 23bc03bc0c..ae0b202c26 100644 --- a/src/tests/libxrpl/ledger/LoanEntry.cpp +++ b/src/tests/libxrpl/ledger/LoanEntry.cpp @@ -18,9 +18,9 @@ TEST(LoanEntryTests, constructors) expectKeylet( e, keylet::loan(e.someID(), seq), "loan(loanBrokerID, loanSeq)", e.someID(), seq); - expectKeylet(e, keylet::loan(e.someID()), "loan(uint256)", e.someID()); + expectKeylet(e, keylet::loan(e.someID()), "loan(UInt256)", e.someID()); - // Both overloads start with the same uint256, so they must not produce + // Both overloads start with the same UInt256, so they must not produce // the same key -- otherwise arity is the only thing keeping them apart // and the test proves nothing. EXPECT_NE(keylet::loan(e.someID(), seq).key, keylet::loan(e.someID()).key); diff --git a/src/tests/libxrpl/ledger/MPTokenEntry.cpp b/src/tests/libxrpl/ledger/MPTokenEntry.cpp index fe89555c7e..0dcf74cfa1 100644 --- a/src/tests/libxrpl/ledger/MPTokenEntry.cpp +++ b/src/tests/libxrpl/ledger/MPTokenEntry.cpp @@ -28,7 +28,7 @@ TEST(MPTokenEntryTests, constructors) e.someID(), e.bob.id()); - expectKeylet(e, keylet::mptoken(e.someID()), "mptoken(uint256)", e.someID()); + expectKeylet(e, keylet::mptoken(e.someID()), "mptoken(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/MPTokenIssuanceEntry.cpp b/src/tests/libxrpl/ledger/MPTokenIssuanceEntry.cpp index 825f75debe..e7c17fc659 100644 --- a/src/tests/libxrpl/ledger/MPTokenIssuanceEntry.cpp +++ b/src/tests/libxrpl/ledger/MPTokenIssuanceEntry.cpp @@ -27,7 +27,7 @@ TEST(MPTokenIssuanceEntryTests, constructors) e, keylet::mptokenIssuance(issuanceID), "mptokenIssuance(MPTID)", issuanceID); expectKeylet( - e, keylet::mptokenIssuance(e.someID()), "mptokenIssuance(uint256)", e.someID()); + e, keylet::mptokenIssuance(e.someID()), "mptokenIssuance(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/NFTokenOfferEntry.cpp b/src/tests/libxrpl/ledger/NFTokenOfferEntry.cpp index 2ad676e220..ce35254866 100644 --- a/src/tests/libxrpl/ledger/NFTokenOfferEntry.cpp +++ b/src/tests/libxrpl/ledger/NFTokenOfferEntry.cpp @@ -18,7 +18,7 @@ TEST(NFTokenOfferEntryTests, constructors) e, keylet::nftokenOffer(e.alice.id(), seq), "nftokenOffer(owner, seq)", e.alice.id(), seq); expectKeylet( - e, keylet::nftokenOffer(e.someID()), "nftokenOffer(uint256)", e.someID()); + e, keylet::nftokenOffer(e.someID()), "nftokenOffer(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/OfferEntry.cpp b/src/tests/libxrpl/ledger/OfferEntry.cpp index 17f98b69c2..bda9af0648 100644 --- a/src/tests/libxrpl/ledger/OfferEntry.cpp +++ b/src/tests/libxrpl/ledger/OfferEntry.cpp @@ -17,7 +17,7 @@ TEST(OfferEntryTests, constructors) expectKeylet( e, keylet::offer(e.alice.id(), seq), "offer(id, seq)", e.alice.id(), seq); - expectKeylet(e, keylet::offer(e.someID()), "offer(uint256)", e.someID()); + expectKeylet(e, keylet::offer(e.someID()), "offer(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/PermissionedDomainEntry.cpp b/src/tests/libxrpl/ledger/PermissionedDomainEntry.cpp index feb3002c4e..1326648e4e 100644 --- a/src/tests/libxrpl/ledger/PermissionedDomainEntry.cpp +++ b/src/tests/libxrpl/ledger/PermissionedDomainEntry.cpp @@ -22,7 +22,7 @@ TEST(PermissionedDomainEntryTests, constructors) seq); expectKeylet( - e, keylet::permissionedDomain(e.someID()), "permissionedDomain(uint256)", e.someID()); + e, keylet::permissionedDomain(e.someID()), "permissionedDomain(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/TicketEntry.cpp b/src/tests/libxrpl/ledger/TicketEntry.cpp index fa26b1a937..b6a377676e 100644 --- a/src/tests/libxrpl/ledger/TicketEntry.cpp +++ b/src/tests/libxrpl/ledger/TicketEntry.cpp @@ -21,7 +21,7 @@ TEST(TicketEntryTests, constructors) e.alice.id(), ticketSeq); - expectKeylet(e, keylet::ticket(e.someID()), "ticket(uint256)", e.someID()); + expectKeylet(e, keylet::ticket(e.someID()), "ticket(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/ledger/VaultEntry.cpp b/src/tests/libxrpl/ledger/VaultEntry.cpp index 61f24db410..3df580efe4 100644 --- a/src/tests/libxrpl/ledger/VaultEntry.cpp +++ b/src/tests/libxrpl/ledger/VaultEntry.cpp @@ -17,7 +17,7 @@ TEST(VaultEntryTests, constructors) expectKeylet( e, keylet::vault(e.alice.id(), seq), "vault(owner, seq)", e.alice.id(), seq); - expectKeylet(e, keylet::vault(e.someID()), "vault(uint256)", e.someID()); + expectKeylet(e, keylet::vault(e.someID()), "vault(UInt256)", e.someID()); } } // namespace xrpl::test diff --git a/src/tests/libxrpl/nodestore/Backend.cpp b/src/tests/libxrpl/nodestore/Backend.cpp index 3bd36ced8d..fc70c50092 100644 --- a/src/tests/libxrpl/nodestore/Backend.cpp +++ b/src/tests/libxrpl/nodestore/Backend.cpp @@ -71,7 +71,7 @@ protected: params_.set("type", GetParam()); params_.set("path", tempDir_.path()); - beast::xor_shift_engine rng(kSeedValue); + beast::XorShiftEngine rng(kSeedValue); batch_ = createPredictableBatch(kNumObjects, rng()); } @@ -103,7 +103,7 @@ TEST_P(BackendTypeTest, store_and_fetch) { SCOPED_TRACE("read in shuffled order"); - beast::xor_shift_engine rng(kSeedValue); + beast::XorShiftEngine rng(kSeedValue); std::shuffle(batch_.begin(), batch_.end(), rng); auto const copy = fetchCopyOfBatch(*backend, batch_); EXPECT_EQ(batch_, copy); diff --git a/src/tests/libxrpl/nodestore/Database.cpp b/src/tests/libxrpl/nodestore/Database.cpp index a3f7340f62..c2884c10ec 100644 --- a/src/tests/libxrpl/nodestore/Database.cpp +++ b/src/tests/libxrpl/nodestore/Database.cpp @@ -70,7 +70,7 @@ protected: nodeParams_.set("type", GetParam()); nodeParams_.set("path", nodeDb_.path()); - beast::xor_shift_engine rng(kSeedValue); + beast::XorShiftEngine rng(kSeedValue); batch_ = createPredictableBatch(kNumObjects, rng()); } @@ -109,7 +109,7 @@ TEST_P(NodeStoreDatabaseTest, store_and_fetch) { SCOPED_TRACE("read in shuffled order"); - beast::xor_shift_engine rng(kSeedValue); + beast::XorShiftEngine rng(kSeedValue); std::shuffle(batch_.begin(), batch_.end(), rng); auto const copy = fetchCopyOfBatch(*db, batch_); EXPECT_EQ(batch_, copy); diff --git a/src/tests/libxrpl/nodestore/TestBase.h b/src/tests/libxrpl/nodestore/TestBase.h index 5a262ac7bb..61b54c54a8 100644 --- a/src/tests/libxrpl/nodestore/TestBase.h +++ b/src/tests/libxrpl/nodestore/TestBase.h @@ -50,7 +50,7 @@ createPredictableBatch(std::size_t numObjects, std::uint64_t seed) Batch batch; batch.reserve(numObjects); - beast::xor_shift_engine rng(seed); + beast::XorShiftEngine rng(seed); for (auto i = 0uz; i < numObjects; ++i) { @@ -69,7 +69,7 @@ createPredictableBatch(std::size_t numObjects, std::uint64_t seed) } }(); - uint256 hash; + UInt256 hash; beast::rngfill(hash.begin(), hash.size(), rng); Blob blob(randInt(rng, kMinPayloadBytes, kMaxPayloadBytes)); diff --git a/src/tests/libxrpl/peerfinder/PeerFinder.cpp b/src/tests/libxrpl/peerfinder/PeerFinder.cpp index 2d98d4385f..aaee776c03 100644 --- a/src/tests/libxrpl/peerfinder/PeerFinder.cpp +++ b/src/tests/libxrpl/peerfinder/PeerFinder.cpp @@ -60,7 +60,7 @@ endpoint(std::string const& value) class MockStore : public Store { public: - MOCK_METHOD(std::size_t, load, (Store::load_callback const& cb), (override)); + MOCK_METHOD(std::size_t, load, (Store::LoadCallback const& cb), (override)); MOCK_METHOD(void, save, (std::vector const& entries), (override)); }; @@ -71,7 +71,7 @@ public: std::vector> saves; std::size_t - load(Store::load_callback const& cb) override + load(Store::LoadCallback const& cb) override { for (auto const& entry : entriesToLoad) cb(entry.endpoint, entry.valence); diff --git a/src/tests/libxrpl/protocol_autogen/TestHelpers.h b/src/tests/libxrpl/protocol_autogen/TestHelpers.h index 0fc26032f0..45ced5f2e7 100644 --- a/src/tests/libxrpl/protocol_autogen/TestHelpers.h +++ b/src/tests/libxrpl/protocol_autogen/TestHelpers.h @@ -131,7 +131,7 @@ using Vector256Value = std::decay_t; inline Vector256Value canonical_VECTOR256() { - return Vector256Value{uint256{1}}; + return Vector256Value{UInt256{1}}; } using BlobValue = std::decay_t; diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/AMMTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/AMMTests.cpp index 0bb80c41e6..c874ead946 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/AMMTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/AMMTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(AMMTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const tradingFeeValue = canonical_UINT16(); @@ -135,7 +135,7 @@ TEST(AMMTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(AMMTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const tradingFeeValue = canonical_UINT16(); @@ -292,7 +292,7 @@ TEST(AMMTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(AMMTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -311,7 +311,7 @@ TEST(AMMTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(AMMTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -328,7 +328,7 @@ TEST(AMMTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(AMMTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const lPTokenBalanceValue = canonical_AMOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/AccountRootTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/AccountRootTests.cpp index 17c80899f9..eea98a82e2 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/AccountRootTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/AccountRootTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(AccountRootTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -293,7 +293,7 @@ TEST(AccountRootTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(AccountRootTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -687,7 +687,7 @@ TEST(AccountRootTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(AccountRootTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -706,7 +706,7 @@ TEST(AccountRootTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(AccountRootTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -723,7 +723,7 @@ TEST(AccountRootTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(AccountRootTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/AmendmentsTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/AmendmentsTests.cpp index 17da755a3d..22cdda7f15 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/AmendmentsTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/AmendmentsTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(AmendmentsTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const amendmentsValue = canonical_VECTOR256(); auto const majoritiesValue = canonical_ARRAY(); @@ -85,7 +85,7 @@ TEST(AmendmentsTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(AmendmentsTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const amendmentsValue = canonical_VECTOR256(); auto const majoritiesValue = canonical_ARRAY(); @@ -167,7 +167,7 @@ TEST(AmendmentsTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(AmendmentsTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -186,7 +186,7 @@ TEST(AmendmentsTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(AmendmentsTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -203,7 +203,7 @@ TEST(AmendmentsTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(AmendmentsTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; AmendmentsBuilder builder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/BridgeTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/BridgeTests.cpp index 1d4cfc00b9..afd33512d7 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/BridgeTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/BridgeTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(BridgeTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const signatureRewardValue = canonical_AMOUNT(); @@ -127,7 +127,7 @@ TEST(BridgeTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(BridgeTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const signatureRewardValue = canonical_AMOUNT(); @@ -272,7 +272,7 @@ TEST(BridgeTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(BridgeTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -291,7 +291,7 @@ TEST(BridgeTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(BridgeTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -308,7 +308,7 @@ TEST(BridgeTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(BridgeTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const signatureRewardValue = canonical_AMOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/CheckTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/CheckTests.cpp index f14b4fb4e4..885231a159 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/CheckTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/CheckTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(CheckTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); @@ -149,7 +149,7 @@ TEST(CheckTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(CheckTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); @@ -327,7 +327,7 @@ TEST(CheckTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(CheckTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -346,7 +346,7 @@ TEST(CheckTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(CheckTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -363,7 +363,7 @@ TEST(CheckTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(CheckTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/CredentialTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/CredentialTests.cpp index 4fbf6d2a26..a3caa4a7fa 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/CredentialTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/CredentialTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(CredentialTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const subjectValue = canonical_ACCOUNT(); auto const issuerValue = canonical_ACCOUNT(); @@ -123,7 +123,7 @@ TEST(CredentialTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(CredentialTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const subjectValue = canonical_ACCOUNT(); auto const issuerValue = canonical_ACCOUNT(); @@ -262,7 +262,7 @@ TEST(CredentialTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(CredentialTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -281,7 +281,7 @@ TEST(CredentialTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(CredentialTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -298,7 +298,7 @@ TEST(CredentialTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(CredentialTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const subjectValue = canonical_ACCOUNT(); auto const issuerValue = canonical_ACCOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/DIDTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/DIDTests.cpp index 29d49a47f2..6e3515c0d4 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/DIDTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/DIDTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(DIDTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const dIDDocumentValue = canonical_VL(); @@ -107,7 +107,7 @@ TEST(DIDTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(DIDTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const dIDDocumentValue = canonical_VL(); @@ -222,7 +222,7 @@ TEST(DIDTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(DIDTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -241,7 +241,7 @@ TEST(DIDTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(DIDTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -258,7 +258,7 @@ TEST(DIDTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(DIDTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/DelegateTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/DelegateTests.cpp index 24c7c97d7f..2190d22a10 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/DelegateTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/DelegateTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(DelegateTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const authorizeValue = canonical_ACCOUNT(); @@ -103,7 +103,7 @@ TEST(DelegateTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(DelegateTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const authorizeValue = canonical_ACCOUNT(); @@ -212,7 +212,7 @@ TEST(DelegateTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(DelegateTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -231,7 +231,7 @@ TEST(DelegateTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(DelegateTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -248,7 +248,7 @@ TEST(DelegateTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(DelegateTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const authorizeValue = canonical_ACCOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/DepositPreauthTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/DepositPreauthTests.cpp index 9e6144d5b9..4b0f57bbaa 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/DepositPreauthTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/DepositPreauthTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(DepositPreauthTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const authorizeValue = canonical_ACCOUNT(); @@ -97,7 +97,7 @@ TEST(DepositPreauthTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(DepositPreauthTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const authorizeValue = canonical_ACCOUNT(); @@ -197,7 +197,7 @@ TEST(DepositPreauthTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(DepositPreauthTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -216,7 +216,7 @@ TEST(DepositPreauthTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(DepositPreauthTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -233,7 +233,7 @@ TEST(DepositPreauthTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(DepositPreauthTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/DirectoryNodeTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/DirectoryNodeTests.cpp index af617c2634..ba4186500c 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/DirectoryNodeTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/DirectoryNodeTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(DirectoryNodeTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const ownerValue = canonical_ACCOUNT(); auto const takerPaysCurrencyValue = canonical_UINT160(); @@ -201,7 +201,7 @@ TEST(DirectoryNodeTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(DirectoryNodeTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const ownerValue = canonical_ACCOUNT(); auto const takerPaysCurrencyValue = canonical_UINT160(); @@ -457,7 +457,7 @@ TEST(DirectoryNodeTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(DirectoryNodeTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -476,7 +476,7 @@ TEST(DirectoryNodeTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(DirectoryNodeTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -493,7 +493,7 @@ TEST(DirectoryNodeTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(DirectoryNodeTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const indexesValue = canonical_VECTOR256(); auto const rootIndexValue = canonical_UINT256(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/EscrowTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/EscrowTests.cpp index ad5f88fd2f..bed69a49c8 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/EscrowTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/EscrowTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(EscrowTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -203,7 +203,7 @@ TEST(EscrowTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(EscrowTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -462,7 +462,7 @@ TEST(EscrowTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(EscrowTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -481,7 +481,7 @@ TEST(EscrowTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(EscrowTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -498,7 +498,7 @@ TEST(EscrowTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(EscrowTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/FeeSettingsTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/FeeSettingsTests.cpp index 92bf25398c..3280bd8e59 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/FeeSettingsTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/FeeSettingsTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(FeeSettingsTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const baseFeeValue = canonical_UINT64(); auto const referenceFeeUnitsValue = canonical_UINT32(); @@ -165,7 +165,7 @@ TEST(FeeSettingsTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(FeeSettingsTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const baseFeeValue = canonical_UINT64(); auto const referenceFeeUnitsValue = canonical_UINT32(); @@ -367,7 +367,7 @@ TEST(FeeSettingsTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(FeeSettingsTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -386,7 +386,7 @@ TEST(FeeSettingsTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(FeeSettingsTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -403,7 +403,7 @@ TEST(FeeSettingsTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(FeeSettingsTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; FeeSettingsBuilder builder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/LedgerHashesTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/LedgerHashesTests.cpp index 8a7ae38749..1d9e63a2a8 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/LedgerHashesTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/LedgerHashesTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(LedgerHashesTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const firstLedgerSequenceValue = canonical_UINT32(); auto const lastLedgerSequenceValue = canonical_UINT32(); @@ -73,7 +73,7 @@ TEST(LedgerHashesTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(LedgerHashesTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const firstLedgerSequenceValue = canonical_UINT32(); auto const lastLedgerSequenceValue = canonical_UINT32(); @@ -137,7 +137,7 @@ TEST(LedgerHashesTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(LedgerHashesTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -156,7 +156,7 @@ TEST(LedgerHashesTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(LedgerHashesTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -173,7 +173,7 @@ TEST(LedgerHashesTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(LedgerHashesTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const hashesValue = canonical_VECTOR256(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanBrokerTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanBrokerTests.cpp index fba8c539d2..4b07b77a5f 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanBrokerTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanBrokerTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(LoanBrokerTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -197,7 +197,7 @@ TEST(LoanBrokerTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(LoanBrokerTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -447,7 +447,7 @@ TEST(LoanBrokerTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(LoanBrokerTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -466,7 +466,7 @@ TEST(LoanBrokerTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(LoanBrokerTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -483,7 +483,7 @@ TEST(LoanBrokerTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(LoanBrokerTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanTests.cpp index 845a8337b9..82706d54e6 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/LoanTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(LoanTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -295,7 +295,7 @@ TEST(LoanTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(LoanTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -692,7 +692,7 @@ TEST(LoanTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(LoanTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -711,7 +711,7 @@ TEST(LoanTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(LoanTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -728,7 +728,7 @@ TEST(LoanTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(LoanTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenIssuanceTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenIssuanceTests.cpp index e8c1b645d8..533541e3c7 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenIssuanceTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenIssuanceTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(MPTokenIssuanceTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const issuerValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -223,7 +223,7 @@ TEST(MPTokenIssuanceTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(MPTokenIssuanceTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const issuerValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -512,7 +512,7 @@ TEST(MPTokenIssuanceTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(MPTokenIssuanceTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -531,7 +531,7 @@ TEST(MPTokenIssuanceTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(MPTokenIssuanceTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -548,7 +548,7 @@ TEST(MPTokenIssuanceTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(MPTokenIssuanceTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const issuerValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenTests.cpp index 41eff1cce7..338d9f9c7e 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/MPTokenTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(MPTokenTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const mPTokenIssuanceIDValue = canonical_UINT192(); @@ -185,7 +185,7 @@ TEST(MPTokenTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(MPTokenTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const mPTokenIssuanceIDValue = canonical_UINT192(); @@ -417,7 +417,7 @@ TEST(MPTokenTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(MPTokenTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -436,7 +436,7 @@ TEST(MPTokenTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(MPTokenTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -453,7 +453,7 @@ TEST(MPTokenTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(MPTokenTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const mPTokenIssuanceIDValue = canonical_UINT192(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenOfferTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenOfferTests.cpp index 9d039b2c38..2e555c07ff 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenOfferTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenOfferTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(NFTokenOfferTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const ownerValue = canonical_ACCOUNT(); auto const nFTokenIDValue = canonical_UINT256(); @@ -121,7 +121,7 @@ TEST(NFTokenOfferTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(NFTokenOfferTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const ownerValue = canonical_ACCOUNT(); auto const nFTokenIDValue = canonical_UINT256(); @@ -257,7 +257,7 @@ TEST(NFTokenOfferTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(NFTokenOfferTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -276,7 +276,7 @@ TEST(NFTokenOfferTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(NFTokenOfferTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -293,7 +293,7 @@ TEST(NFTokenOfferTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(NFTokenOfferTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const ownerValue = canonical_ACCOUNT(); auto const nFTokenIDValue = canonical_UINT256(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenPageTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenPageTests.cpp index 5909050169..d93dc79f8f 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenPageTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/NFTokenPageTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(NFTokenPageTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousPageMinValue = canonical_UINT256(); auto const nextPageMinValue = canonical_UINT256(); @@ -89,7 +89,7 @@ TEST(NFTokenPageTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(NFTokenPageTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousPageMinValue = canonical_UINT256(); auto const nextPageMinValue = canonical_UINT256(); @@ -177,7 +177,7 @@ TEST(NFTokenPageTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(NFTokenPageTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -196,7 +196,7 @@ TEST(NFTokenPageTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(NFTokenPageTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -213,7 +213,7 @@ TEST(NFTokenPageTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(NFTokenPageTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const nFTokensValue = canonical_ARRAY(); auto const previousTxnIDValue = canonical_UINT256(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/NegativeUNLTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/NegativeUNLTests.cpp index 48ff060c11..0ca2267b96 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/NegativeUNLTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/NegativeUNLTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(NegativeUNLTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const disabledValidatorsValue = canonical_ARRAY(); auto const validatorToDisableValue = canonical_VL(); @@ -95,7 +95,7 @@ TEST(NegativeUNLTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(NegativeUNLTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const disabledValidatorsValue = canonical_ARRAY(); auto const validatorToDisableValue = canonical_VL(); @@ -192,7 +192,7 @@ TEST(NegativeUNLTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(NegativeUNLTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -211,7 +211,7 @@ TEST(NegativeUNLTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(NegativeUNLTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -228,7 +228,7 @@ TEST(NegativeUNLTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(NegativeUNLTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; NegativeUNLBuilder builder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/OfferTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/OfferTests.cpp index 5cb1bbd804..a4bb92436c 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/OfferTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/OfferTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(OfferTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -147,7 +147,7 @@ TEST(OfferTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(OfferTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -322,7 +322,7 @@ TEST(OfferTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(OfferTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -341,7 +341,7 @@ TEST(OfferTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(OfferTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -358,7 +358,7 @@ TEST(OfferTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(OfferTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/OracleTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/OracleTests.cpp index 837fd576bf..1e9a10045c 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/OracleTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/OracleTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(OracleTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const ownerValue = canonical_ACCOUNT(); auto const oracleDocumentIDValue = canonical_UINT32(); @@ -129,7 +129,7 @@ TEST(OracleTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(OracleTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const ownerValue = canonical_ACCOUNT(); auto const oracleDocumentIDValue = canonical_UINT32(); @@ -277,7 +277,7 @@ TEST(OracleTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(OracleTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -296,7 +296,7 @@ TEST(OracleTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(OracleTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -313,7 +313,7 @@ TEST(OracleTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(OracleTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const ownerValue = canonical_ACCOUNT(); auto const providerValue = canonical_VL(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/PayChannelTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/PayChannelTests.cpp index 7c31252369..3cb87229af 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/PayChannelTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/PayChannelTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(PayChannelTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); @@ -177,7 +177,7 @@ TEST(PayChannelTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(PayChannelTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); @@ -397,7 +397,7 @@ TEST(PayChannelTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(PayChannelTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -416,7 +416,7 @@ TEST(PayChannelTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(PayChannelTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -433,7 +433,7 @@ TEST(PayChannelTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(PayChannelTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const accountValue = canonical_ACCOUNT(); auto const destinationValue = canonical_ACCOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/PermissionedDomainTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/PermissionedDomainTests.cpp index c448d064cf..cc99ba983f 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/PermissionedDomainTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/PermissionedDomainTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(PermissionedDomainTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const ownerValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -93,7 +93,7 @@ TEST(PermissionedDomainTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(PermissionedDomainTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const ownerValue = canonical_ACCOUNT(); auto const sequenceValue = canonical_UINT32(); @@ -187,7 +187,7 @@ TEST(PermissionedDomainTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(PermissionedDomainTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -206,7 +206,7 @@ TEST(PermissionedDomainTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(PermissionedDomainTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/RippleStateTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/RippleStateTests.cpp index de0769793b..26713e3ce4 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/RippleStateTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/RippleStateTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(RippleStateTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const balanceValue = canonical_AMOUNT(); auto const lowLimitValue = canonical_AMOUNT(); @@ -165,7 +165,7 @@ TEST(RippleStateTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(RippleStateTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const balanceValue = canonical_AMOUNT(); auto const lowLimitValue = canonical_AMOUNT(); @@ -367,7 +367,7 @@ TEST(RippleStateTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(RippleStateTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -386,7 +386,7 @@ TEST(RippleStateTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(RippleStateTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -403,7 +403,7 @@ TEST(RippleStateTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(RippleStateTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const balanceValue = canonical_AMOUNT(); auto const lowLimitValue = canonical_AMOUNT(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/SignerListTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/SignerListTests.cpp index 5ec2c4e10d..8c79fc93d1 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/SignerListTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/SignerListTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(SignerListTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const ownerValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); @@ -103,7 +103,7 @@ TEST(SignerListTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(SignerListTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const ownerValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); @@ -212,7 +212,7 @@ TEST(SignerListTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(SignerListTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -231,7 +231,7 @@ TEST(SignerListTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(SignerListTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -248,7 +248,7 @@ TEST(SignerListTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(SignerListTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const ownerNodeValue = canonical_UINT64(); auto const signerQuorumValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/SponsorshipTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/SponsorshipTests.cpp index e1d9ff15b9..8828af949d 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/SponsorshipTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/SponsorshipTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(SponsorshipTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -123,7 +123,7 @@ TEST(SponsorshipTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(SponsorshipTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -262,7 +262,7 @@ TEST(SponsorshipTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(SponsorshipTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -281,7 +281,7 @@ TEST(SponsorshipTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(SponsorshipTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -298,7 +298,7 @@ TEST(SponsorshipTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(SponsorshipTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/TicketTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/TicketTests.cpp index 1ac00288f0..8a8204f044 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/TicketTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/TicketTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(TicketTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); @@ -85,7 +85,7 @@ TEST(TicketTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(TicketTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const ownerNodeValue = canonical_UINT64(); @@ -167,7 +167,7 @@ TEST(TicketTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(TicketTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -189,7 +189,7 @@ TEST(TicketTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(TicketTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type CheckBuilder wrongBuilder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/TransactionProposalTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/TransactionProposalTests.cpp index f22554519c..d5363e1dd7 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/TransactionProposalTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/TransactionProposalTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(TransactionProposalTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -93,7 +93,7 @@ TEST(TransactionProposalTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(TransactionProposalTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -187,7 +187,7 @@ TEST(TransactionProposalTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(TransactionProposalTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -206,7 +206,7 @@ TEST(TransactionProposalTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(TransactionProposalTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/VaultTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/VaultTests.cpp index 26dde55563..2191386caf 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/VaultTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/VaultTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(VaultTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -217,7 +217,7 @@ TEST(VaultTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(VaultTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); @@ -497,7 +497,7 @@ TEST(VaultTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(VaultTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -516,7 +516,7 @@ TEST(VaultTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(VaultTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ @@ -533,7 +533,7 @@ TEST(VaultTests, BuilderThrowsOnWrongEntryType) // 5) Build with only required fields and verify optional fields return nullopt. TEST(VaultTests, OptionalFieldsReturnNullopt) { - uint256 const index{3u}; + UInt256 const index{3u}; auto const previousTxnIDValue = canonical_UINT256(); auto const previousTxnLgrSeqValue = canonical_UINT32(); diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedClaimIDTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedClaimIDTests.cpp index 4b6979b86a..9fc14fa3fa 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedClaimIDTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedClaimIDTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(XChainOwnedClaimIDTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const xChainBridgeValue = canonical_XCHAIN_BRIDGE(); @@ -117,7 +117,7 @@ TEST(XChainOwnedClaimIDTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(XChainOwnedClaimIDTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const xChainBridgeValue = canonical_XCHAIN_BRIDGE(); @@ -247,7 +247,7 @@ TEST(XChainOwnedClaimIDTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(XChainOwnedClaimIDTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -266,7 +266,7 @@ TEST(XChainOwnedClaimIDTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(XChainOwnedClaimIDTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ diff --git a/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimIDTests.cpp b/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimIDTests.cpp index 0e4e1fb977..85fea41108 100644 --- a/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimIDTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/ledger_entries/XChainOwnedCreateAccountClaimIDTests.cpp @@ -18,7 +18,7 @@ namespace xrpl::ledger_entries { // builder's STObject and the wrapper's SLE. TEST(XChainOwnedCreateAccountClaimIDTests, BuilderSettersRoundTrip) { - uint256 const index{1u}; + UInt256 const index{1u}; auto const accountValue = canonical_ACCOUNT(); auto const xChainBridgeValue = canonical_XCHAIN_BRIDGE(); @@ -101,7 +101,7 @@ TEST(XChainOwnedCreateAccountClaimIDTests, BuilderSettersRoundTrip) // from that SLE, build a new wrapper, and verify all fields (and validate()). TEST(XChainOwnedCreateAccountClaimIDTests, BuilderFromSleRoundTrip) { - uint256 const index{2u}; + UInt256 const index{2u}; auto const accountValue = canonical_ACCOUNT(); auto const xChainBridgeValue = canonical_XCHAIN_BRIDGE(); @@ -207,7 +207,7 @@ TEST(XChainOwnedCreateAccountClaimIDTests, BuilderFromSleRoundTrip) // 3) Verify wrapper throws when constructed from wrong ledger entry type. TEST(XChainOwnedCreateAccountClaimIDTests, WrapperThrowsOnWrongEntryType) { - uint256 const index{3u}; + UInt256 const index{3u}; // Build a valid ledger entry of a different type // Ticket requires: Account, OwnerNode, TicketSequence, PreviousTxnID, PreviousTxnLgrSeq @@ -226,7 +226,7 @@ TEST(XChainOwnedCreateAccountClaimIDTests, WrapperThrowsOnWrongEntryType) // 4) Verify builder throws when constructed from wrong ledger entry type. TEST(XChainOwnedCreateAccountClaimIDTests, BuilderThrowsOnWrongEntryType) { - uint256 const index{4u}; + UInt256 const index{4u}; // Build a valid ledger entry of a different type TicketBuilder wrongBuilder{ diff --git a/src/tests/libxrpl/resource/Logic.cpp b/src/tests/libxrpl/resource/Logic.cpp index b38ca2e051..91d7b3b0e1 100644 --- a/src/tests/libxrpl/resource/Logic.cpp +++ b/src/tests/libxrpl/resource/Logic.cpp @@ -34,7 +34,7 @@ protected: class TestLogic : private boost::base_from_member, public Logic { private: - using clock_type = boost::base_from_member; + using ClockType = boost::base_from_member; public: explicit TestLogic(beast::Journal journal) diff --git a/src/tests/libxrpl/shamap/SHAMap.cpp b/src/tests/libxrpl/shamap/SHAMap.cpp index f67c299300..babc50f512 100644 --- a/src/tests/libxrpl/shamap/SHAMap.cpp +++ b/src/tests/libxrpl/shamap/SHAMap.cpp @@ -127,10 +127,10 @@ TEST_P(SHAMapTest, add_traverse_snapshot_build_tear_and_iterate) tests::TestNodeFamily f{j_}; // kH3 and kH4 differ only in the leaf, same terminal node (level 19) - constexpr uint256 kH1("092891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7"); - constexpr uint256 kH2("436ccbac3347baa1f1e53baeef1f43334da88f1f6d70d963b833afd6dfa289fe"); - constexpr uint256 kH3("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); - constexpr uint256 kH4("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8"); + constexpr UInt256 kH1("092891fe4ef6cee585fdc6fda0e09eb4d386363158ec3321b8123e5a772c6ca7"); + constexpr UInt256 kH2("436ccbac3347baa1f1e53baeef1f43334da88f1f6d70d963b833afd6dfa289fe"); + constexpr UInt256 kH3("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); + constexpr UInt256 kH4("b92891fe4ef6cee585fdc6fda2e09eb4d386363158ec3321b8123e5a772c6ca8"); SHAMap sMap{SHAMapType::FREE, f}; sMap.invariants(); @@ -195,25 +195,25 @@ TEST_P(SHAMapTest, add_traverse_snapshot_build_tear_and_iterate) sMap.dump(); { constexpr std::array kKeys{ - uint256{"b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, }; constexpr std::array kHashes{ - uint256{"B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C64B6281F7F"}, - uint256{"FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A8831845467FB2ECE266"}, - uint256{"4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51AE756795B75"}, - uint256{"7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC6C74F93E07"}, - uint256{"395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596462B0E3A3E"}, - uint256{"D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D98A84D9DDE4"}, - uint256{"76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF94361143615"}, - uint256{"DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA02BBE7230E5"}, + UInt256{"B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C64B6281F7F"}, + UInt256{"FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A8831845467FB2ECE266"}, + UInt256{"4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51AE756795B75"}, + UInt256{"7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC6C74F93E07"}, + UInt256{"395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596462B0E3A3E"}, + UInt256{"D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D98A84D9DDE4"}, + UInt256{"76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF94361143615"}, + UInt256{"DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA02BBE7230E5"}, }; SHAMap map{SHAMapType::FREE, f}; @@ -240,14 +240,14 @@ TEST_P(SHAMapTest, add_traverse_snapshot_build_tear_and_iterate) { constexpr std::array kKeys{ - uint256{"f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, - uint256{"292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, + UInt256{"292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"}, }; tests::TestNodeFamily tf{j_}; @@ -282,10 +282,10 @@ protected: // Keys that share a long prefix and then fan out across distinct branches, so the deeper inner // nodes have several children and traversal must descend many levels. - static std::vector + static std::vector deepFanOutKeys() { - std::vector keys; + std::vector keys; for (unsigned int branch = 0; branch < SHAMap::kBranchFactor; ++branch) { // Vary the 6th nibble, keeping the first five identical. @@ -300,10 +300,10 @@ protected: // chain of single-child inner nodes down to depth 63 with the leaves as siblings at depth 64. // This exercises kLeafDepth directly, unlike deepFanOutKeys() above, whose fan-out at the 6th // nibble keeps the tree only about 6 levels deep. - static std::vector + static std::vector deepFanOutKeysAtLeafDepth() { - std::vector keys; + std::vector keys; for (unsigned int branch = 0; branch < SHAMap::kBranchFactor; ++branch) { auto text = std::string(63, 'a') + "0123456789abcdef"[branch]; @@ -313,7 +313,7 @@ protected: } static void - fillMap(SHAMap& map, std::vector const& keys) + fillMap(SHAMap& map, std::vector const& keys) { map.setUnbacked(); for (auto const& k : keys) @@ -335,7 +335,7 @@ TEST_F(SHAMapTraversal, forward_iteration_visits_every_key_in_order) fillMap(map, keys); std::ranges::sort(keys); - std::vector visited; + std::vector visited; for (auto const& item : map) visited.push_back(item.key()); @@ -391,7 +391,7 @@ TEST_F(SHAMapTraversal, bounds_agree_with_iteration_for_absent_keys) // Probe keys that are not in the map, so the traversal starts mid-tree rather than at a leaf. for (unsigned char const c : {0x00, 0x40, 0x80, 0xc0, 0xff}) { - uint256 probe; + UInt256 probe; std::fill_n(probe.begin(), probe.size(), c); auto const expectedUpper = std::ranges::upper_bound(keys, probe); @@ -427,7 +427,7 @@ TEST_F(SHAMapTraversal, bounds_agree_with_iteration_for_absent_keys) { auto text = std::string("abcde") + nibble; text.append(64 - text.size(), nibble); - uint256 const probe{std::string_view{text}}; + UInt256 const probe{std::string_view{text}}; auto const expectedUpper = std::ranges::upper_bound(keys, probe); auto const upper = map.upperBound(probe); @@ -464,10 +464,10 @@ TEST_F(SHAMapTraversal, bounds_on_empty_map_return_end) // The root is a childless inner node, so boundHelper's inner-node branch scans every branch on // the requested side of the one id selects, finds them all empty, and falls through to end() // rather than dereference a child. - EXPECT_EQ(map.upperBound(uint256{}), map.end()); - EXPECT_EQ(map.lowerBound(uint256{}), map.end()); + EXPECT_EQ(map.upperBound(UInt256{}), map.end()); + EXPECT_EQ(map.lowerBound(UInt256{}), map.end()); - uint256 probe; + UInt256 probe; std::fill_n(probe.begin(), probe.size(), std::uint8_t{0xff}); EXPECT_EQ(map.upperBound(probe), map.end()); EXPECT_EQ(map.lowerBound(probe), map.end()); @@ -483,9 +483,9 @@ TEST_F(SHAMapTraversal, bounds_on_single_item_map_use_the_leaf_below_the_root) // fillMap adds items in-process, so root_ stays an inner node with the single leaf below it. // The stack holds both, so boundHelper examines the leaf first. - uint256 below = key; + UInt256 below = key; --below; - uint256 above = key; + UInt256 above = key; ++above; auto const upper = map.upperBound(below); @@ -519,11 +519,11 @@ TEST_F(SHAMapTraversal, iteration_survives_deletions) map.invariants(); } - std::vector expected; + std::vector expected; for (std::size_t k = 1; k < keys.size(); k += 2) expected.push_back(keys[k]); - std::vector visited; + std::vector visited; for (auto const& item : map) visited.push_back(item.key()); EXPECT_EQ(visited, expected); @@ -543,7 +543,7 @@ TEST_F(SHAMapTraversal, iteration_survives_a_collapsed_inner_node) // One key in a separate subtree, diverging from the fan-out group at the very first nibble, so // it survives untouched while the fan-out group below is collapsed. - auto const sentinel = uint256{std::string_view{std::string(64, '0')}}; + auto const sentinel = UInt256{std::string_view{std::string(64, '0')}}; auto fanOutKeys = deepFanOutKeysAtLeafDepth(); fillMap(map, fanOutKeys); @@ -568,8 +568,8 @@ TEST_F(SHAMapTraversal, iteration_survives_a_collapsed_inner_node) map.invariants(); } - std::vector const expected{sentinel, fanOutKeys.back()}; - std::vector visited; + std::vector const expected{sentinel, fanOutKeys.back()}; + std::vector visited; for (auto const& item : map) visited.push_back(item.key()); EXPECT_EQ(visited, expected); @@ -594,7 +594,7 @@ TEST_F(SHAMapTraversal, forward_iteration_visits_every_key_in_order_at_leaf_dept fillMap(map, keys); std::ranges::sort(keys); - std::vector visited; + std::vector visited; for (auto const& item : map) visited.push_back(item.key()); @@ -659,7 +659,7 @@ TEST_F(SHAMapTraversal, bounds_agree_with_iteration_for_absent_keys_at_leaf_dept { auto text = std::string(divergeAt, 'a') + nibble; text.append(64 - text.size(), '0'); - uint256 const probe{std::string_view{text}}; + UInt256 const probe{std::string_view{text}}; auto const expectedUpper = std::ranges::upper_bound(keys, probe); auto const upper = map.upperBound(probe); @@ -707,11 +707,11 @@ TEST_F(SHAMapTraversal, iteration_survives_deletions_at_leaf_depth) map.invariants(); } - std::vector expected; + std::vector expected; for (std::size_t k = 1; k < keys.size(); k += 2) expected.push_back(keys[k]); - std::vector visited; + std::vector visited; for (auto const& item : map) visited.push_back(item.key()); EXPECT_EQ(visited, expected); @@ -736,8 +736,8 @@ TEST_F(SHAMapPathProof, verify_proof_path) SHAMap map{SHAMapType::FREE, tf}; map.setUnbacked(); - uint256 key; - uint256 rootHash; + UInt256 key; + UInt256 rootHash; std::vector goodPath; static constexpr unsigned char kFirstKey = 1; @@ -746,7 +746,7 @@ TEST_F(SHAMapPathProof, verify_proof_path) for (unsigned char c = kFirstKey; c < kKeyCount; ++c) { - uint256 k(c); + UInt256 k(c); map.addItem(SHAMapNodeType::TnAccountState, makeShamapitem(k, Slice{k.data(), k.size()})); map.invariants(); @@ -766,7 +766,7 @@ TEST_F(SHAMapPathProof, verify_proof_path) proofPath.insert(proofPath.begin(), proofPath.front()); EXPECT_FALSE(map.verifyProofPath(root, k, proofPath)); // wrong key - uint256 const wrongKey(c + 1); + UInt256 const wrongKey(c + 1); EXPECT_FALSE(map.getProofPath(wrongKey)); } if (c == kLastKey) @@ -811,8 +811,8 @@ TEST_F(SHAMapPathProof, legitimate_deep_path_is_sixty_five_elements) SHAMap map{SHAMapType::FREE, f}; map.setUnbacked(); - auto const kA = uint256{std::string_view{std::string(63, 'a') + "1"}}; - auto const kB = uint256{std::string_view{std::string(63, 'a') + "2"}}; + auto const kA = UInt256{std::string_view{std::string(63, 'a') + "1"}}; + auto const kB = UInt256{std::string_view{std::string(63, 'a') + "2"}}; for (auto const& k : {kA, kB}) { @@ -842,12 +842,12 @@ TEST_F(SHAMapPathProof, legitimate_deep_path_is_sixty_five_elements) TEST_F(SHAMapPathProof, all_inner_path_at_leaf_depth_is_rejected) { // An arbitrary well-formed key; the test does not care about its specific value. - constexpr uint256 kTestKey("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); + constexpr UInt256 kTestKey("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); // Build upwards from the deepest node so each parent's selected branch carries its child's hash // and the hash chain validates at every level. std::vector path; - SHAMapHash childHash{uint256{1}}; + SHAMapHash childHash{UInt256{1}}; for (auto depth = SHAMap::kLeafDepth + 1u; depth-- > 0;) { @@ -856,7 +856,7 @@ TEST_F(SHAMapPathProof, all_inner_path_at_leaf_depth_is_rejected) Serializer s; for (auto i = 0u; i < SHAMap::kBranchFactor; ++i) - s.addBitString(i == branch ? childHash.asUInt256() : uint256{}); + s.addBitString(i == branch ? childHash.asUInt256() : UInt256{}); s.add8(kWireTypeInner); path.push_back(s.getData()); @@ -881,8 +881,8 @@ TEST_F(SHAMapPathProof, all_inner_path_at_leaf_depth_is_rejected) * @return the path (deepest element first) and the forged root hash, or an empty path if the leaf * blob does not parse. */ -static std::pair, uint256> -forgeRootOverLeaf(Blob const& leafBlob, uint256 const& key) +static std::pair, UInt256> +forgeRootOverLeaf(Blob const& leafBlob, UInt256 const& key) { auto leaf = SHAMapTreeNode::makeFromWire(makeSlice(leafBlob)); if (!leaf || !leaf->isLeaf()) @@ -892,7 +892,7 @@ forgeRootOverLeaf(Blob const& leafBlob, uint256 const& key) auto const branch = selectBranch(SHAMapNodeID::createID(0, key), key); Serializer s; for (auto i = 0u; i < SHAMap::kBranchFactor; ++i) - s.addBitString(i == branch ? leaf->getHash().asUInt256() : uint256{}); + s.addBitString(i == branch ? leaf->getHash().asUInt256() : UInt256{}); s.add8(kWireTypeInner); auto root = SHAMapTreeNode::makeFromWire(makeSlice(s.peekData())); @@ -913,8 +913,8 @@ TEST_F(SHAMapPathProof, substituted_leaf_for_other_key_is_rejected) map.setUnbacked(); // Two arbitrary keys differing in their first nibble, so each leaf hangs off the root directly. - constexpr uint256 kKey("1c8cec8e5e9b0e5e0e0f5b3e2c9f7a1d6b4e8c2a0d7f3b9e5c1a8d4f2b6e0c93"); - constexpr uint256 kOtherKey("e3f1a7d5b9c2e8f406a1d3b5c7e9f2a4d6b8c0e2f4a6d8b0c2e4f6a8d0b2c4e6"); + constexpr UInt256 kKey("1c8cec8e5e9b0e5e0e0f5b3e2c9f7a1d6b4e8c2a0d7f3b9e5c1a8d4f2b6e0c93"); + constexpr UInt256 kOtherKey("e3f1a7d5b9c2e8f406a1d3b5c7e9f2a4d6b8c0e2f4a6d8b0c2e4f6a8d0b2c4e6"); for (auto const& k : {kKey, kOtherKey}) { diff --git a/src/tests/libxrpl/shamap/SHAMapNodeID.cpp b/src/tests/libxrpl/shamap/SHAMapNodeID.cpp index 95b7497c9c..a8f9210a67 100644 --- a/src/tests/libxrpl/shamap/SHAMapNodeID.cpp +++ b/src/tests/libxrpl/shamap/SHAMapNodeID.cpp @@ -12,13 +12,13 @@ namespace xrpl::tests { // An arbitrary 32-byte key reused across tests below that don't care about its specific value, // only that it is a well-formed key. -constexpr uint256 kTestKey("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); +constexpr UInt256 kTestKey("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); TEST(SHAMapNodeIDTest, root_is_prefix_of_every_key) { SHAMapNodeID const root; EXPECT_EQ(root.getDepth(), 0u); - EXPECT_TRUE(root.isPrefixOf(uint256{})); + EXPECT_TRUE(root.isPrefixOf(UInt256{})); EXPECT_TRUE(root.isPrefixOf(kTestKey)); } @@ -54,7 +54,7 @@ TEST(SHAMapNodeIDTest, wrong_branch_is_not_prefix_of_key) TEST(SHAMapNodeIDTest, prefix_check_is_depth_sensitive) { // kTestKey and kOther agree on the first two nibbles ("b9") and then diverge. - constexpr uint256 kOther("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); + constexpr UInt256 kOther("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca8"); auto id = SHAMapNodeID{}.getChildNodeID(selectBranch(SHAMapNodeID{}, kTestKey)); EXPECT_TRUE(id.isPrefixOf(kTestKey)); @@ -76,7 +76,7 @@ TEST(SHAMapNodeIDTest, leaf_id_from_key_is_prefix_of_that_key) EXPECT_TRUE(leaf.isPrefixOf(kTestKey)); // At full depth the prefix is the whole key, so nothing else matches. - constexpr uint256 kOther("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca9"); + constexpr UInt256 kOther("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e5a772c6ca9"); EXPECT_FALSE(leaf.isPrefixOf(kOther)); } @@ -129,7 +129,7 @@ TEST(SHAMapNodeIDDeathTest, out_of_range_depth_is_clamped) } // The constructor clamps on its own, for the paths that do not go through createID. - SHAMapNodeID const direct{SHAMap::kLeafDepth + 1u, uint256{}}; + SHAMapNodeID const direct{SHAMap::kLeafDepth + 1u, UInt256{}}; EXPECT_EQ(direct.getDepth(), SHAMap::kLeafDepth); #else EXPECT_DEATH( @@ -171,7 +171,7 @@ TEST(SHAMapNodeIDTest, deserialize_rejects_out_of_range_depth) // assertion, so an out-of-range depth here is built by hand instead. auto serializeWithRawDepth = [](unsigned int depth) { Serializer s; - s.addBitString(uint256{}); + s.addBitString(UInt256{}); s.add8(static_cast(depth)); return s.getString(); }; @@ -184,7 +184,7 @@ TEST(SHAMapNodeIDTest, deserialize_rejects_out_of_range_depth) // A depth-64 ID is legal, since leaves live there, but it has no children. auto const id = - deserializeSHAMapNodeID(SHAMapNodeID{SHAMap::kLeafDepth, uint256{}}.getRawString()); + deserializeSHAMapNodeID(SHAMapNodeID{SHAMap::kLeafDepth, UInt256{}}.getRawString()); ASSERT_TRUE(id.has_value()); // NOLINTNEXTLINE(bugprone-unchecked-optional-access) has_value checked above EXPECT_THROW((void)id->getChildNodeID(0), std::logic_error); diff --git a/src/tests/libxrpl/shamap/SHAMapSync.cpp b/src/tests/libxrpl/shamap/SHAMapSync.cpp index e4bcbd8970..fe236b2318 100644 --- a/src/tests/libxrpl/shamap/SHAMapSync.cpp +++ b/src/tests/libxrpl/shamap/SHAMapSync.cpp @@ -29,7 +29,7 @@ class SHAMapSyncTest : public ::testing::Test { protected: beast::Journal const j_{TestSink::instance()}; - beast::xor_shift_engine eng_; + beast::XorShiftEngine eng_; boost::intrusive_ptr makeRandomAS() @@ -50,7 +50,7 @@ protected: // map should be the same SHAMapHash const beforeHash = map.getHash(); - std::list items; + std::list items; for (auto i = 0uz; i < count; ++i) { diff --git a/src/tests/libxrpl/shamap/common.h b/src/tests/libxrpl/shamap/common.h index 91401d2973..2476933675 100644 --- a/src/tests/libxrpl/shamap/common.h +++ b/src/tests/libxrpl/shamap/common.h @@ -93,14 +93,14 @@ public: void missingNodeAcquireBySeq( [[maybe_unused]] std::uint32_t refNum, - [[maybe_unused]] uint256 const& nodeHash) override + [[maybe_unused]] UInt256 const& nodeHash) override { Throw("missing node"); } void missingNodeAcquireByHash( - [[maybe_unused]] uint256 const& refHash, + [[maybe_unused]] UInt256 const& refHash, [[maybe_unused]] std::uint32_t refNum) override { Throw("missing node"); diff --git a/src/tests/libxrpl/tx/AccountSet.cpp b/src/tests/libxrpl/tx/AccountSet.cpp index fe6818670e..d9dc0496f1 100644 --- a/src/tests/libxrpl/tx/AccountSet.cpp +++ b/src/tests/libxrpl/tx/AccountSet.cpp @@ -368,7 +368,7 @@ TEST(AccountSet, wallet_id) std::string_view const locator = "9633EC8AF54F16B5286DB1D7B519EF49EEFC050C0C8AC4384F1D88ACD1BFDF05"; - uint256 locatorHash{}; + UInt256 locatorHash{}; EXPECT_TRUE(locatorHash.parseHex(locator)); // Set the wallet locator @@ -400,7 +400,7 @@ TEST(AccountSet, email_hash) env.close(); std::string_view const mh = "5F31A79367DC3137FADA860C05742EE6"; - uint128 emailHash{}; + UInt128 emailHash{}; EXPECT_TRUE(emailHash.parseHex(mh)); // Set the email hash diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 42270a91f1..ea63e2311e 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -92,7 +92,7 @@ RCLConsensus::RCLConsensus( LedgerMaster& ledgerMaster, LocalTxs& localTxs, InboundTransactions& inboundTransactions, - Consensus::clock_type const& clock, + Consensus::ClockType const& clock, ValidatorKeys const& validatorKeys, beast::Journal journal) : adaptor_( @@ -214,7 +214,7 @@ RCLConsensus::Adaptor::share(RCLCxTx const& tx) msg.set_rawtransaction(slice.data(), slice.size()); msg.set_status(protocol::tsNEW); msg.set_receivetimestamp(app_.getTimeKeeper().now().time_since_epoch().count()); - static std::set const kSkip{}; + static std::set const kSkip{}; app_.getOverlay().relay(tx.id(), msg, kSkip); } else @@ -299,14 +299,14 @@ RCLConsensus::Adaptor::proposersFinished(RCLCxLedger const& ledger, LedgerHash c return vals.getNodesAfter(RCLValidatedLedger(ledger.ledger, vals.adaptor().journal()), h); } -uint256 +UInt256 RCLConsensus::Adaptor::getPrevLedger( - uint256 ledgerID, + UInt256 ledgerID, RCLCxLedger const& ledger, ConsensusMode mode) { RCLValidations& vals = app_.getValidations(); - uint256 netLgr = vals.getPreferred( + UInt256 netLgr = vals.getPreferred( RCLValidatedLedger{ledger.ledger, vals.adaptor().journal()}, ledgerMaster_.getValidLedgerIndex()); @@ -551,7 +551,7 @@ RCLConsensus::Adaptor::doAccept( censorshipDetector_.check( std::move(accepted), [curr = built.seq(), j = app_.getJournal("CensorshipDetector"), &failed]( - uint256 const& id, LedgerIndex seq) { + UInt256 const& id, LedgerIndex seq) { if (failed.contains(id)) return true; @@ -965,7 +965,7 @@ RCLConsensus::peerProposal(NetClock::time_point const& now, RCLCxPeerPos const& } bool -RCLConsensus::Adaptor::preStartRound(RCLCxLedger const& prevLgr, hash_set const& nowTrusted) +RCLConsensus::Adaptor::preStartRound(RCLCxLedger const& prevLgr, HashSet const& nowTrusted) { // We have a key, we do not want out of sync validations after a restart // and are not amendment blocked. @@ -1023,7 +1023,7 @@ RCLConsensus::Adaptor::getValidLedgerIndex() const return ledgerMaster_.getValidLedgerIndex(); } -std::pair> +std::pair> RCLConsensus::Adaptor::getQuorumKeys() const { return app_.getValidators().getQuorumKeys(); @@ -1031,8 +1031,8 @@ RCLConsensus::Adaptor::getQuorumKeys() const std::size_t RCLConsensus::Adaptor::laggards( - Ledger_t::Seq const seq, - hash_set& trustedKeys) const + LedgerT::Seq const seq, + HashSet& trustedKeys) const { return app_.getValidations().laggards(seq, trustedKeys); } @@ -1055,8 +1055,8 @@ RCLConsensus::startRound( NetClock::time_point const& now, RCLCxLedger::ID const& prevLgrId, RCLCxLedger const& prevLgr, - hash_set const& nowUntrusted, - hash_set const& nowTrusted, + HashSet const& nowUntrusted, + HashSet const& nowTrusted, std::unique_ptr const& clog) { std::scoped_lock const _{mutex_}; diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index 4c07e7e646..b30a3fe572 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -87,11 +87,11 @@ class RCLConsensus NegativeUNLVote nUnlVote_; public: - using Ledger_t = RCLCxLedger; - using NodeID_t = NodeID; - using NodeKey_t = PublicKey; - using TxSet_t = RCLTxSet; - using PeerPosition_t = RCLCxPeerPos; + using LedgerT = RCLCxLedger; + using NodeIDT = NodeID; + using NodeKeyT = PublicKey; + using TxSetT = RCLTxSet; + using PeerPositionT = RCLCxPeerPos; using Result = ConsensusResult; @@ -136,7 +136,7 @@ class RCLConsensus * @return Whether we enter the round proposing */ bool - preStartRound(RCLCxLedger const& prevLedger, hash_set const& nowTrusted); + preStartRound(RCLCxLedger const& prevLedger, HashSet const& nowTrusted); bool haveValidated() const; @@ -144,11 +144,11 @@ class RCLConsensus LedgerIndex getValidLedgerIndex() const; - std::pair> + std::pair> getQuorumKeys() const; std::size_t - laggards(Ledger_t::Seq const seq, hash_set& trustedKeys) const; + laggards(LedgerT::Seq const seq, HashSet& trustedKeys) const; /** * Whether I am a validator. @@ -288,8 +288,8 @@ class RCLConsensus * @note ledgerID may not match ledger.id() if we haven't acquired * the ledger matching ledgerID from the network */ - uint256 - getPrevLedger(uint256 ledgerID, RCLCxLedger const& ledger, ConsensusMode mode); + UInt256 + getPrevLedger(UInt256 ledgerID, RCLCxLedger const& ledger, ConsensusMode mode); /** * Notified of change in consensus mode @@ -434,7 +434,7 @@ public: LedgerMaster& ledgerMaster, LocalTxs& localTxs, InboundTransactions& inboundTransactions, - Consensus::clock_type const& clock, + Consensus::ClockType const& clock, ValidatorKeys const& validatorKeys, beast::Journal journal); @@ -506,8 +506,8 @@ public: NetClock::time_point const& now, RCLCxLedger::ID const& prevLgrId, RCLCxLedger const& prevLgr, - hash_set const& nowUntrusted, - hash_set const& nowTrusted, + HashSet const& nowUntrusted, + HashSet const& nowTrusted, std::unique_ptr const& clog); /** diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.cpp b/src/xrpld/app/consensus/RCLCxPeerPos.cpp index 781582c925..026f3d5541 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.cpp +++ b/src/xrpld/app/consensus/RCLCxPeerPos.cpp @@ -18,7 +18,7 @@ namespace xrpl { RCLCxPeerPos::RCLCxPeerPos( PublicKey const& publicKey, Slice const& signature, - uint256 const& suppression, + UInt256 const& suppression, Proposal const& proposal) // trivially copyable : publicKey_(publicKey), suppression_(suppression), proposal_(proposal) { @@ -49,10 +49,10 @@ RCLCxPeerPos::getJson() const return ret; } -uint256 +UInt256 proposalUniqueId( - uint256 const& proposeHash, - uint256 const& previousLedger, + UInt256 const& proposeHash, + UInt256 const& previousLedger, std::uint32_t proposeSeq, NetClock::time_point closeTime, Slice const& publicKey, diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.h b/src/xrpld/app/consensus/RCLCxPeerPos.h index 078556dea8..ea030198e5 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.h +++ b/src/xrpld/app/consensus/RCLCxPeerPos.h @@ -27,7 +27,7 @@ class RCLCxPeerPos { public: //< The type of the proposed position - using Proposal = ConsensusProposal; + using Proposal = ConsensusProposal; /** * Constructor @@ -43,7 +43,7 @@ public: RCLCxPeerPos( PublicKey const& publicKey, Slice const& signature, - uint256 const& suppress, + UInt256 const& suppress, Proposal const& proposal); // trivially copyable /** @@ -73,7 +73,7 @@ public: /** * Unique id used by hash router to suppress duplicates */ - uint256 const& + UInt256 const& suppressionID() const { return suppression_; @@ -99,7 +99,7 @@ public: private: PublicKey publicKey_; - uint256 suppression_; + UInt256 suppression_; Proposal proposal_; boost::container::static_vector signature_; @@ -133,10 +133,10 @@ private: * @param publicKey Signer's public key * @param signature Proposal signature */ -uint256 +UInt256 proposalUniqueId( - uint256 const& proposeHash, - uint256 const& previousLedger, + UInt256 const& proposeHash, + UInt256 const& previousLedger, std::uint32_t proposeSeq, NetClock::time_point closeTime, Slice const& publicKey, diff --git a/src/xrpld/app/consensus/RCLCxTx.h b/src/xrpld/app/consensus/RCLCxTx.h index 110ef14e1d..f73f834615 100644 --- a/src/xrpld/app/consensus/RCLCxTx.h +++ b/src/xrpld/app/consensus/RCLCxTx.h @@ -24,7 +24,7 @@ public: /** * Unique identifier/hash of transaction */ - using ID = uint256; + using ID = UInt256; /** * Constructor @@ -62,7 +62,7 @@ public: /** * Unique identifier/hash of the set of transactions */ - using ID = uint256; + using ID = UInt256; /** * The type that corresponds to a single transaction */ @@ -183,7 +183,7 @@ public: // map from a trusted validator map->compare(*(j.map), delta, 65536); - std::map ret; + std::map ret; for (auto const& [k, v] : delta) { XRPL_ASSERT( diff --git a/src/xrpld/app/consensus/RCLValidations.h b/src/xrpld/app/consensus/RCLValidations.h index 963b6c150e..05512a509e 100644 --- a/src/xrpld/app/consensus/RCLValidations.h +++ b/src/xrpld/app/consensus/RCLValidations.h @@ -51,7 +51,7 @@ public: /** * Validated ledger's hash */ - [[nodiscard]] uint256 + [[nodiscard]] UInt256 ledgerID() const { return val_->getLedgerHash(); @@ -218,7 +218,7 @@ public: private: ID ledgerID_; Seq ledgerSeq_; - std::vector ancestors_; + std::vector ancestors_; beast::Journal j_; }; diff --git a/src/xrpld/app/ledger/AbstractFetchPackContainer.h b/src/xrpld/app/ledger/AbstractFetchPackContainer.h index 6298ddda0d..716b0ca8d1 100644 --- a/src/xrpld/app/ledger/AbstractFetchPackContainer.h +++ b/src/xrpld/app/ledger/AbstractFetchPackContainer.h @@ -24,7 +24,7 @@ public: * otherwise, the hash associated data. */ virtual std::optional - getFetchPack(uint256 const& nodeHash) = 0; + getFetchPack(UInt256 const& nodeHash) = 0; }; } // namespace xrpl diff --git a/src/xrpld/app/ledger/InboundLedger.h b/src/xrpld/app/ledger/InboundLedger.h index 9a7ee510f6..4660e3d59b 100644 --- a/src/xrpld/app/ledger/InboundLedger.h +++ b/src/xrpld/app/ledger/InboundLedger.h @@ -35,7 +35,7 @@ class InboundLedger final : public TimeoutCounter, public CountedObject { public: - using clock_type = beast::AbstractClock; + using ClockType = beast::AbstractClock; // These are the reasons we might acquire a ledger enum class Reason { @@ -46,10 +46,10 @@ public: InboundLedger( Application& app, - uint256 const& hash, + UInt256 const& hash, std::uint32_t seq, Reason reason, - clock_type&, + ClockType&, std::unique_ptr peerSet); ~InboundLedger() override; @@ -96,7 +96,7 @@ public: bool gotData(std::weak_ptr, std::shared_ptr const&); - using neededHash_t = std::pair; + using NeededHashT = std::pair; /** * Return a json::ValueType::Object. @@ -113,7 +113,7 @@ public: lastAction_ = clock_.now(); } - clock_type::time_point + ClockType::time_point getLastAction() const { return lastAction_; @@ -123,12 +123,12 @@ private: enum class TriggerReason { Added, Reply, Timeout }; void - filterNodes(std::vector>& nodes, TriggerReason reason); + filterNodes(std::vector>& nodes, TriggerReason reason); void trigger(std::shared_ptr const&, TriggerReason); - std::vector + std::vector getNeededHashes(); void @@ -167,14 +167,14 @@ private: bool takeAsRootNode(std::string_view data, SHAMapAddNode& san); - std::vector + std::vector neededTxHashes(int max, SHAMapSyncFilter const* filter) const; - std::vector + std::vector neededStateHashes(int max, SHAMapSyncFilter const* filter) const; - clock_type& clock_; - clock_type::time_point lastAction_; + ClockType& clock_; + ClockType::time_point lastAction_; std::shared_ptr ledger_; bool haveHeader_{false}; @@ -185,7 +185,7 @@ private: std::uint32_t seq_; Reason const reason_; - std::set recentNodes_; + std::set recentNodes_; SHAMapAddNode stats_; diff --git a/src/xrpld/app/ledger/InboundLedgers.h b/src/xrpld/app/ledger/InboundLedgers.h index e288201c66..3c35c0cf7d 100644 --- a/src/xrpld/app/ledger/InboundLedgers.h +++ b/src/xrpld/app/ledger/InboundLedgers.h @@ -28,20 +28,20 @@ namespace xrpl { class InboundLedgers { public: - using clock_type = beast::AbstractClock; + using ClockType = beast::AbstractClock; virtual ~InboundLedgers() = default; // Callers should use this if they possibly need an authoritative // response immediately. virtual std::shared_ptr - acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason) = 0; + acquire(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason) = 0; // Callers should use this if they are known to be executing on the Job // Queue. TODO review whether all callers of acquire() can use this // instead. Inbound ledger acquisition is asynchronous anyway. virtual void - acquireAsync(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) = 0; + acquireAsync(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) = 0; virtual std::shared_ptr find(LedgerHash const& hash) = 0; @@ -58,10 +58,10 @@ public: gotStaleData(std::shared_ptr packet) = 0; virtual void - logFailure(uint256 const& h, std::uint32_t seq) = 0; + logFailure(UInt256 const& h, std::uint32_t seq) = 0; virtual bool - isFailure(uint256 const& h) = 0; + isFailure(UInt256 const& h) = 0; virtual void clearFailures() = 0; @@ -96,7 +96,7 @@ public: std::unique_ptr makeInboundLedgers( Application& app, - InboundLedgers::clock_type& clock, - beast::insight::Collector::ptr const& collector); + InboundLedgers::ClockType& clock, + beast::insight::Collector::Ptr const& collector); } // namespace xrpl diff --git a/src/xrpld/app/ledger/InboundTransactions.h b/src/xrpld/app/ledger/InboundTransactions.h index a961d04c33..788fa56df6 100644 --- a/src/xrpld/app/ledger/InboundTransactions.h +++ b/src/xrpld/app/ledger/InboundTransactions.h @@ -25,7 +25,7 @@ class Application; class InboundTransactions { public: - using clock_type = beast::AbstractClock; + using ClockType = beast::AbstractClock; InboundTransactions() = default; InboundTransactions(InboundTransactions const&) = delete; @@ -44,7 +44,7 @@ public: * missing. */ virtual std::shared_ptr - getSet(uint256 const& setHash, bool acquire) = 0; + getSet(UInt256 const& setHash, bool acquire) = 0; /** * Add a transaction set from a LedgerData message. @@ -55,7 +55,7 @@ public: */ virtual void gotData( - uint256 const& setHash, + UInt256 const& setHash, std::shared_ptr peer, std::shared_ptr message) = 0; @@ -68,7 +68,7 @@ public: * or constructed by ourself during consensus. */ virtual void - giveSet(uint256 const& setHash, std::shared_ptr const& set, bool acquired) = 0; + giveSet(UInt256 const& setHash, std::shared_ptr const& set, bool acquired) = 0; /** * Informs the container if a new consensus round @@ -83,7 +83,7 @@ public: std::unique_ptr makeInboundTransactions( Application& app, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, std::function const&, bool)> gotSet); } // namespace xrpl diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index 8734faa1fb..bd6c58d8dc 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -33,7 +33,7 @@ namespace xrpl { // FIXME: Need to clean up ledgers by index at some point -LedgerHistory::LedgerHistory(beast::insight::Collector::ptr const& collector, Application& app) +LedgerHistory::LedgerHistory(beast::insight::Collector::Ptr const& collector, Application& app) : app_(app) , collector_(collector) , mismatchCounter_(collector->makeCounter("ledger.history", "mismatch")) @@ -89,7 +89,7 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index) if (it != ledgersByIndex_.end()) { - uint256 const hash = it->second; + UInt256 const hash = it->second; sl.unlock(); return getLedgerByHash(hash); } @@ -155,7 +155,7 @@ LedgerHistory::getLedgerByHash(LedgerHash const& hash) } static void -logOne(ReadView const& ledger, uint256 const& tx, char const* msg, beast::Journal& j) +logOne(ReadView const& ledger, UInt256 const& tx, char const* msg, beast::Journal& j) { auto metaData = ledger.txRead(tx).second; @@ -176,10 +176,10 @@ static void logMetadataDifference( ReadView const& builtLedger, ReadView const& validLedger, - uint256 const& tx, + UInt256 const& tx, beast::Journal j) { - auto getMeta = [](ReadView const& ledger, uint256 const& txID) { + auto getMeta = [](ReadView const& ledger, UInt256 const& txID) { std::optional ret; if (auto meta = ledger.txRead(txID).second) ret.emplace(txID, ledger.seq(), *meta); @@ -313,8 +313,8 @@ void LedgerHistory::handleMismatch( LedgerHash const& built, LedgerHash const& valid, - std::optional const& builtConsensusHash, - std::optional const& validatedConsensusHash, + std::optional const& builtConsensusHash, + std::optional const& validatedConsensusHash, json::Value const& consensus) { XRPL_ASSERT(built != valid, "xrpl::LedgerHistory::handleMismatch : unequal hashes"); @@ -426,7 +426,7 @@ LedgerHistory::handleMismatch( void LedgerHistory::builtLedger( std::shared_ptr const& ledger, - uint256 const& consensusHash, + UInt256 const& consensusHash, json::Value consensus) { LedgerIndex const index = ledger->header().seq; @@ -466,7 +466,7 @@ LedgerHistory::builtLedger( void LedgerHistory::validatedLedger( std::shared_ptr const& ledger, - std::optional const& consensusHash) + std::optional const& consensusHash) { LedgerIndex const index = ledger->header().seq; LedgerHash const hash = ledger->header().hash; diff --git a/src/xrpld/app/ledger/LedgerHistory.h b/src/xrpld/app/ledger/LedgerHistory.h index 922b354c32..7359cdf6cd 100644 --- a/src/xrpld/app/ledger/LedgerHistory.h +++ b/src/xrpld/app/ledger/LedgerHistory.h @@ -25,7 +25,7 @@ namespace xrpl { class LedgerHistory { public: - LedgerHistory(beast::insight::Collector::ptr const& collector, Application& app); + LedgerHistory(beast::insight::Collector::Ptr const& collector, Application& app); /** * Track a ledger @@ -78,7 +78,7 @@ public: * Report that we have locally built a particular ledger */ void - builtLedger(std::shared_ptr const&, uint256 const& consensusHash, json::Value); + builtLedger(std::shared_ptr const&, UInt256 const& consensusHash, json::Value); /** * Report that we have validated a particular ledger @@ -86,7 +86,7 @@ public: void validatedLedger( std::shared_ptr const&, - std::optional const& consensusHash); + std::optional const& consensusHash); /** * Repair a hash to index mapping @@ -116,12 +116,12 @@ private: handleMismatch( LedgerHash const& built, LedgerHash const& valid, - std::optional const& builtConsensusHash, - std::optional const& validatedConsensusHash, + std::optional const& builtConsensusHash, + std::optional const& validatedConsensusHash, json::Value const& consensus); Application& app_; - beast::insight::Collector::ptr collector_; + beast::insight::Collector::Ptr collector_; beast::insight::Counter mismatchCounter_; using LedgersByHash = TaggedCache; @@ -137,9 +137,9 @@ private: // Hash of the validated ledger std::optional validated; // Hash of locally accepted consensus transaction set - std::optional builtConsensusHash; + std::optional builtConsensusHash; // Hash of validated consensus transaction set - std::optional validatedConsensusHash; + std::optional validatedConsensusHash; // Consensus metadata of built ledger std::optional consensus; }; diff --git a/src/xrpld/app/ledger/LedgerMaster.h b/src/xrpld/app/ledger/LedgerMaster.h index 140b12fa59..bc1cb86c28 100644 --- a/src/xrpld/app/ledger/LedgerMaster.h +++ b/src/xrpld/app/ledger/LedgerMaster.h @@ -52,7 +52,7 @@ public: explicit LedgerMaster( Application& app, Stopwatch& stopwatch, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, beast::Journal journal); ~LedgerMaster() override = default; @@ -120,7 +120,7 @@ public: switchLCL(std::shared_ptr const& lastClosed); void - failedSave(std::uint32_t seq, uint256 const& hash); + failedSave(std::uint32_t seq, UInt256 const& hash); std::string getCompleteLedgers() const; @@ -149,7 +149,7 @@ public: /** * Get a ledger's hash by sequence number using the cache */ - uint256 + UInt256 getHashBySeq(std::uint32_t index); /** @@ -176,7 +176,7 @@ public: getLedgerBySeq(std::uint32_t index); std::shared_ptr - getLedgerByHash(uint256 const& hash); + getLedgerByHash(UInt256 const& hash); void setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV); @@ -211,11 +211,11 @@ public: void checkAccept(std::shared_ptr const& ledger); void - checkAccept(uint256 const& hash, std::uint32_t seq); + checkAccept(UInt256 const& hash, std::uint32_t seq); void consensusBuilt( std::shared_ptr const& ledger, - uint256 const& consensusHash, + UInt256 const& consensusHash, json::Value consensus); void @@ -250,16 +250,16 @@ public: gotFetchPack(bool progress, std::uint32_t seq); void - addFetchPack(uint256 const& hash, std::shared_ptr data); + addFetchPack(UInt256 const& hash, std::shared_ptr data); std::optional - getFetchPack(uint256 const& hash) override; + getFetchPack(UInt256 const& hash) override; void makeFetchPack( std::weak_ptr const& wPeer, std::shared_ptr const& request, - uint256 haveLedgerHash, + UInt256 haveLedgerHash, UptimeClock::time_point uptime); std::size_t @@ -279,7 +279,7 @@ public: minSqlSeq(); // Iff a txn exists at the specified ledger and offset then return its txnid - std::optional + std::optional txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex); private: @@ -342,11 +342,11 @@ private: std::shared_ptr histLedger_; // Fully validated ledger, whether or not we have the ledger resident. - std::pair lastValidLedger_{uint256(), 0}; + std::pair lastValidLedger_{UInt256(), 0}; LedgerHistory ledgerHistory_; - CanonicalTXSet heldTransactions_{uint256()}; + CanonicalTXSet heldTransactions_{UInt256()}; // A set of transactions to replay during the next close std::unique_ptr replayData_; @@ -383,7 +383,7 @@ private: std::uint32_t const ledgerFetchSize_; - TaggedCache fetchPacks_; + TaggedCache fetchPacks_; std::uint32_t fetchSeq_{0}; @@ -398,7 +398,7 @@ private: struct Stats { template - Stats(Handler const& handler, beast::insight::Collector::ptr const& collector) + Stats(Handler const& handler, beast::insight::Collector::Ptr const& collector) : hook(collector->makeHook(handler)) , validatedLedgerAge(collector->makeGauge("LedgerMaster", "Validated_Ledger_Age")) , publishedLedgerAge(collector->makeGauge("LedgerMaster", "Published_Ledger_Age")) diff --git a/src/xrpld/app/ledger/LedgerPersistence.h b/src/xrpld/app/ledger/LedgerPersistence.h index e2e442cb30..c0d32085cf 100644 --- a/src/xrpld/app/ledger/LedgerPersistence.h +++ b/src/xrpld/app/ledger/LedgerPersistence.h @@ -79,7 +79,7 @@ loadByIndex( */ std::shared_ptr loadByHash( - uint256 const& ledgerHash, + UInt256 const& ledgerHash, Rules const& rules, Fees const& fees, ServiceRegistry& registry, @@ -93,7 +93,7 @@ loadByHash( * @param registry Service registry for dependency injection. * @return Tuple of (ledger, sequence, hash), or empty if not found. */ -std::tuple, std::uint32_t, uint256> +std::tuple, std::uint32_t, UInt256> getLatestLedger(Rules const& rules, Fees const& fees, ServiceRegistry& registry); } // namespace xrpl diff --git a/src/xrpld/app/ledger/LedgerReplayTask.h b/src/xrpld/app/ledger/LedgerReplayTask.h index d908a36fc0..9b92f25f72 100644 --- a/src/xrpld/app/ledger/LedgerReplayTask.h +++ b/src/xrpld/app/ledger/LedgerReplayTask.h @@ -31,13 +31,13 @@ public: public: // set on construct InboundLedger::Reason reason; - uint256 finishHash; + UInt256 finishHash; std::uint32_t totalLedgers; // including the start and the finish // to be updated std::uint32_t finishSeq = 0; - std::vector skipList; // including the finishHash - uint256 startHash; + std::vector skipList; // including the finishHash + UInt256 startHash; std::uint32_t startSeq = 0; bool full = false; @@ -49,7 +49,7 @@ public: */ TaskParameter( InboundLedger::Reason r, - uint256 const& finishLedgerHash, + UInt256 const& finishLedgerHash, std::uint32_t totalNumLedgers); /** @@ -62,7 +62,7 @@ public: * true on success */ bool - update(uint256 const& hash, std::uint32_t seq, std::vector const& sList); + update(UInt256 const& hash, std::uint32_t seq, std::vector const& sList); /** * check if this task can be merged into an existing task @@ -129,14 +129,14 @@ private: * @param sList skip list */ void - updateSkipList(uint256 const& hash, std::uint32_t seq, std::vector const& sList); + updateSkipList(UInt256 const& hash, std::uint32_t seq, std::vector const& sList); /** * Notify this task (by a LedgerDeltaAcquire subtask) that a delta is ready * @param deltaHash ledger hash of the delta */ void - deltaReady(uint256 const& deltaHash); + deltaReady(UInt256 const& deltaHash); /** * Trigger another round diff --git a/src/xrpld/app/ledger/LedgerReplayer.h b/src/xrpld/app/ledger/LedgerReplayer.h index b2806ee813..8bb80af54f 100644 --- a/src/xrpld/app/ledger/LedgerReplayer.h +++ b/src/xrpld/app/ledger/LedgerReplayer.h @@ -76,7 +76,7 @@ public: * @note totalNumLedgers must > 0 && totalNumLedgers must <= 256 */ void - replay(InboundLedger::Reason r, uint256 const& finishLedgerHash, std::uint32_t totalNumLedgers); + replay(InboundLedger::Reason r, UInt256 const& finishLedgerHash, std::uint32_t totalNumLedgers); /** * Create LedgerDeltaAcquire subtasks for the LedgerReplayTask task @@ -137,8 +137,8 @@ public: private: mutable std::mutex mtx_; std::vector> tasks_; - hash_map> deltas_; - hash_map> skipLists_; + HashMap> deltas_; + HashMap> skipLists_; Application& app_; InboundLedgers& inboundLedgers_; diff --git a/src/xrpld/app/ledger/OpenLedger.h b/src/xrpld/app/ledger/OpenLedger.h index 4a0aa105f9..1335057e67 100644 --- a/src/xrpld/app/ledger/OpenLedger.h +++ b/src/xrpld/app/ledger/OpenLedger.h @@ -61,7 +61,7 @@ public: * `true` won't cause harm, but it may be * sub-optimal. */ - using modify_type = std::function; + using ModifyType = std::function; OpenLedger() = delete; OpenLedger(OpenLedger const&) = delete; @@ -121,7 +121,7 @@ public: * @return `true` if the open view was changed */ bool - modify(modify_type const& f); + modify(ModifyType const& f); /** * Accept a new ledger. @@ -167,7 +167,7 @@ public: OrderedTxs& retries, ApplyFlags flags, std::string_view suffix = "", - modify_type const& f = {}); + ModifyType const& f = {}); private: /** diff --git a/src/xrpld/app/ledger/OrderBookDBImpl.cpp b/src/xrpld/app/ledger/OrderBookDBImpl.cpp index 1e474ef949..70f218ed51 100644 --- a/src/xrpld/app/ledger/OrderBookDBImpl.cpp +++ b/src/xrpld/app/ledger/OrderBookDBImpl.cpp @@ -246,7 +246,7 @@ OrderBookDBImpl::addOrderBook(Book const& book) // return list of all orderbooks that want this issuerID and currencyID std::vector -OrderBookDBImpl::getBooksByTakerPays(Asset const& asset, std::optional const& domain) +OrderBookDBImpl::getBooksByTakerPays(Asset const& asset, std::optional const& domain) { std::vector ret; @@ -278,7 +278,7 @@ OrderBookDBImpl::getBooksByTakerPays(Asset const& asset, std::optional } int -OrderBookDBImpl::getBookSize(Asset const& asset, std::optional const& domain) +OrderBookDBImpl::getBookSize(Asset const& asset, std::optional const& domain) { std::scoped_lock const sl(lock_); @@ -305,10 +305,10 @@ OrderBookDBImpl::isBookToXRP(Asset const& asset, std::optional const& do return xrpBooks_.contains(asset); } -hash_set +HashSet affectedBooks(AcceptedLedgerTx const& alTx, beast::Journal const& j) { - hash_set result; + HashSet result; for (auto const& node : alTx.getMeta().getNodes()) { diff --git a/src/xrpld/app/ledger/OrderBookDBImpl.h b/src/xrpld/app/ledger/OrderBookDBImpl.h index 5f436a6946..04f0d4b48d 100644 --- a/src/xrpld/app/ledger/OrderBookDBImpl.h +++ b/src/xrpld/app/ledger/OrderBookDBImpl.h @@ -71,15 +71,15 @@ private: bool const standalone_; // Maps order books by "asset in" to "asset out": - hardened_hash_map> allBooks_; + HardenedHashMap> allBooks_; - hardened_hash_map, hardened_hash_set> domainBooks_; + HardenedHashMap, HardenedHashSet> domainBooks_; // does an order book to XRP exist - hash_set xrpBooks_; + HashSet xrpBooks_; // does an order book to XRP exist - hash_set> xrpDomainBooks_; + HashSet> xrpDomainBooks_; std::recursive_mutex lock_; diff --git a/src/xrpld/app/ledger/TransactionMaster.h b/src/xrpld/app/ledger/TransactionMaster.h index 6d81911510..2643419811 100644 --- a/src/xrpld/app/ledger/TransactionMaster.h +++ b/src/xrpld/app/ledger/TransactionMaster.h @@ -33,10 +33,10 @@ public: operator=(TransactionMaster const&) = delete; std::shared_ptr - fetchFromCache(uint256 const&); + fetchFromCache(UInt256 const&); std::variant, std::shared_ptr>, TxSearched> - fetch(uint256 const&, ErrorCodeI& ec); + fetch(UInt256 const&, ErrorCodeI& ec); /** * Fetch transaction from the cache or database. @@ -48,7 +48,7 @@ public: * the database while the search was conducted. */ std::variant, std::shared_ptr>, TxSearched> - fetch(uint256 const&, ClosedInterval const& range, ErrorCodeI& ec); + fetch(UInt256 const&, ClosedInterval const& range, ErrorCodeI& ec); std::shared_ptr fetch( @@ -59,7 +59,7 @@ public: // return value: true = we had the transaction already bool inLedger( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledger, std::optional tseq, std::optional netID); @@ -70,12 +70,12 @@ public: void sweep(); - TaggedCache& + TaggedCache& getCache(); private: Application& app_; - TaggedCache cache_; + TaggedCache cache_; }; } // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index 246c7d567b..a64fc8cce6 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -70,10 +70,10 @@ constexpr auto kLedgerAcquireTimeout = 3000ms; InboundLedger::InboundLedger( Application& app, - uint256 const& hash, + UInt256 const& hash, std::uint32_t seq, Reason reason, - clock_type& clock, + ClockType& clock, std::unique_ptr peerSet) : TimeoutCounter( app, @@ -187,10 +187,10 @@ InboundLedger::~InboundLedger() } } -static std::vector -neededHashes(uint256 const& root, SHAMap& map, int max, SHAMapSyncFilter const* filter) +static std::vector +neededHashes(UInt256 const& root, SHAMap& map, int max, SHAMapSyncFilter const* filter) { - std::vector ret; + std::vector ret; if (!root.isZero()) { @@ -210,13 +210,13 @@ neededHashes(uint256 const& root, SHAMap& map, int max, SHAMapSyncFilter const* return ret; } -std::vector +std::vector InboundLedger::neededTxHashes(int max, SHAMapSyncFilter const* filter) const { return neededHashes(ledger_->header().txHash, ledger_->txMap(), max, filter); } -std::vector +std::vector InboundLedger::neededStateHashes(int max, SHAMapSyncFilter const* filter) const { return neededHashes(ledger_->header().accountHash, ledger_->stateMap(), max, filter); @@ -737,7 +737,7 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) void InboundLedger::filterNodes( - std::vector>& nodes, + std::vector>& nodes, TriggerReason reason) { // Sort nodes so that the ones we haven't recently @@ -1008,10 +1008,10 @@ InboundLedger::takeTxRootNode(std::string_view data, SHAMapAddNode& san) return !result.isInvalid(); } -std::vector +std::vector InboundLedger::getNeededHashes() { - std::vector ret; + std::vector ret; if (!haveHeader_) { diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 4d565ca674..e309bb61ff 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -48,7 +48,7 @@ private: Application& app_; std::mutex fetchRateMutex_; // measures ledgers per second, constants are important - DecayWindow<30, clock_type> fetchRate_; + DecayWindow<30, ClockType> fetchRate_; beast::Journal const j_; public: @@ -57,8 +57,8 @@ public: InboundLedgersImp( Application& app, - clock_type& clock, - beast::insight::Collector::ptr const& collector, + ClockType& clock, + beast::insight::Collector::Ptr const& collector, std::unique_ptr peerSetBuilder) : app_(app) , fetchRate_(clock.now()) @@ -74,7 +74,7 @@ public: * @callgraph */ std::shared_ptr - acquire(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override + acquire(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override { auto doAcquire = [&, seq, reason]() -> std::shared_ptr { XRPL_ASSERT( @@ -129,7 +129,7 @@ public: } void - acquireAsync(uint256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override + acquireAsync(UInt256 const& hash, std::uint32_t seq, InboundLedger::Reason reason) override { std::unique_lock lock(acquiresMutex_); try @@ -153,7 +153,7 @@ public: } std::shared_ptr - find(uint256 const& hash) override + find(UInt256 const& hash) override { XRPL_ASSERT(hash.isNonZero(), "xrpl::InboundLedgersImp::find : nonzero input"); @@ -223,7 +223,7 @@ public: } void - logFailure(uint256 const& h, std::uint32_t seq) override + logFailure(UInt256 const& h, std::uint32_t seq) override { ScopedLockType const sl(lock_); @@ -231,7 +231,7 @@ public: } bool - isFailure(uint256 const& h) override + isFailure(UInt256 const& h) override { ScopedLockType const sl(lock_); @@ -300,7 +300,7 @@ public: { json::Value ret(json::ValueType::Object); - std::vector>> acqs; + std::vector>> acqs; { ScopedLockType const sl(lock_); @@ -430,22 +430,22 @@ public: } private: - clock_type& clock_; + ClockType& clock_; using ScopedLockType = std::unique_lock; std::recursive_mutex lock_; bool stopping_ = false; - using MapType = hash_map>; + using MapType = HashMap>; MapType ledgers_; - beast::aged_map recentFailures_; + beast::AgedMap recentFailures_; beast::insight::Counter counter_; std::unique_ptr peerSetBuilder_; - std::set pendingAcquires_; + std::set pendingAcquires_; std::mutex acquiresMutex_; }; @@ -454,8 +454,8 @@ private: std::unique_ptr makeInboundLedgers( Application& app, - InboundLedgers::clock_type& clock, - beast::insight::Collector::ptr const& collector) + InboundLedgers::ClockType& clock, + beast::insight::Collector::Ptr const& collector) { return std::make_unique(app, clock, collector, makePeerSetBuilder(app)); } diff --git a/src/xrpld/app/ledger/detail/InboundTransactions.cpp b/src/xrpld/app/ledger/detail/InboundTransactions.cpp index 62897fe617..214a6f42e2 100644 --- a/src/xrpld/app/ledger/detail/InboundTransactions.cpp +++ b/src/xrpld/app/ledger/detail/InboundTransactions.cpp @@ -56,22 +56,22 @@ class InboundTransactionsImp : public InboundTransactions public: InboundTransactionsImp( Application& app, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, std::function const&, bool)> gotSet, std::unique_ptr peerSetBuilder) : app_(app) - , zeroSet_(map_[uint256()]) + , zeroSet_(map_[UInt256()]) , gotSet_(std::move(gotSet)) , peerSetBuilder_(std::move(peerSetBuilder)) , j_(app_.getJournal("InboundTransactions")) { zeroSet_.set = - std::make_shared(SHAMapType::TRANSACTION, uint256(), app_.getNodeFamily()); + std::make_shared(SHAMapType::TRANSACTION, UInt256(), app_.getNodeFamily()); zeroSet_.set->setUnbacked(); } TransactionAcquire::pointer - getAcquire(uint256 const& hash) + getAcquire(UInt256 const& hash) { { std::scoped_lock const sl(lock_); @@ -85,7 +85,7 @@ public: } std::shared_ptr - getSet(uint256 const& hash, bool acquire) override + getSet(UInt256 const& hash, bool acquire) override { TransactionAcquire::pointer ta; @@ -180,7 +180,7 @@ public: } void - giveSet(uint256 const& hash, std::shared_ptr const& set, bool fromAcquire) override + giveSet(UInt256 const& hash, std::shared_ptr const& set, bool fromAcquire) override { bool isNew = true; @@ -247,7 +247,7 @@ public: } private: - using MapType = hash_map; + using MapType = HashMap; Application& app_; @@ -274,7 +274,7 @@ InboundTransactions::~InboundTransactions() = default; std::unique_ptr makeInboundTransactions( Application& app, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, std::function const&, bool)> gotSet) { return std::make_unique( diff --git a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp index d3ece3c036..2bbd3d8eb5 100644 --- a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp +++ b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp @@ -242,7 +242,7 @@ private: } } - // VFALCO TODO This should return std::optional + // VFALCO TODO This should return std::optional LedgerHash getLedgerHash(std::shared_ptr& ledger, LedgerIndex index) { diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index 344d5cb8fc..6197c72b0b 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -37,7 +37,7 @@ namespace xrpl { LedgerDeltaAcquire::LedgerDeltaAcquire( Application& app, InboundLedgers& inboundLedgers, - uint256 const& ledgerHash, + UInt256 const& ledgerHash, std::uint32_t ledgerSeq, std::unique_ptr peerSet) : TimeoutCounter( diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h index 10c8a21b3a..ae1b64d159 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h @@ -41,7 +41,7 @@ public: * @param successful if the ledger delta data was acquired successfully * @param hash hash of the ledger to build */ - using OnDeltaDataCB = std::function; + using OnDeltaDataCB = std::function; /** * Constructor @@ -54,7 +54,7 @@ public: LedgerDeltaAcquire( Application& app, InboundLedgers& inboundLedgers, - uint256 const& ledgerHash, + UInt256 const& ledgerHash, std::uint32_t ledgerSeq, std::unique_ptr peerSet); diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 878b257b69..32023dfc4f 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -123,7 +123,7 @@ shouldAcquire( LedgerMaster::LedgerMaster( Application& app, Stopwatch& stopwatch, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, beast::Journal journal) : app_(app) , journal_(journal) @@ -185,7 +185,7 @@ LedgerMaster::getPublishedLedgerAge() if (pubClose == 0s) { JLOG(journal_.debug()) << "No published ledger"; - return weeks{2}; + return Weeks{2}; } std::chrono::seconds ret = app_.getTimeKeeper().closeTime().time_since_epoch(); @@ -210,7 +210,7 @@ LedgerMaster::getValidatedLedgerAge() if (valClose == 0s) { JLOG(journal_.debug()) << "No validated ledger"; - return weeks{2}; + return Weeks{2}; } std::chrono::seconds ret = app_.getTimeKeeper().closeTime().time_since_epoch(); @@ -255,7 +255,7 @@ void LedgerMaster::setValidLedger(std::shared_ptr const& l) { std::vector times; - std::optional consensusHash; + std::optional consensusHash; if (!standalone_) { @@ -529,7 +529,7 @@ LedgerMaster::isValidated(ReadView const& ledger) if (hash) { XRPL_ASSERT(hash->isNonZero(), "xrpl::LedgerMaster::isValidated : nonzero hash"); - uint256 const valHash = app_.getRelationalDatabase().getHashByIndex(seq); + UInt256 const valHash = app_.getRelationalDatabase().getHashByIndex(seq); if (valHash == ledger.header().hash) { // SQL database doesn't match ledger chain @@ -647,7 +647,7 @@ void LedgerMaster::tryFill(std::shared_ptr ledger) { std::uint32_t seq = ledger->header().seq; - uint256 prevHash = ledger->header().parentHash; + UInt256 prevHash = ledger->header().parentHash; std::map ledgerHashes; @@ -768,7 +768,7 @@ void LedgerMaster::fixMismatch(ReadView const& ledger) { int invalidate = 0; - std::optional hash; + std::optional hash; for (std::uint32_t lSeq = ledger.header().seq - 1; lSeq > 0; --lSeq) { @@ -838,7 +838,7 @@ LedgerMaster::setFullLedger( { // Check the SQL database's entry for the sequence before this // ledger, if it's not this ledger's parent, invalidate it - uint256 const prevHash = + UInt256 const prevHash = app_.getRelationalDatabase().getHashByIndex(ledger->header().seq - 1); if (prevHash.isNonZero() && prevHash != ledger->header().parentHash) clearLedger(ledger->header().seq - 1); @@ -878,7 +878,7 @@ LedgerMaster::setFullLedger( } void -LedgerMaster::failedSave(std::uint32_t seq, uint256 const& hash) +LedgerMaster::failedSave(std::uint32_t seq, UInt256 const& hash) { clearLedger(seq); app_.getInboundLedgers().acquire(hash, seq, InboundLedger::Reason::GENERIC); @@ -887,7 +887,7 @@ LedgerMaster::failedSave(std::uint32_t seq, uint256 const& hash) // Check if the specified ledger can become the new last fully-validated // ledger. void -LedgerMaster::checkAccept(uint256 const& hash, std::uint32_t seq) +LedgerMaster::checkAccept(UInt256 const& hash, std::uint32_t seq) { std::size_t valCount = 0; @@ -1063,7 +1063,7 @@ LedgerMaster::checkAccept(std::shared_ptr const& ledger) } // To throttle the warning messages, instead of printing a warning // every flag ledger, we print every week. - else if (currentTime - upgradeWarningPrevTime_ >= weeks{1}) + else if (currentTime - upgradeWarningPrevTime_ >= Weeks{1}) { // Printed the warning before, and assuming most validators // do not downgrade, we keep printing the warning @@ -1090,7 +1090,7 @@ LedgerMaster::checkAccept(std::shared_ptr const& ledger) void LedgerMaster::consensusBuilt( std::shared_ptr const& ledger, - uint256 const& consensusHash, + UInt256 const& consensusHash, json::Value consensus) { // Because we just built a ledger, we are no longer building one @@ -1147,7 +1147,7 @@ LedgerMaster::consensusBuilt( }; // Count the number of current, trusted validations - hash_map count; + HashMap count; for (auto const& v : validations) { ValSeq& vs = count[v->getLedgerHash()]; @@ -1610,7 +1610,7 @@ LedgerMaster::missingFromCompleteLedgerRange(LedgerIndex first, LedgerIndex last std::optional LedgerMaster::getCloseTimeBySeq(LedgerIndex ledgerIndex) { - uint256 const hash = getHashBySeq(ledgerIndex); + UInt256 const hash = getHashBySeq(ledgerIndex); return hash.isNonZero() ? getCloseTimeByHash(hash, ledgerIndex) : std::nullopt; } @@ -1633,10 +1633,10 @@ LedgerMaster::getCloseTimeByHash(LedgerHash const& ledgerHash, std::uint32_t ind return std::nullopt; } -uint256 +UInt256 LedgerMaster::getHashBySeq(std::uint32_t index) { - uint256 hash = ledgerHistory_.getLedgerHash(index); + UInt256 hash = ledgerHistory_.getLedgerHash(index); if (hash.isNonZero()) return hash; @@ -1747,7 +1747,7 @@ LedgerMaster::getLedgerBySeq(std::uint32_t index) } std::shared_ptr -LedgerMaster::getLedgerByHash(uint256 const& hash) +LedgerMaster::getLedgerByHash(UInt256 const& hash) { if (auto ret = ledgerHistory_.getLedgerByHash(hash)) return ret; @@ -1996,13 +1996,13 @@ LedgerMaster::doAdvance(std::unique_lock& sl) } void -LedgerMaster::addFetchPack(uint256 const& hash, std::shared_ptr data) +LedgerMaster::addFetchPack(UInt256 const& hash, std::shared_ptr data) { fetchPacks_.canonicalizeReplaceClient(hash, data); } std::optional -LedgerMaster::getFetchPack(uint256 const& hash) +LedgerMaster::getFetchPack(UInt256 const& hash) { Blob data; if (fetchPacks_.retrieve(hash, data)) @@ -2087,7 +2087,7 @@ void LedgerMaster::makeFetchPack( std::weak_ptr const& wPeer, std::shared_ptr const& request, - uint256 haveLedgerHash, + UInt256 haveLedgerHash, UptimeClock::time_point uptime) { using namespace std::chrono_literals; @@ -2217,7 +2217,7 @@ LedgerMaster::minSqlSeq() return app_.getRelationalDatabase().getMinLedgerSeq(); } -std::optional +std::optional LedgerMaster::txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex) { uint32_t first = 0, last = 0; diff --git a/src/xrpld/app/ledger/detail/LedgerPersistence.cpp b/src/xrpld/app/ledger/detail/LedgerPersistence.cpp index 6baf64e923..02c1f6a4f8 100644 --- a/src/xrpld/app/ledger/detail/LedgerPersistence.cpp +++ b/src/xrpld/app/ledger/detail/LedgerPersistence.cpp @@ -131,7 +131,7 @@ finishLoadByIndexOrHash(std::shared_ptr const& ledger, beast::Journal j) ledger->setFull(); } -std::tuple, std::uint32_t, uint256> +std::tuple, std::uint32_t, UInt256> getLatestLedger(Rules const& rules, Fees const& fees, ServiceRegistry& registry) { std::optional const info = registry.getRelationalDatabase().getNewestLedgerInfo(); @@ -160,7 +160,7 @@ loadByIndex( std::shared_ptr loadByHash( - uint256 const& ledgerHash, + UInt256 const& ledgerHash, Rules const& rules, Fees const& fees, ServiceRegistry& registry, diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp index 6ed4a296ac..56b401d464 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp @@ -45,7 +45,7 @@ LedgerReplayMsgHandler::processProofPathRequest( protocol::TMProofPathResponse reply; if (!packet.has_key() || !packet.has_ledgerhash() || !packet.has_type() || - packet.ledgerhash().size() != uint256::size() || packet.key().size() != uint256::size() || + packet.ledgerhash().size() != UInt256::size() || packet.key().size() != UInt256::size() || !protocol::TMLedgerMapType_IsValid(packet.type())) { JLOG(journal_.debug()) << "getProofPath: Invalid request"; @@ -56,8 +56,8 @@ LedgerReplayMsgHandler::processProofPathRequest( reply.set_ledgerhash(packet.ledgerhash()); reply.set_type(packet.type()); - uint256 const key = uint256::fromRaw(packet.key()); - uint256 const ledgerHash = uint256::fromRaw(packet.ledgerhash()); + UInt256 const key = UInt256::fromRaw(packet.key()); + UInt256 const ledgerHash = UInt256::fromRaw(packet.ledgerhash()); auto ledger = app_.getLedgerMaster().getLedgerByHash(ledgerHash); if (!ledger) { @@ -113,7 +113,7 @@ LedgerReplayMsgHandler::processProofPathResponse( } if (!reply.has_key() || !reply.has_ledgerhash() || !reply.has_type() || !reply.has_ledgerheader() || reply.path_size() == 0 || - reply.ledgerhash().size() != uint256::size() || reply.key().size() != uint256::size()) + reply.ledgerhash().size() != UInt256::size() || reply.key().size() != UInt256::size()) { JLOG(journal_.debug()) << "ProofPathResponse: malformed (missing or wrong-size fields)"; return ReplayMsgStatus::Malformed; @@ -136,7 +136,7 @@ LedgerReplayMsgHandler::processProofPathResponse( JLOG(journal_.debug()) << "ProofPathResponse: malformed header (" << e.what() << ")"; return ReplayMsgStatus::Malformed; } - uint256 const replyHash = uint256::fromRaw(reply.ledgerhash()); + UInt256 const replyHash = UInt256::fromRaw(reply.ledgerhash()); if (calculateLedgerHash(info) != replyHash) { JLOG(journal_.debug()) << "ProofPathResponse: malformed (hash mismatch)"; @@ -144,7 +144,7 @@ LedgerReplayMsgHandler::processProofPathResponse( } info.hash = replyHash; - uint256 const key = uint256::fromRaw(reply.key()); + UInt256 const key = UInt256::fromRaw(reply.key()); if (key != keylet::skip().key) { JLOG(journal_.debug()) << "ProofPathResponse: malformed (unexpected key " << key << ")"; @@ -199,7 +199,7 @@ LedgerReplayMsgHandler::processReplayDeltaRequest( protocol::TMReplayDeltaRequest const& packet = *msg; protocol::TMReplayDeltaResponse reply; - if (!packet.has_ledgerhash() || packet.ledgerhash().size() != uint256::size()) + if (!packet.has_ledgerhash() || packet.ledgerhash().size() != UInt256::size()) { JLOG(journal_.debug()) << "getReplayDelta: Invalid request"; reply.set_error(protocol::TMReplyError::reBAD_REQUEST); @@ -207,7 +207,7 @@ LedgerReplayMsgHandler::processReplayDeltaRequest( } reply.set_ledgerhash(packet.ledgerhash()); - uint256 const ledgerHash = uint256::fromRaw(packet.ledgerhash()); + UInt256 const ledgerHash = UInt256::fromRaw(packet.ledgerhash()); auto ledger = app_.getLedgerMaster().getLedgerByHash(ledgerHash); if (!ledger || !ledger->isImmutable()) { @@ -242,7 +242,7 @@ LedgerReplayMsgHandler::processReplayDeltaResponse( return ReplayMsgStatus::BadData; } if (!reply.has_ledgerheader() || !reply.has_ledgerhash() || - reply.ledgerhash().size() != uint256::size()) + reply.ledgerhash().size() != UInt256::size()) { JLOG(journal_.debug()) << "ReplayDeltaResponse: malformed (missing or wrong-size fields)"; return ReplayMsgStatus::Malformed; @@ -258,7 +258,7 @@ LedgerReplayMsgHandler::processReplayDeltaResponse( JLOG(journal_.debug()) << "ReplayDeltaResponse: malformed header (" << e.what() << ")"; return ReplayMsgStatus::Malformed; } - uint256 const replyHash = uint256::fromRaw(reply.ledgerhash()); + UInt256 const replyHash = UInt256::fromRaw(reply.ledgerhash()); if (calculateLedgerHash(info) != replyHash) { JLOG(journal_.debug()) << "ReplayDeltaResponse: malformed (hash mismatch)"; diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index 3d7b1e0f92..4d447115b9 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -24,7 +24,7 @@ namespace xrpl { LedgerReplayTask::TaskParameter::TaskParameter( InboundLedger::Reason r, - uint256 const& finishLedgerHash, + UInt256 const& finishLedgerHash, std::uint32_t totalNumLedgers) : reason(r), finishHash(finishLedgerHash), totalLedgers(totalNumLedgers) { @@ -36,9 +36,9 @@ LedgerReplayTask::TaskParameter::TaskParameter( bool LedgerReplayTask::TaskParameter::update( - uint256 const& hash, + UInt256 const& hash, std::uint32_t seq, - std::vector const& sList) + std::vector const& sList) { if (finishHash != hash || sList.size() + 1 < totalLedgers || full) return false; @@ -115,7 +115,7 @@ LedgerReplayTask::init() JLOG(journal_.debug()) << "Task start " << hash_; std::weak_ptr const wptr = shared_from_this(); - skipListAcquirer_->addDataCallback([wptr](bool good, uint256 const& hash) { + skipListAcquirer_->addDataCallback([wptr](bool good, UInt256 const& hash) { if (auto sptr = wptr.lock(); sptr) { if (!good) @@ -164,7 +164,7 @@ LedgerReplayTask::trigger(ScopedLockType& sl) } void -LedgerReplayTask::deltaReady(uint256 const& deltaHash) +LedgerReplayTask::deltaReady(UInt256 const& deltaHash) { JLOG(journal_.trace()) << "Delta " << deltaHash << " ready for task " << hash_; ScopedLockType sl(mtx_); @@ -178,7 +178,7 @@ LedgerReplayTask::tryAdvance(ScopedLockType& sl) JLOG(journal_.trace()) << "tryAdvance task " << hash_ << (parameter_.full ? ", full parameter" : ", waiting to fill parameter") << ", deltaIndex=" << deltaToBuild_ << ", totalDeltas=" << deltas_.size() - << ", parent " << (parent_ ? parent_->header().hash : uint256()); + << ", parent " << (parent_ ? parent_->header().hash : UInt256()); bool const shouldTry = parent_ && parameter_.full && parameter_.totalLedgers - 1 == deltas_.size(); @@ -217,9 +217,9 @@ LedgerReplayTask::tryAdvance(ScopedLockType& sl) void LedgerReplayTask::updateSkipList( - uint256 const& hash, + UInt256 const& hash, std::uint32_t seq, - std::vector const& sList) + std::vector const& sList) { { ScopedLockType const sl(mtx_); @@ -264,7 +264,7 @@ void LedgerReplayTask::addDelta(std::shared_ptr const& delta) { std::weak_ptr const wptr = shared_from_this(); - delta->addDataCallback(parameter_.reason, [wptr](bool good, uint256 const& hash) { + delta->addDataCallback(parameter_.reason, [wptr](bool good, UInt256 const& hash) { if (auto sptr = wptr.lock(); sptr) { if (!good) diff --git a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp index 52184c1723..47bf210f6a 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp @@ -46,7 +46,7 @@ LedgerReplayer::~LedgerReplayer() void LedgerReplayer::replay( InboundLedger::Reason r, - uint256 const& finishLedgerHash, + UInt256 const& finishLedgerHash, std::uint32_t totalNumLedgers) { XRPL_ASSERT( diff --git a/src/xrpld/app/ledger/detail/LocalTxs.cpp b/src/xrpld/app/ledger/detail/LocalTxs.cpp index d540134f8d..4ade84e4b2 100644 --- a/src/xrpld/app/ledger/detail/LocalTxs.cpp +++ b/src/xrpld/app/ledger/detail/LocalTxs.cpp @@ -58,7 +58,7 @@ public: expire_ = std::min(expire_, txn->getFieldU32(sfLastLedgerSequence) + 1); } - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& getID() const { return id_; @@ -91,7 +91,7 @@ public: private: std::shared_ptr txn_; LedgerIndex expire_; - uint256 id_; + UInt256 id_; AccountID account_; SeqProxy seqProxy_; }; @@ -115,7 +115,7 @@ public: CanonicalTXSet getTxSet() override { - CanonicalTXSet tset(uint256{}); + CanonicalTXSet tset(UInt256{}); // Get the set of local transactions as a canonical // set (so they apply in a valid order) diff --git a/src/xrpld/app/ledger/detail/OpenLedger.cpp b/src/xrpld/app/ledger/detail/OpenLedger.cpp index 4d8a37cdf1..6e81301442 100644 --- a/src/xrpld/app/ledger/detail/OpenLedger.cpp +++ b/src/xrpld/app/ledger/detail/OpenLedger.cpp @@ -61,7 +61,7 @@ OpenLedger::current() const } bool -OpenLedger::modify(modify_type const& f) +OpenLedger::modify(ModifyType const& f) { std::scoped_lock const lock1(modifyMutex_); auto next = std::make_shared(*current_); @@ -84,15 +84,15 @@ OpenLedger::accept( OrderedTxs& retries, ApplyFlags flags, std::string_view suffix, - modify_type const& f) + ModifyType const& f) { JLOG(j_.trace()) << "accept ledger " << ledger->seq() << " " << suffix; auto next = create(rules, ledger); if (retriesFirst) { // Handle disputed tx, outside lock - using empty = std::vector>; - apply(app, *next, *ledger, empty{}, retries, flags, j_); + using Empty = std::vector>; + apply(app, *next, *ledger, Empty{}, retries, flags, j_); } // Block calls to modify, otherwise // new tx going into the open ledger diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp index 97b50a9a3a..66b5f4f526 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp @@ -32,7 +32,7 @@ namespace xrpl { SkipListAcquire::SkipListAcquire( Application& app, InboundLedgers& inboundLedgers, - uint256 const& ledgerHash, + UInt256 const& ledgerHash, std::unique_ptr peerSet) : TimeoutCounter( app, @@ -201,7 +201,7 @@ SkipListAcquire::retrieveSkipList(std::shared_ptr const& ledger, S void SkipListAcquire::onSkipListAcquired( - std::vector const& skipList, + std::vector const& skipList, std::uint32_t ledgerSeq, ScopedLockType& sl) { diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.h b/src/xrpld/app/ledger/detail/SkipListAcquire.h index 6f8ceb8b74..1e2fa72d12 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.h +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.h @@ -36,14 +36,14 @@ public: * @param successful if the skipList data was acquired successfully * @param hash hash of the ledger that has the skipList */ - using OnSkipListDataCB = std::function; + using OnSkipListDataCB = std::function; struct SkipListData { std::uint32_t const ledgerSeq; - std::vector const skipList; + std::vector const skipList; - SkipListData(std::uint32_t const ledgerSeq, std::vector skipList) + SkipListData(std::uint32_t const ledgerSeq, std::vector skipList) : ledgerSeq(ledgerSeq), skipList(std::move(skipList)) { } @@ -59,7 +59,7 @@ public: SkipListAcquire( Application& app, InboundLedgers& inboundLedgers, - uint256 const& ledgerHash, + UInt256 const& ledgerHash, std::unique_ptr peerSet); ~SkipListAcquire() override; @@ -122,7 +122,7 @@ private: */ void onSkipListAcquired( - std::vector const& skipList, + std::vector const& skipList, std::uint32_t ledgerSeq, ScopedLockType& sl); diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp index 9cf58bee47..177843ee0f 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp @@ -20,7 +20,7 @@ using namespace std::chrono_literals; TimeoutCounter::TimeoutCounter( Application& app, - uint256 const& hash, + UInt256 const& hash, std::chrono::milliseconds interval, QueueJobParameter&& jobParameter, beast::Journal journal) diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.h b/src/xrpld/app/ledger/detail/TimeoutCounter.h index 682abf1537..93dd6feee4 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.h +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.h @@ -79,7 +79,7 @@ protected: TimeoutCounter( Application& app, - uint256 const& targetHash, + UInt256 const& targetHash, std::chrono::milliseconds timeoutInterval, QueueJobParameter&& jobParameter, beast::Journal journal); @@ -124,7 +124,7 @@ protected: * The hash of the object (in practice, always a ledger) we are trying to * fetch. */ - uint256 const hash_; + UInt256 const hash_; int timeouts_{0}; bool complete_{false}; bool failed_{false}; diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp index db99299fd6..0fdf0a15b3 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp @@ -36,7 +36,7 @@ static constexpr auto kMaxTimeouts = 20; TransactionAcquire::TransactionAcquire( Application& app, - uint256 const& hash, + UInt256 const& hash, std::unique_ptr peerSet) : TimeoutCounter( app, @@ -64,7 +64,7 @@ TransactionAcquire::done() JLOG(journal_.debug()) << "Acquired TX set " << hash_; map_->setImmutable(); - uint256 const& hash(hash_); + UInt256 const& hash(hash_); std::shared_ptr const& map(map_); auto const pap = &app_; // Note that, when we're in the process of shutting down, addJob() diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.h b/src/xrpld/app/ledger/detail/TransactionAcquire.h index e91b69f71e..3622a1a591 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.h +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.h @@ -28,7 +28,7 @@ class TransactionAcquire final : public TimeoutCounter, public: using pointer = std::shared_ptr; - TransactionAcquire(Application& app, uint256 const& hash, std::unique_ptr peerSet); + TransactionAcquire(Application& app, UInt256 const& hash, std::unique_ptr peerSet); ~TransactionAcquire() override = default; SHAMapAddNode diff --git a/src/xrpld/app/ledger/detail/TransactionMaster.cpp b/src/xrpld/app/ledger/detail/TransactionMaster.cpp index ac2aa1aabe..6b030cf5e7 100644 --- a/src/xrpld/app/ledger/detail/TransactionMaster.cpp +++ b/src/xrpld/app/ledger/detail/TransactionMaster.cpp @@ -40,7 +40,7 @@ TransactionMaster::TransactionMaster(Application& app) bool TransactionMaster::inLedger( - uint256 const& hash, + UInt256 const& hash, std::uint32_t ledger, std::optional tseq, std::optional netID) @@ -55,13 +55,13 @@ TransactionMaster::inLedger( } std::shared_ptr -TransactionMaster::fetchFromCache(uint256 const& txnID) +TransactionMaster::fetchFromCache(UInt256 const& txnID) { return cache_.fetch(txnID); } std::variant, std::shared_ptr>, TxSearched> -TransactionMaster::fetch(uint256 const& txnID, ErrorCodeI& ec) +TransactionMaster::fetch(UInt256 const& txnID, ErrorCodeI& ec) { using TxPair = std::pair, std::shared_ptr>; @@ -83,7 +83,7 @@ TransactionMaster::fetch(uint256 const& txnID, ErrorCodeI& ec) std::variant, std::shared_ptr>, TxSearched> TransactionMaster::fetch( - uint256 const& txnID, + UInt256 const& txnID, ClosedInterval const& range, ErrorCodeI& ec) { @@ -141,7 +141,7 @@ TransactionMaster::fetch( void TransactionMaster::canonicalize(std::shared_ptr* pTransaction) { - uint256 const tid = (*pTransaction)->getID(); + UInt256 const tid = (*pTransaction)->getID(); if (tid != beast::kZero) { auto txn = *pTransaction; @@ -157,7 +157,7 @@ TransactionMaster::sweep() cache_.sweep(); } -TaggedCache& +TaggedCache& TransactionMaster::getCache() { return cache_; diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 775471854d..fc30209f3b 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -243,7 +243,7 @@ public: std::unique_ptr inboundLedgers_; std::unique_ptr inboundTransactions_; std::unique_ptr ledgerReplayer_; - TaggedCache acceptedLedgerCache_; + TaggedCache acceptedLedgerCache_; std::unique_ptr networkOPs_; std::unique_ptr cluster_; std::unique_ptr peerReservations_; @@ -265,7 +265,7 @@ public: std::optional relationalDatabase_; std::unique_ptr walletDB_; std::unique_ptr overlay_; - std::optional trapTxID_; + std::optional trapTxID_; boost::asio::signal_set signals_; @@ -633,7 +633,7 @@ public: return *inboundTransactions_; } - TaggedCache& + TaggedCache& getAcceptedLedgerCache() override { return acceptedLedgerCache_; @@ -999,7 +999,7 @@ public: << "; size after: " << treeNodeCache->size(); } { - TaggedCache const& masterTxCache = + TaggedCache const& masterTxCache = getMasterTransaction().getCache(); std::size_t const oldMasterTxSize = masterTxCache.size(); @@ -1111,7 +1111,7 @@ public: return maxDisallowedLedger_; } - std::optional const& + std::optional const& getTrapTxID() const override { return trapTxID_; @@ -1142,7 +1142,7 @@ private: std::string const& ledgerID, bool replay, bool isFilename, - std::optional trapTxID); + std::optional trapTxID); void setMaxDisallowedLedger(); @@ -1400,7 +1400,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) { try { - auto logStream = beast::logstream{journal_.error()}; + auto logStream = beast::LogStream{journal_.error()}; auto setup = setupServerHandler(*config_, logStream); setup.makeContexts(); serverHandler_->setup(setup, journal_); @@ -1685,9 +1685,9 @@ ApplicationImp::fdRequired() const void ApplicationImp::startGenesisLedger() { - std::vector const initialAmendments = (config_->startUp == StartUpType::Fresh) + std::vector const initialAmendments = (config_->startUp == StartUpType::Fresh) ? amendmentTable_->getDesired() - : std::vector{}; + : std::vector{}; std::shared_ptr const genesis = std::make_shared( kCreateGenesis, @@ -1799,9 +1799,9 @@ ApplicationImp::loadLedgerFromFile(std::string const& name) if (ledger.get().isMember("close_time")) { - using tp = NetClock::time_point; - using d = tp::duration; - closeTime = tp{d{ledger.get()["close_time"].asUInt()}}; + using Tp = NetClock::time_point; + using D = Tp::duration; + closeTime = Tp{D{ledger.get()["close_time"].asUInt()}}; } if (ledger.get().isMember("close_time_resolution")) { @@ -1841,7 +1841,7 @@ ApplicationImp::loadLedgerFromFile(std::string const& name) return nullptr; } - uint256 uIndex; + UInt256 uIndex; if (!uIndex.parseHex(entry[jss::index].asString())) { @@ -1892,7 +1892,7 @@ ApplicationImp::loadOldLedger( std::string const& ledgerID, bool replay, bool isFileName, - std::optional trapTxID) + std::optional trapTxID) { try { @@ -1905,7 +1905,7 @@ ApplicationImp::loadOldLedger( } else if (ledgerID.length() == 64) { - uint256 hash; + UInt256 hash; if (hash.parseHex(ledgerID)) { diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 225275afe4..e3d119af75 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -43,7 +43,7 @@ template < class TaggedCache; class STLedgerEntry; using SLE = STLedgerEntry; -using CachedSLEs = TaggedCache; +using CachedSLEs = TaggedCache; class CollectorManager; class Family; diff --git a/src/xrpld/app/main/CollectorManager.cpp b/src/xrpld/app/main/CollectorManager.cpp index 87b5286f97..f38e5cc759 100644 --- a/src/xrpld/app/main/CollectorManager.cpp +++ b/src/xrpld/app/main/CollectorManager.cpp @@ -20,7 +20,7 @@ class CollectorManagerImp : public CollectorManager public: // NOLINTBEGIN(readability-identifier-naming) beast::Journal journal_; - beast::insight::Collector::ptr collector_; + beast::insight::Collector::Ptr collector_; std::unique_ptr groups_; // NOLINTEND(readability-identifier-naming) @@ -46,13 +46,13 @@ public: ~CollectorManagerImp() override = default; - beast::insight::Collector::ptr const& + beast::insight::Collector::Ptr const& collector() override { return collector_; } - beast::insight::Group::ptr const& + beast::insight::Group::Ptr const& group(std::string const& name) override { return groups_->get(name); diff --git a/src/xrpld/app/main/CollectorManager.h b/src/xrpld/app/main/CollectorManager.h index fac72b4de1..b8c219e96e 100644 --- a/src/xrpld/app/main/CollectorManager.h +++ b/src/xrpld/app/main/CollectorManager.h @@ -18,10 +18,10 @@ class CollectorManager public: virtual ~CollectorManager() = default; - virtual beast::insight::Collector::ptr const& + virtual beast::insight::Collector::Ptr const& collector() = 0; - virtual beast::insight::Group::ptr const& + virtual beast::insight::Group::Ptr const& group(std::string const& name) = 0; }; diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index c1ea5e874b..7edb279513 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -534,11 +534,11 @@ GRPCServerImpl::setupListeners() auto addToRequests = [&requests](auto callData) { requests.push_back(std::move(callData)); }; { - using cd = + using Cd = CallData; addToRequests( - std::make_shared( + std::make_shared( service_, *cq_, app_, @@ -550,12 +550,12 @@ GRPCServerImpl::setupListeners() secureGatewayIPs_)); } { - using cd = CallData< + using Cd = CallData< org::xrpl::rpc::v1::GetLedgerDataRequest, org::xrpl::rpc::v1::GetLedgerDataResponse>; addToRequests( - std::make_shared( + std::make_shared( service_, *cq_, app_, @@ -567,12 +567,12 @@ GRPCServerImpl::setupListeners() secureGatewayIPs_)); } { - using cd = CallData< + using Cd = CallData< org::xrpl::rpc::v1::GetLedgerDiffRequest, org::xrpl::rpc::v1::GetLedgerDiffResponse>; addToRequests( - std::make_shared( + std::make_shared( service_, *cq_, app_, @@ -584,12 +584,12 @@ GRPCServerImpl::setupListeners() secureGatewayIPs_)); } { - using cd = CallData< + using Cd = CallData< org::xrpl::rpc::v1::GetLedgerEntryRequest, org::xrpl::rpc::v1::GetLedgerEntryResponse>; addToRequests( - std::make_shared( + std::make_shared( service_, *cq_, app_, diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index 36f82e392b..82f44b26e2 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -90,9 +90,9 @@ LoadManager::run() beast::setCurrentThreadName("LoadManager"); using namespace std::chrono_literals; - using clock_type = std::chrono::steady_clock; + using ClockType = std::chrono::steady_clock; - auto t = clock_type::now(); + auto t = ClockType::now(); while (true) { diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index ba6520db5f..6217604e73 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -660,7 +660,7 @@ run(int argc, char** argv) config->startUp = StartUpType::Replay; if (vm.contains("trap_tx_hash")) { - uint256 tmp = {}; + UInt256 tmp = {}; auto hash = vm["trap_tx_hash"].as(); if (tmp.parseHex(hash)) { diff --git a/src/xrpld/app/misc/FeeVoteImpl.cpp b/src/xrpld/app/misc/FeeVoteImpl.cpp index f1cb944a52..30c9318364 100644 --- a/src/xrpld/app/misc/FeeVoteImpl.cpp +++ b/src/xrpld/app/misc/FeeVoteImpl.cpp @@ -293,7 +293,7 @@ FeeVoteImpl::doVoting( } }); - uint256 const txID = feeTx.getTransactionID(); + UInt256 const txID = feeTx.getTransactionID(); JLOG(journal_.warn()) << "Vote: " << txID; diff --git a/src/xrpld/app/misc/NegativeUNLVote.cpp b/src/xrpld/app/misc/NegativeUNLVote.cpp index 2ed440fba8..ab401dcfeb 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.cpp +++ b/src/xrpld/app/misc/NegativeUNLVote.cpp @@ -36,7 +36,7 @@ NegativeUNLVote::NegativeUNLVote(NodeID const& myId, beast::Journal j) : myId_(m void NegativeUNLVote::doVoting( std::shared_ptr const& prevLedger, - hash_set const& unlKeys, + HashSet const& unlKeys, RCLValidations& validations, std::shared_ptr const& initialSet) { @@ -48,8 +48,8 @@ NegativeUNLVote::doVoting( // Build NodeID set for internal use. // Build NodeID to PublicKey map for lookup before creating ttUNL_MODIFY Tx. - hash_set unlNodeIDs; - hash_map nidToKeyMap; + HashSet unlNodeIDs; + HashMap nidToKeyMap; for (auto const& k : unlKeys) { auto nid = calcNodeID(k); @@ -58,7 +58,7 @@ NegativeUNLVote::doVoting( } // Build a reliability score table of validators - if (std::optional> scoreTable = + if (std::optional> scoreTable = buildScoreTable(prevLedger, unlNodeIDs, validations)) { // build next negUnl @@ -70,7 +70,7 @@ NegativeUNLVote::doVoting( if (negUnlToReEnable) negUnlKeys.erase(*negUnlToReEnable); - hash_set negUnlNodeIDs; + HashSet negUnlNodeIDs; for (auto const& k : negUnlKeys) { auto nid = calcNodeID(k); @@ -138,10 +138,10 @@ NegativeUNLVote::addTx( } NodeID -NegativeUNLVote::choose(uint256 const& randomPadData, std::vector const& candidates) +NegativeUNLVote::choose(UInt256 const& randomPadData, std::vector const& candidates) { XRPL_ASSERT(!candidates.empty(), "xrpl::NegativeUNLVote::choose : non-empty input"); - static_assert(NodeID::kBytes <= uint256::kBytes); + static_assert(NodeID::kBytes <= UInt256::kBytes); NodeID const randomPad = NodeID::fromVoid(randomPadData.data()); NodeID txNodeID = candidates[0]; for (int j = 1; j < candidates.size(); ++j) @@ -154,10 +154,10 @@ NegativeUNLVote::choose(uint256 const& randomPadData, std::vector const& return txNodeID; } -std::optional> +std::optional> NegativeUNLVote::buildScoreTable( std::shared_ptr const& prevLedger, - hash_set const& unl, + HashSet const& unl, RCLValidations& validations) { // Find agreed validation messages received for @@ -186,7 +186,7 @@ NegativeUNLVote::buildScoreTable( } // have enough ledger ancestors, build the score table - hash_map scoreTable; + HashMap scoreTable; for (auto const& k : unl) { scoreTable[k] = 0; @@ -234,9 +234,9 @@ NegativeUNLVote::buildScoreTable( NegativeUNLVote::Candidates NegativeUNLVote::findAllCandidates( - hash_set const& unl, - hash_set const& negUnl, - hash_map const& scoreTable) + HashSet const& unl, + HashSet const& negUnl, + HashMap const& scoreTable) { // Compute if need to find more validators to disable auto const canAdd = [&]() -> bool { @@ -307,7 +307,7 @@ NegativeUNLVote::findAllCandidates( } void -NegativeUNLVote::newValidators(LedgerIndex seq, hash_set const& nowTrusted) +NegativeUNLVote::newValidators(LedgerIndex seq, HashSet const& nowTrusted) { std::scoped_lock const lock(mutex_); for (auto const& n : nowTrusted) diff --git a/src/xrpld/app/misc/NegativeUNLVote.h b/src/xrpld/app/misc/NegativeUNLVote.h index a01bf04dcf..b5b57be571 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.h +++ b/src/xrpld/app/misc/NegativeUNLVote.h @@ -93,7 +93,7 @@ public: void doVoting( std::shared_ptr const& prevLedger, - hash_set const& unlKeys, + HashSet const& unlKeys, RCLValidations& validations, std::shared_ptr const& initialSet); @@ -105,13 +105,13 @@ public: * @param nowTrusted the new validators */ void - newValidators(LedgerIndex seq, hash_set const& nowTrusted); + newValidators(LedgerIndex seq, HashSet const& nowTrusted); private: NodeID const myId_; beast::Journal j_; mutable std::mutex mutex_; - hash_map newValidators_; + HashMap newValidators_; /** * UNLModify Tx candidates @@ -147,7 +147,7 @@ private: * @return the picked candidate */ static NodeID - choose(uint256 const& randomPadData, std::vector const& candidates); + choose(UInt256 const& randomPadData, std::vector const& candidates); /** * Build a reliability measurement score table of validators' validation @@ -163,10 +163,10 @@ private: * @return the built scoreTable or empty optional if table could not be * built */ - std::optional> + std::optional> buildScoreTable( std::shared_ptr const& prevLedger, - hash_set const& unl, + HashSet const& unl, RCLValidations& validations); /** @@ -180,9 +180,9 @@ private: */ Candidates findAllCandidates( - hash_set const& unl, - hash_set const& negUnl, - hash_map const& scoreTable); + HashSet const& unl, + HashSet const& negUnl, + HashMap const& scoreTable); /** * Purge validators that are not new anymore. diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 102ef76779..7b99053dc2 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -303,7 +303,7 @@ class NetworkOPsImp final : public NetworkOPs public: NetworkOPsImp( ServiceRegistry& registry, - NetworkOPs::clock_type& clock, + NetworkOPs::ClockType& clock, bool standalone, std::size_t minPeerCount, bool startValid, @@ -312,7 +312,7 @@ public: ValidatorKeys const& validatorKeys, boost::asio::io_context& ioCtx, beast::Journal journal, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : registry_(registry) , journal_(journal) , localTX_(makeLocalTxs()) @@ -468,11 +468,11 @@ private: void switchLastClosedLedger(std::shared_ptr const& newLCL); bool - checkLastClosedLedger(Overlay::PeerSequence const&, uint256& networkClosed); + checkLastClosedLedger(Overlay::PeerSequence const&, UInt256& networkClosed); public: bool - beginConsensus(uint256 const& networkClosed, std::unique_ptr const& clog) + beginConsensus(UInt256 const& networkClosed, std::unique_ptr const& clog) override; void endConsensus(std::unique_ptr const& clog) override; @@ -559,22 +559,21 @@ public: // InfoSub::Source. // void - subAccount(InfoSub::ref ispListener, hash_set const& vnaAccountIDs, bool rt) - override; + subAccount(InfoSub::Ref ispListener, HashSet const& vnaAccountIDs, bool rt) override; void - unsubAccount(InfoSub::ref ispListener, hash_set const& vnaAccountIDs, bool rt) + unsubAccount(InfoSub::Ref ispListener, HashSet const& vnaAccountIDs, bool rt) override; // Just remove the subscription from the tracking // not from the InfoSub. Needed for InfoSub destruction void - unsubAccountInternal(std::uint64_t seq, hash_set const& vnaAccountIDs, bool rt) + unsubAccountInternal(std::uint64_t seq, HashSet const& vnaAccountIDs, bool rt) override; ErrorCodeI - subAccountHistory(InfoSub::ref ispListener, AccountID const& account) override; + subAccountHistory(InfoSub::Ref ispListener, AccountID const& account) override; void - unsubAccountHistory(InfoSub::ref ispListener, AccountID const& account, bool historyOnly) + unsubAccountHistory(InfoSub::Ref ispListener, AccountID const& account, bool historyOnly) override; void @@ -584,70 +583,70 @@ public: void scheduleAccountCleanup( std::uint64_t seq, - hash_set rtAccounts, - hash_set normalAccounts, - hash_set historyAccounts) override; + HashSet rtAccounts, + HashSet normalAccounts, + HashSet historyAccounts) override; bool - subLedger(InfoSub::ref ispListener, json::Value& jvResult) override; + subLedger(InfoSub::Ref ispListener, json::Value& jvResult) override; bool unsubLedger(std::uint64_t uListener) override; bool - subBookChanges(InfoSub::ref ispListener) override; + subBookChanges(InfoSub::Ref ispListener) override; bool unsubBookChanges(std::uint64_t uListener) override; bool - subServer(InfoSub::ref ispListener, json::Value& jvResult, bool admin) override; + subServer(InfoSub::Ref ispListener, json::Value& jvResult, bool admin) override; bool unsubServer(std::uint64_t uListener) override; bool - subBook(InfoSub::ref ispListener, Book const&) override; + subBook(InfoSub::Ref ispListener, Book const&) override; bool - unsubBook(InfoSub::ref ispListener, Book const&) override; + unsubBook(InfoSub::Ref ispListener, Book const&) override; bool unsubBookInternal(std::uint64_t uListener, Book const&) override; bool - subManifests(InfoSub::ref ispListener) override; + subManifests(InfoSub::Ref ispListener) override; bool unsubManifests(std::uint64_t uListener) override; void pubManifest(Manifest const&) override; bool - subTransactions(InfoSub::ref ispListener) override; + subTransactions(InfoSub::Ref ispListener) override; bool unsubTransactions(std::uint64_t uListener) override; bool - subRTTransactions(InfoSub::ref ispListener) override; + subRTTransactions(InfoSub::Ref ispListener) override; bool unsubRTTransactions(std::uint64_t uListener) override; bool - subValidations(InfoSub::ref ispListener) override; + subValidations(InfoSub::Ref ispListener) override; bool unsubValidations(std::uint64_t uListener) override; bool - subPeerStatus(InfoSub::ref ispListener) override; + subPeerStatus(InfoSub::Ref ispListener) override; bool unsubPeerStatus(std::uint64_t uListener) override; void pubPeerStatus(std::function const&) override; bool - subConsensus(InfoSub::ref ispListener) override; + subConsensus(InfoSub::Ref ispListener) override; bool unsubConsensus(std::uint64_t uListener) override; InfoSub::pointer findRpcSub(std::string const& strUrl) override; InfoSub::pointer - addRpcSub(std::string const& strUrl, InfoSub::ref) override; + addRpcSub(std::string const& strUrl, InfoSub::Ref) override; bool tryRemoveRpcSub(std::string const& strUrl) override; @@ -805,9 +804,9 @@ private: getHostId(bool forAdmin); private: - using SubMapType = hash_map; - using SubInfoMapType = hash_map; - using subRpcMapType = hash_map; + using SubMapType = HashMap; + using SubInfoMapType = HashMap; + using SubRpcMapType = HashMap; /* * With a validated ledger to separate history and future, the node @@ -841,11 +840,11 @@ private: }; struct SubAccountHistoryInfoWeak { - InfoSub::wptr sinkWptr; + InfoSub::Wptr sinkWptr; std::shared_ptr index; }; using SubAccountHistoryMapType = - hash_map>; + HashMap>; /** * @note called while holding accountLock_ (it only touches @@ -884,7 +883,7 @@ private: * between chunks so a competing publish can interleave; no iterator is held * across the unlock, so a concurrent mutation cannot dangle. * - * @tparam OuterMap hash_map>. + * @tparam OuterMap HashMap>. * @tparam BeforeErase Invoked with the inner value about to be erased, for * per-entry teardown the plain account maps do not need * (the history map uses it to stop its paging job). @@ -898,7 +897,7 @@ private: void cleanupSubscriptionMap( std::uint64_t seq, - hash_set const& accounts, + HashSet const& accounts, OuterMap& outerMap, BeforeErase&& beforeErase); @@ -912,7 +911,7 @@ private: void cleanupAccountSubscriptions( std::uint64_t seq, - hash_set const& accounts, + HashSet const& accounts, SubInfoMapType& subMap); /** @@ -920,7 +919,7 @@ private: * accountLock_-bounded chunks. Keyed on seq. See kAccountCleanupChunk. */ void - cleanupAccountHistorySubscriptions(std::uint64_t seq, hash_set const& accounts); + cleanupAccountHistorySubscriptions(std::uint64_t seq, HashSet const& accounts); std::reference_wrapper registry_; beast::Journal journal_; @@ -971,13 +970,13 @@ private: * by pubBookTransaction and eagerly by unsubBookInternal (~InfoSub path). * Guarded by bookLock_. */ - using SubBookMapType = hash_map; + using SubBookMapType = HashMap; SubInfoMapType subAccount_; SubInfoMapType subRTAccount_; SubBookMapType subBook_; ///< Guarded by bookLock_. - subRpcMapType rpcSubMap_; + SubRpcMapType rpcSubMap_; SubAccountHistoryMapType subAccountHistory_; @@ -1020,14 +1019,14 @@ private: StateAccounting accounting_; - std::set pendingValidations_; + std::set pendingValidations_; std::mutex validationsMutex_; private: struct Stats { template - Stats(Handler const& handler, beast::insight::Collector::ptr const& collector) + Stats(Handler const& handler, beast::insight::Collector::Ptr const& collector) : hook(collector->makeHook(handler)) , disconnectedDuration( collector->makeGauge("State_Accounting", "Disconnected_duration")) @@ -2055,7 +2054,7 @@ NetworkOPsImp::clearUNLBlocked() } bool -NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint256& networkClosed) +NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, UInt256& networkClosed) { // Returns true if there's an *abnormal* ledger issue, normal changing in // TRACKING mode should return false. Do we have sufficient validations for @@ -2069,8 +2068,8 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint if (!ourClosed) return false; - uint256 closedLedger = ourClosed->header().hash; - uint256 const prevClosedLedger = ourClosed->header().parentHash; + UInt256 closedLedger = ourClosed->header().hash; + UInt256 const prevClosedLedger = ourClosed->header().parentHash; JLOG(journal_.trace()) << "OurClosed: " << closedLedger; JLOG(journal_.trace()) << "PrevClosed: " << prevClosedLedger; @@ -2081,14 +2080,14 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint JLOG(journal_.debug()) << "ValidationTrie " << json::Compact(validations.getJsonTrie()); // Will rely on peer LCL if no trusted validations exist - hash_map peerCounts; + HashMap peerCounts; peerCounts[closedLedger] = 0; if (mode_ >= OperatingMode::TRACKING) peerCounts[closedLedger]++; for (auto& peer : peerList) { - uint256 const peerLedger = peer->getClosedLedgerHash(); + UInt256 const peerLedger = peer->getClosedLedgerHash(); if (peerLedger.isNonZero()) ++peerCounts[peerLedger]; @@ -2097,7 +2096,7 @@ NetworkOPsImp::checkLastClosedLedger(Overlay::PeerSequence const& peerList, uint for (auto const& it : peerCounts) JLOG(journal_.debug()) << "L: " << it.first << " n=" << it.second; - uint256 const preferredLCL = validations.getPreferredLCL( + UInt256 const preferredLCL = validations.getPreferredLCL( RCLValidatedLedger{ourClosed, validations.adaptor().journal()}, ledgerMaster_.getValidLedgerIndex(), peerCounts); @@ -2216,7 +2215,7 @@ NetworkOPsImp::switchLastClosedLedger(std::shared_ptr const& newLC bool NetworkOPsImp::beginConsensus( - uint256 const& networkClosed, + UInt256 const& networkClosed, std::unique_ptr const& clog) { XRPL_ASSERT(networkClosed.isNonZero(), "xrpl::NetworkOPsImp::beginConsensus : nonzero input"); @@ -2330,7 +2329,7 @@ NetworkOPsImp::mapComplete(std::shared_ptr const& map, bool fromAcquire) void NetworkOPsImp::endConsensus(std::unique_ptr const& clog) { - uint256 const deadLedger = ledgerMaster_.getClosedLedger()->header().parentHash; + UInt256 const deadLedger = ledgerMaster_.getClosedLedger()->header().parentHash; for (auto const& it : registry_.get().getOverlay().getActivePeers()) { if (it && (it->getClosedLedgerHash() == deadLedger)) @@ -2340,7 +2339,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) } } - uint256 networkClosed; + UInt256 networkClosed; bool const ledgerChange = checkLastClosedLedger(registry_.get().getOverlay().getActivePeers(), networkClosed); @@ -3662,7 +3661,7 @@ NetworkOPsImp::pubBookTransaction(AcceptedLedgerTx const& alTx, MultiApiJson con // safely with concurrent traffic. std::vector listeners; - hash_set seen; + HashSet seen; // Sized for the common case where every affected book has at most // one subscriber. Multi-subscriber books trigger reallocation, but @@ -3720,7 +3719,7 @@ NetworkOPsImp::pubAccountTransaction( AcceptedLedgerTx const& transaction, bool last) { - hash_set notify; + HashSet notify; int iProposed = 0; int iAccepted = 0; @@ -3819,7 +3818,7 @@ NetworkOPsImp::pubAccountTransaction( auto const trResult = transaction.getResult(); MultiApiJson jvObj = transJson(stTxn, trResult, true, ledger, metaRef); - for (InfoSub::ref isrListener : notify) + for (InfoSub::Ref isrListener : notify) { jvObj.visit( isrListener->getApiVersion(), // @@ -3854,7 +3853,7 @@ NetworkOPsImp::pubProposedAccountTransaction( std::shared_ptr const& tx, TER result) { - hash_set notify; + HashSet notify; int iProposed = 0; std::vector accountHistoryNotify; @@ -3901,7 +3900,7 @@ NetworkOPsImp::pubProposedAccountTransaction( // Create two different Json objects, for different API versions MultiApiJson jvObj = transJson(tx, result, false, ledger, std::nullopt); - for (InfoSub::ref isrListener : notify) + for (InfoSub::Ref isrListener : notify) { jvObj.visit( isrListener->getApiVersion(), // @@ -3931,8 +3930,8 @@ NetworkOPsImp::pubProposedAccountTransaction( void NetworkOPsImp::subAccount( - InfoSub::ref isrListener, - hash_set const& vnaAccountIDs, + InfoSub::Ref isrListener, + HashSet const& vnaAccountIDs, bool rt) { SubInfoMapType& subMap = rt ? subRTAccount_ : subAccount_; @@ -3967,8 +3966,8 @@ NetworkOPsImp::subAccount( void NetworkOPsImp::unsubAccount( - InfoSub::ref isrListener, - hash_set const& vnaAccountIDs, + InfoSub::Ref isrListener, + HashSet const& vnaAccountIDs, bool rt) { for (auto const& naAccountID : vnaAccountIDs) @@ -3984,7 +3983,7 @@ NetworkOPsImp::unsubAccount( void NetworkOPsImp::unsubAccountInternal( std::uint64_t uSeq, - hash_set const& vnaAccountIDs, + HashSet const& vnaAccountIDs, bool rt) { std::scoped_lock const sl(accountLock_); @@ -4013,7 +4012,7 @@ template void NetworkOPsImp::cleanupSubscriptionMap( std::uint64_t seq, - hash_set const& accounts, + HashSet const& accounts, OuterMap& outerMap, BeforeErase&& beforeErase) { @@ -4053,17 +4052,17 @@ NetworkOPsImp::cleanupSubscriptionMap( void NetworkOPsImp::cleanupAccountSubscriptions( std::uint64_t seq, - hash_set const& accounts, + HashSet const& accounts, SubInfoMapType& subMap) { // Plain account maps need no per-entry teardown before erase. - cleanupSubscriptionMap(seq, accounts, subMap, [](InfoSub::wptr const&) {}); + cleanupSubscriptionMap(seq, accounts, subMap, [](InfoSub::Wptr const&) {}); } void NetworkOPsImp::cleanupAccountHistorySubscriptions( std::uint64_t seq, - hash_set const& accounts) + HashSet const& accounts) { // Cancel any in-flight historical paging job for this connection before // dropping its record. The job holds its own shared_ptr to the index, so @@ -4078,9 +4077,9 @@ NetworkOPsImp::cleanupAccountHistorySubscriptions( void NetworkOPsImp::scheduleAccountCleanup( std::uint64_t seq, - hash_set rtAccounts, - hash_set normalAccounts, - hash_set historyAccounts) + HashSet rtAccounts, + HashSet normalAccounts, + HashSet historyAccounts) { // Nothing to do for a connection that never subscribed to any account. if (rtAccounts.empty() && normalAccounts.empty() && historyAccounts.empty()) @@ -4398,7 +4397,7 @@ NetworkOPsImp::subAccountHistoryStart( } ErrorCodeI -NetworkOPsImp::subAccountHistory(InfoSub::ref isrListener, AccountID const& accountId) +NetworkOPsImp::subAccountHistory(InfoSub::Ref isrListener, AccountID const& accountId) { if (!isrListener->insertSubAccountHistory(accountId)) { @@ -4413,7 +4412,7 @@ NetworkOPsImp::subAccountHistory(InfoSub::ref isrListener, AccountID const& acco auto simIterator = subAccountHistory_.find(accountId); if (simIterator == subAccountHistory_.end()) { - hash_map inner; + HashMap inner; inner.emplace(isrListener->getSeq(), ahi); subAccountHistory_.insert(simIterator, std::make_pair(accountId, inner)); } @@ -4440,7 +4439,7 @@ NetworkOPsImp::subAccountHistory(InfoSub::ref isrListener, AccountID const& acco void NetworkOPsImp::unsubAccountHistory( - InfoSub::ref isrListener, + InfoSub::Ref isrListener, AccountID const& account, bool historyOnly) { @@ -4480,7 +4479,7 @@ NetworkOPsImp::unsubAccountHistoryInternal( } bool -NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) +NetworkOPsImp::subBook(InfoSub::Ref isrListener, Book const& book) { // Server-side insert first, then InfoSub bookkeeping. If the InfoSub-side // insert throws, the orphan in subBook_ is cleared by the expired-weak_ptr @@ -4495,7 +4494,7 @@ NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) } bool -NetworkOPsImp::unsubBook(InfoSub::ref isrListener, Book const& book) +NetworkOPsImp::unsubBook(InfoSub::Ref isrListener, Book const& book) { // Mirrors unsubAccount: clear the per-subscriber tracking set first so // ~InfoSub does not re-issue an unsubBookInternal for a book the caller @@ -4536,7 +4535,7 @@ NetworkOPsImp::acceptLedger(std::optional consensusDe // <-- bool: true=added, false=already there bool -NetworkOPsImp::subLedger(InfoSub::ref isrListener, json::Value& jvResult) +NetworkOPsImp::subLedger(InfoSub::Ref isrListener, json::Value& jvResult) { if (auto lpClosed = ledgerMaster_.getValidatedLedger()) { @@ -4563,7 +4562,7 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, json::Value& jvResult) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subBookChanges(InfoSub::ref isrListener) +NetworkOPsImp::subBookChanges(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SBookChanges].emplace(isrListener->getSeq(), isrListener).second; @@ -4587,7 +4586,7 @@ NetworkOPsImp::unsubBookChanges(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subManifests(InfoSub::ref isrListener) +NetworkOPsImp::subManifests(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SManifests].emplace(isrListener->getSeq(), isrListener).second; @@ -4603,9 +4602,9 @@ NetworkOPsImp::unsubManifests(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subServer(InfoSub::ref isrListener, json::Value& jvResult, bool admin) +NetworkOPsImp::subServer(InfoSub::Ref isrListener, json::Value& jvResult, bool admin) { - uint256 uRandom; + UInt256 uRandom; if (standalone_) jvResult[jss::stand_alone] = standalone_; @@ -4636,7 +4635,7 @@ NetworkOPsImp::unsubServer(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subTransactions(InfoSub::ref isrListener) +NetworkOPsImp::subTransactions(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[STransactions].emplace(isrListener->getSeq(), isrListener).second; @@ -4652,7 +4651,7 @@ NetworkOPsImp::unsubTransactions(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subRTTransactions(InfoSub::ref isrListener) +NetworkOPsImp::subRTTransactions(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SRtTransactions].emplace(isrListener->getSeq(), isrListener).second; @@ -4668,7 +4667,7 @@ NetworkOPsImp::unsubRTTransactions(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subValidations(InfoSub::ref isrListener) +NetworkOPsImp::subValidations(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SValidations].emplace(isrListener->getSeq(), isrListener).second; @@ -4690,7 +4689,7 @@ NetworkOPsImp::unsubValidations(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subPeerStatus(InfoSub::ref isrListener) +NetworkOPsImp::subPeerStatus(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SPeerStatus].emplace(isrListener->getSeq(), isrListener).second; @@ -4706,7 +4705,7 @@ NetworkOPsImp::unsubPeerStatus(std::uint64_t uSeq) // <-- bool: true=added, false=already there bool -NetworkOPsImp::subConsensus(InfoSub::ref isrListener) +NetworkOPsImp::subConsensus(InfoSub::Ref isrListener) { std::scoped_lock const sl(streamLock_); return streamMaps_[SConsensusPhase].emplace(isrListener->getSeq(), isrListener).second; @@ -4740,7 +4739,7 @@ NetworkOPsImp::findRpcSub(std::string const& strUrl) } InfoSub::pointer -NetworkOPsImp::addRpcSub(std::string const& strUrl, InfoSub::ref rspEntry) +NetworkOPsImp::addRpcSub(std::string const& strUrl, InfoSub::Ref rspEntry) { std::scoped_lock const sl(streamLock_); @@ -4798,9 +4797,9 @@ NetworkOPsImp::getBookPage( json::Value& jvOffers = (jvResult[jss::offers] = json::Value(json::ValueType::Array)); std::unordered_map umBalance; - uint256 const uBookBase = getBookBase(book); - uint256 const uBookEnd = getQualityNext(uBookBase); - uint256 uTipIndex = uBookBase; + UInt256 const uBookBase = getBookBase(book); + UInt256 const uBookEnd = getQualityNext(uBookBase); + UInt256 uTipIndex = uBookBase; if (auto stream = journal_.trace()) { @@ -4818,7 +4817,7 @@ NetworkOPsImp::getBookPage( bool bDirectAdvance = true; SLE::const_pointer sleOfferDir; - uint256 offerIndex; + UInt256 offerIndex; unsigned int uBookEntry = 0; STAmount saDirRate; @@ -5253,7 +5252,7 @@ NetworkOPsImp::StateAccounting::json(json::Value& obj) const std::unique_ptr makeNetworkOPs( ServiceRegistry& registry, - NetworkOPs::clock_type& clock, + NetworkOPs::ClockType& clock, bool standalone, std::size_t minPeerCount, bool startValid, @@ -5262,7 +5261,7 @@ makeNetworkOPs( ValidatorKeys const& validatorKeys, boost::asio::io_context& ioCtx, beast::Journal journal, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) { return std::make_unique( registry, diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index 61951fbb59..4f15d74755 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -55,7 +55,7 @@ class Transaction : public std::enable_shared_from_this, { public: using pointer = std::shared_ptr; - using ref = pointer const&; + using Ref = pointer const&; Transaction(std::shared_ptr const&, std::string&, Application&) noexcept; @@ -79,7 +79,7 @@ public: return transaction_; } - uint256 const& + UInt256 const& getID() const { return transactionID_; @@ -312,7 +312,7 @@ public: // at the time of search. struct Locator { - std::variant, ClosedInterval> locator; + std::variant, ClosedInterval> locator; /** * @return true if transaction was found, false otherwise @@ -324,7 +324,7 @@ public: [[nodiscard]] bool isFound() const { - return std::holds_alternative>(locator); + return std::holds_alternative>(locator); } /** @@ -332,10 +332,10 @@ public: * * @throws if isFound() returns false */ - uint256 const& + UInt256 const& getNodestoreHash() { - return std::get>(locator).first; + return std::get>(locator).first; } /** @@ -346,7 +346,7 @@ public: uint32_t getLedgerSequence() { - return std::get>(locator).second; + return std::get>(locator).second; } /** @@ -362,16 +362,16 @@ public: }; static Locator - locate(uint256 const& id, Application& app); + locate(UInt256 const& id, Application& app); static std:: variant, std::shared_ptr>, TxSearched> - load(uint256 const& id, Application& app, ErrorCodeI& ec); + load(UInt256 const& id, Application& app, ErrorCodeI& ec); static std:: variant, std::shared_ptr>, TxSearched> load( - uint256 const& id, + UInt256 const& id, Application& app, ClosedInterval const& range, ErrorCodeI& ec); @@ -380,12 +380,12 @@ private: static std:: variant, std::shared_ptr>, TxSearched> load( - uint256 const& id, + UInt256 const& id, Application& app, std::optional> const& range, ErrorCodeI& ec); - uint256 transactionID_; + UInt256 transactionID_; LedgerIndex ledgerIndex_ = 0; std::optional txnSeq_; diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index 4e6e9edbac..2de59e9160 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -370,7 +370,7 @@ public: * Return the next sequence that would go in the TxQ for an account. */ SeqProxy - nextQueuableSeq(SLE::const_ref sleAccount) const; + nextQueuableSeq(SLE::ConstRef sleAccount) const; /** * Returns fee metrics in reference fee level units. @@ -428,7 +428,7 @@ public: private: // Implementation for nextQueuableSeq(). The passed lock must be held. SeqProxy - nextQueuableSeqImpl(SLE::const_ref sleAccount, std::scoped_lock const&) const; + nextQueuableSeqImpl(SLE::ConstRef sleAccount, std::scoped_lock const&) const; /** * Track and use the fee escalation metrics of the @@ -949,7 +949,7 @@ private: STTx const&, ApplyFlags const, OpenView const&, - SLE::const_ref sleAccount, + SLE::ConstRef sleAccount, AccountMap::iterator const&, std::optional const&, std::scoped_lock const& lock); diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index 4e001affe8..29d57142a6 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -120,8 +120,8 @@ struct TrustChanges { explicit TrustChanges() = default; - hash_set added; - hash_set removed; + HashSet added; + HashSet removed; }; /** @@ -202,7 +202,7 @@ class ValidatorList // base-64 or hex-encoded manifest containing the publisher's master and // signing public keys std::optional rawManifest; - uint256 hash; + UInt256 hash; }; struct PublisherListCollection @@ -230,7 +230,7 @@ class ValidatorList std::map remaining; std::optional maxSequence; // The hash of the full set if sent in a single message - uint256 fullHash; + UInt256 fullHash; std::string rawManifest; std::uint32_t rawVersion = 0; }; @@ -241,20 +241,20 @@ class ValidatorList std::filesystem::path const dataPath_; beast::Journal const j_; std::shared_mutex mutable mutex_; - using scoped_lock = std::scoped_lock; - using shared_lock = std::shared_lock; + using ScopedLock = std::scoped_lock; + using SharedLock = std::shared_lock; std::atomic quorum_; std::optional minimumQuorum_; // Published lists stored by publisher master public key - hash_map publisherLists_; + HashMap publisherLists_; // Listed master public keys with the number of lists they appear on - hash_map keyListings_; + HashMap keyListings_; // The current list of trusted master keys - hash_set trustedMasterKeys_; + HashSet trustedMasterKeys_; // Minimum number of lists on which a trusted validator must appear on std::size_t listThreshold_{1}; @@ -262,7 +262,7 @@ class ValidatorList // The current list of trusted signing keys. For those validators using // a manifest, the signing key is the ephemeral key. For the ones using // a seed, the signing key is the same as the master key. - hash_set trustedSigningKeys_; + HashSet trustedSigningKeys_; std::optional localPubKey_; @@ -277,7 +277,7 @@ class ValidatorList PublisherList localPublisherList_; // The master public keys of the current negative UNL - hash_set negativeUNL_; + HashSet negativeUNL_; // Currently supported versions of publisher list format static constexpr std::uint32_t kSupportedListVersions[]{1, 2}; @@ -329,10 +329,10 @@ public: explicit MessageWithHash() = default; explicit MessageWithHash( std::shared_ptr const& message, - uint256 hash, + UInt256 hash, std::size_t num); std::shared_ptr message; - uint256 hash; + UInt256 hash; std::size_t numVLs = 0; }; @@ -431,7 +431,7 @@ public: std::uint32_t version, std::vector const& blobs, std::string siteUri, - uint256 const& hash, + UInt256 const& hash, Overlay& overlay, HashRouter& hashRouter, NetworkOPs& networkOPs); @@ -463,7 +463,7 @@ public: std::uint32_t version, std::vector const& blobs, std::string siteUri, - std::optional const& hash = {}); + std::optional const& hash = {}); /** * Attempt to read previously stored list files. Expected to only be @@ -496,7 +496,7 @@ public: */ TrustChanges updateTrusted( - hash_set const& seenValidators, + HashSet const& seenValidators, NetClock::time_point closeTime, NetworkOPs& ops, Overlay& overlay, @@ -652,7 +652,7 @@ public: std::map const& blobInfos, PublicKey const& pubKey, std::size_t maxSequence, - uint256 const& hash)> func) const; + UInt256 const& hash)> func) const; /** * Returns the current valid list for the given publisher key, @@ -689,7 +689,7 @@ public: json::Value getJson() const; - using QuorumKeys = std::pair>; + using QuorumKeys = std::pair>; /** * Get the quorum and all of the trusted keys. * @@ -698,7 +698,7 @@ public: QuorumKeys getQuorumKeys() const { - shared_lock const readLock{mutex_}; + SharedLock const readLock{mutex_}; return {quorum_, trustedSigningKeys_}; } @@ -706,7 +706,7 @@ public: * get the trusted master public keys * @return the public keys */ - hash_set + HashSet getTrustedMasterKeys() const; /** @@ -720,7 +720,7 @@ public: * get the master public keys of Negative UNL validators * @return the master public keys */ - hash_set + HashSet getNegativeUNL() const; /** @@ -728,7 +728,7 @@ public: * @param negUnl the public keys */ void - setNegativeUNL(hash_set const& negUnl); + setNegativeUNL(HashSet const& negUnl); /** * Remove validations that are from validators on the negative UNL. @@ -744,7 +744,7 @@ private: * Return the number of configured validator list sites. */ std::size_t - count(shared_lock const&) const; + count(SharedLock const&) const; /** * Returns `true` if public key is trusted @@ -756,7 +756,7 @@ private: * May be called concurrently */ bool - trusted(shared_lock const&, PublicKey const& identity) const; + trusted(SharedLock const&, PublicKey const& identity) const; /** * Returns master public key if public key is trusted @@ -770,7 +770,7 @@ private: * May be called concurrently */ std::optional - getTrustedKey(shared_lock const&, PublicKey const& identity) const; + getTrustedKey(SharedLock const&, PublicKey const& identity) const; /** * Return the time when the validator list will expire @@ -783,7 +783,7 @@ private: * May be called concurrently */ std::optional - expires(shared_lock const&) const; + expires(SharedLock const&) const; /** * Apply published list of public keys @@ -816,8 +816,8 @@ private: std::string const& signature, std::uint32_t version, std::string siteUri, - std::optional const& hash, - scoped_lock const&); + std::optional const& hash, + ScopedLock const&); // This function updates the keyListings_ counts for all the trusted // master keys @@ -826,7 +826,7 @@ private: PublicKey const& pubKey, PublisherList const& current, std::vector const& oldList, - scoped_lock const&); + ScopedLock const&); static void buildBlobInfos( @@ -841,7 +841,7 @@ private: PublicKey const& publisherKey, PublisherListCollection const& lists, std::size_t maxSequence, - uint256 const& hash, + UInt256 const& hash, Overlay& overlay, HashRouter& hashRouter, beast::Journal j); @@ -863,7 +863,7 @@ private: * Get the filename used for caching UNLs */ std::filesystem::path - getCacheFileName(scoped_lock const&, PublicKey const& pubKey) const; + getCacheFileName(ScopedLock const&, PublicKey const& pubKey) const; /** * Build a Json representation of the collection, suitable for @@ -898,7 +898,7 @@ private: * Write a JSON UNL to a cache file */ void - cacheValidatorFile(scoped_lock const& lock, PublicKey const& pubKey) const; + cacheValidatorFile(ScopedLock const& lock, PublicKey const& pubKey) const; /** * Check response for trusted valid published list @@ -911,7 +911,7 @@ private: */ std::pair> verify( - scoped_lock const&, + ScopedLock const&, json::Value& list, Manifest manifest, std::string const& blob, @@ -929,7 +929,7 @@ private: * Calling public member function is expected to lock mutex */ bool - removePublisherList(scoped_lock const&, PublicKey const& publisherKey, PublisherStatus reason); + removePublisherList(ScopedLock const&, PublicKey const& publisherKey, PublisherStatus reason); /** * Return quorum for trusted validator set diff --git a/src/xrpld/app/misc/ValidatorSite.h b/src/xrpld/app/misc/ValidatorSite.h index 7e7ad098eb..f0db921a21 100644 --- a/src/xrpld/app/misc/ValidatorSite.h +++ b/src/xrpld/app/misc/ValidatorSite.h @@ -57,15 +57,15 @@ class ValidatorSite friend class Work; private: - using error_code = boost::system::error_code; - using clock_type = std::chrono::system_clock; - using endpoint_type = boost::asio::ip::tcp::endpoint; + using ErrorCode = boost::system::error_code; + using ClockType = std::chrono::system_clock; + using EndpointType = boost::asio::ip::tcp::endpoint; struct Site { struct Status { - clock_type::time_point refreshed; + ClockType::time_point refreshed; ListDisposition disposition; std::string message; }; @@ -100,9 +100,9 @@ private: unsigned short redirCount{0}; std::chrono::minutes refreshInterval; - clock_type::time_point nextRefresh; + ClockType::time_point nextRefresh; std::optional lastRefreshStatus; - endpoint_type lastRequestEndpoint; + EndpointType lastRequestEndpoint; bool lastRequestSuccessful{false}; }; @@ -116,7 +116,7 @@ private: std::condition_variable cv_; std::weak_ptr work_; - boost::asio::basic_waitable_timer timer_; + boost::asio::basic_waitable_timer timer_; // A list is currently being fetched from a site std::atomic fetching_; @@ -210,13 +210,13 @@ private: * request took too long */ void - onRequestTimeout(std::size_t siteIdx, error_code const& ec); + onRequestTimeout(std::size_t siteIdx, ErrorCode const& ec); /** * Fetch site whose time has come */ void - onTimer(std::size_t siteIdx, error_code const& ec); + onTimer(std::size_t siteIdx, ErrorCode const& ec); /** * Store latest list fetched from site @@ -224,8 +224,8 @@ private: void onSiteFetch( boost::system::error_code const& ec, - endpoint_type const& endpoint, - detail::response_type const& res, + EndpointType const& endpoint, + detail::ResponseType const& res, std::size_t siteIdx); /** @@ -260,7 +260,7 @@ private: */ std::shared_ptr processRedirect( - detail::response_type const& res, + detail::ResponseType const& res, std::size_t siteIdx, std::scoped_lock const&); diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 4af556d3e7..477e013c3b 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -46,7 +46,7 @@ namespace xrpl { -static std::vector> +static std::vector> parseSection(Section const& section) { static boost::regex const kRe1( @@ -58,7 +58,7 @@ parseSection(Section const& section) , boost::regex_constants::optimize); - std::vector> names; + std::vector> names; for (auto const& line : section.lines()) { @@ -67,7 +67,7 @@ parseSection(Section const& section) if (!boost::regex_match(line, match, kRe1)) Throw("Invalid entry '" + line + "' in [" + section.name() + "]"); - uint256 id; + UInt256 id; if (!id.parseHex(match[1])) { @@ -107,7 +107,7 @@ private: // and an expiration for that record. struct UpvotesAndTimeout { - std::vector upVotes; + std::vector upVotes; /** * An unseated timeout indicates that either * 1. No validations have ever been received @@ -116,7 +116,7 @@ private: */ std::optional timeout; }; - hash_map recordedVotes_; + HashMap recordedVotes_; public: TrustedVotes() = default; @@ -128,7 +128,7 @@ public: // // Call with AmendmentTable::mutex_ locked. void - trustChanged(hash_set const& allTrusted, std::scoped_lock const& lock) + trustChanged(HashSet const& allTrusted, std::scoped_lock const& lock) { decltype(recordedVotes_) newRecordedVotes; newRecordedVotes.reserve(allTrusted.size()); @@ -260,10 +260,10 @@ public: // Return the information needed by AmendmentSet to determine votes. // // Call with AmendmentTable::mutex_ locked. - [[nodiscard]] std::pair> + [[nodiscard]] std::pair> getVotes(Rules const& rules, std::scoped_lock const& lock) const { - hash_map ret; + HashMap ret; int available = 0; for (auto& validatorVotes : recordedVotes_) { @@ -272,7 +272,7 @@ public: "xrpl::TrustedVotes::getVotes : valid votes"); if (validatorVotes.second.timeout) ++available; - for (uint256 const& amendment : validatorVotes.second.upVotes) + for (UInt256 const& amendment : validatorVotes.second.upVotes) { ret[amendment] += 1; } @@ -321,7 +321,7 @@ class AmendmentSet { private: // How many yes votes each amendment received - hash_map votes_; + HashMap votes_; // number of trusted validations int trustedValidations_ = 0; // number of votes needed @@ -347,7 +347,7 @@ public: } [[nodiscard]] bool - passes(uint256 const& amendment) const + passes(UInt256 const& amendment) const { auto const& it = votes_.find(amendment); @@ -363,7 +363,7 @@ public: } [[nodiscard]] int - votes(uint256 const& amendment) const + votes(UInt256 const& amendment) const { auto const& it = votes_.find(amendment); @@ -400,7 +400,7 @@ class AmendmentTableImpl final : public AmendmentTable private: mutable std::mutex mutex_; - hash_map amendmentMap_; + HashMap amendmentMap_; std::uint32_t lastUpdateSeq_{0}; // Record of the last votes seen from trusted validators. @@ -428,26 +428,26 @@ private: // Finds or creates state. Must be called with mutex_ locked. AmendmentState& - add(uint256 const& amendment, std::scoped_lock const& lock); + add(UInt256 const& amendment, std::scoped_lock const& lock); // Finds existing state. Must be called with mutex_ locked. AmendmentState* - get(uint256 const& amendment, std::scoped_lock const& lock); + get(UInt256 const& amendment, std::scoped_lock const& lock); AmendmentState const* - get(uint256 const& amendment, std::scoped_lock const& lock) const; + get(UInt256 const& amendment, std::scoped_lock const& lock) const; // Injects amendment json into v. Must be called with mutex_ locked. void injectJson( json::Value& v, - uint256 const& amendment, + UInt256 const& amendment, AmendmentState const& state, bool isAdmin, std::scoped_lock const& lock) const; void - persistVote(uint256 const& amendment, std::string const& name, AmendmentVote vote) const; + persistVote(UInt256 const& amendment, std::string const& name, AmendmentVote vote) const; public: AmendmentTableImpl( @@ -458,21 +458,21 @@ public: Section const& vetoed, beast::Journal journal); - uint256 + UInt256 find(std::string const& name) const override; bool - veto(uint256 const& amendment) override; + veto(UInt256 const& amendment) override; bool - unVeto(uint256 const& amendment) override; + unVeto(UInt256 const& amendment) override; bool - enable(uint256 const& amendment) override; + enable(UInt256 const& amendment) override; bool - isEnabled(uint256 const& amendment) const override; + isEnabled(UInt256 const& amendment) const override; bool - isSupported(uint256 const& amendment) const override; + isSupported(UInt256 const& amendment) const override; bool hasUnsupportedEnabled() const override; @@ -483,7 +483,7 @@ public: json::Value getJson(bool isAdmin) const override; json::Value - getJson(uint256 const&, bool isAdmin) const override; + getJson(UInt256 const&, bool isAdmin) const override; bool needValidatedLedger(LedgerIndex seq) const override; @@ -491,24 +491,24 @@ public: void doValidatedLedger( LedgerIndex seq, - std::set const& enabled, - majorityAmendments_t const& majority) override; + std::set const& enabled, + MajorityAmendmentsT const& majority) override; void - trustChanged(hash_set const& allTrusted) override; + trustChanged(HashSet const& allTrusted) override; - std::vector - doValidation(std::set const& enabledAmendments) const override; + std::vector + doValidation(std::set const& enabledAmendments) const override; - std::vector + std::vector getDesired() const override; - std::map + std::map doVoting( Rules const& rules, NetClock::time_point closeTime, - std::set const& enabledAmendments, - majorityAmendments_t const& majorityAmendments, + std::set const& enabledAmendments, + MajorityAmendmentsT const& majorityAmendments, std::vector> const& validations) override; }; @@ -559,9 +559,9 @@ AmendmentTableImpl::AmendmentTableImpl( << " voted by default if not enabled on the ledger."; } - hash_set detectConflict; + HashSet detectConflict; // Parse enabled amendments from config - for (std::pair const& a : parseSection(enabled)) + for (std::pair const& a : parseSection(enabled)) { if (featureVotesExist) { // If the table existed, warn about duplicate config info @@ -605,7 +605,7 @@ AmendmentTableImpl::AmendmentTableImpl( [&](boost::optional amendmentHash, boost::optional amendmentName, boost::optional vote) { - uint256 amendHash; + UInt256 amendHash; if (!amendmentHash || !amendmentName || !vote) { // These fields should never have nulls, but check @@ -646,14 +646,14 @@ AmendmentTableImpl::AmendmentTableImpl( } AmendmentState& -AmendmentTableImpl::add(uint256 const& amendmentHash, std::scoped_lock const&) +AmendmentTableImpl::add(UInt256 const& amendmentHash, std::scoped_lock const&) { // call with the mutex held return amendmentMap_[amendmentHash]; } AmendmentState* -AmendmentTableImpl::get(uint256 const& amendmentHash, std::scoped_lock const& lock) +AmendmentTableImpl::get(UInt256 const& amendmentHash, std::scoped_lock const& lock) { // Forward to the const version of get. // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast) @@ -661,7 +661,7 @@ AmendmentTableImpl::get(uint256 const& amendmentHash, std::scoped_lock const&) const +AmendmentTableImpl::get(UInt256 const& amendmentHash, std::scoped_lock const&) const { // call with the mutex held auto ret = amendmentMap_.find(amendmentHash); @@ -672,7 +672,7 @@ AmendmentTableImpl::get(uint256 const& amendmentHash, std::scoped_locksecond; } -uint256 +UInt256 AmendmentTableImpl::find(std::string const& name) const { std::scoped_lock const lock(mutex_); @@ -688,7 +688,7 @@ AmendmentTableImpl::find(std::string const& name) const void AmendmentTableImpl::persistVote( - uint256 const& amendment, + UInt256 const& amendment, std::string const& name, AmendmentVote vote) const { @@ -700,7 +700,7 @@ AmendmentTableImpl::persistVote( } bool -AmendmentTableImpl::veto(uint256 const& amendment) +AmendmentTableImpl::veto(UInt256 const& amendment) { std::scoped_lock const lock(mutex_); AmendmentState& s = add(amendment, lock); @@ -713,7 +713,7 @@ AmendmentTableImpl::veto(uint256 const& amendment) } bool -AmendmentTableImpl::unVeto(uint256 const& amendment) +AmendmentTableImpl::unVeto(UInt256 const& amendment) { std::scoped_lock const lock(mutex_); AmendmentState* const s = get(amendment, lock); @@ -726,7 +726,7 @@ AmendmentTableImpl::unVeto(uint256 const& amendment) } bool -AmendmentTableImpl::enable(uint256 const& amendment) +AmendmentTableImpl::enable(UInt256 const& amendment) { std::scoped_lock const lock(mutex_); AmendmentState& s = add(amendment, lock); @@ -746,7 +746,7 @@ AmendmentTableImpl::enable(uint256 const& amendment) } bool -AmendmentTableImpl::isEnabled(uint256 const& amendment) const +AmendmentTableImpl::isEnabled(UInt256 const& amendment) const { std::scoped_lock const lock(mutex_); AmendmentState const* s = get(amendment, lock); @@ -754,7 +754,7 @@ AmendmentTableImpl::isEnabled(uint256 const& amendment) const } bool -AmendmentTableImpl::isSupported(uint256 const& amendment) const +AmendmentTableImpl::isSupported(UInt256 const& amendment) const { std::scoped_lock const lock(mutex_); AmendmentState const* s = get(amendment, lock); @@ -775,12 +775,12 @@ AmendmentTableImpl::firstUnsupportedExpected() const return firstUnsupportedExpected_; } -std::vector -AmendmentTableImpl::doValidation(std::set const& enabled) const +std::vector +AmendmentTableImpl::doValidation(std::set const& enabled) const { // Get the list of amendments we support and do not // veto, but that are not already enabled - std::vector amendments; + std::vector amendments; { std::scoped_lock const lock(mutex_); @@ -802,19 +802,19 @@ AmendmentTableImpl::doValidation(std::set const& enabled) const return amendments; } -std::vector +std::vector AmendmentTableImpl::getDesired() const { // Get the list of amendments we support and do not veto return doValidation({}); } -std::map +std::map AmendmentTableImpl::doVoting( Rules const& rules, NetClock::time_point closeTime, - std::set const& enabledAmendments, - majorityAmendments_t const& majorityAmendments, + std::set const& enabledAmendments, + MajorityAmendmentsT const& majorityAmendments, std::vector> const& valSet) { JLOG(j_.trace()) << "voting at " << closeTime.time_since_epoch().count() << ": " @@ -833,7 +833,7 @@ AmendmentTableImpl::doVoting( // Map of amendments to the action to be taken for each one. The action is // the value of the flags in the pseudo-transaction - std::map actions; + std::map actions; // process all amendments we know of for (auto const& entry : amendmentMap_) @@ -914,8 +914,8 @@ AmendmentTableImpl::needValidatedLedger(LedgerIndex ledgerSeq) const void AmendmentTableImpl::doValidatedLedger( LedgerIndex ledgerSeq, - std::set const& enabled, - majorityAmendments_t const& majority) + std::set const& enabled, + MajorityAmendmentsT const& majority) { for (auto& e : enabled) enable(e); @@ -949,7 +949,7 @@ AmendmentTableImpl::doValidatedLedger( } void -AmendmentTableImpl::trustChanged(hash_set const& allTrusted) +AmendmentTableImpl::trustChanged(HashSet const& allTrusted) { std::scoped_lock const lock(mutex_); previousTrustedVotes_.trustChanged(allTrusted, lock); @@ -958,7 +958,7 @@ AmendmentTableImpl::trustChanged(hash_set const& allTrusted) void AmendmentTableImpl::injectJson( json::Value& v, - uint256 const& id, + UInt256 const& id, AmendmentState const& fs, bool isAdmin, std::scoped_lock const&) const @@ -1014,7 +1014,7 @@ AmendmentTableImpl::getJson(bool isAdmin) const } json::Value -AmendmentTableImpl::getJson(uint256 const& amendmentID, bool isAdmin) const +AmendmentTableImpl::getJson(UInt256 const& amendmentID, bool isAdmin) const { json::Value ret = json::ValueType::Object; diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index 59cc4b6c4c..914c4ceefb 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -116,26 +116,26 @@ Transaction::transactionFromSQL( } std::variant, std::shared_ptr>, TxSearched> -Transaction::load(uint256 const& id, Application& app, ErrorCodeI& ec) +Transaction::load(UInt256 const& id, Application& app, ErrorCodeI& ec) { return load(id, app, std::nullopt, ec); } std::variant, std::shared_ptr>, TxSearched> Transaction::load( - uint256 const& id, + UInt256 const& id, Application& app, ClosedInterval const& range, ErrorCodeI& ec) { - using op = std::optional>; + using Op = std::optional>; - return load(id, app, op{range}, ec); + return load(id, app, Op{range}, ec); } std::variant, std::shared_ptr>, TxSearched> Transaction::load( - uint256 const& id, + UInt256 const& id, Application& app, std::optional> const& range, ErrorCodeI& ec) @@ -151,7 +151,7 @@ Transaction::getJson(JsonOptions options, bool binary) const { // Note, we explicitly suppress `include_date` option here json::Value ret(transaction_->getJson( - options & ~static_cast(JsonOptions::Values::IncludeDate), + options & ~static_cast(JsonOptions::Values::IncludeDate), binary)); // NOTE Binary STTx::getJson output might not be a JSON object diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 19dc351444..7c4bf657ea 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -409,7 +409,7 @@ TxQ::canBeHeld( STTx const& tx, ApplyFlags const flags, OpenView const& view, - SLE::const_ref sleAccount, + SLE::ConstRef sleAccount, AccountMap::iterator const& accountIter, std::optional const& replacementIter, std::scoped_lock const& lock) @@ -1616,7 +1616,7 @@ TxQ::accept(Application& app, OpenView& view) // // Acquires a lock and calls the implementation. SeqProxy -TxQ::nextQueuableSeq(SLE::const_ref sleAccount) const +TxQ::nextQueuableSeq(SLE::ConstRef sleAccount) const { std::scoped_lock const lock(mutex_); return nextQueuableSeqImpl(sleAccount, lock); @@ -1629,7 +1629,7 @@ TxQ::nextQueuableSeq(SLE::const_ref sleAccount) const // sequence number, that is not used by a transaction in the queue, must // be found and returned. SeqProxy -TxQ::nextQueuableSeqImpl(SLE::const_ref sleAccount, std::scoped_lock const&) const +TxQ::nextQueuableSeqImpl(SLE::ConstRef sleAccount, std::scoped_lock const&) const { // If the account is not in the ledger or a non-account was passed // then return zero. We have no idea. diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index f099ebf059..61e4d517c6 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -122,7 +122,7 @@ ValidatorList::PublisherListStats::mergeDispositions(PublisherListStats const& s ValidatorList::MessageWithHash::MessageWithHash( std::shared_ptr const& message, - uint256 hash, + UInt256 hash, std::size_t num) : message(message), hash(hash), numVLs(num) { @@ -287,7 +287,7 @@ ValidatorList::load( } std::filesystem::path -ValidatorList::getCacheFileName(ValidatorList::scoped_lock const&, PublicKey const& pubKey) const +ValidatorList::getCacheFileName(ValidatorList::ScopedLock const&, PublicKey const& pubKey) const { return dataPath_ / (kFilePrefix + strHex(pubKey)); } @@ -364,7 +364,7 @@ ValidatorList::buildFileData( } void -ValidatorList::cacheValidatorFile(ValidatorList::scoped_lock const& lock, PublicKey const& pubKey) +ValidatorList::cacheValidatorFile(ValidatorList::ScopedLock const& lock, PublicKey const& pubKey) const { if (dataPath_.empty()) @@ -752,7 +752,7 @@ ValidatorList::broadcastBlobs( PublicKey const& publisherKey, ValidatorList::PublisherListCollection const& lists, std::size_t maxSequence, - uint256 const& hash, + UInt256 const& hash, Overlay& overlay, HashRouter& hashRouter, beast::Journal j) @@ -808,7 +808,7 @@ ValidatorList::applyListsAndBroadcast( std::uint32_t version, std::vector const& blobs, std::string siteUri, - uint256 const& hash, + UInt256 const& hash, Overlay& overlay, HashRouter& hashRouter, NetworkOPs& networkOPs) @@ -869,7 +869,7 @@ ValidatorList::applyLists( std::uint32_t version, std::vector const& blobs, std::string siteUri, - std::optional const& hash /* = {} */) + std::optional const& hash /* = {} */) { if (std::count(std::begin(kSupportedListVersions), std::end(kSupportedListVersions), version) != 1) @@ -945,7 +945,7 @@ ValidatorList::updatePublisherList( PublicKey const& pubKey, PublisherList const& current, std::vector const& oldList, - ValidatorList::scoped_lock const&) + ValidatorList::ScopedLock const&) { // Update keyListings_ for added and removed keys std::vector const& publisherList = current.list; @@ -1016,8 +1016,8 @@ ValidatorList::applyList( std::string const& signature, std::uint32_t version, std::string siteUri, - std::optional const& hash, - ValidatorList::scoped_lock const& lock) + std::optional const& hash, + ValidatorList::ScopedLock const& lock) { using namespace std::string_literals; @@ -1240,7 +1240,7 @@ ValidatorList::loadLists() // contain the default-constructed public keys std::pair> ValidatorList::verify( - ValidatorList::scoped_lock const& lock, + ValidatorList::ScopedLock const& lock, json::Value& list, Manifest manifest, std::string const& blob, @@ -1343,7 +1343,7 @@ ValidatorList::listed(PublicKey const& identity) const } bool -ValidatorList::trusted(ValidatorList::shared_lock const&, PublicKey const& identity) const +ValidatorList::trusted(ValidatorList::SharedLock const&, PublicKey const& identity) const { auto const pubKey = validatorManifests_.getMasterKey(identity); return trustedMasterKeys_.contains(pubKey); @@ -1368,7 +1368,7 @@ ValidatorList::getListedKey(PublicKey const& identity) const } std::optional -ValidatorList::getTrustedKey(ValidatorList::shared_lock const&, PublicKey const& identity) const +ValidatorList::getTrustedKey(ValidatorList::SharedLock const&, PublicKey const& identity) const { auto pubKey = validatorManifests_.getMasterKey(identity); if (trustedMasterKeys_.contains(pubKey)) @@ -1401,7 +1401,7 @@ ValidatorList::localPublicKey() const bool ValidatorList::removePublisherList( - ValidatorList::scoped_lock const&, + ValidatorList::ScopedLock const&, PublicKey const& publisherKey, PublisherStatus reason) { @@ -1437,7 +1437,7 @@ ValidatorList::removePublisherList( } std::size_t -ValidatorList::count(ValidatorList::shared_lock const&) const +ValidatorList::count(ValidatorList::SharedLock const&) const { return publisherLists_.size() + static_cast(!localPublisherList_.list.empty()); } @@ -1450,7 +1450,7 @@ ValidatorList::count() const } std::optional -ValidatorList::expires(ValidatorList::shared_lock const&) const +ValidatorList::expires(ValidatorList::SharedLock const&) const { std::optional res{}; for (auto const& [_, collection] : publisherLists_) @@ -1656,7 +1656,7 @@ ValidatorList::forEachAvailable( std::map const& blobInfos, PublicKey const& pubKey, std::size_t maxSequence, - uint256 const& hash)> func) const + UInt256 const& hash)> func) const { std::shared_lock const readLock{mutex_}; @@ -1798,7 +1798,7 @@ ValidatorList::calculateQuorum( TrustChanges ValidatorList::updateTrusted( - hash_set const& seenValidators, + HashSet const& seenValidators, NetClock::time_point closeTime, NetworkOPs& ops, Overlay& overlay, @@ -1946,7 +1946,7 @@ ValidatorList::updateTrusted( if (negativeUNL_.contains(k)) --effectiveUnlSize; } - hash_set negUnlNodeIDs; + HashSet negUnlNodeIDs; for (auto const& k : negativeUNL_) { negUnlNodeIDs.emplace(calcNodeID(k)); @@ -1978,7 +1978,7 @@ ValidatorList::updateTrusted( return trustChanges; } -hash_set +HashSet ValidatorList::getTrustedMasterKeys() const { std::shared_lock const readLock{mutex_}; @@ -1992,7 +1992,7 @@ ValidatorList::getListThreshold() const return listThreshold_; } -hash_set +HashSet ValidatorList::getNegativeUNL() const { std::shared_lock const readLock{mutex_}; @@ -2000,7 +2000,7 @@ ValidatorList::getNegativeUNL() const } void -ValidatorList::setNegativeUNL(hash_set const& negUnl) +ValidatorList::setNegativeUNL(HashSet const& negUnl) { std::scoped_lock const lock{mutex_}; negativeUNL_ = negUnl; diff --git a/src/xrpld/app/misc/detail/ValidatorSite.cpp b/src/xrpld/app/misc/detail/ValidatorSite.cpp index 73ec3e0d6f..dafea1a7f8 100644 --- a/src/xrpld/app/misc/detail/ValidatorSite.cpp +++ b/src/xrpld/app/misc/detail/ValidatorSite.cpp @@ -92,7 +92,7 @@ ValidatorSite::Site::Site(std::string uri) : loadedResource{std::make_shared(std::move(uri))} , startingResource{loadedResource} , refreshInterval{kDefaultRefreshInterval} - , nextRefresh{clock_type::now()} + , nextRefresh{ClockType::now()} { } @@ -114,7 +114,7 @@ ValidatorSite::ValidatorSite( ValidatorSite::~ValidatorSite() { std::unique_lock lock{stateMutex_}; - if (timer_.expiry() > clock_type::time_point{}) + if (timer_.expiry() > ClockType::time_point{}) { if (!stopping_) { @@ -179,7 +179,7 @@ ValidatorSite::start() { std::scoped_lock const l0{sitesMutex_}; std::scoped_lock const l1{stateMutex_}; - if (timer_.expiry() == clock_type::time_point{}) + if (timer_.expiry() == ClockType::time_point{}) setTimer(l0, l1); } @@ -226,7 +226,7 @@ ValidatorSite::setTimer( if (next != sites_.end()) { - pending_ = next->nextRefresh <= clock_type::now(); + pending_ = next->nextRefresh <= ClockType::now(); cv_.notify_all(); timer_.expires_at(next->nextRefresh); auto idx = std::distance(sites_.begin(), next); @@ -256,16 +256,15 @@ ValidatorSite::makeRequest( { } }; - auto onFetch = [this, siteIdx, timeoutCancel]( - error_code const& err, - endpoint_type const& endpoint, - detail::response_type const& resp) { - timeoutCancel(); - onSiteFetch(err, endpoint, resp, siteIdx); - }; + auto onFetch = + [this, siteIdx, timeoutCancel]( + ErrorCode const& err, EndpointType const& endpoint, detail::ResponseType const& resp) { + timeoutCancel(); + onSiteFetch(err, endpoint, resp, siteIdx); + }; auto onFetchFile = [this, siteIdx, timeoutCancel]( - error_code const& err, std::string const& resp) { + ErrorCode const& err, std::string const& resp) { timeoutCancel(); onTextFetch(err, resp, siteIdx); }; @@ -319,7 +318,7 @@ ValidatorSite::makeRequest( } void -ValidatorSite::onRequestTimeout(std::size_t siteIdx, error_code const& ec) +ValidatorSite::onRequestTimeout(std::size_t siteIdx, ErrorCode const& ec) { if (ec) return; @@ -350,21 +349,21 @@ ValidatorSite::onRequestTimeout(std::size_t siteIdx, error_code const& ec) } void -ValidatorSite::onTimer(std::size_t siteIdx, error_code const& ec) +ValidatorSite::onTimer(std::size_t siteIdx, ErrorCode const& ec) { if (ec) { // Restart the timer if any errors are encountered, unless the error // is from the wait operation being aborted due to a shutdown request. if (ec != boost::asio::error::operation_aborted) - onSiteFetch(ec, {}, detail::response_type{}, siteIdx); + onSiteFetch(ec, {}, detail::ResponseType{}, siteIdx); return; } try { std::scoped_lock const lock{sitesMutex_}; - sites_[siteIdx].nextRefresh = clock_type::now() + sites_[siteIdx].refreshInterval; + sites_[siteIdx].nextRefresh = ClockType::now() + sites_[siteIdx].refreshInterval; sites_[siteIdx].redirCount = 0; // the WorkSSL client ctor can throw if SSL init fails makeRequest(sites_[siteIdx].startingResource, siteIdx, lock); @@ -375,7 +374,7 @@ ValidatorSite::onTimer(std::size_t siteIdx, error_code const& ec) onSiteFetch( boost::system::error_code{-1, boost::system::generic_category()}, {}, - detail::response_type{}, + detail::ResponseType{}, siteIdx); } } @@ -440,7 +439,7 @@ ValidatorSite::parseJsonResponse( sites_[siteIdx].lastRefreshStatus.emplace( Site::Status{ - .refreshed = clock_type::now(), + .refreshed = ClockType::now(), .disposition = applyResult.bestDisposition(), .message = ""}); @@ -494,13 +493,13 @@ ValidatorSite::parseJsonResponse( 1min, std::chrono::minutes{24h}); sites_[siteIdx].refreshInterval = refresh; - sites_[siteIdx].nextRefresh = clock_type::now() + sites_[siteIdx].refreshInterval; + sites_[siteIdx].nextRefresh = ClockType::now() + sites_[siteIdx].refreshInterval; } } std::shared_ptr ValidatorSite::processRedirect( - detail::response_type const& res, + detail::ResponseType const& res, std::size_t siteIdx, std::scoped_lock const& sitesLock) { @@ -542,24 +541,24 @@ ValidatorSite::processRedirect( void ValidatorSite::onSiteFetch( boost::system::error_code const& ec, - endpoint_type const& endpoint, - detail::response_type const& res, + EndpointType const& endpoint, + detail::ResponseType const& res, std::size_t siteIdx) { std::scoped_lock lockSites{sitesMutex_}; { - if (endpoint != endpoint_type{}) + if (endpoint != EndpointType{}) sites_[siteIdx].lastRequestEndpoint = endpoint; JLOG(j_.debug()) << "Got completion for " << sites_[siteIdx].activeResource->uri << " " << endpoint; auto onError = [&](std::string const& errMsg, bool retry) { sites_[siteIdx].lastRefreshStatus.emplace( Site::Status{ - .refreshed = clock_type::now(), + .refreshed = ClockType::now(), .disposition = ListDisposition::Invalid, .message = errMsg}); if (retry) - sites_[siteIdx].nextRefresh = clock_type::now() + kErrorRetryInterval; + sites_[siteIdx].nextRefresh = ClockType::now() + kErrorRetryInterval; // See if there's a copy saved locally from last time we // saw the list. @@ -651,7 +650,7 @@ ValidatorSite::onTextFetch( JLOG(j_.error()) << "Exception in " << __func__ << ": " << ex.what(); sites_[siteIdx].lastRefreshStatus.emplace( Site::Status{ - .refreshed = clock_type::now(), + .refreshed = ClockType::now(), .disposition = ListDisposition::Invalid, .message = ex.what()}); } diff --git a/src/xrpld/app/misc/detail/Work.h b/src/xrpld/app/misc/detail/Work.h index 27f4e7f6eb..eabdc7c2cd 100644 --- a/src/xrpld/app/misc/detail/Work.h +++ b/src/xrpld/app/misc/detail/Work.h @@ -5,7 +5,7 @@ namespace xrpl::detail { -using response_type = boost::beast::http::response; +using ResponseType = boost::beast::http::response; class Work { diff --git a/src/xrpld/app/misc/detail/WorkBase.h b/src/xrpld/app/misc/detail/WorkBase.h index fd36cb5318..b70845c837 100644 --- a/src/xrpld/app/misc/detail/WorkBase.h +++ b/src/xrpld/app/misc/detail/WorkBase.h @@ -23,31 +23,30 @@ template class WorkBase : public Work { protected: - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; public: - using callback_type = - std::function; + using CallbackType = std::function; protected: - using socket_type = boost::asio::ip::tcp::socket; - using resolver_type = boost::asio::ip::tcp::resolver; - using results_type = boost::asio::ip::tcp::resolver::results_type; - using request_type = boost::beast::http::request; + using SocketType = boost::asio::ip::tcp::socket; + using ResolverType = boost::asio::ip::tcp::resolver; + using ResultsType = boost::asio::ip::tcp::resolver::results_type; + using RequestType = boost::beast::http::request; std::string host_; std::string path_; std::string port_; - callback_type cb_; + CallbackType cb_; boost::asio::io_context& ios_; boost::asio::strand strand_; - resolver_type resolver_; - socket_type socket_; - request_type req_; - response_type res_; + ResolverType resolver_; + SocketType socket_; + RequestType req_; + ResponseType res_; boost::beast::multi_buffer readBuf_; - endpoint_type lastEndpoint_; + EndpointType lastEndpoint_; bool lastStatus_; private: @@ -56,9 +55,9 @@ private: std::string path, std::string port, boost::asio::io_context& ios, - endpoint_type lastEndpoint, + EndpointType lastEndpoint, bool lastStatus, - callback_type cb); + CallbackType cb); public: ~WorkBase() override; @@ -76,22 +75,22 @@ public: cancel() override; void - fail(error_code const& ec); + fail(ErrorCode const& ec); void - onResolve(error_code const& ec, results_type results); + onResolve(ErrorCode const& ec, ResultsType results); void - onConnect(error_code const& ec, endpoint_type const& endpoint); + onConnect(ErrorCode const& ec, EndpointType const& endpoint); void onStart(); void - onRequest(error_code const& ec); + onRequest(ErrorCode const& ec); void - onResponse(error_code const& ec); + onResponse(ErrorCode const& ec); private: void @@ -108,9 +107,9 @@ WorkBase::WorkBase( std::string path, std::string port, boost::asio::io_context& ios, - endpoint_type lastEndpoint, + EndpointType lastEndpoint, bool lastStatus, - callback_type cb) + CallbackType cb) : host_(std::move(host)) , path_(std::move(path)) , port_(std::move(port)) @@ -148,8 +147,7 @@ WorkBase::run() host_, port_, boost::asio::bind_executor( - strand_, - [self = impl().shared_from_this()](error_code const& ec, results_type results) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, ResultsType results) { self->onResolve(ec, results); })); } @@ -167,14 +165,14 @@ WorkBase::cancel() strand_, [self = impl().shared_from_this()] { self->cancel(); })); } - error_code ec; + ErrorCode ec; resolver_.cancel(); socket_.cancel(ec); } template void -WorkBase::fail(error_code const& ec) +WorkBase::fail(ErrorCode const& ec) { if (cb_) { @@ -185,7 +183,7 @@ WorkBase::fail(error_code const& ec) template void -WorkBase::onResolve(error_code const& ec, results_type results) +WorkBase::onResolve(ErrorCode const& ec, ResultsType results) { if (ec) return fail(ec); @@ -195,8 +193,7 @@ WorkBase::onResolve(error_code const& ec, results_type results) results, boost::asio::bind_executor( strand_, - [self = impl().shared_from_this()]( - error_code const& ec, endpoint_type const& endpoint) { + [self = impl().shared_from_this()](ErrorCode const& ec, EndpointType const& endpoint) { // Call the base-class overload explicitly: the derived Impl // hides it with its own single-argument onConnect(ec). self->WorkBase::onConnect(ec, endpoint); @@ -205,7 +202,7 @@ WorkBase::onResolve(error_code const& ec, results_type results) template void -WorkBase::onConnect(error_code const& ec, endpoint_type const& endpoint) +WorkBase::onConnect(ErrorCode const& ec, EndpointType const& endpoint) { lastEndpoint_ = endpoint; @@ -229,14 +226,14 @@ WorkBase::onStart() impl().stream(), req_, boost::asio::bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec, std::size_t) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, std::size_t) { self->onRequest(ec); })); } template void -WorkBase::onRequest(error_code const& ec) +WorkBase::onRequest(ErrorCode const& ec) { if (ec) return fail(ec); @@ -246,14 +243,14 @@ WorkBase::onRequest(error_code const& ec) readBuf_, res_, boost::asio::bind_executor( - strand_, [self = impl().shared_from_this()](error_code const& ec, std::size_t) { + strand_, [self = impl().shared_from_this()](ErrorCode const& ec, std::size_t) { self->onResponse(ec); })); } template void -WorkBase::onResponse(error_code const& ec) +WorkBase::onResponse(ErrorCode const& ec) { if (ec) return fail(ec); @@ -270,7 +267,7 @@ WorkBase::close() { if (socket_.is_open()) { - error_code ec; + ErrorCode ec; socket_.shutdown(boost::asio::socket_base::shutdown_send, ec); if (ec) return; diff --git a/src/xrpld/app/misc/detail/WorkFile.h b/src/xrpld/app/misc/detail/WorkFile.h index eb42d14db4..c7c59142bc 100644 --- a/src/xrpld/app/misc/detail/WorkFile.h +++ b/src/xrpld/app/misc/detail/WorkFile.h @@ -21,15 +21,15 @@ namespace xrpl::detail { class WorkFile : public Work, public std::enable_shared_from_this { protected: - using error_code = boost::system::error_code; + using ErrorCode = boost::system::error_code; // Override the definition in Work.h - using response_type = std::string; + using ResponseType = std::string; public: - using callback_type = std::function; + using CallbackType = std::function; public: - WorkFile(std::string path, boost::asio::io_context& ios, callback_type cb); + WorkFile(std::string path, boost::asio::io_context& ios, CallbackType cb); ~WorkFile() override; void @@ -40,14 +40,14 @@ public: private: std::string path_; - callback_type cb_; + CallbackType cb_; boost::asio::io_context& ios_; boost::asio::strand strand_; }; //------------------------------------------------------------------------------ -inline WorkFile::WorkFile(std::string path, boost::asio::io_context& ios, callback_type cb) +inline WorkFile::WorkFile(std::string path, boost::asio::io_context& ios, CallbackType cb) : path_(std::move(path)), cb_(std::move(cb)), ios_(ios), strand_(boost::asio::make_strand(ios)) { } @@ -69,7 +69,7 @@ WorkFile::run() return; } - error_code ec; + ErrorCode ec; auto const fileContents = getFileContents(ec, path_, megabytes(1)); XRPL_ASSERT(cb_, "xrpl::detail::WorkFile::run : callback is set"); diff --git a/src/xrpld/app/misc/detail/WorkPlain.h b/src/xrpld/app/misc/detail/WorkPlain.h index 4c45fb4801..92efd0d45e 100644 --- a/src/xrpld/app/misc/detail/WorkPlain.h +++ b/src/xrpld/app/misc/detail/WorkPlain.h @@ -18,16 +18,16 @@ public: std::string const& path, std::string const& port, boost::asio::io_context& ios, - endpoint_type const& lastEndpoint, + EndpointType const& lastEndpoint, bool lastStatus, - callback_type cb); + CallbackType cb); ~WorkPlain() override = default; private: void - onConnect(error_code const& ec); + onConnect(ErrorCode const& ec); - socket_type& + SocketType& stream() { return socket_; @@ -41,15 +41,15 @@ inline WorkPlain::WorkPlain( std::string const& path, std::string const& port, boost::asio::io_context& ios, - endpoint_type const& lastEndpoint, + EndpointType const& lastEndpoint, bool lastStatus, - callback_type cb) + CallbackType cb) : WorkBase(host, path, port, ios, lastEndpoint, lastStatus, cb) { } inline void -WorkPlain::onConnect(error_code const& ec) +WorkPlain::onConnect(ErrorCode const& ec) { if (ec) { diff --git a/src/xrpld/app/misc/detail/WorkSSL.cpp b/src/xrpld/app/misc/detail/WorkSSL.cpp index 48231b147e..e7a70eed2b 100644 --- a/src/xrpld/app/misc/detail/WorkSSL.cpp +++ b/src/xrpld/app/misc/detail/WorkSSL.cpp @@ -24,9 +24,9 @@ WorkSSL::WorkSSL( boost::asio::io_context& ios, beast::Journal j, Config const& config, - endpoint_type const& lastEndpoint, + EndpointType const& lastEndpoint, bool lastStatus, - callback_type cb) + CallbackType cb) : WorkBase(host, path, port, ios, lastEndpoint, lastStatus, cb) , context_( config.sslVerifyDir, @@ -42,7 +42,7 @@ WorkSSL::WorkSSL( } void -WorkSSL::onConnect(error_code const& ec) +WorkSSL::onConnect(ErrorCode const& ec) { auto err = ec ? ec : context_.postConnectVerify(stream_, host_); if (err) @@ -54,11 +54,11 @@ WorkSSL::onConnect(error_code const& ec) stream_.async_handshake( boost::asio::ssl::stream_base::client, boost::asio::bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onHandshake(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onHandshake(ec); })); } void -WorkSSL::onHandshake(error_code const& ec) +WorkSSL::onHandshake(ErrorCode const& ec) { if (ec) { diff --git a/src/xrpld/app/misc/detail/WorkSSL.h b/src/xrpld/app/misc/detail/WorkSSL.h index e4b7586054..266b49d824 100644 --- a/src/xrpld/app/misc/detail/WorkSSL.h +++ b/src/xrpld/app/misc/detail/WorkSSL.h @@ -19,10 +19,10 @@ class WorkSSL : public WorkBase, public std::enable_shared_from_this; private: - using stream_type = boost::asio::ssl::stream; + using StreamType = boost::asio::ssl::stream; HTTPClientSSLContext context_; - stream_type stream_; + StreamType stream_; public: WorkSSL( @@ -32,23 +32,23 @@ public: boost::asio::io_context& ios, beast::Journal j, Config const& config, - endpoint_type const& lastEndpoint, + EndpointType const& lastEndpoint, bool lastStatus, - callback_type cb); + CallbackType cb); ~WorkSSL() override = default; private: - stream_type& + StreamType& stream() { return stream_; } void - onConnect(error_code const& ec); + onConnect(ErrorCode const& ec); void - onHandshake(error_code const& ec); + onHandshake(ErrorCode const& ec); }; } // namespace xrpl::detail diff --git a/src/xrpld/app/misc/make_NetworkOPs.h b/src/xrpld/app/misc/make_NetworkOPs.h index b4dba2b065..af4424b7c7 100644 --- a/src/xrpld/app/misc/make_NetworkOPs.h +++ b/src/xrpld/app/misc/make_NetworkOPs.h @@ -19,7 +19,7 @@ class ValidatorKeys; std::unique_ptr makeNetworkOPs( ServiceRegistry& registry, - NetworkOPs::clock_type& clock, + NetworkOPs::ClockType& clock, bool standalone, std::size_t minPeerCount, bool startValid, @@ -28,6 +28,6 @@ makeNetworkOPs( ValidatorKeys const& validatorKeys, boost::asio::io_context& ioSvc, beast::Journal journal, - beast::insight::Collector::ptr const& collector); + beast::insight::Collector::Ptr const& collector); } // namespace xrpl diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index f5b930d23e..1695e28ec9 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -67,7 +67,7 @@ public: * @return Ledger if found, otherwise no value. */ std::optional - getLedgerInfoByHash(uint256 const& ledgerHash) override; + getLedgerInfoByHash(UInt256 const& ledgerHash) override; /** * @brief getHashByIndex Returns the hash of the ledger with the given @@ -75,7 +75,7 @@ public: * @param ledgerIndex Ledger sequence. * @return Hash of the ledger. */ - uint256 + UInt256 getHashByIndex(LedgerIndex ledgerIndex) override; /** @@ -349,7 +349,7 @@ public: */ std::variant getTransaction( - uint256 const& id, + UInt256 const& id, std::optional> const& range, ErrorCodeI& ec) override; diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index be4c5d29e5..a9337d2a94 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -312,7 +312,7 @@ saveValidatedLedger( for (auto const& acceptedLedgerTx : *aLedger) { - uint256 const transactionID = acceptedLedgerTx->getTransactionID(); + UInt256 const transactionID = acceptedLedgerTx->getTransactionID(); std::string const txnId(to_string(transactionID)); std::string const txnSeq(std::to_string(acceptedLedgerTx->getTxnSeq())); @@ -526,17 +526,17 @@ getLimitedNewestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, } std::optional -getLedgerInfoByHash(soci::session& session, uint256 const& ledgerHash, beast::Journal j) +getLedgerInfoByHash(soci::session& session, UInt256 const& ledgerHash, beast::Journal j) { std::ostringstream s; s << "WHERE LedgerHash = '" << ledgerHash << "'"; return getLedgerInfo(session, s.str(), j); } -uint256 +UInt256 getHashByIndex(soci::session& session, LedgerIndex ledgerIndex) { - uint256 ret; + UInt256 ret; std::string sql = "SELECT LedgerHash FROM Ledgers INDEXED BY SeqLedger WHERE LedgerSeq='"; sql.append(std::to_string(ledgerIndex)); @@ -925,7 +925,7 @@ getNewestAccountTxs( * number of transactions skipped. We need to skip some number of * transactions if option offset is > 0 in the options structure. */ -static std::pair, int> +static std::pair, int> getAccountTxsB( soci::session& session, Application& app, @@ -933,7 +933,7 @@ getAccountTxsB( bool descending, beast::Journal j) { - std::vector ret; + std::vector ret; std::string const sql = transactionsSQL( app, @@ -982,7 +982,7 @@ getAccountTxsB( return {ret, total}; } -std::pair, int> +std::pair, int> getOldestAccountTxsB( soci::session& session, Application& app, @@ -992,7 +992,7 @@ getOldestAccountTxsB( return getAccountTxsB(session, app, options, false, j); } -std::pair, int> +std::pair, int> getNewestAccountTxsB( soci::session& session, Application& app, @@ -1336,7 +1336,7 @@ std::variant getTransaction( soci::session& session, Application& app, - uint256 const& id, + UInt256 const& id, std::optional> const& range, ErrorCodeI& ec) { diff --git a/src/xrpld/app/rdb/backend/detail/Node.h b/src/xrpld/app/rdb/backend/detail/Node.h index ba3eb91ca3..f3f4a44a14 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.h +++ b/src/xrpld/app/rdb/backend/detail/Node.h @@ -182,7 +182,7 @@ getLimitedNewestLedgerInfo(soci::session& session, LedgerIndex ledgerFirstIndex, * @return Ledger or none if ledger not found. */ std::optional -getLedgerInfoByHash(soci::session& session, uint256 const& ledgerHash, beast::Journal j); +getLedgerInfoByHash(soci::session& session, UInt256 const& ledgerHash, beast::Journal j); /** * @brief getHashByIndex Returns hash of ledger with given sequence. @@ -190,7 +190,7 @@ getLedgerInfoByHash(soci::session& session, uint256 const& ledgerHash, beast::Jo * @param ledgerIndex Ledger sequence. * @return Hash of the ledger. */ -uint256 +UInt256 getHashByIndex(soci::session& session, LedgerIndex ledgerIndex); /** @@ -306,7 +306,7 @@ getNewestAccountTxs( * skipped. We need to skip some quantity of transactions if option * offset is > 0 in the options structure. */ -std::pair, int> +std::pair, int> getOldestAccountTxsB( soci::session& session, Application& app, @@ -332,7 +332,7 @@ getOldestAccountTxsB( * skipped. We need to skip some quantity of transactions if option * offset is > 0 in the options structure. */ -std::pair, int> +std::pair, int> getNewestAccountTxsB( soci::session& session, Application& app, @@ -411,7 +411,7 @@ std::variant getTransaction( soci::session& session, Application& app, - uint256 const& id, + UInt256 const& id, std::optional> const& range, ErrorCodeI& ec); diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 338a3a33df..5349815934 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -271,7 +271,7 @@ SQLiteDatabase::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) } std::optional -SQLiteDatabase::getLedgerInfoByHash(uint256 const& ledgerHash) +SQLiteDatabase::getLedgerInfoByHash(UInt256 const& ledgerHash) { if (existsLedger()) { @@ -285,7 +285,7 @@ SQLiteDatabase::getLedgerInfoByHash(uint256 const& ledgerHash) return {}; } -uint256 +UInt256 SQLiteDatabase::getHashByIndex(LedgerIndex ledgerIndex) { if (existsLedger()) @@ -297,7 +297,7 @@ SQLiteDatabase::getHashByIndex(LedgerIndex ledgerIndex) return res; } - return uint256(); + return UInt256(); } std::optional @@ -536,7 +536,7 @@ SQLiteDatabase::newestAccountTxPageB(AccountTxPageOptions const& options) std::variant SQLiteDatabase::getTransaction( - uint256 const& id, + UInt256 const& id, std::optional> const& range, ErrorCodeI& ec) { diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index b7ff0f9986..dd4e98168f 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -157,7 +157,7 @@ public: std::string startLedger; - std::optional trapTxHash; + std::optional trapTxHash; // Network parameters uint32_t networkId = 0; @@ -285,7 +285,7 @@ public: // These override the command line client settings std::optional rpcIp; - std::unordered_set> features; + std::unordered_set> features; std::string serverDomain; diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index a0367f7ffc..c280db63e3 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -975,11 +975,11 @@ Config::loadFromString(std::string const& fileContents) } else if (boost::iequals(match[2], "days")) { - amendmentMajorityTime = days(duration); + amendmentMajorityTime = Days(duration); } else if (boost::iequals(match[2], "weeks")) { - amendmentMajorityTime = weeks(duration); + amendmentMajorityTime = Weeks(duration); } if (amendmentMajorityTime < minutes(15)) diff --git a/src/xrpld/overlay/Cluster.h b/src/xrpld/overlay/Cluster.h index bffebca550..ce3d85c72e 100644 --- a/src/xrpld/overlay/Cluster.h +++ b/src/xrpld/overlay/Cluster.h @@ -25,6 +25,7 @@ private: { explicit Comparator() = default; + // NOLINTNEXTLINE(readability-identifier-naming) -- std heterogeneous-lookup concept name using is_transparent = std::true_type; bool diff --git a/src/xrpld/overlay/Overlay.h b/src/xrpld/overlay/Overlay.h index 9ab80e6697..0dd951695b 100644 --- a/src/xrpld/overlay/Overlay.h +++ b/src/xrpld/overlay/Overlay.h @@ -37,8 +37,8 @@ namespace xrpl { class Overlay : public beast::PropertyStream::Source { protected: - using socket_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; + using SocketType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; // VFALCO NOTE The requirement of this constructor is an // unfortunate problem with the API for @@ -82,8 +82,8 @@ public: */ virtual Handoff onHandoff( - std::unique_ptr&& bundle, - http_request_type&& request, + std::unique_ptr&& bundle, + HttpRequestType&& request, boost::asio::ip::tcp::endpoint remoteAddress) = 0; /** @@ -133,7 +133,7 @@ public: * Returns the peer with the matching short id, or null. */ [[nodiscard]] virtual std::shared_ptr - findPeerByShortID(Peer::id_t const& id) const = 0; + findPeerByShortID(Peer::ID const& id) const = 0; /** * Returns the peer with the matching public key, or null. @@ -160,8 +160,8 @@ public: * @param validator The pubkey of the validator that issued this proposal * @return the set of peers which have already sent us this proposal */ - virtual std::set - relay(protocol::TMProposeSet const& m, uint256 const& uid, PublicKey const& validator) = 0; + virtual std::set + relay(protocol::TMProposeSet const& m, UInt256 const& uid, PublicKey const& validator) = 0; /** * Relay a validation. @@ -170,8 +170,8 @@ public: * @param validator The pubkey of the validator that issued this validation * @return the set of peers which have already sent us this validation */ - virtual std::set - relay(protocol::TMValidation const& m, uint256 const& uid, PublicKey const& validator) = 0; + virtual std::set + relay(protocol::TMValidation const& m, UInt256 const& uid, PublicKey const& validator) = 0; /** * Relay a transaction. If the tx reduce-relay feature is enabled then @@ -183,9 +183,9 @@ public: */ virtual void relay( - uint256 const& hash, + UInt256 const& hash, std::optional> m, - std::set const& toSkip) = 0; + std::set const& toSkip) = 0; /** * Visit every active peer. diff --git a/src/xrpld/overlay/Peer.h b/src/xrpld/overlay/Peer.h index 6c4cf1dff1..b1a4e808ac 100644 --- a/src/xrpld/overlay/Peer.h +++ b/src/xrpld/overlay/Peer.h @@ -30,7 +30,7 @@ enum class ProtocolFeature { class Peer { public: - using ptr = std::shared_ptr; + using Ptr = std::shared_ptr; /** * Uniquely identifies a peer. @@ -38,7 +38,7 @@ public: * can discover if the peer is no longer connected and make * adjustments as needed. */ - using id_t = std::uint32_t; + using ID = std::uint32_t; virtual ~Peer() = default; @@ -62,13 +62,13 @@ public: * Aggregate transaction's hash. */ virtual void - addTxQueue(uint256 const&) = 0; + addTxQueue(UInt256 const&) = 0; /** * Remove hash from the transactions' hashes queue. */ virtual void - removeTxQueue(uint256 const&) = 0; + removeTxQueue(UInt256 const&) = 0; /** * Adjust this peer's load balance based on the type of load imposed. @@ -80,7 +80,7 @@ public: // Identity // - [[nodiscard]] virtual id_t + [[nodiscard]] virtual ID id() const = 0; /** @@ -116,14 +116,14 @@ public: // Ledger // - [[nodiscard]] virtual uint256 + [[nodiscard]] virtual UInt256 getClosedLedgerHash() const = 0; [[nodiscard]] virtual bool - hasLedger(uint256 const& hash, std::uint32_t seq) const = 0; + hasLedger(UInt256 const& hash, std::uint32_t seq) const = 0; virtual void ledgerRange(std::uint32_t& minSeq, std::uint32_t& maxSeq) const = 0; [[nodiscard]] virtual bool - hasTxSet(uint256 const& hash) const = 0; + hasTxSet(UInt256 const& hash) const = 0; virtual void cycleStatus() = 0; virtual bool diff --git a/src/xrpld/overlay/PeerSet.h b/src/xrpld/overlay/PeerSet.h index ffba7932de..67c71fcf88 100644 --- a/src/xrpld/overlay/PeerSet.h +++ b/src/xrpld/overlay/PeerSet.h @@ -62,7 +62,7 @@ public: /** * get the set of ids of previously added peers */ - [[nodiscard]] virtual std::set const& + [[nodiscard]] virtual std::set const& getPeerIds() const = 0; }; diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index 4b5026414b..8284cc977c 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -78,14 +78,14 @@ public: * @param duration Squelch duration in seconds */ virtual void - squelch(PublicKey const& validator, Peer::id_t id, std::uint32_t duration) const = 0; + squelch(PublicKey const& validator, Peer::ID id, std::uint32_t duration) const = 0; /** * Unsquelch handler * @param validator Public key of the source validator * @param id Peer's id to unsquelch */ virtual void - unsquelch(PublicKey const& validator, Peer::id_t id) const = 0; + unsquelch(PublicKey const& validator, Peer::ID id) const = 0; }; /** @@ -103,11 +103,11 @@ class Slot final { private: friend class Slots; - using id_t = Peer::id_t; + using ID = Peer::ID; using time_point = ClockType::time_point; // a callback to report ignored squelches - using ignored_squelch_callback = std::function; + using IgnoredSquelchCallback = std::function; /** * Constructor @@ -147,9 +147,9 @@ private: void update( PublicKey const& validator, - id_t id, + ID id, protocol::MessageType type, - ignored_squelch_callback callback); + IgnoredSquelchCallback callback); /** * Handle peer deletion when a peer disconnects. @@ -163,7 +163,7 @@ private: * disconnects */ void - deletePeer(PublicKey const& validator, id_t id, bool erase); + deletePeer(PublicKey const& validator, ID id, bool erase); /** * Get the time of the last peer selection round @@ -198,14 +198,14 @@ private: /** * Return selected peers */ - [[nodiscard]] std::set + [[nodiscard]] std::set getSelected() const; /** * Get peers info. Return map of peer's state, count, squelch * expiration milsec, and last message time milsec. */ - [[nodiscard]] std::unordered_map> + [[nodiscard]] std::unordered_map> getPeers() const; /** @@ -251,11 +251,11 @@ private: time_point lastMessage; // time last message received }; - std::unordered_map peers_; // peer's data + std::unordered_map peers_; // peer's data // pool of peers considered as the source of messages // from validator - peers that reached kMinMessageThreshold - std::unordered_set considered_; + std::unordered_set considered_; // number of peers that reached kMaxMessageThreshold std::uint16_t reachedThreshold_{0}; @@ -298,9 +298,9 @@ template void Slot::update( PublicKey const& validator, - id_t id, + ID id, protocol::MessageType type, - ignored_squelch_callback callback) + IgnoredSquelchCallback callback) { using namespace std::chrono; auto now = ClockType::now(); @@ -362,7 +362,7 @@ Slot::update( // If number of remaining peers != maxSelectedPeers_ // then reset the Counting state and let deleteIdlePeer() handle // idled peers. - std::unordered_set selected; + std::unordered_set selected; auto const consideredPoolSize = considered_.size(); while (selected.size() != maxSelectedPeers_ && !considered_.empty()) { @@ -444,12 +444,12 @@ Slot::getSquelchDuration(std::size_t npeers) template void -Slot::deletePeer(PublicKey const& validator, id_t id, bool erase) +Slot::deletePeer(PublicKey const& validator, ID id, bool erase) { auto it = peers_.find(id); if (it != peers_.end()) { - std::vector toUnsquelch; + std::vector toUnsquelch; JLOG(journal_.trace()) << "deletePeer: " << Slice(validator) << " " << id << " selected " << (it->second.state == PeerState::Selected) << " considered " @@ -527,10 +527,10 @@ Slot::notInState(PeerState state) const } template -std::set +std::set Slot::getSelected() const { - std::set r; + std::set r; for (auto const& [id, info] : peers_) { if (info.state == PeerState::Selected) @@ -540,12 +540,12 @@ Slot::getSelected() const } template -std::unordered_map> +std::unordered_map> Slot::getPeers() const { using namespace std::chrono; auto r = std:: - unordered_map>(); + unordered_map>(); for (auto const& [id, info] : peers_) { @@ -572,12 +572,12 @@ template class Slots final { using time_point = ClockType::time_point; - using id_t = Peer::id_t; - using messages = beast::aged_unordered_map< - uint256, - std::unordered_set, + using ID = Peer::ID; + using Messages = beast::AgedUnorderedMap< + UInt256, + std::unordered_set, ClockType, - HardenedHash>; + HardenedHash>; public: /** @@ -629,9 +629,9 @@ public: */ void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - id_t id, + ID id, protocol::MessageType type) { updateSlotAndSquelch(key, validator, id, type, []() {}); @@ -647,11 +647,11 @@ public: */ void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - id_t id, + ID id, protocol::MessageType type, - Slot::ignored_squelch_callback callback); + Slot::IgnoredSquelchCallback callback); /** * Check if peers stopped relaying messages @@ -699,7 +699,7 @@ public: /** * Get selected peers */ - std::set + std::set getSelected(PublicKey const& validator) { auto const& it = slots_.find(validator); @@ -712,7 +712,7 @@ public: * Get peers info. Return map of peer's state, count, and squelch * expiration milliseconds. */ - std::unordered_map> + std::unordered_map> getPeers(PublicKey const& validator) { auto const& it = slots_.find(validator); @@ -741,7 +741,7 @@ public: * @param erase If true then erase the peer */ void - deletePeer(id_t id, bool erase); + deletePeer(ID id, bool erase); private: /** @@ -750,11 +750,11 @@ private: * Return true if added */ bool - addPeerMessage(uint256 const& key, id_t id); + addPeerMessage(UInt256 const& key, ID id); std::atomic_bool reduceRelayReady_{false}; - hash_map> slots_; + HashMap> slots_; SquelchHandler const& handler_; // squelch/unsquelch handler Logs& logs_; beast::Journal const journal_; @@ -766,12 +766,12 @@ private: // to discard duplicate message from the same peer. A message // is aged after IDLED seconds. A message received IDLED seconds // after it was relayed is ignored by PeerImp. - inline static messages peersWithMessage{beast::getAbstractClock()}; + inline static Messages peersWithMessage{beast::getAbstractClock()}; }; template bool -Slots::addPeerMessage(uint256 const& key, id_t id) +Slots::addPeerMessage(UInt256 const& key, ID id) { beast::expire(peersWithMessage, reduce_relay::kIdled); @@ -781,7 +781,7 @@ Slots::addPeerMessage(uint256 const& key, id_t id) if (it == peersWithMessage.end()) { JLOG(journal_.trace()) << "addPeerMessage: new " << to_string(key) << " " << id; - peersWithMessage.emplace(key, std::unordered_set{id}); + peersWithMessage.emplace(key, std::unordered_set{id}); return true; } @@ -803,11 +803,11 @@ Slots::addPeerMessage(uint256 const& key, id_t id) template void Slots::updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - id_t id, + ID id, protocol::MessageType type, - Slot::ignored_squelch_callback callback) + Slot::IgnoredSquelchCallback callback) { if (!addPeerMessage(key, id)) return; @@ -832,7 +832,7 @@ Slots::updateSlotAndSquelch( template void -Slots::deletePeer(id_t id, bool erase) +Slots::deletePeer(ID id, bool erase) { for (auto& [validator, slot] : slots_) slot.deletePeer(validator, id, erase); diff --git a/src/xrpld/overlay/Squelch.h b/src/xrpld/overlay/Squelch.h index 6899bf39f0..c89824de17 100644 --- a/src/xrpld/overlay/Squelch.h +++ b/src/xrpld/overlay/Squelch.h @@ -54,7 +54,7 @@ private: * Maintains the list of squelched relaying to downstream peers. * Expiration time is included in the TMSquelch message. */ - hash_map squelched_; + HashMap squelched_; beast::Journal const journal_; }; diff --git a/src/xrpld/overlay/detail/ConnectAttempt.cpp b/src/xrpld/overlay/detail/ConnectAttempt.cpp index b78b8eb7b8..579bd6b948 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.cpp +++ b/src/xrpld/overlay/detail/ConnectAttempt.cpp @@ -48,10 +48,10 @@ namespace xrpl { ConnectAttempt::ConnectAttempt( Application& app, boost::asio::io_context& ioContext, - endpoint_type remoteEndpoint, + EndpointType remoteEndpoint, resource::Consumer usage, - shared_context const& context, - Peer::id_t id, + SharedContext const& context, + Peer::ID id, std::shared_ptr const& slot, beast::Journal journal, OverlayImpl& overlay) @@ -65,8 +65,8 @@ ConnectAttempt::ConnectAttempt( , strand_(boost::asio::make_strand(ioContext)) , timer_(ioContext) , streamPtr_( - std::make_unique( - socket_type(std::forward(ioContext)), + std::make_unique( + SocketType(std::forward(ioContext)), *context)) , socket_(streamPtr_->next_layer().socket()) , stream_(*streamPtr_) @@ -104,7 +104,7 @@ ConnectAttempt::run() stream_.next_layer().async_connect( remoteEndpoint_, boost::asio::bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onConnect(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onConnect(ec); })); } //------------------------------------------------------------------------------ @@ -138,7 +138,7 @@ ConnectAttempt::fail(std::string const& reason) } void -ConnectAttempt::fail(std::string const& name, error_code ec) +ConnectAttempt::fail(std::string const& name, ErrorCode ec) { JLOG(journal_.debug()) << name << ": " << ec.message(); close(); @@ -159,7 +159,7 @@ ConnectAttempt::setTimer() timer_.async_wait( boost::asio::bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); } void @@ -176,7 +176,7 @@ ConnectAttempt::cancelTimer() } void -ConnectAttempt::onTimer(error_code ec) +ConnectAttempt::onTimer(ErrorCode ec) { if (!socket_.is_open()) return; @@ -196,7 +196,7 @@ ConnectAttempt::onTimer(error_code ec) } void -ConnectAttempt::onConnect(error_code ec) +ConnectAttempt::onConnect(ErrorCode ec) { cancelTimer(); @@ -226,11 +226,11 @@ ConnectAttempt::onConnect(error_code ec) stream_.async_handshake( boost::asio::ssl::stream_base::client, boost::asio::bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onHandshake(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onHandshake(ec); })); } void -ConnectAttempt::onHandshake(error_code ec) +ConnectAttempt::onHandshake(ErrorCode ec) { cancelTimer(); if (!socket_.is_open()) @@ -287,11 +287,11 @@ ConnectAttempt::onHandshake(error_code ec) req_, boost::asio::bind_executor( strand_, - [self = shared_from_this()](error_code const& ec, std::size_t) { self->onWrite(ec); })); + [self = shared_from_this()](ErrorCode const& ec, std::size_t) { self->onWrite(ec); })); } void -ConnectAttempt::onWrite(error_code ec) +ConnectAttempt::onWrite(ErrorCode ec) { cancelTimer(); @@ -313,11 +313,11 @@ ConnectAttempt::onWrite(error_code ec) response_, boost::asio::bind_executor( strand_, - [self = shared_from_this()](error_code const& ec, std::size_t) { self->onRead(ec); })); + [self = shared_from_this()](ErrorCode const& ec, std::size_t) { self->onRead(ec); })); } void -ConnectAttempt::onRead(error_code ec) +ConnectAttempt::onRead(ErrorCode ec) { cancelTimer(); @@ -336,7 +336,7 @@ ConnectAttempt::onRead(error_code ec) stream_.async_shutdown( boost::asio::bind_executor( strand_, - [self = shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); return; } @@ -348,7 +348,7 @@ ConnectAttempt::onRead(error_code ec) } void -ConnectAttempt::onShutdown(error_code ec) +ConnectAttempt::onShutdown(ErrorCode ec) { cancelTimer(); if (!ec) @@ -394,7 +394,7 @@ ConnectAttempt::processResponse() { if (v.isString()) { - error_code ec; + ErrorCode ec; auto const ep = parseEndpoint(v.asString(), ec); if (!ec) eps.push_back(ep); diff --git a/src/xrpld/overlay/detail/ConnectAttempt.h b/src/xrpld/overlay/detail/ConnectAttempt.h index 3ebffc529d..eb485617f1 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.h +++ b/src/xrpld/overlay/detail/ConnectAttempt.h @@ -26,40 +26,40 @@ class ConnectAttempt : public OverlayImpl::Child, public std::enable_shared_from_this { private: - using error_code = boost::system::error_code; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using request_type = boost::beast::http::request; - using response_type = boost::beast::http::response; + using ErrorCode = boost::system::error_code; + using EndpointType = boost::asio::ip::tcp::endpoint; + using RequestType = boost::beast::http::request; + using ResponseType = boost::beast::http::response; - using socket_type = boost::asio::ip::tcp::socket; - using middle_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; - using shared_context = std::shared_ptr; + using SocketType = boost::asio::ip::tcp::socket; + using MiddleType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; + using SharedContext = std::shared_ptr; Application& app_; std::uint32_t const id_; beast::WrappedSink sink_; beast::Journal const journal_; - endpoint_type remoteEndpoint_; + EndpointType remoteEndpoint_; resource::Consumer usage_; boost::asio::strand strand_; boost::asio::basic_waitable_timer timer_; - std::unique_ptr streamPtr_; - socket_type& socket_; - stream_type& stream_; + std::unique_ptr streamPtr_; + SocketType& socket_; + StreamType& stream_; boost::beast::multi_buffer readBuf_; - response_type response_; + ResponseType response_; std::shared_ptr slot_; - request_type req_; + RequestType req_; public: ConnectAttempt( Application& app, boost::asio::io_context& ioContext, - endpoint_type remoteEndpoint, + EndpointType remoteEndpoint, resource::Consumer usage, - shared_context const& context, - Peer::id_t id, + SharedContext const& context, + Peer::ID id, std::shared_ptr const& slot, beast::Journal journal, OverlayImpl& overlay); @@ -78,23 +78,23 @@ private: void fail(std::string const& reason); void - fail(std::string const& name, error_code ec); + fail(std::string const& name, ErrorCode ec); void setTimer(); void cancelTimer(); void - onTimer(error_code ec); + onTimer(ErrorCode ec); void - onConnect(error_code ec); + onConnect(ErrorCode ec); void - onHandshake(error_code ec); + onHandshake(ErrorCode ec); void - onWrite(error_code ec); + onWrite(ErrorCode ec); void - onRead(error_code ec); + onRead(ErrorCode ec); void - onShutdown(error_code ec); + onShutdown(ErrorCode ec); void processResponse(); diff --git a/src/xrpld/overlay/detail/Handshake.cpp b/src/xrpld/overlay/detail/Handshake.cpp index a12923d1c3..f496a25332 100644 --- a/src/xrpld/overlay/detail/Handshake.cpp +++ b/src/xrpld/overlay/detail/Handshake.cpp @@ -100,7 +100,7 @@ makeFeaturesRequestHeader( std::string makeFeaturesResponseHeader( - http_request_type const& headers, + HttpRequestType const& headers, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, @@ -144,15 +144,15 @@ hashLastMessage(SSL const* ssl, size_t (*get)(const SSL*, void*, size_t)) if (len < kSslMinimumFinishedLength) return std::nullopt; - sha512_hasher const h; + Sha512Hasher const h; BaseUInt<512> cookie; SHA512(buf, len, cookie.data()); return cookie; } -std::optional -makeSharedValue(stream_type& ssl, beast::Journal journal) +std::optional +makeSharedValue(StreamType& ssl, beast::Journal journal) { auto const cookie1 = hashLastMessage(ssl.native_handle(), SSL_get_finished); if (!cookie1) @@ -184,7 +184,7 @@ makeSharedValue(stream_type& ssl, beast::Journal journal) void buildHandshake( boost::beast::http::fields& h, - xrpl::uint256 const& sharedValue, + xrpl::UInt256 const& sharedValue, std::optional networkID, beast::ip::Address publicIp, beast::ip::Address remoteIp, @@ -229,7 +229,7 @@ buildHandshake( PublicKey verifyHandshake( boost::beast::http::fields const& headers, - xrpl::uint256 const& sharedValue, + xrpl::UInt256 const& sharedValue, std::optional networkID, beast::ip::Address publicIp, beast::ip::Address remote, @@ -368,9 +368,9 @@ makeRequest( bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, - bool vpReduceRelayEnabled) -> request_type + bool vpReduceRelayEnabled) -> RequestType { - request_type m; + RequestType m; m.method(boost::beast::http::verb::get); m.target("/"); m.version(11); @@ -386,18 +386,18 @@ makeRequest( return m; } -http_response_type +HttpResponseType makeResponse( bool crawlPublic, - http_request_type const& req, + HttpRequestType const& req, beast::ip::Address publicIp, beast::ip::Address remoteIp, - uint256 const& sharedValue, + UInt256 const& sharedValue, std::optional networkID, ProtocolVersion protocol, Application& app) { - http_response_type resp; + HttpResponseType resp; resp.result(boost::beast::http::status::switching_protocols); resp.version(req.version()); resp.insert("Connection", "Upgrade"); diff --git a/src/xrpld/overlay/detail/Handshake.h b/src/xrpld/overlay/detail/Handshake.h index d54cd3a0ea..5f94341a58 100644 --- a/src/xrpld/overlay/detail/Handshake.h +++ b/src/xrpld/overlay/detail/Handshake.h @@ -20,11 +20,11 @@ namespace xrpl { -using socket_type = boost::beast::tcp_stream; -using stream_type = boost::beast::ssl_stream; -using request_type = boost::beast::http::request; -using http_request_type = boost::beast::http::request; -using http_response_type = boost::beast::http::response; +using SocketType = boost::beast::tcp_stream; +using StreamType = boost::beast::ssl_stream; +using RequestType = boost::beast::http::request; +using HttpRequestType = boost::beast::http::request; +using HttpResponseType = boost::beast::http::response; /** * Computes a shared value based on the SSL connection state. @@ -36,8 +36,8 @@ using http_response_type = boost::beast::http::response -makeSharedValue(stream_type& ssl, beast::Journal journal); +std::optional +makeSharedValue(StreamType& ssl, beast::Journal journal); /** * Insert fields headers necessary for upgrading the link to the peer protocol. @@ -45,7 +45,7 @@ makeSharedValue(stream_type& ssl, beast::Journal journal); void buildHandshake( boost::beast::http::fields& h, - uint256 const& sharedValue, + UInt256 const& sharedValue, std::optional networkID, beast::ip::Address publicIp, beast::ip::Address remoteIp, @@ -66,7 +66,7 @@ buildHandshake( PublicKey verifyHandshake( boost::beast::http::fields const& headers, - uint256 const& sharedValue, + UInt256 const& sharedValue, std::optional networkID, beast::ip::Address publicIp, beast::ip::Address remote, @@ -84,7 +84,7 @@ verifyHandshake( * feature is enabled * @return http request with empty body */ -request_type +RequestType makeRequest( bool crawlPublic, bool comprEnabled, @@ -105,13 +105,13 @@ makeRequest( * @param app Application's reference to access some common properties * @return http response */ -http_response_type +HttpResponseType makeResponse( bool crawlPublic, - http_request_type const& req, + HttpRequestType const& req, beast::ip::Address publicIp, beast::ip::Address remoteIp, - uint256 const& sharedValue, + UInt256 const& sharedValue, std::optional networkID, ProtocolVersion version, Application& app); @@ -231,7 +231,7 @@ makeFeaturesRequestHeader( */ std::string makeFeaturesResponseHeader( - http_request_type const& headers, + HttpRequestType const& headers, bool comprEnabled, bool ledgerReplayEnabled, bool txReduceRelayEnabled, diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index dfac03b961..1c1ce67455 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -135,11 +135,11 @@ OverlayImpl::Timer::asyncWait() timer.async_wait( boost::asio::bind_executor( overlay_.strand_, - [self = shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + [self = shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); } void -OverlayImpl::Timer::onTimer(error_code ec) +OverlayImpl::Timer::onTimer(ErrorCode ec) { if (ec || stopping) { @@ -172,7 +172,7 @@ OverlayImpl::OverlayImpl( Resolver& resolver, boost::asio::io_context& ioContext, BasicConfig const& config, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : app_(app) , ioContext_(ioContext) , work_(std::in_place, boost::asio::make_work_guard(ioContext_)) @@ -210,9 +210,9 @@ OverlayImpl::OverlayImpl( Handoff OverlayImpl::onHandoff( - std::unique_ptr&& streamPtr, - http_request_type&& request, - endpoint_type remoteEndpoint) + std::unique_ptr&& streamPtr, + HttpRequestType&& request, + EndpointType remoteEndpoint) { auto const id = nextId_++; auto peerJournal = app_.getJournal("Peer"); @@ -229,7 +229,7 @@ OverlayImpl::onHandoff( JLOG(journal.debug()) << "Peer connection upgrade from " << remoteEndpoint; - error_code ec; + ErrorCode ec; auto const localEndpoint(streamPtr->next_layer().socket().local_endpoint(ec)); if (ec) { @@ -364,7 +364,7 @@ OverlayImpl::onHandoff( //------------------------------------------------------------------------------ bool -OverlayImpl::isPeerUpgrade(http_request_type const& request) +OverlayImpl::isPeerUpgrade(HttpRequestType const& request) { if (!isUpgrade(request)) return false; @@ -383,8 +383,8 @@ OverlayImpl::makePrefix(std::uint32_t id) std::shared_ptr OverlayImpl::makeRedirectResponse( std::shared_ptr const& slot, - http_request_type const& request, - address_type remoteAddress) + HttpRequestType const& request, + AddressType remoteAddress) { boost::beast::http::response msg; msg.version(request.version()); @@ -410,8 +410,8 @@ OverlayImpl::makeRedirectResponse( std::shared_ptr OverlayImpl::makeErrorResponse( std::shared_ptr const& slot, - http_request_type const& request, - address_type remoteAddress, + HttpRequestType const& request, + AddressType remoteAddress, std::string const& text) { boost::beast::http::response msg; @@ -656,7 +656,7 @@ OverlayImpl::activate(std::shared_ptr const& peer) } void -OverlayImpl::onPeerDeactivate(Peer::id_t id) +OverlayImpl::onPeerDeactivate(Peer::ID id) { std::scoped_lock const lock(mutex_); ids_.erase(id); @@ -908,7 +908,7 @@ OverlayImpl::json() } bool -OverlayImpl::processCrawl(http_request_type const& req, Handoff& handoff) +OverlayImpl::processCrawl(HttpRequestType const& req, Handoff& handoff) { if (req.target() != "/crawl" || setup_.crawlOptions == crawl_options::kDisabled) return false; @@ -944,7 +944,7 @@ OverlayImpl::processCrawl(http_request_type const& req, Handoff& handoff) } bool -OverlayImpl::processValidatorList(http_request_type const& req, Handoff& handoff) +OverlayImpl::processValidatorList(HttpRequestType const& req, Handoff& handoff) { // If the target is in the form "/vl/", // return the most recent validator list for that key. @@ -1008,7 +1008,7 @@ OverlayImpl::processValidatorList(http_request_type const& req, Handoff& handoff } bool -OverlayImpl::processHealth(http_request_type const& req, Handoff& handoff) +OverlayImpl::processHealth(HttpRequestType const& req, Handoff& handoff) { if (req.target() != "/health") return false; @@ -1112,7 +1112,7 @@ OverlayImpl::processHealth(http_request_type const& req, Handoff& handoff) } bool -OverlayImpl::processRequest(http_request_type const& req, Handoff& handoff) +OverlayImpl::processRequest(HttpRequestType const& req, Handoff& handoff) { // Take advantage of || short-circuiting return processCrawl(req, handoff) || processValidatorList(req, handoff) || @@ -1132,7 +1132,7 @@ OverlayImpl::getActivePeers() const Overlay::PeerSequence OverlayImpl::getActivePeers( - std::set const& toSkip, + std::set const& toSkip, std::size_t& active, std::size_t& disabled, std::size_t& enabledInSkip) const @@ -1176,7 +1176,7 @@ OverlayImpl::checkTracking(std::uint32_t index) } std::shared_ptr -OverlayImpl::findPeerByShortID(Peer::id_t const& id) const +OverlayImpl::findPeerByShortID(Peer::ID const& id) const { std::scoped_lock const lock(mutex_); auto const iter = ids_.find(id); @@ -1211,8 +1211,8 @@ OverlayImpl::broadcast(protocol::TMProposeSet const& m) forEach([&](std::shared_ptr const& p) { p->send(sm); }); } -std::set -OverlayImpl::relay(protocol::TMProposeSet const& m, uint256 const& uid, PublicKey const& validator) +std::set +OverlayImpl::relay(protocol::TMProposeSet const& m, UInt256 const& uid, PublicKey const& validator) { if (auto const toSkip = app_.getHashRouter().shouldRelay(uid)) { @@ -1233,8 +1233,8 @@ OverlayImpl::broadcast(protocol::TMValidation const& m) forEach([sm](std::shared_ptr const& p) { p->send(sm); }); } -std::set -OverlayImpl::relay(protocol::TMValidation const& m, uint256 const& uid, PublicKey const& validator) +std::set +OverlayImpl::relay(protocol::TMValidation const& m, UInt256 const& uid, PublicKey const& validator) { if (auto const toSkip = app_.getHashRouter().shouldRelay(uid)) { @@ -1265,7 +1265,7 @@ OverlayImpl::getManifestsMessage() { PublicKey masterKey; std::string serialized; - uint256 hash; + UInt256 hash; }; std::vector cached; app_.getValidatorManifests().forEachManifest( @@ -1325,9 +1325,9 @@ OverlayImpl::getManifestsMessage() void OverlayImpl::relay( - uint256 const& hash, + UInt256 const& hash, std::optional> tx, - std::set const& toSkip) + std::set const& toSkip) { bool relay = tx.has_value(); if (relay) @@ -1506,7 +1506,7 @@ makeSquelchMessage(PublicKey const& validator, bool squelch, uint32_t squelchDur } void -OverlayImpl::unsquelch(PublicKey const& validator, Peer::id_t id) const +OverlayImpl::unsquelch(PublicKey const& validator, Peer::ID id) const { if (auto peer = findPeerByShortID(id); peer) { @@ -1517,7 +1517,7 @@ OverlayImpl::unsquelch(PublicKey const& validator, Peer::id_t id) const } void -OverlayImpl::squelch(PublicKey const& validator, Peer::id_t id, uint32_t squelchDuration) const +OverlayImpl::squelch(PublicKey const& validator, Peer::ID id, uint32_t squelchDuration) const { if (auto peer = findPeerByShortID(id); peer) { @@ -1527,9 +1527,9 @@ OverlayImpl::squelch(PublicKey const& validator, Peer::id_t id, uint32_t squelch void OverlayImpl::updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - std::set&& peers, + std::set&& peers, protocol::MessageType type) { if (!slots_.baseSquelchReady()) @@ -1557,9 +1557,9 @@ OverlayImpl::updateSlotAndSquelch( void OverlayImpl::updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - Peer::id_t peer, + Peer::ID peer, protocol::MessageType type) { if (!slots_.baseSquelchReady()) @@ -1584,7 +1584,7 @@ OverlayImpl::updateSlotAndSquelch( } void -OverlayImpl::deletePeer(Peer::id_t id) +OverlayImpl::deletePeer(Peer::ID id) { if (!strand_.running_in_this_thread()) { @@ -1729,7 +1729,7 @@ makeOverlay( Resolver& resolver, boost::asio::io_context& ioContext, BasicConfig const& config, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) { return std::make_unique( app, setup, serverHandler, resourceManager, resolver, ioContext, config, collector); diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index bc90d64e89..c7bd2c891a 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -83,15 +83,15 @@ public: }; private: - using clock_type = std::chrono::steady_clock; - using socket_type = boost::asio::ip::tcp::socket; - using address_type = boost::asio::ip::address; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using error_code = boost::system::error_code; + using ClockType = std::chrono::steady_clock; + using SocketType = boost::asio::ip::tcp::socket; + using AddressType = boost::asio::ip::address; + using EndpointType = boost::asio::ip::tcp::endpoint; + using ErrorCode = boost::system::error_code; struct Timer : Child, std::enable_shared_from_this { - boost::asio::basic_waitable_timer timer; + boost::asio::basic_waitable_timer timer; bool stopping{false}; explicit Timer(OverlayImpl& overlay); @@ -103,7 +103,7 @@ private: asyncWait(); void - onTimer(error_code ec); + onTimer(ErrorCode ec); }; Application& app_; @@ -121,10 +121,10 @@ private: peer_finder::StoreSqdb store_; std::unique_ptr peerFinder_; TrafficCount traffic_; - hash_map, std::weak_ptr> peers_; - hash_map> ids_; + HashMap, std::weak_ptr> peers_; + HashMap> ids_; Resolver& resolver_; - std::atomic nextId_; + std::atomic nextId_; int timerCount_{0}; std::atomic jqTransOverflow_{0}; std::atomic peerDisconnects_{0}; @@ -153,7 +153,7 @@ public: Resolver& resolver, boost::asio::io_context& ioContext, BasicConfig const& config, - beast::insight::Collector::ptr const& collector); + beast::insight::Collector::Ptr const& collector); OverlayImpl(OverlayImpl const&) = delete; OverlayImpl& @@ -185,9 +185,9 @@ public: Handoff onHandoff( - std::unique_ptr&& bundle, - http_request_type&& request, - endpoint_type remoteEndpoint) override; + std::unique_ptr&& bundle, + HttpRequestType&& request, + EndpointType remoteEndpoint) override; void connect(beast::ip::Endpoint const& remoteEndpoint) override; @@ -216,7 +216,7 @@ public: */ PeerSequence getActivePeers( - std::set const& toSkip, + std::set const& toSkip, std::size_t& active, std::size_t& disabled, std::size_t& enabledInSkip) const; @@ -225,7 +225,7 @@ public: checkTracking(std::uint32_t) override; std::shared_ptr - findPeerByShortID(Peer::id_t const& id) const override; + findPeerByShortID(Peer::ID const& id) const override; std::shared_ptr findPeerByPublicKey(PublicKey const& pubKey) override; @@ -236,17 +236,17 @@ public: void broadcast(protocol::TMValidation const& m) override; - std::set - relay(protocol::TMProposeSet const& m, uint256 const& uid, PublicKey const& validator) override; + std::set + relay(protocol::TMProposeSet const& m, UInt256 const& uid, PublicKey const& validator) override; - std::set - relay(protocol::TMValidation const& m, uint256 const& uid, PublicKey const& validator) override; + std::set + relay(protocol::TMValidation const& m, UInt256 const& uid, PublicKey const& validator) override; void relay( - uint256 const&, + UInt256 const&, std::optional> m, - std::set const& skip) override; + std::set const& skip) override; std::shared_ptr getManifestsMessage(); @@ -273,7 +273,7 @@ public: // Called when an active peer is destroyed. void - onPeerDeactivate(Peer::id_t id); + onPeerDeactivate(Peer::ID id); // UnaryFunc will be called as // void(std::shared_ptr&&) @@ -308,7 +308,7 @@ public: std::shared_ptr const& from); static bool - isPeerUpgrade(http_request_type const& request); + isPeerUpgrade(HttpRequestType const& request); template static bool @@ -406,9 +406,9 @@ public: */ void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - std::set&& peers, + std::set&& peers, protocol::MessageType type); /** @@ -416,9 +416,9 @@ public: */ void updateSlotAndSquelch( - uint256 const& key, + UInt256 const& key, PublicKey const& validator, - Peer::id_t peer, + Peer::ID peer, protocol::MessageType type); /** @@ -428,7 +428,7 @@ public: * @param id Peer's id */ void - deletePeer(Peer::id_t id); + deletePeer(Peer::ID id); json::Value txMetrics() const override @@ -451,23 +451,23 @@ public: private: void - squelch(PublicKey const& validator, Peer::id_t const id, std::uint32_t squelchDuration) + squelch(PublicKey const& validator, Peer::ID const id, std::uint32_t squelchDuration) const override; void - unsquelch(PublicKey const& validator, Peer::id_t id) const override; + unsquelch(PublicKey const& validator, Peer::ID id) const override; std::shared_ptr makeRedirectResponse( std::shared_ptr const& slot, - http_request_type const& request, - address_type remoteAddress); + HttpRequestType const& request, + AddressType remoteAddress); static std::shared_ptr makeErrorResponse( std::shared_ptr const& slot, - http_request_type const& request, - address_type remoteAddress, + HttpRequestType const& request, + AddressType remoteAddress, std::string const& msg); /** @@ -477,7 +477,7 @@ private: * @return true if the request was handled. */ bool - processCrawl(http_request_type const& req, Handoff& handoff); + processCrawl(HttpRequestType const& req, Handoff& handoff); /** * Handles validator list requests. @@ -488,7 +488,7 @@ private: * @return true if the request was handled. */ bool - processValidatorList(http_request_type const& req, Handoff& handoff); + processValidatorList(HttpRequestType const& req, Handoff& handoff); /** * Handles health requests. Health returns information about the @@ -497,7 +497,7 @@ private: * @return true if the request was handled. */ bool - processHealth(http_request_type const& req, Handoff& handoff); + processHealth(HttpRequestType const& req, Handoff& handoff); /** * Handles non-peer protocol requests. @@ -505,7 +505,7 @@ private: * @return true if the request was handled. */ bool - processRequest(http_request_type const& req, Handoff& handoff); + processRequest(HttpRequestType const& req, Handoff& handoff); /** * Returns information about peers on the overlay network. @@ -578,7 +578,7 @@ private: private: struct TrafficGauges { - TrafficGauges(std::string const& name, beast::insight::Collector::ptr const& collector) + TrafficGauges(std::string const& name, beast::insight::Collector::Ptr const& collector) : name(name) , bytesIn(collector->makeGauge(name, "Bytes_In")) , bytesOut(collector->makeGauge(name, "Bytes_Out")) @@ -598,7 +598,7 @@ private: template Stats( Handler const& handler, - beast::insight::Collector::ptr const& collector, + beast::insight::Collector::Ptr const& collector, std::unordered_map&& trafficGauges) : peerDisconnects(collector->makeGauge("Overlay", "Peer_Disconnects")) , trafficGauges(std::move(trafficGauges)) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 9069ada510..1e53b8f838 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -126,13 +126,13 @@ constexpr std::chrono::seconds kPeerTimerInterval{60}; PeerImp::PeerImp( Application& app, - id_t id, + ID id, std::shared_ptr const& slot, - http_request_type&& request, + HttpRequestType&& request, PublicKey const& publicKey, ProtocolVersion protocol, resource::Consumer consumer, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, OverlayImpl& overlay) : Child(overlay) , app_(app) @@ -147,16 +147,16 @@ PeerImp::PeerImp( , socket_(streamPtr_->next_layer().socket()) , stream_(*streamPtr_) , strand_(boost::asio::make_strand(socket_.get_executor())) - , timer_(waitable_timer{socket_.get_executor()}) + , timer_(WaitableTimer{socket_.get_executor()}) , remoteAddress_(slot->remoteEndpoint()) , overlay_(overlay) , inbound_(true) , protocol_(std::move(protocol)) , tracking_(Tracking::Unknown) - , trackingTime_(clock_type::now()) + , trackingTime_(ClockType::now()) , publicKey_(publicKey) - , lastPingTime_(clock_type::now()) - , creationTime_(clock_type::now()) + , lastPingTime_(ClockType::now()) + , creationTime_(ClockType::now()) , squelch_(app_.getJournal("Squelch")) , usage_(consumer) , fee_{.fee = resource::kFeeTrivialPeer, .context = ""} @@ -195,29 +195,29 @@ PeerImp::~PeerImp() } } -// Helper function to check for valid uint256 values in protobuf buffers +// Helper function to check for valid UInt256 values in protobuf buffers static bool stringIsUInt256Sized(std::string const& pBuffStr) { - return pBuffStr.size() == uint256::size(); + return pBuffStr.size() == UInt256::size(); } void PeerImp::run() { dispatch(strand_, [self = shared_from_this()]() { - auto parseLedgerHash = [](std::string_view value) -> std::optional { - if (uint256 ret; ret.parseHex(value)) + auto parseLedgerHash = [](std::string_view value) -> std::optional { + if (UInt256 ret; ret.parseHex(value)) return ret; - if (auto const s = base64Decode(value); s.size() == uint256::size()) - return uint256::fromRaw(s); + if (auto const s = base64Decode(value); s.size() == UInt256::size()) + return UInt256::fromRaw(s); return std::nullopt; }; - std::optional closed; - std::optional previous; + std::optional closed; + std::optional previous; if (auto const iter = self->headers_.find("Closed-Ledger"); iter != self->headers_.end()) { @@ -328,10 +328,9 @@ PeerImp::send(std::shared_ptr const& m) boost::asio::async_write( self->stream_, boost::asio::buffer(self->sendQueue_.front()->getBuffer(self->compressionEnabled_)), - bind_executor( - self->strand_, [self](error_code const& ec, std::size_t bytesTransferred) { - self->onWriteMessage(ec, bytesTransferred); - })); + bind_executor(self->strand_, [self](ErrorCode const& ec, std::size_t bytesTransferred) { + self->onWriteMessage(ec, bytesTransferred); + })); }); } @@ -352,7 +351,7 @@ PeerImp::sendTxQueue() } void -PeerImp::addTxQueue(uint256 const& hash) +PeerImp::addTxQueue(UInt256 const& hash) { dispatch(strand_, [self = shared_from_this(), hash]() { if (self->txQueue_.size() == reduce_relay::kMaxTxQueueSize) @@ -367,7 +366,7 @@ PeerImp::addTxQueue(uint256 const& hash) } void -PeerImp::removeTxQueue(uint256 const& hash) +PeerImp::removeTxQueue(UInt256 const& hash) { dispatch(strand_, [self = shared_from_this(), hash]() { auto removed = self->txQueue_.erase(hash); @@ -489,7 +488,7 @@ PeerImp::json() break; } - uint256 closedLedgerHash; + UInt256 closedLedgerHash; protocol::TMStatusChange lastStatus; { std::scoped_lock const sl(recentLock_); @@ -554,7 +553,7 @@ PeerImp::supportsFeature(ProtocolFeature f) const //------------------------------------------------------------------------------ bool -PeerImp::hasLedger(uint256 const& hash, std::uint32_t seq) const +PeerImp::hasLedger(UInt256 const& hash, std::uint32_t seq) const { { std::scoped_lock const sl(recentLock_); @@ -577,7 +576,7 @@ PeerImp::ledgerRange(std::uint32_t& minSeq, std::uint32_t& maxSeq) const } bool -PeerImp::hasTxSet(uint256 const& hash) const +PeerImp::hasTxSet(UInt256 const& hash) const { std::scoped_lock const sl(recentLock_); return std::ranges::find(recentTxSets_, hash) != recentTxSets_.end(); @@ -612,7 +611,7 @@ PeerImp::close() detaching_ = true; // DEPRECATED cancelTimer(); - error_code ec; + ErrorCode ec; socket_.close(ec); // NOLINT(bugprone-unused-return-value) overlay_.incPeerDisconnect(); @@ -633,7 +632,7 @@ PeerImp::fail(std::string const& reason) } void -PeerImp::fail(std::string const& name, error_code ec) +PeerImp::fail(std::string const& name, ErrorCode ec) { XRPL_ASSERT(strand_.running_in_this_thread(), "xrpl::PeerImp::fail : strand in this thread"); if (!socket_.is_open()) @@ -656,7 +655,7 @@ PeerImp::gracefulClose() return; setTimer(); stream_.async_shutdown(bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); } void @@ -672,7 +671,7 @@ PeerImp::setTimer() return; } timer_.async_wait(bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onTimer(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onTimer(ec); })); } // convenience for ignoring the error code @@ -700,7 +699,7 @@ PeerImp::makePrefix(std::string const& fingerprint) } void -PeerImp::onTimer(error_code const& ec) +PeerImp::onTimer(ErrorCode const& ec) { if (!socket_.is_open()) return; @@ -724,11 +723,11 @@ PeerImp::onTimer(error_code const& ec) if (auto const t = tracking_.load(); !inbound_ && t != Tracking::Converged) { - clock_type::duration duration; + ClockType::duration duration; { std::scoped_lock const sl(recentLock_); - duration = clock_type::now() - trackingTime_; + duration = ClockType::now() - trackingTime_; } if ((t == Tracking::Diverged && (duration > app_.config().maxDivergedTime)) || @@ -747,7 +746,7 @@ PeerImp::onTimer(error_code const& ec) return; } - lastPingTime_ = clock_type::now(); + lastPingTime_ = ClockType::now(); lastPingSeq_ = randInt(); protocol::TMPing message; @@ -760,7 +759,7 @@ PeerImp::onTimer(error_code const& ec) } void -PeerImp::onShutdown(error_code ec) +PeerImp::onShutdown(ErrorCode ec) { cancelTimer(); @@ -837,7 +836,7 @@ PeerImp::doAccept() bind_executor( strand_, [this, writeBuffer, self = shared_from_this()]( - error_code ec, std::size_t bytesTransferred) { + ErrorCode ec, std::size_t bytesTransferred) { if (!socket_.is_open()) return; if (ec) @@ -879,7 +878,7 @@ PeerImp::domain() const void PeerImp::doProtocolStart() { - onReadMessage(error_code(), 0); + onReadMessage(ErrorCode(), 0); // Send all the validator lists that have been loaded if (inbound_) @@ -890,7 +889,7 @@ PeerImp::doProtocolStart() std::map const& blobInfos, PublicKey const& pubKey, std::size_t maxSequence, - uint256 const& hash) { + UInt256 const& hash) { ValidatorList::sendValidatorList( *this, 0, @@ -915,7 +914,7 @@ PeerImp::doProtocolStart() // Called repeatedly with protocol message data void -PeerImp::onReadMessage(error_code ec, std::size_t bytesTransferred) +PeerImp::onReadMessage(ErrorCode ec, std::size_t bytesTransferred) { if (!socket_.is_open()) return; @@ -981,13 +980,13 @@ PeerImp::onReadMessage(error_code ec, std::size_t bytesTransferred) readBuffer_.prepare(std::max(tuning::kReadBufferBytes, hint)), bind_executor( strand_, - [self = shared_from_this()](error_code const& ec, std::size_t bytesTransferred) { + [self = shared_from_this()](ErrorCode const& ec, std::size_t bytesTransferred) { self->onReadMessage(ec, bytesTransferred); })); } void -PeerImp::onWriteMessage(error_code ec, std::size_t bytesTransferred) +PeerImp::onWriteMessage(ErrorCode ec, std::size_t bytesTransferred) { if (!socket_.is_open()) return; @@ -1018,7 +1017,7 @@ PeerImp::onWriteMessage(error_code ec, std::size_t bytesTransferred) boost::asio::buffer(sendQueue_.front()->getBuffer(compressionEnabled_)), bind_executor( strand_, - [self = shared_from_this()](error_code const& ec, std::size_t bytesTransferred) { + [self = shared_from_this()](ErrorCode const& ec, std::size_t bytesTransferred) { self->onWriteMessage(ec, bytesTransferred); })); return; @@ -1027,7 +1026,7 @@ PeerImp::onWriteMessage(error_code ec, std::size_t bytesTransferred) if (gracefulClose_) { stream_.async_shutdown(bind_executor( - strand_, [self = shared_from_this()](error_code const& ec) { self->onShutdown(ec); })); + strand_, [self = shared_from_this()](ErrorCode const& ec) { self->onShutdown(ec); })); return; } } @@ -1140,7 +1139,7 @@ PeerImp::onMessage(std::shared_ptr const& m) // Update latency estimate auto const rtt = - std::chrono::round(clock_type::now() - lastPingTime_); + std::chrono::round(ClockType::now() - lastPingTime_); std::scoped_lock const sl(recentLock_); @@ -1313,7 +1312,7 @@ PeerImp::handleTransaction( try { auto stx = std::make_shared(sit); - uint256 const txID = stx->getTransactionID(); + UInt256 const txID = stx->getTransactionID(); // Charge strongly for attempting to relay a txn with tfInnerBatchTxn // LCOV_EXCL_START @@ -1781,7 +1780,7 @@ PeerImp::onMessage(std::shared_ptr const& m) { badData( "Received node with empty data while relaying ledger data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1794,7 +1793,7 @@ PeerImp::onMessage(std::shared_ptr const& m) badData( "Received liBASE message with node reference while relaying ledger " "data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1808,7 +1807,7 @@ PeerImp::onMessage(std::shared_ptr const& m) { badData( "Received mixed mode message while relaying ledger data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1837,7 +1836,7 @@ PeerImp::onMessage(std::shared_ptr const& m) { badData( "Unable to get tree node while relaying ledger data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1847,7 +1846,7 @@ PeerImp::onMessage(std::shared_ptr const& m) { badData( "Unable to get node ID while relaying ledger data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1861,7 +1860,7 @@ PeerImp::onMessage(std::shared_ptr const& m) SOMETIMES(true, "xrpl::PeerImp : relay node has empty reference"); badData( "Empty node reference while relaying ledger data for " + - to_string(uint256::fromRaw(m->ledgerhash())) + " to peer " + + to_string(UInt256::fromRaw(m->ledgerhash())) + " to peer " + std::to_string(peer->id())); return; } @@ -1877,7 +1876,7 @@ PeerImp::onMessage(std::shared_ptr const& m) return; } - uint256 const ledgerHash = uint256::fromRaw(m->ledgerhash()); + UInt256 const ledgerHash = UInt256::fromRaw(m->ledgerhash()); // Otherwise check if received data for a candidate transaction set if (m->type() == protocol::liTS_CANDIDATE) @@ -1939,12 +1938,12 @@ PeerImp::onMessage(std::shared_ptr const& m) return; } - uint256 const proposeHash = uint256::fromRaw(set.currenttxhash()); - uint256 const prevLedger = uint256::fromRaw(set.previousledger()); + UInt256 const proposeHash = UInt256::fromRaw(set.currenttxhash()); + UInt256 const prevLedger = UInt256::fromRaw(set.previousledger()); NetClock::time_point const closeTime{NetClock::duration{set.closetime()}}; - uint256 const suppression = proposalUniqueId( + UInt256 const suppression = proposalUniqueId( proposeHash, prevLedger, set.proposeseq(), closeTime, publicKey.slice(), sig); if (auto [added, relayed] = app_.getHashRouter().addSuppressionPeerWithStatus(suppression, id_); @@ -2046,7 +2045,7 @@ PeerImp::onMessage(std::shared_ptr const& m) } { - uint256 closedLedgerHash{}; + UInt256 closedLedgerHash{}; bool const peerChangedLedgers{m->has_ledgerhash() && stringIsUInt256Sized(m->ledgerhash())}; { @@ -2151,7 +2150,7 @@ PeerImp::onMessage(std::shared_ptr const& m) if (m->has_ledgerhash()) { - uint256 closedLedgerHash{}; + UInt256 closedLedgerHash{}; { std::scoped_lock const sl(recentLock_); closedLedgerHash = closedLedgerHash_; @@ -2210,7 +2209,7 @@ PeerImp::checkTracking(std::uint32_t seq1, std::uint32_t seq2) std::scoped_lock const sl(recentLock_); tracking_ = Tracking::Diverged; - trackingTime_ = clock_type::now(); + trackingTime_ = ClockType::now(); } } @@ -2223,7 +2222,7 @@ PeerImp::onMessage(std::shared_ptr const& m) return; } - uint256 const hash = uint256::fromRaw(m->hash()); + UInt256 const hash = UInt256::fromRaw(m->hash()); if (m->status() == protocol::tsHAVE) { @@ -2711,7 +2710,7 @@ PeerImp::onMessage(std::shared_ptr const& m) if (pLDo) { - uint256 const hash = uint256::fromRaw(obj.hash()); + UInt256 const hash = UInt256::fromRaw(obj.hash()); app_.getLedgerMaster().addFetchPack( hash, std::make_shared(obj.data().begin(), obj.data().end())); @@ -2745,7 +2744,7 @@ PeerImp::processGetObjectByHash(std::shared_ptr con // Defense in depth: caller (onMessage) already validates cheap // structural properties of the request before dispatching here: // - objects_size() <= kHardMaxReplyNodes (oversize gate) - // - if has_ledgerhash() then ledgerhash is uint256-sized + // - if has_ledgerhash() then ledgerhash is UInt256-sized // The iteration cap below mirrors the oversize gate so this method // remains safe if invoked directly by tests or future callers, and // a peer cannot drive unbounded NodeStore lookups by sending @@ -2759,7 +2758,7 @@ PeerImp::processGetObjectByHash(std::shared_ptr con if (!obj.has_hash() || !stringIsUInt256Sized(obj.hash())) continue; - uint256 const hash = uint256::fromRaw(obj.hash()); + UInt256 const hash = UInt256::fromRaw(obj.hash()); // VFALCO TODO Move this someplace more sensible so we don't // need to inject the NodeStore interfaces. std::uint32_t const seq{obj.has_ledgerseq() ? obj.ledgerseq() : 0}; @@ -2826,7 +2825,7 @@ PeerImp::handleHaveTransactions(std::shared_ptr co return; } - uint256 hash = uint256::fromRaw(m->hashes(i)); + UInt256 hash = UInt256::fromRaw(m->hashes(i)); auto txn = app_.getMasterTransaction().fetchFromCache(hash); @@ -2929,7 +2928,7 @@ PeerImp::onMessage(std::shared_ptr const& m) //-------------------------------------------------------------------------- void -PeerImp::addLedger(uint256 const& hash, std::scoped_lock const& lockedRecentLock) +PeerImp::addLedger(UInt256 const& hash, std::scoped_lock const& lockedRecentLock) { // lockedRecentLock is passed as a reminder that recentLock_ must be // locked by the caller. @@ -2964,7 +2963,7 @@ PeerImp::doFetchPack(std::shared_ptr const& packet) fee_.fee = resource::kFeeHeavyBurdenPeer; - uint256 const hash = uint256::fromRaw(packet->ledgerhash()); + UInt256 const hash = UInt256::fromRaw(packet->ledgerhash()); std::weak_ptr const weak = shared_from_this(); auto elapsed = UptimeClock::now(); @@ -2999,7 +2998,7 @@ PeerImp::doTransactions(std::shared_ptr const& pack return; } - uint256 hash = uint256::fromRaw(obj.hash()); + UInt256 hash = UInt256::fromRaw(obj.hash()); auto txn = app_.getMasterTransaction().fetchFromCache(hash); @@ -3222,7 +3221,7 @@ PeerImp::checkPropose( void PeerImp::checkValidation( std::shared_ptr const& val, - uint256 const& key, + UInt256 const& key, std::shared_ptr const& packet) { if (!val->isValid()) @@ -3262,7 +3261,7 @@ PeerImp::checkValidation( // the TX tree with the specified root hash. // static std::shared_ptr -getPeerWithTree(OverlayImpl& ov, uint256 const& rootHash, PeerImp const* skip) +getPeerWithTree(OverlayImpl& ov, UInt256 const& rootHash, PeerImp const* skip) { std::shared_ptr ret; int retScore = 0; @@ -3288,7 +3287,7 @@ getPeerWithTree(OverlayImpl& ov, uint256 const& rootHash, PeerImp const* skip) static std::shared_ptr getPeerWithLedger( OverlayImpl& ov, - uint256 const& ledgerHash, + UInt256 const& ledgerHash, LedgerIndex ledger, PeerImp const* skip) { @@ -3357,7 +3356,7 @@ PeerImp::getLedger(std::shared_ptr const& m) if (m->has_ledgerhash()) { // Attempt to find ledger by hash - uint256 const ledgerHash = uint256::fromRaw(m->ledgerhash()); + UInt256 const ledgerHash = UInt256::fromRaw(m->ledgerhash()); ledger = app_.getLedgerMaster().getLedgerByHash(ledgerHash); if (!ledger) { @@ -3436,7 +3435,7 @@ PeerImp::getTxSet(std::shared_ptr const& m) const { JLOG(pJournal_.trace()) << "getTxSet: TX set"; - uint256 const txSetHash = uint256::fromRaw(m->ledgerhash()); + UInt256 const txSetHash = UInt256::fromRaw(m->ledgerhash()); std::shared_ptr shaMap{app_.getInboundTransactions().getSet(txSetHash, false)}; if (!shaMap) { @@ -3753,7 +3752,7 @@ PeerImp::Metrics::addMessage(std::uint64_t bytes) totalBytes_ += bytes; accumBytes_ += bytes; - auto const timeElapsed = clock_type::now() - intervalStart_; + auto const timeElapsed = ClockType::now() - intervalStart_; auto const timeElapsedInSecs = std::chrono::duration_cast(timeElapsed); if (timeElapsedInSecs >= 1s) @@ -3764,7 +3763,7 @@ PeerImp::Metrics::addMessage(std::uint64_t bytes) auto const totalBytes = std::accumulate(rollingAvg_.begin(), rollingAvg_.end(), 0ull); rollingAvgBytes_ = totalBytes / rollingAvg_.size(); - intervalStart_ = clock_type::now(); + intervalStart_ = ClockType::now(); accumBytes_ = 0; } } diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index e87c12279e..ba7c6ebd36 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -72,29 +72,29 @@ public: enum class Tracking { Diverged, Unknown, Converged }; private: - using clock_type = std::chrono::steady_clock; - using error_code = boost::system::error_code; - using socket_type = boost::asio::ip::tcp::socket; - using middle_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; - using address_type = boost::asio::ip::address; - using endpoint_type = boost::asio::ip::tcp::endpoint; - using waitable_timer = boost::asio::basic_waitable_timer; + using ClockType = std::chrono::steady_clock; + using ErrorCode = boost::system::error_code; + using SocketType = boost::asio::ip::tcp::socket; + using MiddleType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; + using AddressType = boost::asio::ip::address; + using EndpointType = boost::asio::ip::tcp::endpoint; + using WaitableTimer = boost::asio::basic_waitable_timer; using Compressed = compression::Compressed; Application& app_; - id_t const id_; + ID const id_; std::string fingerprint_; std::string prefix_; beast::WrappedSink sink_; beast::WrappedSink pSink_; beast::Journal const journal_; beast::Journal const pJournal_; - std::unique_ptr streamPtr_; - socket_type& socket_; - stream_type& stream_; + std::unique_ptr streamPtr_; + SocketType& socket_; + StreamType& stream_; boost::asio::strand strand_; - waitable_timer timer_; + WaitableTimer timer_; // Updated at each stage of the connection process to reflect // the current conditions as closely as possible. @@ -109,7 +109,7 @@ private: ProtocolVersion protocol_; std::atomic tracking_; - clock_type::time_point trackingTime_; + ClockType::time_point trackingTime_; bool detaching_ = false; // Node public key of peer. PublicKey const publicKey_; @@ -120,16 +120,16 @@ private: // LedgerIndex minLedger_ = 0; LedgerIndex maxLedger_ = 0; - uint256 closedLedgerHash_; - uint256 previousLedgerHash_; + UInt256 closedLedgerHash_; + UInt256 previousLedgerHash_; - boost::circular_buffer recentLedgers_{128}; - boost::circular_buffer recentTxSets_{128}; + boost::circular_buffer recentLedgers_{128}; + boost::circular_buffer recentTxSets_{128}; std::optional latency_; std::optional lastPingSeq_; - clock_type::time_point lastPingTime_; - clock_type::time_point const creationTime_; + ClockType::time_point lastPingTime_; + ClockType::time_point const creationTime_; reduce_relay::Squelch squelch_; @@ -190,8 +190,8 @@ private: std::atomic chargeDisconnectFired_{false}; std::shared_ptr const slot_; boost::beast::multi_buffer readBuffer_; - http_request_type request_; - http_response_type response_; + HttpRequestType request_; + HttpResponseType response_; boost::beast::http::fields const& headers_; std::queue> sendQueue_; bool gracefulClose_ = false; @@ -199,14 +199,14 @@ private: std::unique_ptr loadEvent_; // The highest sequence of each PublisherList that has // been sent to or received from this peer. - hash_map publisherListSequences_; + HashMap publisherListSequences_; Compressed compressionEnabled_ = Compressed::Off; // Queue of transactions' hashes that have not been // relayed. The hashes are sent once a second to a peer // and the peer requests missing transactions from the node. - hash_set txQueue_; + HashSet txQueue_; // true if tx reduce-relay feature is enabled on the peer. bool txReduceRelayEnabled_ = false; @@ -236,7 +236,7 @@ private: private: std::shared_mutex mutable mutex_; boost::circular_buffer rollingAvg_{30, 0ull}; - clock_type::time_point intervalStart_{clock_type::now()}; + ClockType::time_point intervalStart_{ClockType::now()}; std::uint64_t totalBytes_{0}; std::uint64_t accumBytes_{0}; std::uint64_t rollingAvgBytes_{0}; @@ -258,13 +258,13 @@ public: */ PeerImp( Application& app, - id_t id, + ID id, std::shared_ptr const& slot, - http_request_type&& request, + HttpRequestType&& request, PublicKey const& publicKey, ProtocolVersion protocol, resource::Consumer consumer, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, OverlayImpl& overlay); /** @@ -274,14 +274,14 @@ public: template PeerImp( Application& app, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, Buffers const& buffers, std::shared_ptr&& slot, - http_response_type&& response, + HttpResponseType&& response, resource::Consumer usage, PublicKey const& publicKey, ProtocolVersion protocol, - id_t id, + ID id, OverlayImpl& overlay); ~PeerImp() override; @@ -324,14 +324,14 @@ public: * @param hash transaction's hash */ void - addTxQueue(uint256 const& hash) override; + addTxQueue(UInt256 const& hash) override; /** * Remove transaction's hash from the transactions' hashes queue * @param hash transaction's hash */ void - removeTxQueue(uint256 const& hash) override; + removeTxQueue(UInt256 const& hash) override; /** * Send a set of PeerFinder endpoints as a protocol message. @@ -357,7 +357,7 @@ public: // Identity // - Peer::id_t + Peer::ID id() const override { return id_; @@ -395,10 +395,10 @@ public: getVersion() const; // Return the connection elapsed time. - clock_type::duration + ClockType::duration uptime() const { - return clock_type::now() - creationTime_; + return ClockType::now() - creationTime_; } json::Value @@ -430,7 +430,7 @@ public: // Ledger // - uint256 + UInt256 getClosedLedgerHash() const override { std::scoped_lock const sl{recentLock_}; @@ -438,13 +438,13 @@ public: } bool - hasLedger(uint256 const& hash, std::uint32_t seq) const override; + hasLedger(UInt256 const& hash, std::uint32_t seq) const override; void ledgerRange(std::uint32_t& minSeq, std::uint32_t& maxSeq) const override; bool - hasTxSet(uint256 const& hash) const override; + hasTxSet(UInt256 const& hash) const override; void cycleStatus() override; @@ -494,7 +494,7 @@ private: close(); void - fail(std::string const& name, error_code ec); + fail(std::string const& name, ErrorCode ec); void gracefulClose(); @@ -514,7 +514,7 @@ private: // Called when SSL shutdown completes void - onShutdown(error_code ec); + onShutdown(ErrorCode ec); void doAccept(); @@ -535,11 +535,11 @@ private: // Called when protocol message bytes are received void - onReadMessage(error_code ec, std::size_t bytesTransferred); + onReadMessage(ErrorCode ec, std::size_t bytesTransferred); // Called when protocol messages bytes are sent void - onWriteMessage(error_code ec, std::size_t bytesTransferred); + onWriteMessage(ErrorCode ec, std::size_t bytesTransferred); /** * Called from onMessage(TMTransaction(s)). @@ -648,7 +648,7 @@ private: // lockedRecentLock is passed as a reminder to callers that recentLock_ // must be locked. void - addLedger(uint256 const& hash, std::scoped_lock const& lockedRecentLock); + addLedger(UInt256 const& hash, std::scoped_lock const& lockedRecentLock); void doFetchPack(std::shared_ptr const& packet); @@ -684,7 +684,7 @@ private: void checkValidation( std::shared_ptr const& val, - uint256 const& key, + UInt256 const& key, std::shared_ptr const& packet); void @@ -764,14 +764,14 @@ protected: template PeerImp::PeerImp( Application& app, - std::unique_ptr&& streamPtr, + std::unique_ptr&& streamPtr, Buffers const& buffers, std::shared_ptr&& slot, - http_response_type&& response, + HttpResponseType&& response, resource::Consumer usage, PublicKey const& publicKey, ProtocolVersion protocol, - id_t id, + ID id, OverlayImpl& overlay) : Child(overlay) , app_(app) @@ -786,16 +786,16 @@ PeerImp::PeerImp( , socket_(streamPtr_->next_layer().socket()) , stream_(*streamPtr_) , strand_(boost::asio::make_strand(socket_.get_executor())) - , timer_(waitable_timer{socket_.get_executor()}) + , timer_(WaitableTimer{socket_.get_executor()}) , remoteAddress_(slot->remoteEndpoint()) , overlay_(overlay) , inbound_(false) , protocol_(std::move(protocol)) , tracking_(Tracking::Unknown) - , trackingTime_(clock_type::now()) + , trackingTime_(ClockType::now()) , publicKey_(publicKey) - , lastPingTime_(clock_type::now()) - , creationTime_(clock_type::now()) + , lastPingTime_(ClockType::now()) + , creationTime_(ClockType::now()) , squelch_(app_.getJournal("Squelch")) , usage_(usage) , fee_{.fee = resource::kFeeTrivialPeer} diff --git a/src/xrpld/overlay/detail/PeerSet.cpp b/src/xrpld/overlay/detail/PeerSet.cpp index 61bede37fe..3b1aa6b3db 100644 --- a/src/xrpld/overlay/detail/PeerSet.cpp +++ b/src/xrpld/overlay/detail/PeerSet.cpp @@ -42,7 +42,7 @@ public: protocol::MessageType type, std::shared_ptr const& peer) override; - [[nodiscard]] std::set const& + [[nodiscard]] std::set const& getPeerIds() const override; private: @@ -54,7 +54,7 @@ private: /** * The identifiers of the peers we are tracking. */ - std::set peers_; + std::set peers_; }; PeerSetImpl::PeerSetImpl(Application& app) : app_(app), journal_(app.getJournal("PeerSet")) @@ -114,7 +114,7 @@ PeerSetImpl::sendRequest( } } -std::set const& +std::set const& PeerSetImpl::getPeerIds() const { return peers_; @@ -168,10 +168,10 @@ public: JLOG(j_.error()) << "DummyPeerSet sendRequest should not be called"; } - [[nodiscard]] std::set const& + [[nodiscard]] std::set const& getPeerIds() const override { - static std::set const kEmptyPeers; + static std::set const kEmptyPeers; JLOG(j_.error()) << "DummyPeerSet getPeerIds should not be called"; return kEmptyPeers; } diff --git a/src/xrpld/overlay/detail/TxMetrics.cpp b/src/xrpld/overlay/detail/TxMetrics.cpp index d2597cb19f..5f8fd7ef12 100644 --- a/src/xrpld/overlay/detail/TxMetrics.cpp +++ b/src/xrpld/overlay/detail/TxMetrics.cpp @@ -78,7 +78,7 @@ SingleMetrics::addMetrics(std::uint32_t val) using namespace std::chrono_literals; accum += val; n++; - auto const timeElapsed = clock_type::now() - intervalStart; + auto const timeElapsed = ClockType::now() - intervalStart; auto const timeElapsedInSecs = std::chrono::duration_cast(timeElapsed); if (timeElapsedInSecs >= 1s) @@ -90,7 +90,7 @@ SingleMetrics::addMetrics(std::uint32_t val) std::accumulate(rollingAvgAggregate.begin(), rollingAvgAggregate.end(), 0ull); rollingAvg = total / rollingAvgAggregate.size(); - intervalStart = clock_type::now(); + intervalStart = ClockType::now(); accum = 0; n = 0; } diff --git a/src/xrpld/overlay/detail/TxMetrics.h b/src/xrpld/overlay/detail/TxMetrics.h index a9afa1d6b2..85aefb9e4a 100644 --- a/src/xrpld/overlay/detail/TxMetrics.h +++ b/src/xrpld/overlay/detail/TxMetrics.h @@ -29,8 +29,8 @@ struct SingleMetrics SingleMetrics(bool ptu = true) : perTimeUnit(ptu) { } - using clock_type = std::chrono::steady_clock; - clock_type::time_point intervalStart{clock_type::now()}; + using ClockType = std::chrono::steady_clock; + ClockType::time_point intervalStart{ClockType::now()}; std::uint64_t accum{0}; std::uint64_t rollingAvg{0}; std::uint32_t n{0}; diff --git a/src/xrpld/overlay/detail/ZeroCopyStream.h b/src/xrpld/overlay/detail/ZeroCopyStream.h index 9bbe69910b..b15da7bf34 100644 --- a/src/xrpld/overlay/detail/ZeroCopyStream.h +++ b/src/xrpld/overlay/detail/ZeroCopyStream.h @@ -22,12 +22,12 @@ class ZeroCopyInputStream : public ::google::protobuf::io::ZeroCopyInputStream { private: using iterator = Buffers::const_iterator; - using const_buffer = boost::asio::const_buffer; + using ConstBuffer = boost::asio::const_buffer; std::int64_t count_ = 0; iterator last_; - iterator first_; // Where pos_ comes from - const_buffer pos_; // What Next() will return + iterator first_; // Where pos_ comes from + ConstBuffer pos_; // What Next() will return public: explicit ZeroCopyInputStream(Buffers const& buffers); @@ -54,7 +54,7 @@ template ZeroCopyInputStream::ZeroCopyInputStream(Buffers const& buffers) : last_(buffers.end()) , first_(buffers.begin()) - , pos_((first_ != last_) ? *first_ : const_buffer(nullptr, 0)) + , pos_((first_ != last_) ? *first_ : ConstBuffer(nullptr, 0)) { } @@ -67,7 +67,7 @@ ZeroCopyInputStream::Next(void const** data, int* size) if (first_ == last_) return false; count_ += *size; - pos_ = (++first_ != last_) ? *first_ : const_buffer(nullptr, 0); + pos_ = (++first_ != last_) ? *first_ : ConstBuffer(nullptr, 0); return true; } @@ -115,15 +115,15 @@ template class ZeroCopyOutputStream : public ::google::protobuf::io::ZeroCopyOutputStream { private: - using buffers_type = Streambuf::mutable_buffers_type; - using iterator = buffers_type::const_iterator; - using mutable_buffer = boost::asio::mutable_buffer; + using BuffersType = Streambuf::mutable_buffers_type; + using iterator = BuffersType::const_iterator; + using MutableBuffer = boost::asio::mutable_buffer; Streambuf& streambuf_; std::size_t blockSize_; std::int64_t count_ = 0; std::size_t commit_ = 0; - buffers_type buffers_; + BuffersType buffers_; iterator pos_; public: diff --git a/src/xrpld/overlay/make_Overlay.h b/src/xrpld/overlay/make_Overlay.h index c730a05c54..7effa1b835 100644 --- a/src/xrpld/overlay/make_Overlay.h +++ b/src/xrpld/overlay/make_Overlay.h @@ -31,6 +31,6 @@ makeOverlay( Resolver& resolver, boost::asio::io_context& ioContext, BasicConfig const& config, - beast::insight::Collector::ptr const& collector); + beast::insight::Collector::Ptr const& collector); } // namespace xrpl diff --git a/src/xrpld/overlay/predicates.h b/src/xrpld/overlay/predicates.h index 56f4c80291..e2e9f0f839 100644 --- a/src/xrpld/overlay/predicates.h +++ b/src/xrpld/overlay/predicates.h @@ -13,7 +13,7 @@ namespace xrpl { */ struct SendAlways { - using return_type = void; + using ReturnType = void; std::shared_ptr const& msg; @@ -36,7 +36,7 @@ struct SendAlways template struct SendIfPred { - using return_type = void; + using ReturnType = void; std::shared_ptr const& msg; Predicate const& predicate; @@ -71,7 +71,7 @@ sendIf(std::shared_ptr const& m, Predicate const& f) template struct SendIfNotPred { - using return_type = void; + using ReturnType = void; std::shared_ptr const& msg; Predicate const& predicate; @@ -151,9 +151,9 @@ struct PeerInCluster */ struct PeerInSet { - std::set const& peerSet; + std::set const& peerSet; - PeerInSet(std::set const& peers) : peerSet(peers) + PeerInSet(std::set const& peers) : peerSet(peers) { } diff --git a/src/xrpld/peerfinder/detail/StoreSqdb.h b/src/xrpld/peerfinder/detail/StoreSqdb.h index ce13d72c15..3bb0918b0d 100644 --- a/src/xrpld/peerfinder/detail/StoreSqdb.h +++ b/src/xrpld/peerfinder/detail/StoreSqdb.h @@ -45,7 +45,7 @@ public: // Loads the bootstrap cache, calling the callback for each entry // std::size_t - load(load_callback const& cb) override + load(LoadCallback const& cb) override { std::size_t n(0); diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index d7944589af..d192e57b6b 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -181,7 +181,7 @@ PerfLogImp::Counters::countersJson() const json::Value PerfLogImp::Counters::currentJson() const { - auto const present = steady_clock::now(); + auto const present = SteadyClock::now(); json::Value jobsArray(json::ValueType::Array); auto const jobs = [this] { @@ -196,7 +196,7 @@ PerfLogImp::Counters::currentJson() const json::Value jobj(json::ValueType::Object); jobj[jss::job] = JobTypes::name(j.first); jobj[jss::duration_us] = - std::to_string(std::chrono::duration_cast(present - j.second).count()); + std::to_string(std::chrono::duration_cast(present - j.second).count()); jobsArray.append(jobj); } @@ -215,7 +215,7 @@ PerfLogImp::Counters::currentJson() const // NOLINTNEXTLINE(bugprone-suspicious-stringview-data-usage) methodobj[jss::method] = json::StaticString{m.first.data()}; methodobj[jss::duration_us] = - std::to_string(std::chrono::duration_cast(present - m.second).count()); + std::to_string(std::chrono::duration_cast(present - m.second).count()); methodsArray.append(methodobj); } @@ -264,7 +264,7 @@ void PerfLogImp::run() { beast::setCurrentThreadName("perflog"); - lastLog_ = system_clock::now(); + lastLog_ = SystemClock::now(); while (true) { @@ -293,13 +293,13 @@ PerfLogImp::report() return; } - auto const present = system_clock::now(); + auto const present = SystemClock::now(); if (present < lastLog_ + setup_.logInterval) return; lastLog_ = present; json::Value report(json::ValueType::Object); - report[jss::time] = to_string(std::chrono::floor(present)); + report[jss::time] = to_string(std::chrono::floor(present)); { std::scoped_lock const lock{counters_.jobsMutex}; report[jss::workers] = static_cast(counters_.jobs.size()); @@ -352,7 +352,7 @@ PerfLogImp::rpcStart(std::string_view method, std::uint64_t const requestId) } std::scoped_lock const lock(counters_.methodsMutex); // The key, not the method argument: what is stored has to outlive the call. - counters_.methods[requestId] = {counter->first, steady_clock::now()}; + counters_.methods[requestId] = {counter->first, SteadyClock::now()}; } void @@ -366,7 +366,7 @@ PerfLogImp::rpcEnd(std::string_view method, std::uint64_t const requestId, bool return; // LCOV_EXCL_STOP } - steady_time_point startTime; + SteadyTimePoint startTime; { std::scoped_lock const lock(counters_.methodsMutex); auto const e = counters_.methods.find(requestId); @@ -392,7 +392,7 @@ PerfLogImp::rpcEnd(std::string_view method, std::uint64_t const requestId, bool ++counter->second.value.errored; } counter->second.value.duration += - std::chrono::duration_cast(steady_clock::now() - startTime); + std::chrono::duration_cast(SteadyClock::now() - startTime); } void @@ -411,11 +411,7 @@ PerfLogImp::jobQueue(JobType const type) } void -PerfLogImp::jobStart( - JobType const type, - microseconds dur, - steady_time_point startTime, - int instance) +PerfLogImp::jobStart(JobType const type, Microseconds dur, SteadyTimePoint startTime, int instance) { auto counter = counters_.jq.find(type); if (counter == counters_.jq.end()) @@ -437,7 +433,7 @@ PerfLogImp::jobStart( } void -PerfLogImp::jobFinish(JobType const type, microseconds dur, int instance) +PerfLogImp::jobFinish(JobType const type, Microseconds dur, int instance) { auto counter = counters_.jq.find(type); if (counter == counters_.jq.end()) @@ -455,7 +451,7 @@ PerfLogImp::jobFinish(JobType const type, microseconds dur, int instance) } std::scoped_lock const lock(counters_.jobsMutex); if (instance >= 0 && instance < counters_.jobs.size()) - counters_.jobs[instance] = {JtInvalid, steady_time_point()}; + counters_.jobs[instance] = {JtInvalid, SteadyTimePoint()}; } void @@ -463,7 +459,7 @@ PerfLogImp::resizeJobs(int const resize) { std::scoped_lock const lock(counters_.jobsMutex); if (resize > counters_.jobs.size()) - counters_.jobs.resize(resize, {JtInvalid, steady_time_point()}); + counters_.jobs.resize(resize, {JtInvalid, SteadyTimePoint()}); } void diff --git a/src/xrpld/perflog/detail/PerfLogImp.h b/src/xrpld/perflog/detail/PerfLogImp.h index bb1eb904de..bfb71cb237 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.h +++ b/src/xrpld/perflog/detail/PerfLogImp.h @@ -59,7 +59,7 @@ class PerfLogImp : public PerfLog struct Counters { public: - using MethodStart = std::pair; + using MethodStart = std::pair; /** * RPC performance counters. @@ -72,7 +72,7 @@ class PerfLogImp : public PerfLog std::uint64_t finished{0}; std::uint64_t errored{0}; // Cumulative duration of all finished and errored method calls. - microseconds duration{0}; + Microseconds duration{0}; }; /** @@ -86,8 +86,8 @@ class PerfLogImp : public PerfLog std::uint64_t started{0}; std::uint64_t finished{0}; // Cumulative duration of all jobs' queued and running times. - microseconds queuedDuration{0}; - microseconds runningDuration{0}; + Microseconds queuedDuration{0}; + Microseconds runningDuration{0}; }; // rpc and jq do not need mutex protection because all @@ -105,7 +105,7 @@ class PerfLogImp : public PerfLog // have to outlive this object, not the container that carried them. std::vector labels; std::unordered_map> jq; - std::vector> jobs; + std::vector> jobs; mutable std::mutex jobsMutex; // Each view is a key of rpc above, not the argument rpcStart() received, so // currentJson() may read it as a C string. @@ -128,7 +128,7 @@ class PerfLogImp : public PerfLog std::thread thread_; std::mutex mutex_; std::condition_variable cond_; - system_time_point lastLog_; + SystemTimePoint lastLog_; std::string const hostname_{boost::asio::ip::host_name()}; bool stop_{false}; bool rotate_{false}; @@ -176,10 +176,10 @@ public: void jobQueue(JobType const type) override; void - jobStart(JobType const type, microseconds dur, steady_time_point startTime, int instance) + jobStart(JobType const type, Microseconds dur, SteadyTimePoint startTime, int instance) override; void - jobFinish(JobType const type, microseconds dur, int instance) override; + jobFinish(JobType const type, Microseconds dur, int instance) override; json::Value countersJson() const override diff --git a/src/xrpld/rpc/BookChanges.h b/src/xrpld/rpc/BookChanges.h index 1912b0512e..4d86de7e26 100644 --- a/src/xrpld/rpc/BookChanges.h +++ b/src/xrpld/rpc/BookChanges.h @@ -49,7 +49,7 @@ computeBookChanges(std::shared_ptr const& lpAccepted) STAmount, // low rate STAmount, // open rate STAmount, // close rate - std::optional>> // optional: domain id + std::optional>> // optional: domain id tally; // Accumulating volume can exceed what the asset can represent, and the two @@ -182,7 +182,7 @@ computeBookChanges(std::shared_ptr const& lpAccepted) ss << p << "|" << g; } - std::optional const domain = finalFields[~sfDomainID]; + std::optional const domain = finalFields[~sfDomainID]; std::string const key{ss.str()}; @@ -273,7 +273,7 @@ computeBookChanges(std::shared_ptr const& lpAccepted) inner[jss::open] = to_string(std::get<4>(entry.second).iou()); inner[jss::close] = to_string(std::get<5>(entry.second).iou()); - std::optional const domain = std::get<6>(entry.second); + std::optional const domain = std::get<6>(entry.second); if (domain) inner[jss::domain] = to_string(*domain); } diff --git a/src/xrpld/rpc/Role.h b/src/xrpld/rpc/Role.h index 48c89333bd..7775524cbe 100644 --- a/src/xrpld/rpc/Role.h +++ b/src/xrpld/rpc/Role.h @@ -71,6 +71,6 @@ ipAllowed( std::vector const& nets6); std::string_view -forwardedFor(http_request_type const& request); +forwardedFor(HttpRequestType const& request); } // namespace xrpl diff --git a/src/xrpld/rpc/ServerHandler.h b/src/xrpld/rpc/ServerHandler.h index a09fc1c18a..fc275ffc2f 100644 --- a/src/xrpld/rpc/ServerHandler.h +++ b/src/xrpld/rpc/ServerHandler.h @@ -76,8 +76,8 @@ public: }; private: - using socket_type = boost::beast::tcp_stream; - using stream_type = boost::beast::ssl_stream; + using SocketType = boost::beast::tcp_stream; + using StreamType = boost::beast::ssl_stream; Application& app_; resource::Manager& resourceManager_; @@ -155,17 +155,17 @@ public: Handoff onHandoff( Session& session, - std::unique_ptr&& bundle, - http_request_type&& request, + std::unique_ptr&& bundle, + HttpRequestType&& request, boost::asio::ip::tcp::endpoint const& remoteAddress); Handoff onHandoff( Session& session, - http_request_type&& request, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) + HttpRequestType&& request, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) boost::asio::ip::tcp::endpoint const& remoteAddress) { - return onHandoff(session, {}, std::forward(request), remoteAddress); + return onHandoff(session, {}, std::forward(request), remoteAddress); } void @@ -203,7 +203,7 @@ private: std::string_view user); [[nodiscard]] Handoff - statusResponse(http_request_type const& request) const; + statusResponse(HttpRequestType const& request) const; }; ServerHandler::Setup diff --git a/src/xrpld/rpc/detail/AccountAssets.cpp b/src/xrpld/rpc/detail/AccountAssets.cpp index 0e71836b74..f71a604e45 100644 --- a/src/xrpld/rpc/detail/AccountAssets.cpp +++ b/src/xrpld/rpc/detail/AccountAssets.cpp @@ -13,13 +13,13 @@ namespace xrpl { -hash_set +HashSet accountSourceAssets( AccountID const& account, std::shared_ptr const& lrCache, bool includeXRP) { - hash_set assets; + HashSet assets; // YYY Only bother if they are above reserve if (includeXRP) @@ -57,13 +57,13 @@ accountSourceAssets( return assets; } -hash_set +HashSet accountDestAssets( AccountID const& account, std::shared_ptr const& lrCache, bool includeXRP) { - hash_set assets; + HashSet assets; if (includeXRP) assets.insert(xrpCurrency()); diff --git a/src/xrpld/rpc/detail/AccountAssets.h b/src/xrpld/rpc/detail/AccountAssets.h index 16c6087e3f..72c145634a 100644 --- a/src/xrpld/rpc/detail/AccountAssets.h +++ b/src/xrpld/rpc/detail/AccountAssets.h @@ -10,13 +10,13 @@ namespace xrpl { -hash_set +HashSet accountDestAssets( AccountID const& account, std::shared_ptr const& cache, bool includeXRP); -hash_set +HashSet accountSourceAssets( AccountID const& account, std::shared_ptr const& lrLedger, diff --git a/src/xrpld/rpc/detail/AssetCache.cpp b/src/xrpld/rpc/detail/AssetCache.cpp index e29f5659f9..4e85495b32 100644 --- a/src/xrpld/rpc/detail/AssetCache.cpp +++ b/src/xrpld/rpc/detail/AssetCache.cpp @@ -124,7 +124,7 @@ AssetCache::getMPTs(xrpl::AccountID const& account) std::vector mpts; // Get issued/authorized tokens - forEachItem(*ledger_, account, [&](SLE::const_ref sle) { + forEachItem(*ledger_, account, [&](SLE::ConstRef sle) { if (sle->getType() == ltMPTOKEN_ISSUANCE) { auto const mptID = makeMptID(sle->getFieldU32(sfSequence), account); diff --git a/src/xrpld/rpc/detail/AssetCache.h b/src/xrpld/rpc/detail/AssetCache.h index 71a7c262d4..17b4d9f90c 100644 --- a/src/xrpld/rpc/detail/AssetCache.h +++ b/src/xrpld/rpc/detail/AssetCache.h @@ -103,9 +103,9 @@ private: // most accounts are not going to have any entries (estimated over 90%), so // vectors will not need to be created for them. This should lead to far // less memory usage overall. - hash_map>, AccountKey::Hash> lines_; + HashMap>, AccountKey::Hash> lines_; std::size_t totalLineCount_ = 0; - hash_map>> mpts_; + HashMap>> mpts_; }; } // namespace xrpl diff --git a/src/xrpld/rpc/detail/PathRequest.cpp b/src/xrpld/rpc/detail/PathRequest.cpp index 0a01031ae2..9b6116609f 100644 --- a/src/xrpld/rpc/detail/PathRequest.cpp +++ b/src/xrpld/rpc/detail/PathRequest.cpp @@ -375,7 +375,7 @@ PathRequest::parseJson(json::Value const& jvParams) } else { - uint192 u; + UInt192 u; if (!c[jss::mpt_issuance_id].isString() || !u.parseHex(c[jss::mpt_issuance_id].asString())) { @@ -470,7 +470,7 @@ PathRequest::parseJson(json::Value const& jvParams) if (jvParams.isMember(jss::domain)) { - uint256 num; + UInt256 num; if (!jvParams[jss::domain].isString() || !num.parseHex(jvParams[jss::domain].asString())) { jvStatus_ = rpcError(RpcDomainMalformed); @@ -509,7 +509,7 @@ PathRequest::doAborting() const std::unique_ptr const& PathRequest::getPathFinder( std::shared_ptr const& cache, - hash_map>& currencyMap, + HashMap>& currencyMap, PathAsset const& currency, STAmount const& dstAmount, int const level, @@ -587,7 +587,7 @@ PathRequest::findPaths( } auto const dstAmount = convertAmount(saDstAmount_, convertAll_); - hash_map> currencyMap; + HashMap> currencyMap; for (auto const& asset : sourceAssets) { if (continueCallback && !continueCallback()) diff --git a/src/xrpld/rpc/detail/PathRequest.h b/src/xrpld/rpc/detail/PathRequest.h index f56b3d0652..e73e55827b 100644 --- a/src/xrpld/rpc/detail/PathRequest.h +++ b/src/xrpld/rpc/detail/PathRequest.h @@ -44,10 +44,10 @@ class PathRequest final : public InfoSubRequest, public CountedObject { public: - using wptr = std::weak_ptr; + using Wptr = std::weak_ptr; using pointer = std::shared_ptr; - using ref = pointer const&; - using wref = wptr const&; + using Ref = pointer const&; + using Wref = Wptr const&; public: // path_find semantics @@ -108,7 +108,7 @@ private: std::unique_ptr const& getPathFinder( std::shared_ptr const&, - hash_map>&, + HashMap>&, PathAsset const&, STAmount const&, int const, @@ -151,7 +151,7 @@ private: std::set sciSourceAssets_; std::map context_; - std::optional domain_; + std::optional domain_; bool convertAll_{}; diff --git a/src/xrpld/rpc/detail/PathRequestManager.cpp b/src/xrpld/rpc/detail/PathRequestManager.cpp index 117bfbda1e..a4ba7b610f 100644 --- a/src/xrpld/rpc/detail/PathRequestManager.cpp +++ b/src/xrpld/rpc/detail/PathRequestManager.cpp @@ -62,7 +62,7 @@ PathRequestManager::updateAll(std::shared_ptr const& inLedger) { auto event = app_.getJobQueue().makeLoadEvent(JtPathFind, "PathRequest::updateAll"); - std::vector requests; + std::vector requests; std::shared_ptr cache; // Get the ledger and cache we should be using diff --git a/src/xrpld/rpc/detail/PathRequestManager.h b/src/xrpld/rpc/detail/PathRequestManager.h index 29a80e66c0..4c81701699 100644 --- a/src/xrpld/rpc/detail/PathRequestManager.h +++ b/src/xrpld/rpc/detail/PathRequestManager.h @@ -29,7 +29,7 @@ public: PathRequestManager( Application& app, beast::Journal journal, - beast::insight::Collector::ptr const& collector) + beast::insight::Collector::Ptr const& collector) : app_(app), journal_(journal), lastIdentifier_(0) { fast_ = collector->makeEvent("pathfind_fast"); @@ -100,7 +100,7 @@ private: beast::insight::Event full_; // Track all requests - std::vector requests_; + std::vector requests_; // Use a AssetCache std::weak_ptr assetCache_; diff --git a/src/xrpld/rpc/detail/Pathfinder.cpp b/src/xrpld/rpc/detail/Pathfinder.cpp index c3e74fa4eb..0b88a12ba0 100644 --- a/src/xrpld/rpc/detail/Pathfinder.cpp +++ b/src/xrpld/rpc/detail/Pathfinder.cpp @@ -216,7 +216,7 @@ Pathfinder::Pathfinder( std::optional const& uSrcIssuer, STAmount const& saDstAmount, std::optional const& srcAmount, - std::optional const& domain, + std::optional const& domain, Application& app) : srcAccount_(uSrcAccount) , dstAccount_(uDstAccount) diff --git a/src/xrpld/rpc/detail/Pathfinder.h b/src/xrpld/rpc/detail/Pathfinder.h index 0b4da6abde..b29033e3dd 100644 --- a/src/xrpld/rpc/detail/Pathfinder.h +++ b/src/xrpld/rpc/detail/Pathfinder.h @@ -47,7 +47,7 @@ public: std::optional const& uSrcIssuer, STAmount const& dstAmount, std::optional const& srcAmount, - std::optional const& domain, + std::optional const& domain, Application& app); Pathfinder(Pathfinder const&) = delete; Pathfinder& @@ -200,7 +200,7 @@ private: */ STAmount remainingAmount_; bool convertAll_; - std::optional domain_; + std::optional domain_; std::shared_ptr ledger_; std::unique_ptr loadEvent_; @@ -211,7 +211,7 @@ private: std::vector pathRanks_; std::map paths_; - hash_map pathsOutCountMap_; + HashMap pathsOutCountMap_; Application& app_; beast::Journal const j_; diff --git a/src/xrpld/rpc/detail/RPCCall.cpp b/src/xrpld/rpc/detail/RPCCall.cpp index 09d244b7e7..bed9f534e2 100644 --- a/src/xrpld/rpc/detail/RPCCall.cpp +++ b/src/xrpld/rpc/detail/RPCCall.cpp @@ -183,7 +183,7 @@ private: } else if (strLedger.length() == 64) { - // YYY Could confirm this is a uint256. + // YYY Could confirm this is a UInt256. jvRequest[jss::ledger_hash] = strLedger; } else @@ -245,7 +245,7 @@ private: } private: - using parseFuncPtr = json::Value (RPCParser::*)(json::Value const& jvParams); + using ParseFuncPtr = json::Value (RPCParser::*)(json::Value const& jvParams); json::Value // NOLINTNEXTLINE(readability-convert-member-functions-to-static) @@ -858,7 +858,7 @@ private: { // verify the channel id is a valid 256 bit number - uint256 channelId; + UInt256 channelId; if (!channelId.parseHex(jvParams[index].asString())) return rpcError(RpcChannelMalformed); jvRequest[jss::channel_id] = to_string(channelId); @@ -890,7 +890,7 @@ private: jvRequest[jss::public_key] = strPk; { // verify the channel id is a valid 256 bit number - uint256 channelId; + UInt256 channelId; if (!channelId.parseHex(jvParams[1u].asString())) return rpcError(RpcChannelMalformed); } @@ -973,7 +973,7 @@ private: parseVault(json::Value const& jvParams) { std::string const strVaultID = jvParams[0u].asString(); - uint256 id = beast::kZero; + UInt256 id = beast::kZero; if (!id.parseHex(strVaultID)) return rpcError(RpcInvalidParams); @@ -1988,7 +1988,7 @@ rpcClient( xrpl::ServerHandler::Setup setup; try { - beast::logstream rpcCallLog{logs.journal("HTTPClient").warn()}; + beast::LogStream rpcCallLog{logs.journal("HTTPClient").warn()}; setup = setupServerHandler(config, rpcCallLog); } catch (std::exception const&) // NOLINT(bugprone-empty-catch) diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 321f8f5a3c..18a6863b40 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -46,7 +46,7 @@ namespace xrpl::rpc { std::uint64_t -getStartHint(SLE::const_ref sle, AccountID const& accountID) +getStartHint(SLE::ConstRef sle, AccountID const& accountID) { if (sle->getType() == ltRIPPLE_STATE) { @@ -67,7 +67,7 @@ getStartHint(SLE::const_ref sle, AccountID const& accountID) } bool -isRelatedToAccount(ReadView const& ledger, SLE::const_ref sle, AccountID const& accountID) +isRelatedToAccount(ReadView const& ledger, SLE::ConstRef sle, AccountID const& accountID) { if (sle->getType() == ltRIPPLE_STATE) { @@ -100,17 +100,17 @@ isRelatedToAccount(ReadView const& ledger, SLE::const_ref sle, AccountID const& return false; } -hash_set +HashSet parseAccountIds(json::Value const& jvArray) { - hash_set result; + HashSet result; for (auto const& jv : jvArray) { if (!jv.isString()) - return hash_set(); + return HashSet(); auto const id = parseBase58(jv.asString()); if (!id) - return hash_set(); + return HashSet(); result.insert(*id); } return result; @@ -158,21 +158,21 @@ parseXrplLibSeed(json::Value const& value) std::optional getSeedFromRPC(json::Value const& params, json::Value& error) { - using string_to_seed_t = std::function(std::string const&)>; - using seed_match_t = std::pair; + using StringToSeedT = std::function(std::string const&)>; + using SeedMatchT = std::pair; - static seed_match_t const kSeedTypes[]{ + static SeedMatchT const kSeedTypes[]{ {jss::passphrase.cStr(), [](std::string const& s) { return parseGenericSeed(s); }}, {jss::seed.cStr(), [](std::string const& s) { return parseBase58(s); }}, {jss::seed_hex.cStr(), [](std::string const& s) { - uint128 i; + UInt128 i; if (i.parseHex(s)) return std::optional(Slice(i.data(), i.size())); return std::optional{}; }}}; // Identify which seed type is in use. - seed_match_t const* seedType = nullptr; + SeedMatchT const* seedType = nullptr; int count = 0; for (auto const& t : kSeedTypes) { diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 24c06021c0..1d527742b0 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -44,7 +44,7 @@ struct JsonContext; * @return A 64-bit unsigned integer representing the start hint for traversal. */ std::uint64_t -getStartHint(SLE::const_ref sle, AccountID const& accountID); +getStartHint(SLE::ConstRef sle, AccountID const& accountID); /** * @brief Tests if a ledger entry (SLE) is owned by the specified account. @@ -58,7 +58,7 @@ getStartHint(SLE::const_ref sle, AccountID const& accountID); * @return true if the SLE is owned by the account, false otherwise. */ bool -isRelatedToAccount(ReadView const& ledger, SLE::const_ref sle, AccountID const& accountID); +isRelatedToAccount(ReadView const& ledger, SLE::ConstRef sle, AccountID const& accountID); /** * @brief Parses an array of account IDs from a JSON value. @@ -66,9 +66,9 @@ isRelatedToAccount(ReadView const& ledger, SLE::const_ref sle, AccountID const& * Extracts and returns a set of AccountID objects from the provided JSON array. * * @param jvArray The JSON value containing an array of account IDs. - * @return A hash_set containing the parsed AccountID objects. + * @return A HashSet containing the parsed AccountID objects. */ -hash_set +HashSet parseAccountIds(json::Value const& jvArray); /** diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index 19fe294924..837bc61610 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -51,7 +51,7 @@ ledgerFromHash( Context const& context, json::StaticString const fieldName) { - uint256 ledgerHash; + UInt256 ledgerHash; if (!ledgerHash.parseHex(hash.asString())) return {RpcInvalidParams, expectedFieldMessage(fieldName, "hex string")}; return getLedger(ledger, ledgerHash, context); @@ -190,7 +190,7 @@ ledgerFromSpecifier( switch (ledgerCase) { case LedgerCase::kHash: { - if (auto hash = uint256::fromVoidChecked(specifier.hash())) + if (auto hash = UInt256::fromVoidChecked(specifier.hash())) { return getLedger(ledger, *hash, context); } @@ -224,7 +224,7 @@ ledgerFromSpecifier( template Status -getLedger(T& ledger, uint256 const& ledgerHash, Context const& context) +getLedger(T& ledger, UInt256 const& ledgerHash, Context const& context) { ledger = context.ledgerMaster.getLedgerByHash(ledgerHash); if (ledger == nullptr) @@ -329,7 +329,7 @@ template Status getLedger<>(std::shared_ptr&, LedgerShortcut shortcut, Context const&); template Status -getLedger<>(std::shared_ptr&, uint256 const&, Context const&); +getLedger<>(std::shared_ptr&, UInt256 const&, Context const&); // explicit instantiation of ledgerFromSpecifier template Status diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index cad5141917..8249a5913d 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -40,7 +40,7 @@ struct JsonContext; */ template Status -getLedger(T& ledger, uint256 const& ledgerHash, Context const& context); +getLedger(T& ledger, UInt256 const& ledgerHash, Context const& context); /** * @brief Retrieves a ledger by its sequence index. diff --git a/src/xrpld/rpc/detail/Role.cpp b/src/xrpld/rpc/detail/Role.cpp index 34970b0580..9e300c6ee2 100644 --- a/src/xrpld/rpc/detail/Role.cpp +++ b/src/xrpld/rpc/detail/Role.cpp @@ -248,7 +248,7 @@ extractIpAddrFromField(std::string_view field) } std::string_view -forwardedFor(http_request_type const& request) +forwardedFor(HttpRequestType const& request) { // Look for the Forwarded field in the request. if (auto it = request.find(boost::beast::http::field::forwarded); it != request.end()) diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index fdadc4ba8b..7bd56b8194 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -79,14 +79,14 @@ class ValidatorKeys; class CanonicalTXSet; static bool -isStatusRequest(http_request_type const& request) +isStatusRequest(HttpRequestType const& request) { return request.version() >= 11 && request.target() == "/" && request.body().size() == 0 && request.method() == boost::beast::http::verb::get; } static Handoff -statusRequestResponse(http_request_type const& request, boost::beast::http::status status) +statusRequestResponse(HttpRequestType const& request, boost::beast::http::status status) { using namespace boost::beast::http; Handoff handoff; @@ -210,8 +210,8 @@ ServerHandler::onAccept(Session& session, boost::asio::ip::tcp::endpoint endpoin Handoff ServerHandler::onHandoff( Session& session, - std::unique_ptr&& bundle, - http_request_type&& request, + std::unique_ptr&& bundle, + HttpRequestType&& request, boost::asio::ip::tcp::endpoint const& remoteAddress) { using namespace boost::beast; @@ -1022,7 +1022,7 @@ ServerHandler::processRequest( is reported, meaning the server can accept more connections. */ Handoff -ServerHandler::statusResponse(http_request_type const& request) const +ServerHandler::statusResponse(HttpRequestType const& request) const { using namespace boost::beast::http; Handoff handoff; diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 6ea879aa2c..127fc795c3 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -259,10 +259,10 @@ checkPayment( RpcInvalidParams, "Cannot specify both 'tx_json.Paths' and 'build_path'"); } - std::optional domain; + std::optional domain; if (txJson.isMember(sfDomainID.jsonName)) { - uint256 num; + UInt256 num; if (!txJson[sfDomainID.jsonName].isString() || !num.parseHex(txJson[sfDomainID.jsonName].asString())) { diff --git a/src/xrpld/rpc/detail/TrustLine.cpp b/src/xrpld/rpc/detail/TrustLine.cpp index 77a2b36d56..950c042321 100644 --- a/src/xrpld/rpc/detail/TrustLine.cpp +++ b/src/xrpld/rpc/detail/TrustLine.cpp @@ -14,7 +14,7 @@ namespace xrpl { -TrustLineBase::TrustLineBase(SLE::const_ref sle, AccountID const& viewAccount) +TrustLineBase::TrustLineBase(SLE::ConstRef sle, AccountID const& viewAccount) : key_(sle->key()) , lowLimit_(sle->getFieldAmount(sfLowLimit)) , highLimit_(sle->getFieldAmount(sfHighLimit)) @@ -36,7 +36,7 @@ TrustLineBase::getJson(int) } std::optional -PathFindTrustLine::makeItem(AccountID const& accountID, SLE::const_ref sle) +PathFindTrustLine::makeItem(AccountID const& accountID, SLE::ConstRef sle) { if (!sle || sle->getType() != ltRIPPLE_STATE) return {}; @@ -52,7 +52,7 @@ getTrustLineItems( LineDirection direction = LineDirection::Outgoing) { std::vector items; - forEachItem(view, accountID, [&items, &accountID, &direction](SLE::const_ref sleCur) { + forEachItem(view, accountID, [&items, &accountID, &direction](SLE::ConstRef sleCur) { auto ret = T::makeItem(accountID, sleCur); if (ret && (direction == LineDirection::Outgoing || !ret->getNoRipple())) items.push_back(std::move(*ret)); @@ -74,7 +74,7 @@ PathFindTrustLine::getItems( return detail::getTrustLineItems(accountID, view, direction); } -RPCTrustLine::RPCTrustLine(SLE::const_ref sle, AccountID const& viewAccount) +RPCTrustLine::RPCTrustLine(SLE::ConstRef sle, AccountID const& viewAccount) : TrustLineBase(sle, viewAccount) , lowQualityIn_(sle->getFieldU32(sfLowQualityIn)) , lowQualityOut_(sle->getFieldU32(sfLowQualityOut)) @@ -84,7 +84,7 @@ RPCTrustLine::RPCTrustLine(SLE::const_ref sle, AccountID const& viewAccount) } std::optional -RPCTrustLine::makeItem(AccountID const& accountID, SLE::const_ref sle) +RPCTrustLine::makeItem(AccountID const& accountID, SLE::ConstRef sle) { if (!sle || sle->getType() != ltRIPPLE_STATE) return {}; diff --git a/src/xrpld/rpc/detail/TrustLine.h b/src/xrpld/rpc/detail/TrustLine.h index c3f76784ba..2c9351fc29 100644 --- a/src/xrpld/rpc/detail/TrustLine.h +++ b/src/xrpld/rpc/detail/TrustLine.h @@ -46,7 +46,7 @@ public: protected: // This class should not be instantiated directly. Use one of the derived // classes. - TrustLineBase(SLE::const_ref sle, AccountID const& viewAccount); + TrustLineBase(SLE::ConstRef sle, AccountID const& viewAccount); ~TrustLineBase() = default; TrustLineBase(TrustLineBase const&) = default; @@ -56,7 +56,7 @@ public: /** * Returns the state map key for the ledger entry. */ - [[nodiscard]] uint256 const& + [[nodiscard]] UInt256 const& key() const { return key_; @@ -171,7 +171,7 @@ public: getJson(int); protected: - uint256 key_; + UInt256 key_; STAmount const lowLimit_; STAmount const highLimit_; @@ -192,7 +192,7 @@ public: PathFindTrustLine() = delete; static std::optional - makeItem(AccountID const& accountID, SLE::const_ref sle); + makeItem(AccountID const& accountID, SLE::ConstRef sle); static std::vector getItems(AccountID const& accountID, ReadView const& view, LineDirection direction); @@ -207,7 +207,7 @@ class RPCTrustLine final : public TrustLineBase, public CountedObject - makeItem(AccountID const& accountID, SLE::const_ref sle); + makeItem(AccountID const& accountID, SLE::ConstRef sle); static std::vector getItems(AccountID const& accountID, ReadView const& view); diff --git a/src/xrpld/rpc/handlers/ChannelVerify.cpp b/src/xrpld/rpc/handlers/ChannelVerify.cpp index 50230a34a1..e30ec82100 100644 --- a/src/xrpld/rpc/handlers/ChannelVerify.cpp +++ b/src/xrpld/rpc/handlers/ChannelVerify.cpp @@ -56,7 +56,7 @@ doChannelVerify(rpc::JsonContext& context) } } - uint256 channelId; + UInt256 channelId; if (!channelId.parseHex(params[jss::channel_id].asString())) return rpcError(RpcChannelMalformed); diff --git a/src/xrpld/rpc/handlers/VaultInfo.cpp b/src/xrpld/rpc/handlers/VaultInfo.cpp index 0aa5334bd2..8604aaa64d 100644 --- a/src/xrpld/rpc/handlers/VaultInfo.cpp +++ b/src/xrpld/rpc/handlers/VaultInfo.cpp @@ -16,14 +16,14 @@ namespace xrpl { -static std::optional +static std::optional parseVault(json::Value const& params, json::Value& jvResult) { auto const hasVaultId = params.isMember(jss::vault_id); auto const hasOwner = params.isMember(jss::owner); auto const hasSeq = params.isMember(jss::seq); - uint256 uNodeIndex = beast::kZero; + UInt256 uNodeIndex = beast::kZero; if (hasVaultId && !hasOwner && !hasSeq) { // asString() throws on an object or an array, so the type comes first. diff --git a/src/xrpld/rpc/handlers/account/AccountChannels.cpp b/src/xrpld/rpc/handlers/account/AccountChannels.cpp index f2da1e31ee..6c72476c72 100644 --- a/src/xrpld/rpc/handlers/account/AccountChannels.cpp +++ b/src/xrpld/rpc/handlers/account/AccountChannels.cpp @@ -118,7 +118,7 @@ doAccountChannels(rpc::JsonContext& context) }; VisitData visitData = {.items = {}, .accountID = accountID, .raDstAccount = raDstAccount}; visitData.items.reserve(limit); - uint256 startAfter = beast::kZero; + UInt256 startAfter = beast::kZero; std::uint64_t startHint = 0; if (params.isMember(jss::marker)) @@ -156,7 +156,7 @@ doAccountChannels(rpc::JsonContext& context) } auto count = 0; - std::optional marker = {}; + std::optional marker = {}; std::uint64_t nextHint = 0; if (!forEachItemAfter( *ledger, @@ -164,7 +164,7 @@ doAccountChannels(rpc::JsonContext& context) startAfter, startHint, limit + 1, - [&visitData, &accountID, &count, &limit, &marker, &nextHint](SLE::const_ref sleCur) { + [&visitData, &accountID, &count, &limit, &marker, &nextHint](SLE::ConstRef sleCur) { if (!sleCur) { // LCOV_EXCL_START diff --git a/src/xrpld/rpc/handlers/account/AccountInfo.cpp b/src/xrpld/rpc/handlers/account/AccountInfo.cpp index 2276f98a0e..863f33d412 100644 --- a/src/xrpld/rpc/handlers/account/AccountInfo.cpp +++ b/src/xrpld/rpc/handlers/account/AccountInfo.cpp @@ -138,7 +138,7 @@ doAccountInfo(rpc::JsonContext& context) // Flags that are only reported when their amendment is enabled. This can't be `constexpr`, // since the amendment IDs are computed at runtime. static auto const kAmendmentGatedFlags = - std::to_array>( + std::to_array>( {{"allowTrustLineLocking", lsfAllowTrustLineLocking, featureTokenEscrow}}); // Every `AccountRoot` flag must be reported by `account_info`, so if a new flag is added, it diff --git a/src/xrpld/rpc/handlers/account/AccountLines.cpp b/src/xrpld/rpc/handlers/account/AccountLines.cpp index ac98e271b6..a6bb78fc02 100644 --- a/src/xrpld/rpc/handlers/account/AccountLines.cpp +++ b/src/xrpld/rpc/handlers/account/AccountLines.cpp @@ -147,7 +147,7 @@ doAccountLines(rpc::JsonContext& context) .raPeerAccount = raPeerAccount, .ignoreDefault = ignoreDefault, .foundCount = 0}; - uint256 startAfter = beast::kZero; + UInt256 startAfter = beast::kZero; std::uint64_t startHint = 0; if (params.isMember(jss::marker)) @@ -185,7 +185,7 @@ doAccountLines(rpc::JsonContext& context) } auto count = 0; - std::optional marker = {}; + std::optional marker = {}; std::uint64_t nextHint = 0; { if (!forEachItemAfter( @@ -194,7 +194,7 @@ doAccountLines(rpc::JsonContext& context) startAfter, startHint, limit + 1, - [&visitData, &count, &marker, &limit, &nextHint](SLE::const_ref sleCur) { + [&visitData, &count, &marker, &limit, &nextHint](SLE::ConstRef sleCur) { if (!sleCur) { // LCOV_EXCL_START diff --git a/src/xrpld/rpc/handlers/account/AccountNFTs.cpp b/src/xrpld/rpc/handlers/account/AccountNFTs.cpp index 580b93caa3..3b52317cfe 100644 --- a/src/xrpld/rpc/handlers/account/AccountNFTs.cpp +++ b/src/xrpld/rpc/handlers/account/AccountNFTs.cpp @@ -63,7 +63,7 @@ doAccountNFTs(rpc::JsonContext& context) if (auto err = readLimitField(limit, rpc::tuning::kAccountNfTokens, context)) return *err; - uint256 marker; + UInt256 marker; bool const markerSet = params.isMember(jss::marker); if (markerSet) @@ -88,7 +88,7 @@ doAccountNFTs(rpc::JsonContext& context) // Continue iteration from the current page: bool pastMarker = marker.isZero(); bool markerFound = false; - uint256 const maskedMarker = marker & nft::kPageMask; + UInt256 const maskedMarker = marker & nft::kPageMask; while (cp) { auto arr = cp->getFieldArray(sfNFTokens); @@ -106,8 +106,8 @@ doAccountNFTs(rpc::JsonContext& context) // NFTokenIDs that all have the same low 96 bits. If we're // in that case then we need to compare against the full // 256 bits. - uint256 const nftokenID = o[sfNFTokenID]; - uint256 const maskedNftokenID = nftokenID & nft::kPageMask; + UInt256 const nftokenID = o[sfNFTokenID]; + UInt256 const maskedNftokenID = nftokenID & nft::kPageMask; if (!pastMarker) { diff --git a/src/xrpld/rpc/handlers/account/AccountObjects.cpp b/src/xrpld/rpc/handlers/account/AccountObjects.cpp index 600f41d2e7..477e721196 100644 --- a/src/xrpld/rpc/handlers/account/AccountObjects.cpp +++ b/src/xrpld/rpc/handlers/account/AccountObjects.cpp @@ -44,8 +44,8 @@ getAccountObjects( ReadView const& ledger, AccountID const& account, std::optional> const& typeFilter, - uint256 dirIndex, - uint256 entryIndex, + UInt256 dirIndex, + UInt256 entryIndex, std::uint32_t const limit, std::optional const sponsoredFilter, json::Value& jvResult) @@ -353,8 +353,8 @@ doAccountObjects(rpc::JsonContext& context) if (auto err = readLimitField(limit, rpc::tuning::kAccountObjects, context)) return *err; - uint256 dirIndex; - uint256 entryIndex; + UInt256 dirIndex; + UInt256 entryIndex; if (params.isMember(jss::marker)) { auto const& marker = params[jss::marker]; diff --git a/src/xrpld/rpc/handlers/account/AccountOffers.cpp b/src/xrpld/rpc/handlers/account/AccountOffers.cpp index a7933f65a7..b644e226f9 100644 --- a/src/xrpld/rpc/handlers/account/AccountOffers.cpp +++ b/src/xrpld/rpc/handlers/account/AccountOffers.cpp @@ -31,7 +31,7 @@ namespace xrpl { void -appendOfferJson(SLE::const_ref offer, json::Value& offers) +appendOfferJson(SLE::ConstRef offer, json::Value& offers) { STAmount const dirRate = amountFromQuality(getQuality(offer->getFieldH256(sfBookDirectory))); json::Value& obj(offers.append(json::ValueType::Object)); @@ -86,7 +86,7 @@ doAccountOffers(rpc::JsonContext& context) json::Value& jsonOffers(result[jss::offers] = json::ValueType::Array); std::vector offers; - uint256 startAfter = beast::kZero; + UInt256 startAfter = beast::kZero; std::uint64_t startHint = 0; if (params.isMember(jss::marker)) @@ -124,7 +124,7 @@ doAccountOffers(rpc::JsonContext& context) } auto count = 0; - std::optional marker = {}; + std::optional marker = {}; std::uint64_t nextHint = 0; if (!forEachItemAfter( *ledger, @@ -132,7 +132,7 @@ doAccountOffers(rpc::JsonContext& context) startAfter, startHint, limit + 1, - [&offers, &count, &marker, &limit, &nextHint, &accountID](SLE::const_ref sle) { + [&offers, &count, &marker, &limit, &nextHint, &accountID](SLE::ConstRef sle) { if (!sle) { // LCOV_EXCL_START diff --git a/src/xrpld/rpc/handlers/account/AccountTx.cpp b/src/xrpld/rpc/handlers/account/AccountTx.cpp index 5385776b36..b1e6542e57 100644 --- a/src/xrpld/rpc/handlers/account/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/account/AccountTx.cpp @@ -81,7 +81,7 @@ parseDelegateFilter(json::Value const& delegateNode) using TxnsData = RelationalDatabase::AccountTxs; using TxnsDataBinary = RelationalDatabase::MetaTxsList; -using TxnDataBinary = RelationalDatabase::txnMetaLedgerType; +using TxnDataBinary = RelationalDatabase::TxnMetaLedgerType; using AccountTxArgs = RelationalDatabase::AccountTxArgs; using AccountTxResult = RelationalDatabase::AccountTxResult; using LedgerSpecifier = RelationalDatabase::LedgerSpecifier; @@ -352,9 +352,9 @@ populateJsonResponse( if (context.apiVersion > 1) { jvObj[jsonTx] = txn->getJson( - static_cast( + static_cast( JsonOptions::Values::IncludeDate) | - static_cast( + static_cast( JsonOptions::Values::DisableApiPriorV2), false); jvObj[jss::hash] = to_string(txn->getID()); diff --git a/src/xrpld/rpc/handlers/account/GatewayBalances.cpp b/src/xrpld/rpc/handlers/account/GatewayBalances.cpp index 041e878a3f..92fd1e1647 100644 --- a/src/xrpld/rpc/handlers/account/GatewayBalances.cpp +++ b/src/xrpld/rpc/handlers/account/GatewayBalances.cpp @@ -150,7 +150,7 @@ doGatewayBalances(rpc::JsonContext& context) // Traverse the cold wallet's trust lines { - forEachItem(*ledger, accountID, [&](SLE::const_ref sle) { + forEachItem(*ledger, accountID, [&](SLE::ConstRef sle) { if (sle->getType() == ltESCROW) { auto const& escrow = sle->getFieldAmount(sfAmount); diff --git a/src/xrpld/rpc/handlers/account/NoRippleCheck.cpp b/src/xrpld/rpc/handlers/account/NoRippleCheck.cpp index 283ef7cb3f..9284339732 100644 --- a/src/xrpld/rpc/handlers/account/NoRippleCheck.cpp +++ b/src/xrpld/rpc/handlers/account/NoRippleCheck.cpp @@ -137,7 +137,7 @@ doNoRippleCheck(rpc::JsonContext& context) } } - forEachItemAfter(*ledger, accountID, uint256(), 0, limit, [&](SLE::const_ref ownedItem) { + forEachItemAfter(*ledger, accountID, UInt256(), 0, limit, [&](SLE::ConstRef ownedItem) { if (ownedItem->getType() == ltRIPPLE_STATE) { bool const low = accountID == ownedItem->getFieldAmount(sfLowLimit).getIssuer(); diff --git a/src/xrpld/rpc/handlers/admin/data/CanDelete.cpp b/src/xrpld/rpc/handlers/admin/data/CanDelete.cpp index 5c96bfb215..9a8f6c1ece 100644 --- a/src/xrpld/rpc/handlers/admin/data/CanDelete.cpp +++ b/src/xrpld/rpc/handlers/admin/data/CanDelete.cpp @@ -57,7 +57,7 @@ doCanDelete(rpc::JsonContext& context) if (canDeleteSeq == 0u) return rpc::makeError(RpcNotReady); } - else if (uint256 lh; lh.parseHex(canDeleteStr)) + else if (UInt256 lh; lh.parseHex(canDeleteStr)) { auto ledger = context.ledgerMaster.getLedgerByHash(lh); diff --git a/src/xrpld/rpc/handlers/admin/signing/ChannelAuthorize.cpp b/src/xrpld/rpc/handlers/admin/signing/ChannelAuthorize.cpp index eb3ac24378..e833197e89 100644 --- a/src/xrpld/rpc/handlers/admin/signing/ChannelAuthorize.cpp +++ b/src/xrpld/rpc/handlers/admin/signing/ChannelAuthorize.cpp @@ -66,7 +66,7 @@ doChannelAuthorize(rpc::JsonContext& context) PublicKey const& pk = keyPair->first; SecretKey const& sk = keyPair->second; - uint256 channelId; + UInt256 channelId; if (!channelId.parseHex(params[jss::channel_id].asString())) return rpcError(RpcChannelMalformed); diff --git a/src/xrpld/rpc/handlers/ledger/Ledger.h b/src/xrpld/rpc/handlers/ledger/Ledger.h index 17c95e2653..b63faa5efa 100644 --- a/src/xrpld/rpc/handlers/ledger/Ledger.h +++ b/src/xrpld/rpc/handlers/ledger/Ledger.h @@ -22,7 +22,7 @@ struct JsonContext; // ledger [id|index|current|closed] [full] // { -// ledger: 'current' | 'closed' | | , // optional +// ledger: 'current' | 'closed' | | , // optional // full: true | false // optional, defaults to false. // } diff --git a/src/xrpld/rpc/handlers/ledger/LedgerData.cpp b/src/xrpld/rpc/handlers/ledger/LedgerData.cpp index 697d8e52b8..cf652feab2 100644 --- a/src/xrpld/rpc/handlers/ledger/LedgerData.cpp +++ b/src/xrpld/rpc/handlers/ledger/LedgerData.cpp @@ -152,8 +152,8 @@ doLedgerDataGrpc(rpc::GRPCContext& con return {response, errorStatus}; } - uint256 startKey; - if (auto key = uint256::fromVoidChecked(request.marker())) + UInt256 startKey; + if (auto key = UInt256::fromVoidChecked(request.marker())) { startKey = *key; } @@ -166,7 +166,7 @@ doLedgerDataGrpc(rpc::GRPCContext& con auto e = ledger->sles.end(); if (!request.end_marker().empty()) { - auto const key = uint256::fromVoidChecked(request.end_marker()); + auto const key = UInt256::fromVoidChecked(request.end_marker()); if (!key) return {response, {grpc::StatusCode::INVALID_ARGUMENT, "end marker malformed"}}; diff --git a/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp b/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp index f56a8825bb..a71d4fefab 100644 --- a/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/ledger/LedgerEntry.cpp @@ -35,12 +35,12 @@ namespace xrpl { -using FunctionType = std::function( +using FunctionType = std::function( json::Value const&, json::StaticString const, unsigned const apiVersion)>; -static std::expected +static std::expected parseFixed( Keylet const& keylet, json::Value const& params, @@ -56,25 +56,25 @@ fixed(Keylet const& keylet) return [keylet]( json::Value const& params, json::StaticString const fieldName, - unsigned const apiVersion) -> std::expected { + unsigned const apiVersion) -> std::expected { return parseFixed(keylet, params, fieldName, apiVersion); }; } -static std::expected +static std::expected parseObjectID( json::Value const& params, json::StaticString const fieldName, std::string const& expectedType = "hex string or object") { - if (auto const uNodeIndex = ledger_entry_helpers::parse(params)) + if (auto const uNodeIndex = ledger_entry_helpers::parse(params)) { return *uNodeIndex; } return ledger_entry_helpers::invalidFieldError("malformedRequest", fieldName, expectedType); } -static std::expected +static std::expected parseIndex(json::Value const& params, json::StaticString const fieldName, unsigned const apiVersion) { if (apiVersion > 2u && params.isString()) @@ -96,7 +96,7 @@ parseIndex(json::Value const& params, json::StaticString const fieldName, unsign return parseObjectID(params, fieldName, "hex string"); } -static std::expected +static std::expected parseAccountRoot( json::Value const& params, json::StaticString const fieldName, @@ -112,7 +112,7 @@ parseAccountRoot( auto const parseAmendments = fixed(keylet::amendments()); -static std::expected +static std::expected parseAMM( json::Value const& params, json::StaticString const fieldName, @@ -141,7 +141,7 @@ parseAMM( return keylet::amm(*asset, *asset2).key; } -static std::expected +static std::expected parseBridge( json::Value const& params, json::StaticString const fieldName, @@ -174,7 +174,7 @@ parseBridge( return keylet::bridge(*bridge, chainType).key; } -static std::expected +static std::expected parseCheck( json::Value const& params, json::StaticString const fieldName, @@ -183,7 +183,7 @@ parseCheck( return parseObjectID(params, fieldName, "hex string"); } -static std::expected +static std::expected parseCredential( json::Value const& cred, json::StaticString const fieldName, @@ -212,7 +212,7 @@ parseCredential( return keylet::credential(*subject, *issuer, Slice(credType->data(), credType->size())).key; } -static std::expected +static std::expected parseDelegate( json::Value const& params, json::StaticString const fieldName, @@ -298,7 +298,7 @@ parseAuthorizeCredentials(json::Value const& jv) return arr; } -static std::expected +static std::expected parseDepositPreauth( json::Value const& dp, json::StaticString const fieldName, @@ -349,7 +349,7 @@ parseDepositPreauth( return keylet::depositPreauth(*owner, sorted).key; } -static std::expected +static std::expected parseDID( json::Value const& params, json::StaticString const fieldName, @@ -364,7 +364,7 @@ parseDID( return keylet::did(*account).key; } -static std::expected +static std::expected parseDirectoryNode( json::Value const& params, json::StaticString const fieldName, @@ -393,7 +393,7 @@ parseDirectoryNode( if (params.isMember(jss::dir_root)) { - if (auto const uDirRoot = ledger_entry_helpers::parse(params[jss::dir_root])) + if (auto const uDirRoot = ledger_entry_helpers::parse(params[jss::dir_root])) { return keylet::page(*uDirRoot, uSubIndex).key; } @@ -416,7 +416,7 @@ parseDirectoryNode( return ledger_entry_helpers::malformedError("malformedRequest", ""); } -static std::expected +static std::expected parseEscrow( json::Value const& params, json::StaticString const fieldName, @@ -440,7 +440,7 @@ parseEscrow( auto const parseFeeSettings = fixed(keylet::feeSettings()); -static std::expected +static std::expected parseFixed( Keylet const& keylet, json::Value const& params, @@ -459,7 +459,7 @@ parseFixed( return keylet.key; } -static std::expected +static std::expected parseLedgerHashes( json::Value const& params, json::StaticString const fieldName, @@ -479,7 +479,7 @@ parseLedgerHashes( return parseFixed(keylet::skip(), params, fieldName, apiVersion); } -static std::expected +static std::expected parseLoanBroker( json::Value const& params, json::StaticString const fieldName, @@ -501,7 +501,7 @@ parseLoanBroker( return keylet::loanBroker(*id, seqProxy).key; } -static std::expected +static std::expected parseLoan( json::Value const& params, json::StaticString const fieldName, @@ -524,7 +524,7 @@ parseLoan( return keylet::loan(*id, seqProxy).key; } -static std::expected +static std::expected parseMPToken( json::Value const& params, json::StaticString const fieldName, @@ -548,13 +548,13 @@ parseMPToken( return keylet::mptoken(*mptIssuanceID, *account).key; } -static std::expected +static std::expected parseMPTokenIssuance( json::Value const& params, json::StaticString const fieldName, [[maybe_unused]] unsigned const apiVersion) { - auto const mptIssuanceID = ledger_entry_helpers::parse(params); + auto const mptIssuanceID = ledger_entry_helpers::parse(params); if (!mptIssuanceID) { return ledger_entry_helpers::invalidFieldError( @@ -564,7 +564,7 @@ parseMPTokenIssuance( return keylet::mptokenIssuance(*mptIssuanceID).key; } -static std::expected +static std::expected parseNFTokenOffer( json::Value const& params, json::StaticString const fieldName, @@ -573,7 +573,7 @@ parseNFTokenOffer( return parseObjectID(params, fieldName, "hex string"); } -static std::expected +static std::expected parseNFTokenPage( json::Value const& params, json::StaticString const fieldName, @@ -584,7 +584,7 @@ parseNFTokenPage( auto const parseNegativeUNL = fixed(keylet::negativeUNL()); -static std::expected +static std::expected parseOffer( json::Value const& params, json::StaticString const fieldName, @@ -608,7 +608,7 @@ parseOffer( return keylet::offer(*id, seqProxy).key; } -static std::expected +static std::expected parseOracle( json::Value const& params, json::StaticString const fieldName, @@ -632,7 +632,7 @@ parseOracle( return keylet::oracle(*id, *seq).key; } -static std::expected +static std::expected parsePayChannel( json::Value const& params, json::StaticString const fieldName, @@ -641,7 +641,7 @@ parsePayChannel( return parseObjectID(params, fieldName, "hex string"); } -static std::expected +static std::expected parsePermissionedDomain( json::Value const& pd, json::StaticString const fieldName, @@ -671,7 +671,7 @@ parsePermissionedDomain( return keylet::permissionedDomain(*account, seqProxy).key; } -static std::expected +static std::expected parseRippleState( json::Value const& jvRippleState, json::StaticString const fieldName, @@ -720,7 +720,7 @@ parseRippleState( return keylet::trustLine(*id1, *id2, uCurrency).key; } -static std::expected +static std::expected parseSignerList( json::Value const& params, json::StaticString const fieldName, @@ -729,7 +729,7 @@ parseSignerList( return parseObjectID(params, fieldName, "hex string"); } -static std::expected +static std::expected parseSponsorship( json::Value const& params, json::StaticString const fieldName, @@ -751,7 +751,7 @@ parseSponsorship( return keylet::sponsorship(*sponsorID, *sponseeID).key; } -static std::expected +static std::expected parseTransactionProposal( json::Value const& params, json::StaticString const fieldName, @@ -780,7 +780,7 @@ parseTransactionProposal( return keylet::txProposal(*targetID, *ticketSequence).key; } -static std::expected +static std::expected parseTicket( json::Value const& params, json::StaticString const fieldName, @@ -805,7 +805,7 @@ parseTicket( return keylet::ticket(*id, seqProxy).key; } -static std::expected +static std::expected parseVault( json::Value const& params, json::StaticString const fieldName, @@ -828,7 +828,7 @@ parseVault( return keylet::vault(*id, seqProxy).key; } -static std::expected +static std::expected parseXChainOwnedClaimID( json::Value const& claimId, json::StaticString const fieldName, @@ -854,7 +854,7 @@ parseXChainOwnedClaimID( return keylet.key; } -static std::expected +static std::expected parseXChainOwnedCreateAccountClaimID( json::Value const& claimId, json::StaticString const fieldName, @@ -943,7 +943,7 @@ doLedgerEntry(rpc::JsonContext& context) if (!lpLedger) return jvResult; - uint256 uNodeIndex; + UInt256 uNodeIndex; LedgerEntryType expectedType = ltANY; try @@ -1059,7 +1059,7 @@ doLedgerEntryGrpc(rpc::GRPCContext& c return {response, errorStatus}; } - auto const key = uint256::fromVoidChecked(request.key()); + auto const key = UInt256::fromVoidChecked(request.key()); if (!key) { grpc::Status const errorStatus{grpc::StatusCode::INVALID_ARGUMENT, "index malformed"}; diff --git a/src/xrpld/rpc/handlers/ledger/LedgerEntryHelpers.h b/src/xrpld/rpc/handlers/ledger/LedgerEntryHelpers.h index 1b119db04e..e83b1b5db9 100644 --- a/src/xrpld/rpc/handlers/ledger/LedgerEntryHelpers.h +++ b/src/xrpld/rpc/handlers/ledger/LedgerEntryHelpers.h @@ -176,10 +176,10 @@ requiredUInt32( } template <> -inline std::optional +inline std::optional parse(json::Value const& param) { - uint256 uNodeIndex; + UInt256 uNodeIndex; if (!param.isString() || !uNodeIndex.parseHex(param.asString())) { return std::nullopt; @@ -188,20 +188,20 @@ parse(json::Value const& param) return uNodeIndex; } -inline std::expected +inline std::expected requiredUInt256( json::Value const& params, json::StaticString const fieldName, std::string const& err) { - return required(params, fieldName, err, "Hash256"); + return required(params, fieldName, err, "Hash256"); } template <> -inline std::optional +inline std::optional parse(json::Value const& param) { - uint192 field; + UInt192 field; if (!param.isString() || !field.parseHex(param.asString())) { return std::nullopt; @@ -210,13 +210,13 @@ parse(json::Value const& param) return field; } -inline std::expected +inline std::expected requiredUInt192( json::Value const& params, json::StaticString const fieldName, std::string const& err) { - return required(params, fieldName, err, "Hash192"); + return required(params, fieldName, err, "Hash192"); } template <> diff --git a/src/xrpld/rpc/handlers/orderbook/AMMInfo.cpp b/src/xrpld/rpc/handlers/orderbook/AMMInfo.cpp index e95c51c483..b9942ceec1 100644 --- a/src/xrpld/rpc/handlers/orderbook/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/orderbook/AMMInfo.cpp @@ -83,7 +83,7 @@ doAMMInfo(rpc::JsonContext& context) std::optional accountID; std::optional asset1; std::optional asset2; - std::optional ammID; + std::optional ammID; static constexpr auto kInvalid = [](json::Value const& params) -> bool { return (params.isMember(jss::asset) != params.isMember(jss::asset2)) || diff --git a/src/xrpld/rpc/handlers/orderbook/BookOffers.cpp b/src/xrpld/rpc/handlers/orderbook/BookOffers.cpp index 219c29d53a..ebd4276e16 100644 --- a/src/xrpld/rpc/handlers/orderbook/BookOffers.cpp +++ b/src/xrpld/rpc/handlers/orderbook/BookOffers.cpp @@ -215,10 +215,10 @@ doBookOffers(rpc::JsonContext& context) return rpc::invalidFieldError(jss::taker); } - std::optional domain; + std::optional domain; if (context.params.isMember(jss::domain)) { - uint256 num; + UInt256 num; if (!context.params[jss::domain].isString() || !num.parseHex(context.params[jss::domain].asString())) { diff --git a/src/xrpld/rpc/handlers/orderbook/DepositAuthorized.cpp b/src/xrpld/rpc/handlers/orderbook/DepositAuthorized.cpp index 9d109fe16f..c8f4fccb3a 100644 --- a/src/xrpld/rpc/handlers/orderbook/DepositAuthorized.cpp +++ b/src/xrpld/rpc/handlers/orderbook/DepositAuthorized.cpp @@ -118,7 +118,7 @@ doDepositAuthorized(rpc::JsonContext& context) jss::credentials, "an array of CredentialID(hash256)")); } - uint256 credH; + UInt256 credH; auto const credS = jo.asString(); if (!credH.parseHex(credS)) { diff --git a/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp b/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp index 33eaa9ce1e..084e12613a 100644 --- a/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp +++ b/src/xrpld/rpc/handlers/orderbook/GetAggregatePrice.cpp @@ -51,7 +51,7 @@ using Prices = bimap>, multiset_of const& f) { static constexpr std::uint8_t kMaxHistory = 3; @@ -87,7 +87,7 @@ iteratePriceData( if (++history > kMaxHistory) return; - uint256 const prevTx = chain->getFieldH256(sfPreviousTxnID); + UInt256 const prevTx = chain->getFieldH256(sfPreviousTxnID); std::uint32_t const prevSeq = chain->getFieldU32(sfPreviousTxnLgrSeq); auto const ledger = context.ledgerMaster.getLedgerBySeq(prevSeq); diff --git a/src/xrpld/rpc/handlers/orderbook/NFTBuyOffers.cpp b/src/xrpld/rpc/handlers/orderbook/NFTBuyOffers.cpp index 60b48ac5a6..4b7b1c0187 100644 --- a/src/xrpld/rpc/handlers/orderbook/NFTBuyOffers.cpp +++ b/src/xrpld/rpc/handlers/orderbook/NFTBuyOffers.cpp @@ -15,7 +15,7 @@ doNFTBuyOffers(rpc::JsonContext& context) if (!context.params.isMember(jss::nft_id)) return rpc::missingFieldError(jss::nft_id); - uint256 nftId; + UInt256 nftId; if (!nftId.parseHex(context.params[jss::nft_id].asString())) return rpc::invalidFieldError(jss::nft_id); diff --git a/src/xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h b/src/xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h index 21bf3f8be8..dcbd6ada17 100644 --- a/src/xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h +++ b/src/xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h @@ -27,7 +27,7 @@ namespace xrpl { inline void -appendNftOfferJson(Application const& app, SLE::const_ref offer, json::Value& offers) +appendNftOfferJson(Application const& app, SLE::ConstRef offer, json::Value& offers) { json::Value& obj(offers.append(json::ValueType::Object)); @@ -52,7 +52,7 @@ appendNftOfferJson(Application const& app, SLE::const_ref offer, json::Value& of // marker: opaque // optional, resume previous query // } inline json::Value -enumerateNFTOffers(rpc::JsonContext& context, uint256 const& nftId, Keylet const& directory) +enumerateNFTOffers(rpc::JsonContext& context, UInt256 const& nftId, Keylet const& directory) { unsigned int limit = 0; if (auto err = readLimitField(limit, rpc::tuning::kNftOffers, context)) @@ -73,7 +73,7 @@ enumerateNFTOffers(rpc::JsonContext& context, uint256 const& nftId, Keylet const std::vector offers; unsigned int reserve(limit); - uint256 startAfter; + UInt256 startAfter; std::uint64_t startHint = 0; if (context.params.isMember(jss::marker)) @@ -115,7 +115,7 @@ enumerateNFTOffers(rpc::JsonContext& context, uint256 const& nftId, Keylet const } if (!forEachItemAfter( - *ledger, directory, startAfter, startHint, reserve, [&offers](SLE::const_ref offer) { + *ledger, directory, startAfter, startHint, reserve, [&offers](SLE::ConstRef offer) { if (offer->getType() == ltNFTOKEN_OFFER) { offers.emplace_back(offer); diff --git a/src/xrpld/rpc/handlers/orderbook/NFTSellOffers.cpp b/src/xrpld/rpc/handlers/orderbook/NFTSellOffers.cpp index 8b09b42a34..0f6579bbb0 100644 --- a/src/xrpld/rpc/handlers/orderbook/NFTSellOffers.cpp +++ b/src/xrpld/rpc/handlers/orderbook/NFTSellOffers.cpp @@ -15,7 +15,7 @@ doNFTSellOffers(rpc::JsonContext& context) if (!context.params.isMember(jss::nft_id)) return rpc::missingFieldError(jss::nft_id); - uint256 nftId; + UInt256 nftId; if (!nftId.parseHex(context.params[jss::nft_id].asString())) return rpc::invalidFieldError(jss::nft_id); diff --git a/src/xrpld/rpc/handlers/server_info/Feature.cpp b/src/xrpld/rpc/handlers/server_info/Feature.cpp index 1906658106..0746194691 100644 --- a/src/xrpld/rpc/handlers/server_info/Feature.cpp +++ b/src/xrpld/rpc/handlers/server_info/Feature.cpp @@ -31,7 +31,7 @@ doFeature(rpc::JsonContext& context) bool const isAdmin = context.role == Role::ADMIN; // Get majority amendment status - majorityAmendments_t majorities; + MajorityAmendmentsT majorities; if (auto const valLedger = context.ledgerMaster.getValidatedLedger()) majorities = getMajorityAmendments(*valLedger); diff --git a/src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp b/src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp index c297c2482d..bc11d7c4ce 100644 --- a/src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp +++ b/src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp @@ -36,14 +36,14 @@ private: // translate e.g. STI_LEDGERENTRY to LedgerEntry translate(std::string const& inp); - uint256 defsHash_; + UInt256 defsHash_; json::Value defs_; public: ServerDefinitions(); [[nodiscard]] bool - hashMatches(uint256 hash) const + hashMatches(UInt256 hash) const { return defsHash_ == hash; } @@ -385,7 +385,7 @@ doServerDefinitions(rpc::JsonContext& context) { auto& params = context.params; - uint256 hash; + UInt256 hash; if (params.isMember(jss::hash)) { if (!params[jss::hash].isString() || !hash.parseHex(params[jss::hash].asString())) diff --git a/src/xrpld/rpc/handlers/subscribe/Subscribe.cpp b/src/xrpld/rpc/handlers/subscribe/Subscribe.cpp index 3f6d716f29..702c330d97 100644 --- a/src/xrpld/rpc/handlers/subscribe/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/subscribe/Subscribe.cpp @@ -39,7 +39,7 @@ namespace { * @return true if the request must be rejected to stay within the cap. */ [[nodiscard]] bool -wouldExceedSubscriptionCap(InfoSub::ref ispSub, std::size_t additional, std::size_t cap) +wouldExceedSubscriptionCap(InfoSub::Ref ispSub, std::size_t additional, std::size_t cap) { return exceedsSubscriptionCap(ispSub->totalSubscriptionCount(), additional, cap); } @@ -206,8 +206,8 @@ doSubscribe(rpc::JsonContext& context) bool const hasProposed = context.params.isMember(accountsProposed); bool const hasAccounts = context.params.isMember(jss::accounts); - hash_set proposedIds; - hash_set accountIds; + HashSet proposedIds; + HashSet accountIds; if (hasProposed) { @@ -322,7 +322,7 @@ doSubscribe(rpc::JsonContext& context) if (j.isMember(jss::domain)) { - uint256 domain; + UInt256 domain; if (!j[jss::domain].isString() || !domain.parseHex(j[jss::domain].asString())) { return rpcError(RpcDomainMalformed); diff --git a/src/xrpld/rpc/handlers/subscribe/Unsubscribe.cpp b/src/xrpld/rpc/handlers/subscribe/Unsubscribe.cpp index 33c785a9bb..76f5cc0cc0 100644 --- a/src/xrpld/rpc/handlers/subscribe/Unsubscribe.cpp +++ b/src/xrpld/rpc/handlers/subscribe/Unsubscribe.cpp @@ -177,7 +177,7 @@ doUnsubscribe(rpc::JsonContext& context) if (jv.isMember(jss::domain)) { - uint256 domain; + UInt256 domain; if (!jv[jss::domain].isString() || !domain.parseHex(jv[jss::domain].asString())) { return rpcError(RpcDomainMalformed); diff --git a/src/xrpld/rpc/handlers/transaction/TransactionEntry.cpp b/src/xrpld/rpc/handlers/transaction/TransactionEntry.cpp index 2bd97e852f..2181d41857 100644 --- a/src/xrpld/rpc/handlers/transaction/TransactionEntry.cpp +++ b/src/xrpld/rpc/handlers/transaction/TransactionEntry.cpp @@ -42,7 +42,7 @@ doTransactionEntry(rpc::JsonContext& context) } else { - uint256 uTransID; + UInt256 uTransID; // XXX Relying on trusted WSS client. Would be better to have a strict // routine, returning success or failure. if (!uTransID.parseHex(context.params[jss::tx_hash].asString())) diff --git a/src/xrpld/rpc/handlers/transaction/Tx.cpp b/src/xrpld/rpc/handlers/transaction/Tx.cpp index cebe427af8..7230ba5db7 100644 --- a/src/xrpld/rpc/handlers/transaction/Tx.cpp +++ b/src/xrpld/rpc/handlers/transaction/Tx.cpp @@ -38,7 +38,7 @@ namespace xrpl { static bool -isValidated(LedgerMaster& ledgerMaster, std::uint32_t seq, uint256 const& hash) +isValidated(LedgerMaster& ledgerMaster, std::uint32_t seq, UInt256 const& hash) { if (!ledgerMaster.haveLedger(seq)) return false; @@ -56,13 +56,13 @@ struct TxResult bool validated = false; std::optional ctid; std::optional closeTime; - std::optional ledgerHash; + std::optional ledgerHash; TxSearched searchedAll = TxSearched::Unknown; }; struct TxArgs { - std::optional hash; + std::optional hash; std::optional> ctid; bool binary = false; std::optional> ledgerRange; @@ -206,8 +206,8 @@ populateJsonResponse( if (context.apiVersion > 1) { static constexpr auto kOptionsJson = - static_cast(JsonOptions::Values::IncludeDate) | - static_cast(JsonOptions::Values::DisableApiPriorV2); + static_cast(JsonOptions::Values::IncludeDate) | + static_cast(JsonOptions::Values::DisableApiPriorV2); if (args.binary) { response[jss::tx_blob] = result.txn->getJson(kOptionsJson, true); @@ -282,7 +282,7 @@ doTxJson(rpc::JsonContext& context) if (context.params.isMember(jss::transaction)) { - uint256 hash; + UInt256 hash; if (!hash.parseHex(context.params[jss::transaction].asString())) return rpcError(RpcNotImpl); args.hash = hash; diff --git a/src/xrpld/rpc/handlers/utility/Random.cpp b/src/xrpld/rpc/handlers/utility/Random.cpp index d3428ee6e9..5751ef32ac 100644 --- a/src/xrpld/rpc/handlers/utility/Random.cpp +++ b/src/xrpld/rpc/handlers/utility/Random.cpp @@ -16,7 +16,7 @@ struct JsonContext; // Result: // { -// random: +// random: // } json::Value doRandom(rpc::JsonContext& context) @@ -25,7 +25,7 @@ doRandom(rpc::JsonContext& context) // top level too. try { - uint256 rand; + UInt256 rand; beast::rngfill(rand.begin(), rand.size(), cryptoPrng()); json::Value jvResult; diff --git a/src/xrpld/rpc/json_body.h b/src/xrpld/rpc/json_body.h index 0f56b852f7..661627c48a 100644 --- a/src/xrpld/rpc/json_body.h +++ b/src/xrpld/rpc/json_body.h @@ -22,15 +22,18 @@ struct JsonBody using value_type = json::Value; - class reader // NOLINT(readability-identifier-naming) -- Boost.Beast body concept name + // NOLINTNEXTLINE(readability-identifier-naming) -- Boost.Beast body concept name + class reader { - using dynamic_buffer_type = boost::beast::multi_buffer; + using DynamicBufferType = boost::beast::multi_buffer; - dynamic_buffer_type buffer_; + DynamicBufferType buffer_; public: - using const_buffers_type = dynamic_buffer_type::const_buffers_type; + // NOLINTNEXTLINE(readability-identifier-naming) -- Boost.Beast body concept name + using const_buffers_type = DynamicBufferType::const_buffers_type; + // NOLINTNEXTLINE(readability-identifier-naming) -- Boost.Beast body concept name using is_deferred = std::false_type; template @@ -61,11 +64,13 @@ struct JsonBody } }; - class writer // NOLINT(readability-identifier-naming) -- Boost.Beast body concept name + // NOLINTNEXTLINE(readability-identifier-naming) -- Boost.Beast body concept name + class writer { std::string bodyString_; public: + // NOLINTNEXTLINE(readability-identifier-naming) -- Boost.Beast body concept name using const_buffers_type = boost::asio::const_buffer; template diff --git a/src/xrpld/shamap/NodeFamily.cpp b/src/xrpld/shamap/NodeFamily.cpp index 2e48117d6a..0ee275a534 100644 --- a/src/xrpld/shamap/NodeFamily.cpp +++ b/src/xrpld/shamap/NodeFamily.cpp @@ -63,7 +63,7 @@ NodeFamily::reset() } void -NodeFamily::missingNodeAcquireBySeq(std::uint32_t seq, uint256 const& nodeHash) +NodeFamily::missingNodeAcquireBySeq(std::uint32_t seq, UInt256 const& nodeHash) { JLOG(j_.error()) << "Missing node in " << seq; std::unique_lock lock(maxSeqMutex_); @@ -92,7 +92,7 @@ NodeFamily::missingNodeAcquireBySeq(std::uint32_t seq, uint256 const& nodeHash) } void -NodeFamily::acquire(uint256 const& hash, std::uint32_t seq) +NodeFamily::acquire(UInt256 const& hash, std::uint32_t seq) { if (hash.isNonZero()) { diff --git a/src/xrpld/shamap/NodeFamily.h b/src/xrpld/shamap/NodeFamily.h index 1307d76886..6d764f9151 100644 --- a/src/xrpld/shamap/NodeFamily.h +++ b/src/xrpld/shamap/NodeFamily.h @@ -70,10 +70,10 @@ public: reset() override; void - missingNodeAcquireBySeq(std::uint32_t seq, uint256 const& hash) override; + missingNodeAcquireBySeq(std::uint32_t seq, UInt256 const& hash) override; void - missingNodeAcquireByHash(uint256 const& hash, std::uint32_t seq) override + missingNodeAcquireByHash(UInt256 const& hash, std::uint32_t seq) override { acquire(hash, seq); } @@ -91,7 +91,7 @@ private: std::mutex maxSeqMutex_; void - acquire(uint256 const& hash, std::uint32_t seq); + acquire(UInt256 const& hash, std::uint32_t seq); }; } // namespace xrpl