From 4565cc280bf2d91f8f88ef74cc807ece4c91a243 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 8 Dec 2025 13:39:38 -0500 Subject: [PATCH 01/62] chore: Fix docs readme and cmake (#6122) This change removes the unused `with_docs` option and fixes the README instructions on how to build the `docs` target. --- cmake/XrplDocs.cmake | 4 +--- docs/README.md | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/XrplDocs.cmake b/cmake/XrplDocs.cmake index dda277bffa..a99bbe076b 100644 --- a/cmake/XrplDocs.cmake +++ b/cmake/XrplDocs.cmake @@ -2,9 +2,7 @@ docs target (optional) #]===================================================================] -option(with_docs "Include the docs target?" FALSE) - -if(NOT (with_docs OR only_docs)) +if(NOT only_docs) return() endif() diff --git a/docs/README.md b/docs/README.md index c95a871729..35fcbba2d1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -54,8 +54,8 @@ There is a `docs` target in the CMake configuration. ``` mkdir build cd build -cmake .. -cmake --build . --target docs +cmake -Donly_docs=ON .. +cmake --build . --target docs --parallel ``` The output will be in `build/docs/html`. From 42a432c5dc2af2754f4083b93f0ee0d616092681 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 10 Dec 2025 13:43:02 -0500 Subject: [PATCH 02/62] refactor: clean up `RPCHelpers` (#5684) This PR cleans up `RPCHelpers.h` and `RPCHelpers.cpp`. It splits out all the fetch-ledger functions to a new set of files, `RPCLedgerHelpers.h`/`RPCLedgerHelpers.cpp`, and moves the general-API functions to `ApiVersion.h`. There is no functionality change. --- include/xrpl/protocol/ApiVersion.h | 2 +- src/test/rpc/AccountCurrencies_test.cpp | 4 +- src/test/rpc/AccountLines_test.cpp | 38 ++- src/test/rpc/DepositAuthorized_test.cpp | 5 +- src/test/rpc/LedgerEntry_test.cpp | 8 +- src/test/rpc/LedgerRPC_test.cpp | 35 ++- ...estRPC_test.cpp => LedgerRequest_test.cpp} | 53 ++-- src/test/rpc/NoRippleCheck_test.cpp | 34 ++- src/xrpld/app/ledger/LedgerToJson.h | 4 +- src/xrpld/rpc/detail/Handler.cpp | 1 + src/xrpld/rpc/detail/RPCHelpers.cpp | 82 ------ src/xrpld/rpc/detail/RPCHelpers.h | 161 +++++++----- src/xrpld/rpc/detail/RPCLedgerHelpers.cpp | 235 +++++++++++------- src/xrpld/rpc/detail/RPCLedgerHelpers.h | 171 +++++++++---- src/xrpld/rpc/detail/ServerHandler.cpp | 8 + src/xrpld/rpc/handlers/AMMInfo.cpp | 22 +- src/xrpld/rpc/handlers/AccountInfo.cpp | 42 +++- src/xrpld/rpc/handlers/AccountObjects.cpp | 9 + src/xrpld/rpc/handlers/AccountTx.cpp | 6 +- src/xrpld/rpc/handlers/LedgerRequest.cpp | 12 +- 20 files changed, 579 insertions(+), 353 deletions(-) rename src/test/rpc/{LedgerRequestRPC_test.cpp => LedgerRequest_test.cpp} (89%) diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index 56d607a39b..d83884008d 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -95,7 +95,7 @@ setVersion(JsonObject& parent, unsigned int apiVersion, bool betaEnabled) * 3) the version number is unspecified and * APIVersionIfUnspecified is out of the supported range * - * @param jv a Json value that may or may not specifies + * @param jv a Json value that may or may not specify * the api version number * @param betaEnabled if the beta API version is enabled * @return the api version number diff --git a/src/test/rpc/AccountCurrencies_test.cpp b/src/test/rpc/AccountCurrencies_test.cpp index dd62d2fea4..c4833d11d4 100644 --- a/src/test/rpc/AccountCurrencies_test.cpp +++ b/src/test/rpc/AccountCurrencies_test.cpp @@ -26,7 +26,9 @@ class AccountCurrencies_test : public beast::unit_test::suite auto const result = env.rpc( "json", "account_currencies", to_string(params))[jss::result]; BEAST_EXPECT(result[jss::error] == "invalidParams"); - BEAST_EXPECT(result[jss::error_message] == "ledgerHashNotString"); + BEAST_EXPECT( + result[jss::error_message] == + "Invalid field 'ledger_hash', not hex string."); } { // missing account field diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index d1bdc20687..e062959769 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -89,7 +89,7 @@ public: env.rpc("json", "account_lines", to_string(params)); BEAST_EXPECT( lines[jss::result][jss::error_message] == - "ledgerIndexMalformed"); + "Invalid field 'ledger_index', not string or number."); } { // Specify a different ledger that doesn't exist. @@ -190,16 +190,30 @@ public: testAccountLinesHistory(alice, ledger58Info, 52); { - // Surprisingly, it's valid to specify both index and hash, in - // which case the hash wins. + // Invalid to specify both index and hash Json::Value params; params[jss::account] = alice.human(); params[jss::ledger_hash] = to_string(ledger4Info.hash); params[jss::ledger_index] = ledger58Info.seq; - auto const lines = - env.rpc("json", "account_lines", to_string(params)); - BEAST_EXPECT(lines[jss::result][jss::lines].isArray()); - BEAST_EXPECT(lines[jss::result][jss::lines].size() == 26); + auto const lines = env.rpc( + "json", "account_lines", to_string(params))[jss::result]; + BEAST_EXPECT(lines[jss::error] == "invalidParams"); + BEAST_EXPECT( + lines[jss::error_message] == + "Exactly one of 'ledger_hash' or 'ledger_index' can be " + "specified."); + } + { + // Invalid index + Json::Value params; + params[jss::account] = alice.human(); + params[jss::ledger_index] = Json::objectValue; + auto const lines = env.rpc( + "json", "account_lines", to_string(params))[jss::result]; + BEAST_EXPECT(lines[jss::error] == "invalidParams"); + BEAST_EXPECT( + lines[jss::error_message] == + "Invalid field 'ledger_index', not string or number."); } { // alice should have 52 trust lines in the current ledger. @@ -839,7 +853,8 @@ public: request[jss::params] = params; auto const lines = env.rpc("json2", to_string(request)); BEAST_EXPECT( - lines[jss::error][jss::message] == "ledgerIndexMalformed"); + lines[jss::error][jss::message] == + "Invalid field 'ledger_index', not string or number."); BEAST_EXPECT( lines.isMember(jss::jsonrpc) && lines[jss::jsonrpc] == "2.0"); BEAST_EXPECT( @@ -994,8 +1009,11 @@ public: request[jss::id] = 5; request[jss::params] = params; auto const lines = env.rpc("json2", to_string(request)); - BEAST_EXPECT(lines[jss::result][jss::lines].isArray()); - BEAST_EXPECT(lines[jss::result][jss::lines].size() == 26); + BEAST_EXPECT(lines[jss::error][jss::error] == "invalidParams"); + BEAST_EXPECT( + lines[jss::error][jss::message] == + "Exactly one of 'ledger_hash' or 'ledger_index' can be " + "specified."); BEAST_EXPECT( lines.isMember(jss::jsonrpc) && lines[jss::jsonrpc] == "2.0"); BEAST_EXPECT( diff --git a/src/test/rpc/DepositAuthorized_test.cpp b/src/test/rpc/DepositAuthorized_test.cpp index b20f53592f..8ed52542d6 100644 --- a/src/test/rpc/DepositAuthorized_test.cpp +++ b/src/test/rpc/DepositAuthorized_test.cpp @@ -224,7 +224,10 @@ public: Json::Value args{depositAuthArgs(alice, becky, "-1")}; Json::Value const result{ env.rpc("json", "deposit_authorized", args.toStyledString())}; - verifyErr(result, "invalidParams", "ledgerIndexMalformed"); + verifyErr( + result, + "invalidParams", + "Invalid field 'ledger_index', not string or number."); } { // Request a ledger that doesn't exist yet as a string. diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index a0fde0f457..372f5676b0 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -477,10 +477,10 @@ class LedgerEntry_test : public beast::unit_test::suite "json", "ledger_entry", to_string(jvParams))[jss::result]; - auto const expectedErrMsg = fieldValue.isString() - ? "ledgerHashMalformed" - : "ledgerHashNotString"; - checkErrorValue(jrr, "invalidParams", expectedErrMsg); + checkErrorValue( + jrr, + "invalidParams", + "Invalid field 'ledger_hash', not hex string."); }; auto const& badValues = getBadValues(typeId); diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 57a20527d0..4a90793fa2 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -35,7 +35,10 @@ class LedgerRPC_test : public beast::unit_test::suite jv[jss::error_message] == ""); } else if (BEAST_EXPECT(jv.isMember(jss::error_message))) - BEAST_EXPECT(jv[jss::error_message] == msg); + BEAST_EXPECTS( + jv[jss::error_message] == msg, + "Expected error message \"" + msg + "\", received \"" + + jv[jss::error_message].asString() + "\""); } // Corrupt a valid address by replacing the 10th character with '!'. @@ -111,7 +114,10 @@ class LedgerRPC_test : public beast::unit_test::suite jvParams[jss::ledger_index] = "potato"; auto const jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; - checkErrorValue(jrr, "invalidParams", "ledgerIndexMalformed"); + checkErrorValue( + jrr, + "invalidParams", + "Invalid field 'ledger_index', not string or number."); } { @@ -120,7 +126,10 @@ class LedgerRPC_test : public beast::unit_test::suite jvParams[jss::ledger_index] = -1; auto const jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; - checkErrorValue(jrr, "invalidParams", "ledgerIndexMalformed"); + checkErrorValue( + jrr, + "invalidParams", + "Invalid field 'ledger_index', not string or number."); } { @@ -289,7 +298,9 @@ class LedgerRPC_test : public beast::unit_test::suite jvParams[jss::ledger] = "invalid"; jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr[jss::error] == "invalidParams"); - BEAST_EXPECT(jrr[jss::error_message] == "ledgerIndexMalformed"); + BEAST_EXPECT( + jrr[jss::error_message] == + "Invalid field 'ledger', not string or number."); // numeric index jvParams[jss::ledger] = 4; @@ -322,13 +333,17 @@ class LedgerRPC_test : public beast::unit_test::suite jvParams[jss::ledger_hash] = "DEADBEEF" + hash3; jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr[jss::error] == "invalidParams"); - BEAST_EXPECT(jrr[jss::error_message] == "ledgerHashMalformed"); + BEAST_EXPECT( + jrr[jss::error_message] == + "Invalid field 'ledger_hash', not hex string."); // request with non-string ledger_hash jvParams[jss::ledger_hash] = 2; jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr[jss::error] == "invalidParams"); - BEAST_EXPECT(jrr[jss::error_message] == "ledgerHashNotString"); + BEAST_EXPECT( + jrr[jss::error_message] == + "Invalid field 'ledger_hash', not hex string."); // malformed (non hex) hash jvParams[jss::ledger_hash] = @@ -336,7 +351,9 @@ class LedgerRPC_test : public beast::unit_test::suite "7F2775F2F7485BB37307984C3C0F2340"; jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr[jss::error] == "invalidParams"); - BEAST_EXPECT(jrr[jss::error_message] == "ledgerHashMalformed"); + BEAST_EXPECT( + jrr[jss::error_message] == + "Invalid field 'ledger_hash', not hex string."); // properly formed, but just doesn't exist jvParams[jss::ledger_hash] = @@ -374,7 +391,9 @@ class LedgerRPC_test : public beast::unit_test::suite jvParams[jss::ledger_index] = "invalid"; jrr = env.rpc("json", "ledger", to_string(jvParams))[jss::result]; BEAST_EXPECT(jrr[jss::error] == "invalidParams"); - BEAST_EXPECT(jrr[jss::error_message] == "ledgerIndexMalformed"); + BEAST_EXPECT( + jrr[jss::error_message] == + "Invalid field 'ledger_index', not string or number."); // numeric index for (auto i : {1, 2, 3, 4, 5, 6}) diff --git a/src/test/rpc/LedgerRequestRPC_test.cpp b/src/test/rpc/LedgerRequest_test.cpp similarity index 89% rename from src/test/rpc/LedgerRequestRPC_test.cpp rename to src/test/rpc/LedgerRequest_test.cpp index 0751b120aa..68d29d1901 100644 --- a/src/test/rpc/LedgerRequestRPC_test.cpp +++ b/src/test/rpc/LedgerRequest_test.cpp @@ -12,7 +12,7 @@ namespace ripple { namespace RPC { -class LedgerRequestRPC_test : public beast::unit_test::suite +class LedgerRequest_test : public beast::unit_test::suite { static constexpr char const* hash1 = "3020EB9E7BE24EF7D7A060CB051583EC117384636D1781AFB5B87F3E348DA489"; @@ -115,7 +115,7 @@ public: BEAST_EXPECT( RPC::contains_error(result[jss::result]) && result[jss::result][jss::error_message] == - "Invalid field 'ledger_hash'."); + "Invalid field 'ledger_hash', not hex string."); } { @@ -262,22 +262,43 @@ public: env.fund(XRP(100000), gw); env.close(); - Json::Value jvParams; - jvParams[jss::ledger_hash] = - "AB868A6CFEEC779C2FF845C0AF00A642259986AF40C01976A7F842B6918936C7"; - jvParams[jss::ledger_index] = "1"; - auto result = env.rpc( - "json", "ledger_request", jvParams.toStyledString())[jss::result]; - BEAST_EXPECT(result[jss::error] == "invalidParams"); - BEAST_EXPECT(result[jss::status] == "error"); - BEAST_EXPECT( - result[jss::error_message] == - "Exactly one of ledger_hash and ledger_index can be set."); + { + Json::Value jvParams; + jvParams[jss::ledger_hash] = + "AB868A6CFEEC779C2FF845C0AF00A642259986AF40C01976A7F842B6918936" + "C7"; + jvParams[jss::ledger_index] = "1"; + auto const result = env.rpc( + "json", + "ledger_request", + jvParams.toStyledString())[jss::result]; + BEAST_EXPECT(result[jss::error] == "invalidParams"); + BEAST_EXPECT(result[jss::status] == "error"); + BEAST_EXPECT( + result[jss::error_message] == + "Exactly one of 'ledger_hash' or 'ledger_index' can be " + "specified."); + } + + { + Json::Value jvParams; + jvParams[jss::ledger_index] = "index"; + auto const result = env.rpc( + "json", + "ledger_request", + jvParams.toStyledString())[jss::result]; + BEAST_EXPECT(result[jss::error] == "invalidParams"); + BEAST_EXPECT(result[jss::status] == "error"); + BEAST_EXPECT( + result[jss::error_message] == + "Invalid field 'ledger_index', not number."); + } // the purpose in this test is to force the ledger expiration/out of // date check to trigger env.timeKeeper().adjustCloseTime(weeks{3}); - result = env.rpc(apiVersion, "ledger_request", "1")[jss::result]; + auto const result = + env.rpc(apiVersion, "ledger_request", "1")[jss::result]; BEAST_EXPECT(result[jss::status] == "error"); if (apiVersion == 1) { @@ -350,13 +371,13 @@ public: testLedgerRequest(); testEvolution(); forAllApiVersions( - std::bind_front(&LedgerRequestRPC_test::testBadInput, this)); + std::bind_front(&LedgerRequest_test::testBadInput, this)); testMoreThan256Closed(); testNonAdmin(); } }; -BEAST_DEFINE_TESTSUITE(LedgerRequestRPC, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerRequest, rpc, ripple); } // namespace RPC } // namespace ripple diff --git a/src/test/rpc/NoRippleCheck_test.cpp b/src/test/rpc/NoRippleCheck_test.cpp index 81ec097181..4d9af8524f 100644 --- a/src/test/rpc/NoRippleCheck_test.cpp +++ b/src/test/rpc/NoRippleCheck_test.cpp @@ -97,7 +97,9 @@ class NoRippleCheck_test : public beast::unit_test::suite auto const result = env.rpc( "json", "noripple_check", to_string(params))[jss::result]; BEAST_EXPECT(result[jss::error] == "invalidParams"); - BEAST_EXPECT(result[jss::error_message] == "ledgerHashNotString"); + BEAST_EXPECT( + result[jss::error_message] == + "Invalid field 'ledger_hash', not hex string."); } { // account not found @@ -122,6 +124,36 @@ class NoRippleCheck_test : public beast::unit_test::suite BEAST_EXPECT(result[jss::error] == "actMalformed"); BEAST_EXPECT(result[jss::error_message] == "Account malformed."); } + + { + // ledger and ledger_hash are included + Json::Value params; + params[jss::account] = Account{"nobody"}.human(); + params[jss::role] = "user"; + params[jss::ledger] = "current"; + params[jss::ledger_hash] = "ABCDEF"; + auto const result = env.rpc( + "json", "noripple_check", to_string(params))[jss::result]; + BEAST_EXPECT(result[jss::error] == "invalidParams"); + BEAST_EXPECT( + result[jss::error_message] == + "Exactly one of 'ledger', 'ledger_hash', or 'ledger_index' can " + "be specified."); + } + + { + // invalid ledger + Json::Value params; + params[jss::account] = Account{"nobody"}.human(); + params[jss::role] = "user"; + params[jss::ledger] = Json::objectValue; + auto const result = env.rpc( + "json", "noripple_check", to_string(params))[jss::result]; + BEAST_EXPECT(result[jss::error] == "invalidParams"); + BEAST_EXPECT( + result[jss::error_message] == + "Invalid field 'ledger', not string or number."); + } } void diff --git a/src/xrpld/app/ledger/LedgerToJson.h b/src/xrpld/app/ledger/LedgerToJson.h index 6bc227ed43..cd3dcc9255 100644 --- a/src/xrpld/app/ledger/LedgerToJson.h +++ b/src/xrpld/app/ledger/LedgerToJson.h @@ -16,7 +16,7 @@ struct LedgerFill { LedgerFill( ReadView const& l, - RPC::Context* ctx, + RPC::Context const* ctx, int o = 0, std::vector q = {}) : ledger(l), options(o), txQueue(std::move(q)), context(ctx) @@ -38,7 +38,7 @@ struct LedgerFill ReadView const& ledger; int options; std::vector txQueue; - RPC::Context* context; + RPC::Context const* context; std::optional closeTime; }; diff --git a/src/xrpld/rpc/detail/Handler.cpp b/src/xrpld/rpc/detail/Handler.cpp index e05e9d0e6c..a4a1be3343 100644 --- a/src/xrpld/rpc/detail/Handler.cpp +++ b/src/xrpld/rpc/detail/Handler.cpp @@ -3,6 +3,7 @@ #include #include +#include #include diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 6d1314ff51..a9c75a05e8 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -1,6 +1,3 @@ -#include -#include -#include #include #include #include @@ -21,60 +18,6 @@ namespace ripple { namespace RPC { -std::optional -accountFromStringStrict(std::string const& account) -{ - std::optional result; - - auto const publicKey = - parseBase58(TokenType::AccountPublic, account); - - if (publicKey) - result = calcAccountID(*publicKey); - else - result = parseBase58(account); - - return result; -} - -error_code_i -accountFromStringWithCode( - AccountID& result, - std::string const& strIdent, - bool bStrict) -{ - if (auto accountID = accountFromStringStrict(strIdent)) - { - result = *accountID; - return rpcSUCCESS; - } - - if (bStrict) - return rpcACT_MALFORMED; - - // We allow the use of the seeds which is poor practice - // and merely for debugging convenience. - auto const seed = parseGenericSeed(strIdent); - - if (!seed) - return rpcBAD_SEED; - - auto const keypair = generateKeyPair(KeyType::secp256k1, *seed); - - result = calcAccountID(keypair.first); - return rpcSUCCESS; -} - -Json::Value -accountFromString(AccountID& result, std::string const& strIdent, bool bStrict) -{ - error_code_i code = accountFromStringWithCode(result, strIdent, bStrict); - if (code != rpcSUCCESS) - return rpcError(code); - else - return Json::objectValue; -} - std::uint64_t getStartHint(std::shared_ptr const& sle, AccountID const& accountID) { @@ -146,31 +89,6 @@ parseAccountIds(Json::Value const& jvArray) return result; } -void -injectSLE(Json::Value& jv, SLE const& sle) -{ - jv = sle.getJson(JsonOptions::none); - if (sle.getType() == ltACCOUNT_ROOT) - { - if (sle.isFieldPresent(sfEmailHash)) - { - auto const& hash = sle.getFieldH128(sfEmailHash); - Blob const b(hash.begin(), hash.end()); - std::string md5 = strHex(makeSlice(b)); - boost::to_lower(md5); - // VFALCO TODO Give a name and move this constant - // to a more visible location. Also - // shouldn't this be https? - jv[jss::urlgravatar] = - str(boost::format("http://www.gravatar.com/avatar/%s") % md5); - } - } - else - { - jv[jss::Invalid] = true; - } -} - std::optional readLimitField( unsigned int& limit, diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 808b975de3..3fa652d93b 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -7,65 +7,45 @@ #include #include -#include #include #include #include #include -#include - -namespace Json { -class Value; -} namespace ripple { class ReadView; -class Transaction; namespace RPC { struct JsonContext; -/** Get an AccountID from an account ID or public key. */ -std::optional -accountFromStringStrict(std::string const&); - -// --> strIdent: public key, account ID, or regular seed. -// --> bStrict: Only allow account id or public key. -// -// Returns a Json::objectValue, containing error information if there was one. -Json::Value -accountFromString( - AccountID& result, - std::string const& strIdent, - bool bStrict = false); - -/** Decode account ID from string - @param[out] result account ID decoded from string - @param strIdent public key, account ID, or regular seed. - @param bStrict Only allow account id or public key. - @return code representing error, or rpcSUCCES on success -*/ -error_code_i -accountFromStringWithCode( - AccountID& result, - std::string const& strIdent, - bool bStrict = false); - -/** Gets the start hint for traversing account objects - * @param sle - Ledger entry defined by the marker passed into the RPC. - * @param accountID - The ID of the account whose objects you are traversing. +/** + * @brief Gets the start hint for traversing account objects. + * + * This function retrieves a hint value from the specified ledger entry (SLE) + * that can be used to optimize traversal of account objects for the given + * account ID. + * + * @param sle Shared pointer to the ledger entry (SLE) defined by the marker + * passed into the RPC. + * @param accountID The ID of the account whose objects are being traversed. + * @return A 64-bit unsigned integer representing the start hint for traversal. */ std::uint64_t getStartHint(std::shared_ptr const& sle, AccountID const& accountID); /** - * Tests if a SLE is owned by accountID. - * @param ledger - The ledger used to search for the sle. - * @param sle - The SLE to test for ownership. - * @param account - The account being tested for SLE ownership. + * @brief Tests if a ledger entry (SLE) is owned by the specified account. + * + * Determines whether the given SLE is related to or owned by the provided + * account ID within the context of the specified ledger. + * + * @param ledger The ledger view used to search for the SLE. + * @param sle Shared pointer to the SLE to test for ownership. + * @param accountID The account being tested for SLE ownership. + * @return true if the SLE is owned by the account, false otherwise. */ bool isRelatedToAccount( @@ -73,52 +53,105 @@ isRelatedToAccount( std::shared_ptr const& sle, AccountID const& accountID); +/** + * @brief Parses an array of account IDs from a JSON value. + * + * 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. + */ hash_set parseAccountIds(Json::Value const& jvArray); -bool -isHexTxID(std::string const& txid); - -/** Inject JSON describing ledger entry - - Effects: - Adds the JSON description of `sle` to `jv`. - - If `sle` holds an account root, also adds the - urlgravatar field JSON if sfEmailHash is present. -*/ -void -injectSLE(Json::Value& jv, SLE const& sle); - -/** Retrieve the limit value from a JsonContext, or set a default - - then restrict the limit by max and min if not an ADMIN request. - - If there is an error, return it as JSON. -*/ +/** + * @brief Retrieves the limit value from a JsonContext or sets a default. + * + * Reads the "limit" field from the given JsonContext, applies default, minimum, + * and maximum constraints as appropriate, and returns an error as JSON if + * validation fails. + * + * @param limit Reference to the variable where the limit value will be stored. + * @param range The allowed range for the limit value. + * @param context The JSON context from which to read the limit. + * @return An optional JSON value containing an error if one occurred, or + * std::nullopt on success. + */ std::optional readLimitField( unsigned int& limit, - Tuning::LimitRange const&, - JsonContext const&); + Tuning::LimitRange const& range, + JsonContext const& context); +/** + * @brief Extracts a Seed from RPC parameters. + * + * Attempts to parse and return a Seed from the provided JSON RPC parameters. + * If parsing fails, an error is set in the provided error JSON value. + * + * @param params The JSON value containing RPC parameters. + * @param error Reference to a JSON value to be set with error information if + * parsing fails. + * @return An optional Seed if parsing is successful, or std::nullopt otherwise. + */ std::optional getSeedFromRPC(Json::Value const& params, Json::Value& error); +/** + * @brief Parses a RippleLib seed from RPC parameters. + * + * Attempts to extract and return a Seed from the provided JSON parameters using + * RippleLib conventions. + * + * @param params The JSON value containing RPC parameters. + * @return An optional Seed if parsing is successful, or std::nullopt otherwise. + */ std::optional parseRippleLibSeed(Json::Value const& params); +/** + * @brief Chooses the ledger entry type based on RPC parameters. + * + * Determines the appropriate LedgerEntryType to use based on the provided JSON + * parameters, and returns a pair containing the RPC status and the selected + * type. + * + * @param params The JSON value containing RPC parameters. + * @return A pair consisting of the RPC status and the chosen LedgerEntryType. + */ std::pair chooseLedgerEntryType(Json::Value const& params); /** - * Check if the type is a valid filtering type for account_objects method + * @brief Checks if the type is a valid filtering type for the account_objects + * method. * - * Since Amendments, DirectoryNode, FeeSettings, LedgerHashes can not be - * owned by an account, this function will return false in these situations. + * Determines whether the specified LedgerEntryType is valid for filtering in + * the account_objects RPC method. Types such as Amendments, DirectoryNode, + * FeeSettings, and LedgerHashes are not considered valid as they cannot be + * owned by an account. + * + * @param type The ledger entry type to check. + * @return true if the type is valid for account_objects filtering, false + * otherwise. */ bool isAccountObjectsValidType(LedgerEntryType const& type); +/** + * @brief Generates a keypair for signature from RPC parameters. + * + * Attempts to derive a public and secret key pair from the provided JSON RPC + * parameters. If an error occurs, it is set in the provided error JSON value. + * + * @param params The JSON value containing RPC parameters. + * @param error Reference to a JSON value to be set with error information if + * keypair generation fails. + * @param apiVersion The API version to use for keypair derivation (defaults to + * apiVersionIfUnspecified). + * @return An optional pair containing the public and secret keys if successful, + * or std::nullopt otherwise. + */ std::optional> keypairForSignature( Json::Value const& params, diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index 8ba7eeddcd..144378a1ec 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -1,22 +1,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include -#include -#include #include -#include -#include #include -#include namespace ripple { namespace RPC { @@ -34,63 +24,123 @@ isValidatedOld(LedgerMaster& ledgerMaster, bool standalone) template Status -ledgerFromRequest(T& ledger, JsonContext& context) +ledgerFromHash( + T& ledger, + Json::Value hash, + Context const& context, + Json::StaticString const fieldName) +{ + uint256 ledgerHash; + if (!ledgerHash.parseHex(hash.asString())) + return { + rpcINVALID_PARAMS, expected_field_message(fieldName, "hex string")}; + return getLedger(ledger, ledgerHash, context); +} + +template +Status +ledgerFromIndex( + T& ledger, + Json::Value indexValue, + Context const& context, + Json::StaticString const fieldName) +{ + auto const index = indexValue.asString(); + + if (index == "current" || index.empty()) + return getLedger(ledger, LedgerShortcut::Current, context); + + if (index == "validated") + return getLedger(ledger, LedgerShortcut::Validated, context); + + if (index == "closed") + return getLedger(ledger, LedgerShortcut::Closed, context); + + std::uint32_t iVal; + if (!beast::lexicalCastChecked(iVal, index)) + return { + rpcINVALID_PARAMS, + expected_field_message(fieldName, "string or number")}; + + return getLedger(ledger, iVal, context); +} + +template +Status +ledgerFromRequest(T& ledger, JsonContext const& context) { ledger.reset(); auto& params = context.params; + auto const hasLedger = context.params.isMember(jss::ledger); + auto const hasHash = context.params.isMember(jss::ledger_hash); + auto const hasIndex = context.params.isMember(jss::ledger_index); - auto indexValue = params[jss::ledger_index]; - auto hashValue = params[jss::ledger_hash]; + if ((hasLedger + hasHash + hasIndex) > 1) + { + // while `ledger` is still supported, it is deprecated + // and therefore shouldn't be mentioned in the error message + if (hasLedger) + return { + rpcINVALID_PARAMS, + "Exactly one of 'ledger', 'ledger_hash', or " + "'ledger_index' can be specified."}; + return { + rpcINVALID_PARAMS, + "Exactly one of 'ledger_hash' or " + "'ledger_index' can be specified."}; + } // We need to support the legacy "ledger" field. - auto& legacyLedger = params[jss::ledger]; - if (legacyLedger) + if (hasLedger) { - if (legacyLedger.asString().size() > 12) - hashValue = legacyLedger; + auto& legacyLedger = params[jss::ledger]; + if (!legacyLedger.isString() && !legacyLedger.isUInt() && + !legacyLedger.isInt()) + { + return { + rpcINVALID_PARAMS, + expected_field_message(jss::ledger, "string or number")}; + } + if (legacyLedger.isString() && legacyLedger.asString().size() == 64) + return ledgerFromHash(ledger, legacyLedger, context, jss::ledger); else - indexValue = legacyLedger; + return ledgerFromIndex(ledger, legacyLedger, context, jss::ledger); } - if (!hashValue.isNull()) + if (hasHash) { - if (!hashValue.isString()) - return {rpcINVALID_PARAMS, "ledgerHashNotString"}; - - uint256 ledgerHash; - if (!ledgerHash.parseHex(hashValue.asString())) - return {rpcINVALID_PARAMS, "ledgerHashMalformed"}; - return getLedger(ledger, ledgerHash, context); + auto const& ledgerHash = params[jss::ledger_hash]; + if (!ledgerHash.isString()) + return { + rpcINVALID_PARAMS, + expected_field_message(jss::ledger_hash, "hex string")}; + return ledgerFromHash(ledger, ledgerHash, context, jss::ledger_hash); } - if (!indexValue.isConvertibleTo(Json::stringValue)) - return {rpcINVALID_PARAMS, "ledgerIndexMalformed"}; + if (hasIndex) + { + auto const& ledgerIndex = params[jss::ledger_index]; + if (!ledgerIndex.isString() && !ledgerIndex.isUInt() && + !ledgerIndex.isInt()) + { + return { + rpcINVALID_PARAMS, + expected_field_message(jss::ledger_index, "string or number")}; + } + return ledgerFromIndex(ledger, ledgerIndex, context, jss::ledger_index); + } - auto const index = indexValue.asString(); - - if (index == "current" || index.empty()) - return getLedger(ledger, LedgerShortcut::CURRENT, context); - - if (index == "validated") - return getLedger(ledger, LedgerShortcut::VALIDATED, context); - - if (index == "closed") - return getLedger(ledger, LedgerShortcut::CLOSED, context); - - std::uint32_t val; - if (!beast::lexicalCastChecked(val, index)) - return {rpcINVALID_PARAMS, "ledgerIndexMalformed"}; - - return getLedger(ledger, val, context); + // nothing specified, `index` has a default setting + return getLedger(ledger, LedgerShortcut::Current, context); } } // namespace template Status -ledgerFromRequest(T& ledger, GRPCContext& context) +ledgerFromRequest(T& ledger, GRPCContext const& context) { - R& request = context.params; + R const& request = context.params; return ledgerFromSpecifier(ledger, request.ledger(), context); } @@ -98,26 +148,26 @@ ledgerFromRequest(T& ledger, GRPCContext& context) template Status ledgerFromRequest<>( std::shared_ptr&, - GRPCContext&); + GRPCContext const&); // explicit instantiation of above function template Status ledgerFromRequest<>( std::shared_ptr&, - GRPCContext&); + GRPCContext const&); // explicit instantiation of above function template Status ledgerFromRequest<>( std::shared_ptr&, - GRPCContext&); + GRPCContext const&); template Status ledgerFromSpecifier( T& ledger, org::xrpl::rpc::v1::LedgerSpecifier const& specifier, - Context& context) + Context const& context) { ledger.reset(); @@ -141,7 +191,7 @@ ledgerFromSpecifier( if (shortcut == org::xrpl::rpc::v1::LedgerSpecifier::SHORTCUT_VALIDATED) { - return getLedger(ledger, LedgerShortcut::VALIDATED, context); + return getLedger(ledger, LedgerShortcut::Validated, context); } else { @@ -151,13 +201,13 @@ ledgerFromSpecifier( org::xrpl::rpc::v1::LedgerSpecifier:: SHORTCUT_UNSPECIFIED) { - return getLedger(ledger, LedgerShortcut::CURRENT, context); + return getLedger(ledger, LedgerShortcut::Current, context); } else if ( shortcut == org::xrpl::rpc::v1::LedgerSpecifier::SHORTCUT_CLOSED) { - return getLedger(ledger, LedgerShortcut::CLOSED, context); + return getLedger(ledger, LedgerShortcut::Closed, context); } } } @@ -168,7 +218,7 @@ ledgerFromSpecifier( template Status -getLedger(T& ledger, uint256 const& ledgerHash, Context& context) +getLedger(T& ledger, uint256 const& ledgerHash, Context const& context) { ledger = context.ledgerMaster.getLedgerByHash(ledgerHash); if (ledger == nullptr) @@ -178,7 +228,7 @@ getLedger(T& ledger, uint256 const& ledgerHash, Context& context) template Status -getLedger(T& ledger, uint32_t ledgerIndex, Context& context) +getLedger(T& ledger, uint32_t ledgerIndex, Context const& context) { ledger = context.ledgerMaster.getLedgerBySeq(ledgerIndex); if (ledger == nullptr) @@ -207,7 +257,7 @@ getLedger(T& ledger, uint32_t ledgerIndex, Context& context) template Status -getLedger(T& ledger, LedgerShortcut shortcut, Context& context) +getLedger(T& ledger, LedgerShortcut shortcut, Context const& context) { if (isValidatedOld(context.ledgerMaster, context.app.config().standalone())) { @@ -216,7 +266,7 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context& context) return {rpcNOT_SYNCED, "notSynced"}; } - if (shortcut == LedgerShortcut::VALIDATED) + if (shortcut == LedgerShortcut::Validated) { ledger = context.ledgerMaster.getValidatedLedger(); if (ledger == nullptr) @@ -231,13 +281,13 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context& context) } else { - if (shortcut == LedgerShortcut::CURRENT) + if (shortcut == LedgerShortcut::Current) { ledger = context.ledgerMaster.getCurrentLedger(); XRPL_ASSERT( ledger->open(), "ripple::RPC::getLedger : current is open"); } - else if (shortcut == LedgerShortcut::CLOSED) + else if (shortcut == LedgerShortcut::Closed) { ledger = context.ledgerMaster.getClosedLedger(); XRPL_ASSERT( @@ -271,16 +321,16 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context& context) // Explicit instantiation of above three functions template Status -getLedger<>(std::shared_ptr&, uint32_t, Context&); +getLedger<>(std::shared_ptr&, uint32_t, Context const&); template Status getLedger<>( std::shared_ptr&, LedgerShortcut shortcut, - Context&); + Context const&); template Status -getLedger<>(std::shared_ptr&, uint256 const&, Context&); +getLedger<>(std::shared_ptr&, uint256 const&, Context const&); // The previous version of the lookupLedger command would accept the // "ledger_index" argument as a string and silently treat it as a request to @@ -304,7 +354,7 @@ getLedger<>(std::shared_ptr&, uint256 const&, Context&); Status lookupLedger( std::shared_ptr& ledger, - JsonContext& context, + JsonContext const& context, Json::Value& result) { if (auto status = ledgerFromRequest(ledger, context)) @@ -327,7 +377,9 @@ lookupLedger( } Json::Value -lookupLedger(std::shared_ptr& ledger, JsonContext& context) +lookupLedger( + std::shared_ptr& ledger, + JsonContext const& context) { Json::Value result; if (auto status = lookupLedger(ledger, context, result)) @@ -336,8 +388,8 @@ lookupLedger(std::shared_ptr& ledger, JsonContext& context) return result; } -std::variant, Json::Value> -getLedgerByContext(RPC::JsonContext& context) +Expected, Json::Value> +getOrAcquireLedger(RPC::JsonContext const& context) { auto const hasHash = context.params.isMember(jss::ledger_hash); auto const hasIndex = context.params.isMember(jss::ledger_index); @@ -346,42 +398,45 @@ getLedgerByContext(RPC::JsonContext& context) auto& ledgerMaster = context.app.getLedgerMaster(); LedgerHash ledgerHash; - if ((hasHash && hasIndex) || !(hasHash || hasIndex)) + if ((hasHash + hasIndex) != 1) { - return RPC::make_param_error( - "Exactly one of ledger_hash and ledger_index can be set."); + return Unexpected( + RPC::make_param_error("Exactly one of 'ledger_hash' or " + "'ledger_index' can be specified.")); } - context.loadType = Resource::feeHeavyBurdenRPC; - if (hasHash) { - auto const& jsonHash = context.params[jss::ledger_hash]; + auto const& jsonHash = + context.params.get(jss::ledger_hash, Json::nullValue); if (!jsonHash.isString() || !ledgerHash.parseHex(jsonHash.asString())) - return RPC::invalid_field_error(jss::ledger_hash); + return Unexpected( + RPC::expected_field_error(jss::ledger_hash, "hex string")); } else { - auto const& jsonIndex = context.params[jss::ledger_index]; - if (!jsonIndex.isInt()) - return RPC::invalid_field_error(jss::ledger_index); + auto const& jsonIndex = + context.params.get(jss::ledger_index, Json::nullValue); + if (!jsonIndex.isInt() && !jsonIndex.isUInt()) + return Unexpected( + RPC::expected_field_error(jss::ledger_index, "number")); // We need a validated ledger to get the hash from the sequence if (ledgerMaster.getValidatedLedgerAge() > RPC::Tuning::maxValidatedLedgerAge) { if (context.apiVersion == 1) - return rpcError(rpcNO_CURRENT); - return rpcError(rpcNOT_SYNCED); + return Unexpected(rpcError(rpcNO_CURRENT)); + return Unexpected(rpcError(rpcNOT_SYNCED)); } ledgerIndex = jsonIndex.asInt(); auto ledger = ledgerMaster.getValidatedLedger(); if (ledgerIndex >= ledger->info().seq) - return RPC::make_param_error("Ledger index too large"); + return Unexpected(RPC::make_param_error("Ledger index too large")); if (ledgerIndex <= 0) - return RPC::make_param_error("Ledger index too small"); + return Unexpected(RPC::make_param_error("Ledger index too small")); auto const j = context.app.journal("RPCHandler"); // Try to get the hash of the desired ledger from the validated @@ -395,7 +450,7 @@ getLedgerByContext(RPC::JsonContext& context) auto refHash = hashOfSeq(*ledger, refIndex, j); XRPL_ASSERT( refHash, - "ripple::RPC::getLedgerByContext : nonzero ledger hash"); + "ripple::RPC::getOrAcquireLedger : nonzero ledger hash"); ledger = ledgerMaster.getLedgerByHash(*refHash); if (!ledger) @@ -411,7 +466,7 @@ getLedgerByContext(RPC::JsonContext& context) "acquiring ledger containing requested index"); jvResult[jss::acquiring] = getJson(LedgerFill(*il, &context)); - return jvResult; + return Unexpected(jvResult); } if (auto il = context.app.getInboundLedgers().find(*refHash)) @@ -420,18 +475,18 @@ getLedgerByContext(RPC::JsonContext& context) rpcLGR_NOT_FOUND, "acquiring ledger containing requested index"); jvResult[jss::acquiring] = il->getJson(0); - return jvResult; + return Unexpected(jvResult); } // Likely the app is shutting down - return Json::Value(); + return Unexpected(Json::Value()); } neededHash = hashOfSeq(*ledger, ledgerIndex, j); } XRPL_ASSERT( neededHash, - "ripple::RPC::getLedgerByContext : nonzero needed hash"); + "ripple::RPC::getOrAcquireLedger : nonzero needed hash"); ledgerHash = neededHash ? *neededHash : beast::zero; // kludge } @@ -448,10 +503,10 @@ getLedgerByContext(RPC::JsonContext& context) return ledger; if (auto il = context.app.getInboundLedgers().find(ledgerHash)) - return il->getJson(0); + return Unexpected(il->getJson(0)); - return RPC::make_error( - rpcNOT_READY, "findCreate failed to return an inbound ledger"); + return Unexpected(RPC::make_error( + rpcNOT_READY, "findCreate failed to return an inbound ledger")); } } // namespace RPC diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index 17382d3c53..0a070a16ab 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -7,17 +7,9 @@ #include #include -#include #include -#include -#include #include -#include - -namespace Json { -class Value; -} namespace ripple { @@ -28,66 +20,159 @@ namespace RPC { struct JsonContext; -/** Get ledger by hash - If there is no error in the return value, the ledger pointer will have - been filled -*/ +enum class LedgerShortcut { Current, Closed, Validated }; + +/** + * @brief Retrieves a ledger by its hash. + * + * This function attempts to find and fill the provided ledger pointer with the + * ledger corresponding to the specified hash. If the operation is successful, + * the ledger pointer will be set; otherwise, an error status is returned. + * + * @tparam T Type of the ledger pointer to be filled. + * @param ledger Reference to the ledger pointer to be filled. + * @param ledgerHash The hash of the ledger to retrieve. + * @param context The RPC context containing request parameters and environment. + * @return Status indicating success or failure of the operation. + */ template Status -getLedger(T& ledger, uint256 const& ledgerHash, Context& context); +getLedger(T& ledger, uint256 const& ledgerHash, Context const& context); -/** Get ledger by sequence - If there is no error in the return value, the ledger pointer will have - been filled -*/ +/** + * @brief Retrieves a ledger by its sequence index. + * + * This function attempts to find and fill the provided ledger pointer with the + * ledger corresponding to the specified sequence index. If the operation is + * successful, the ledger pointer will be set; otherwise, an error status is + * returned. + * + * @tparam T Type of the ledger pointer to be filled. + * @param ledger Reference to the ledger pointer to be filled. + * @param ledgerIndex The sequence index of the ledger to retrieve. + * @param context The RPC context containing request parameters and environment. + * @return Status indicating success or failure of the operation. + */ template Status -getLedger(T& ledger, uint32_t ledgerIndex, Context& context); +getLedger(T& ledger, uint32_t ledgerIndex, Context const& context); -enum LedgerShortcut { CURRENT, CLOSED, VALIDATED }; -/** Get ledger specified in shortcut. - If there is no error in the return value, the ledger pointer will have - been filled -*/ +/** + * @brief Retrieves a ledger specified by a `LedgerShortcut`. + * + * This function attempts to find and fill the provided ledger pointer with the + * ledger corresponding to the specified shortcut. If the operation is + * successful, the ledger pointer will be set; otherwise, an error status is + * returned. + * + * @tparam T Type of the ledger pointer to be filled. + * @param ledger Reference to the ledger pointer to be filled. + * @param shortcut The shortcut specifying which ledger to retrieve. + * @param context The RPC context containing request parameters and environment. + * @return Status indicating success or failure of the operation. + */ template Status -getLedger(T& ledger, LedgerShortcut shortcut, Context& context); +getLedger(T& ledger, LedgerShortcut shortcut, Context const& context); -/** Look up a ledger from a request and fill a Json::Result with either - an error, or data representing a ledger. - - If there is no error in the return value, then the ledger pointer will have - been filled. -*/ +/** + * @brief Looks up a ledger from a request and returns a Json::Value with either + * an error or ledger data. + * + * This function attempts to find a ledger based on the parameters in the given + * JsonContext. On success, the ledger pointer is filled and a Json::Value + * representing the ledger is returned. On failure, a Json::Value describing the + * error is returned. + * + * @param ledger Reference to a shared pointer to the ledger to be filled. + * @param context The RPC JsonContext containing request parameters and + * environment. + * @return Json::Value containing either the ledger data or an error + * description. + */ Json::Value -lookupLedger(std::shared_ptr&, JsonContext&); +lookupLedger(std::shared_ptr&, JsonContext const&); -/** Look up a ledger from a request and fill a Json::Result with the data - representing a ledger. - - If the returned Status is OK, the ledger pointer will have been filled. -*/ +/** + * @brief Looks up a ledger from a request and fills a Json::Value with ledger + * data. + * + * This function attempts to find a ledger based on the parameters in the given + * JsonContext. On success, the ledger pointer is filled and the result + * parameter is populated with ledger data. On failure, an error status is + * returned. + * + * @param ledger Reference to a shared pointer to the ledger to be filled. + * @param context The RPC JsonContext containing request parameters and + * environment. + * @param result Reference to a Json::Value to be filled with ledger data. + * @return Status indicating success or failure of the operation. + */ Status lookupLedger( std::shared_ptr&, - JsonContext&, + JsonContext const&, Json::Value& result); +/** + * @brief Retrieves a ledger from a gRPC request context. + * + * This function attempts to find and fill the provided ledger pointer based on + * the parameters in the given gRPC context. On success, the ledger pointer is + * filled. + * + * @tparam T Type of the ledger pointer to be filled. + * @tparam R Type of the gRPC request. + * @param ledger Reference to the ledger pointer to be filled. + * @param context The gRPC context containing request parameters and + * environment. + * @return Status indicating success or failure of the operation. + */ template Status -ledgerFromRequest(T& ledger, GRPCContext& context); +ledgerFromRequest(T& ledger, GRPCContext const& context); +/** + * @brief Retrieves a ledger based on a LedgerSpecifier. + * + * This function attempts to find and fill the provided ledger pointer based on + * the specified LedgerSpecifier. On success, the ledger pointer is filled. + * + * @tparam T Type of the ledger pointer to be filled. + * @param ledger Reference to the ledger pointer to be filled. + * @param specifier The LedgerSpecifier describing which ledger to retrieve. + * @param context The RPC context containing request parameters and environment. + * @return Status indicating success or failure of the operation. + */ template Status ledgerFromSpecifier( T& ledger, org::xrpl::rpc::v1::LedgerSpecifier const& specifier, - Context& context); + Context const& context); -/** Return a ledger based on ledger_hash or ledger_index, - or an RPC error */ -std::variant, Json::Value> -getLedgerByContext(RPC::JsonContext& context); +/** + * @brief Retrieves or acquires a ledger based on the parameters provided in the + * given JsonContext. + * + * This function differs from the other ledger getter functions in this file in + * that it attempts to either retrieve an existing ledger or acquire it if it is + * not already available, based on the context of the RPC request. It returns an + * Expected containing either a shared pointer to the requested immutable Ledger + * object or a Json::Value describing an error. Unlike the other getLedger or + * lookupLedger functions, which typically fill a provided ledger pointer or + * result object and return a Status, this function encapsulates both the result + * and error in a single return value, making it easier to handle success and + * failure cases in a unified way. + * + * @param context The RPC JsonContext containing request parameters and + * environment. + * @return Expected, Json::Value> + * On success, contains a shared pointer to the requested Ledger. + * On failure, contains a Json::Value describing the error. + */ +Expected, Json::Value> +getOrAcquireLedger(RPC::JsonContext const& context); } // namespace RPC diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index 4a7f1d9b7d..8a42153105 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -31,10 +32,17 @@ #include #include +#include #include namespace ripple { +class Peer; +class LedgerMaster; +class Transaction; +class ValidatorKeys; +class CanonicalTXSet; + static bool isStatusRequest(http_request_type const& request) { diff --git a/src/xrpld/rpc/handlers/AMMInfo.cpp b/src/xrpld/rpc/handlers/AMMInfo.cpp index dda30fcfa7..0504adca02 100644 --- a/src/xrpld/rpc/handlers/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/AMMInfo.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -13,22 +12,6 @@ namespace ripple { -std::optional -getAccount(Json::Value const& v, Json::Value& result) -{ - std::string strIdent(v.asString()); - AccountID accountID; - - if (auto jv = RPC::accountFromString(accountID, strIdent)) - { - for (auto it = jv.begin(); it != jv.end(); ++it) - result[it.memberName()] = (*it); - - return std::nullopt; - } - return std::optional(accountID); -} - Expected getIssue(Json::Value const& v, beast::Journal j) { @@ -109,7 +92,8 @@ doAMMInfo(RPC::JsonContext& context) if (params.isMember(jss::amm_account)) { - auto const id = getAccount(params[jss::amm_account], result); + auto const id = + parseBase58((params[jss::amm_account].asString())); if (!id) return Unexpected(rpcACT_MALFORMED); auto const sle = ledger->read(keylet::account(*id)); @@ -122,7 +106,7 @@ doAMMInfo(RPC::JsonContext& context) if (params.isMember(jss::account)) { - accountID = getAccount(params[jss::account], result); + accountID = parseBase58(params[jss::account].asString()); if (!accountID || !ledger->read(keylet::account(*accountID))) return Unexpected(rpcACT_MALFORMED); } diff --git a/src/xrpld/rpc/handlers/AccountInfo.cpp b/src/xrpld/rpc/handlers/AccountInfo.cpp index e9f95d450b..1bf05276f2 100644 --- a/src/xrpld/rpc/handlers/AccountInfo.cpp +++ b/src/xrpld/rpc/handlers/AccountInfo.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -12,8 +11,47 @@ #include #include +#include + namespace ripple { +/** + * @brief Injects JSON describing a ledger entry. + * + * @param jv The JSON value to populate. + * @param sle The ledger entry to describe. + * + * @details + * Populates the provided JSON value with the description of the specified + * ledger entry. If the entry is an account root and contains an email hash, + * adds a 'urlgravatar' field with the corresponding Gravatar URL. + * If the entry is not an account root, sets the 'Invalid' field to true. + */ +void +injectSLE(Json::Value& jv, SLE const& sle) +{ + jv = sle.getJson(JsonOptions::none); + if (sle.getType() == ltACCOUNT_ROOT) + { + if (sle.isFieldPresent(sfEmailHash)) + { + auto const& hash = sle.getFieldH128(sfEmailHash); + Blob const b(hash.begin(), hash.end()); + std::string md5 = strHex(makeSlice(b)); + boost::to_lower(md5); + // VFALCO TODO Give a name and move this constant + // to a more visible location. Also + // shouldn't this be https? + jv[jss::urlgravatar] = + str(boost::format("http://www.gravatar.com/avatar/%s") % md5); + } + } + else + { + jv[jss::Invalid] = true; + } +} + // { // account: , // ledger_hash : @@ -109,7 +147,7 @@ doAccountInfo(RPC::JsonContext& context) } Json::Value jvAccepted(Json::objectValue); - RPC::injectSLE(jvAccepted, *sleAccepted); + injectSLE(jvAccepted, *sleAccepted); result[jss::account_data] = jvAccepted; Json::Value acctFlags{Json::objectValue}; diff --git a/src/xrpld/rpc/handlers/AccountObjects.cpp b/src/xrpld/rpc/handlers/AccountObjects.cpp index 82ff1782e4..669d96a44f 100644 --- a/src/xrpld/rpc/handlers/AccountObjects.cpp +++ b/src/xrpld/rpc/handlers/AccountObjects.cpp @@ -159,6 +159,15 @@ doAccountNFTs(RPC::JsonContext& context) return result; } +/** Gathers all objects for an account in a ledger. + @param ledger Ledger to search account objects. + @param account AccountID to find objects for. + @param typeFilter Gathers objects of these types. empty gathers all types. + @param dirIndex Begin gathering account objects from this directory. + @param entryIndex Begin gathering objects from this directory node. + @param limit Maximum number of objects to find. + @param jvResult A JSON result that holds the request objects. +*/ bool getAccountObjects( ReadView const& ledger, diff --git a/src/xrpld/rpc/handlers/AccountTx.cpp b/src/xrpld/rpc/handlers/AccountTx.cpp index b3f1ec65ef..e248764194 100644 --- a/src/xrpld/rpc/handlers/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/AccountTx.cpp @@ -92,11 +92,11 @@ parseLedgerArgs(RPC::Context& context, Json::Value const& params) std::string ledgerStr = params[jss::ledger_index].asString(); if (ledgerStr == "current" || ledgerStr.empty()) - ledger = LedgerShortcut::CURRENT; + ledger = LedgerShortcut::Current; else if (ledgerStr == "closed") - ledger = LedgerShortcut::CLOSED; + ledger = LedgerShortcut::Closed; else if (ledgerStr == "validated") - ledger = LedgerShortcut::VALIDATED; + ledger = LedgerShortcut::Validated; else { RPC::Status status{ diff --git a/src/xrpld/rpc/handlers/LedgerRequest.cpp b/src/xrpld/rpc/handlers/LedgerRequest.cpp index fd06ab30ba..2846bb9f08 100644 --- a/src/xrpld/rpc/handlers/LedgerRequest.cpp +++ b/src/xrpld/rpc/handlers/LedgerRequest.cpp @@ -4,8 +4,7 @@ #include #include - -#include +#include namespace ripple { @@ -16,12 +15,13 @@ namespace ripple { Json::Value doLedgerRequest(RPC::JsonContext& context) { - auto res = getLedgerByContext(context); + context.loadType = Resource::feeHeavyBurdenRPC; + auto res = RPC::getOrAcquireLedger(context); - if (std::holds_alternative(res)) - return std::get(res); + if (!res.has_value()) + return res.error(); - auto const& ledger = std::get>(res); + auto const& ledger = res.value(); Json::Value jvResult; jvResult[jss::ledger_index] = ledger->info().seq; From bff5954acf09bdbea6d89ad79c04ca6646d10b9f Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 10 Dec 2025 14:12:14 -0500 Subject: [PATCH 03/62] refactor: rename `LedgerInfo` to `LedgerHeader` (#6136) This PR renames `LedgerInfo` to `LedgerHeader`. Namely, `LedgerInfo` was already an alias for `LedgerHeader`, and the comments next to the alias suggested that it would make sense to rename it, since that makes it clearer what it is. --- include/xrpl/ledger/CachedView.h | 2 +- include/xrpl/ledger/OpenView.h | 6 +++--- include/xrpl/ledger/ReadView.h | 2 +- include/xrpl/ledger/detail/ApplyViewBase.h | 2 +- include/xrpl/protocol/LedgerHeader.h | 6 ------ src/libxrpl/ledger/ApplyViewBase.cpp | 2 +- src/libxrpl/ledger/OpenView.cpp | 2 +- src/test/app/SHAMapStore_test.cpp | 4 ++-- src/test/overlay/compression_test.cpp | 4 ++-- src/test/rpc/AccountLines_test.cpp | 16 +++++++-------- src/xrpld/app/ledger/Ledger.cpp | 16 +++++++-------- src/xrpld/app/ledger/Ledger.h | 14 ++++++------- src/xrpld/app/ledger/LedgerReplayer.h | 4 ++-- .../app/ledger/detail/LedgerDeltaAcquire.cpp | 2 +- .../app/ledger/detail/LedgerDeltaAcquire.h | 2 +- .../app/ledger/detail/LedgerReplayer.cpp | 4 ++-- src/xrpld/app/ledger/detail/LedgerToJson.cpp | 4 ++-- src/xrpld/app/rdb/RelationalDatabase.h | 6 +++--- src/xrpld/app/rdb/backend/SQLiteDatabase.h | 4 ++-- src/xrpld/app/rdb/backend/detail/Node.cpp | 14 ++++++------- src/xrpld/app/rdb/backend/detail/Node.h | 10 +++++----- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 20 +++++++++---------- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- 23 files changed, 71 insertions(+), 77 deletions(-) diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index 5e924d8bca..ad1125637b 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -47,7 +47,7 @@ public: return base_.open(); } - LedgerInfo const& + LedgerHeader const& info() const override { return base_.info(); diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index a1e9c201e8..9027f57b97 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -82,7 +82,7 @@ private: monotonic_resource_; txs_map txs_; Rules rules_; - LedgerInfo info_; + LedgerHeader info_; ReadView const* base_; detail::RawStateTable items_; std::shared_ptr hold_; @@ -158,7 +158,7 @@ public: Effects: - The LedgerInfo is copied from the base. + The LedgerHeader is copied from the base. The rules are inherited from the base. @@ -188,7 +188,7 @@ public: // ReadView - LedgerInfo const& + LedgerHeader const& info() const override; Fees const& diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index e8344ac4e2..4108b19967 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -80,7 +80,7 @@ public: } /** Returns information about the ledger. */ - virtual LedgerInfo const& + virtual LedgerHeader const& info() const = 0; /** Returns true if this reflects an open ledger. */ diff --git a/include/xrpl/ledger/detail/ApplyViewBase.h b/include/xrpl/ledger/detail/ApplyViewBase.h index e5564d1e33..7bf490cd9c 100644 --- a/include/xrpl/ledger/detail/ApplyViewBase.h +++ b/include/xrpl/ledger/detail/ApplyViewBase.h @@ -27,7 +27,7 @@ public: bool open() const override; - LedgerInfo const& + LedgerHeader const& info() const override; Fees const& diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index 69368f9e5e..80a481f7d1 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -53,12 +53,6 @@ struct LedgerHeader NetClock::time_point closeTime = {}; }; -// We call them "headers" in conversation -// but "info" in code. Unintuitive. -// This alias lets us give the "correct" name to the class -// without yet disturbing existing uses. -using LedgerInfo = LedgerHeader; - // ledger close flags static std::uint32_t const sLCF_NoConsensusTime = 0x01; diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index bb5e316669..f296c3cef2 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -16,7 +16,7 @@ ApplyViewBase::open() const return base_->open(); } -LedgerInfo const& +LedgerHeader const& ApplyViewBase::info() const { return base_->info(); diff --git a/src/libxrpl/ledger/OpenView.cpp b/src/libxrpl/ledger/OpenView.cpp index 36cde12f82..25b2ba8a0c 100644 --- a/src/libxrpl/ledger/OpenView.cpp +++ b/src/libxrpl/ledger/OpenView.cpp @@ -115,7 +115,7 @@ OpenView::apply(TxsRawView& to) const //--- -LedgerInfo const& +LedgerHeader const& OpenView::info() const { return info_; diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index e472685ec0..8ec5a6fd23 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -49,11 +49,11 @@ class SHAMapStore_test : public beast::unit_test::suite auto const seq = json[jss::result][jss::ledger_index].asUInt(); - std::optional oinfo = + std::optional oinfo = env.app().getRelationalDatabase().getLedgerInfoByIndex(seq); if (!oinfo) return false; - LedgerInfo const& info = oinfo.value(); + LedgerHeader const& info = oinfo.value(); std::string const outHash = to_string(info.hash); LedgerIndex const outSeq = info.seq; diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 4cee6f8034..4e001115d1 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -38,7 +38,7 @@ using namespace ripple::test; using namespace ripple::test::jtx; static uint256 -ledgerHash(LedgerInfo const& info) +ledgerHash(LedgerHeader const& info) { return ripple::sha512Half( HashPrefix::ledgerMaster, @@ -252,7 +252,7 @@ public: for (int i = 0; i < n; i++) { - LedgerInfo info; + LedgerHeader info; info.seq = i; info.parentCloseTime = ct; info.hash = ripple::sha512Half(i); diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index e062959769..2bc6c38779 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -68,7 +68,7 @@ public: } env.fund(XRP(10000), alice); env.close(); - LedgerInfo const ledger3Info = env.closed()->info(); + LedgerHeader const ledger3Info = env.closed()->info(); BEAST_EXPECT(ledger3Info.seq == 3); { @@ -118,7 +118,7 @@ public: env(pay(gw1, alice, gw1Currency(50 + c))); } env.close(); - LedgerInfo const ledger4Info = env.closed()->info(); + LedgerHeader const ledger4Info = env.closed()->info(); BEAST_EXPECT(ledger4Info.seq == 4); // Add another set of trust lines in another ledger so we can see @@ -153,13 +153,13 @@ public: tfSetNoRipple | tfSetFreeze | tfSetDeepFreeze)); } env.close(); - LedgerInfo const ledger58Info = env.closed()->info(); + LedgerHeader const ledger58Info = env.closed()->info(); BEAST_EXPECT(ledger58Info.seq == 58); // A re-usable test for historic ledgers. auto testAccountLinesHistory = [this, &env]( Account const& account, - LedgerInfo const& info, + LedgerHeader const& info, int count) { // Get account_lines by ledger index. Json::Value paramsSeq; @@ -817,7 +817,7 @@ public: } env.fund(XRP(10000), alice); env.close(); - LedgerInfo const ledger3Info = env.closed()->info(); + LedgerHeader const ledger3Info = env.closed()->info(); BEAST_EXPECT(ledger3Info.seq == 3); { @@ -899,7 +899,7 @@ public: env(pay(gw1, alice, gw1Currency(50 + c))); } env.close(); - LedgerInfo const ledger4Info = env.closed()->info(); + LedgerHeader const ledger4Info = env.closed()->info(); BEAST_EXPECT(ledger4Info.seq == 4); // Add another set of trust lines in another ledger so we can see @@ -934,13 +934,13 @@ public: tfSetNoRipple | tfSetFreeze | tfSetDeepFreeze)); } env.close(); - LedgerInfo const ledger58Info = env.closed()->info(); + LedgerHeader const ledger58Info = env.closed()->info(); BEAST_EXPECT(ledger58Info.seq == 58); // A re-usable test for historic ledgers. auto testAccountLinesHistory = [this, &env]( Account const& account, - LedgerInfo const& info, + LedgerHeader const& info, int count) { // Get account_lines by ledger index. Json::Value paramsSeq; diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 6bf3170f18..aaf71b2dc3 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -32,7 +32,7 @@ namespace ripple { create_genesis_t const create_genesis{}; uint256 -calculateLedgerHash(LedgerInfo const& info) +calculateLedgerHash(LedgerHeader const& info) { // VFALCO This has to match addRaw in View.h. return sha512Half( @@ -210,7 +210,7 @@ Ledger::Ledger( } Ledger::Ledger( - LedgerInfo const& info, + LedgerHeader const& info, bool& loaded, bool acquire, Config const& config, @@ -285,7 +285,7 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime) } } -Ledger::Ledger(LedgerInfo const& info, Config const& config, Family& family) +Ledger::Ledger(LedgerHeader const& info, Config const& config, Family& family) : mImmutable(true) , txMap_(SHAMapType::TRANSACTION, info.txHash, family) , stateMap_(SHAMapType::STATE, info.accountHash, family) @@ -1042,13 +1042,13 @@ Ledger::invariants() const /* * Make ledger using info loaded from database. * - * @param LedgerInfo: Ledger information. + * @param LedgerHeader: Ledger information. * @param app: Link to the Application. * @param acquire: Acquire the ledger if not found locally. * @return Shared pointer to the ledger. */ std::shared_ptr -loadLedgerHelper(LedgerInfo const& info, Application& app, bool acquire) +loadLedgerHelper(LedgerHeader const& info, Application& app, bool acquire) { bool loaded; auto ledger = std::make_shared( @@ -1088,7 +1088,7 @@ finishLoadByIndexOrHash( std::tuple, std::uint32_t, uint256> getLatestLedger(Application& app) { - std::optional const info = + std::optional const info = app.getRelationalDatabase().getNewestLedgerInfo(); if (!info) return {std::shared_ptr(), {}, {}}; @@ -1098,7 +1098,7 @@ getLatestLedger(Application& app) std::shared_ptr loadByIndex(std::uint32_t ledgerIndex, Application& app, bool acquire) { - if (std::optional info = + if (std::optional info = app.getRelationalDatabase().getLedgerInfoByIndex(ledgerIndex)) { std::shared_ptr ledger = loadLedgerHelper(*info, app, acquire); @@ -1111,7 +1111,7 @@ loadByIndex(std::uint32_t ledgerIndex, Application& app, bool acquire) std::shared_ptr loadByHash(uint256 const& ledgerHash, Application& app, bool acquire) { - if (std::optional info = + if (std::optional info = app.getRelationalDatabase().getLedgerInfoByHash(ledgerHash)) { std::shared_ptr ledger = loadLedgerHelper(*info, app, acquire); diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index 30bedc0447..cc3bc43c50 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -88,14 +88,14 @@ public: std::vector const& amendments, Family& family); - Ledger(LedgerInfo const& info, Config const& config, Family& family); + Ledger(LedgerHeader const& info, Config const& config, Family& family); /** Used for ledgers loaded from JSON files @param acquire If true, acquires the ledger if not found locally */ Ledger( - LedgerInfo const& info, + LedgerHeader const& info, bool& loaded, bool acquire, Config const& config, @@ -129,14 +129,14 @@ public: return false; } - LedgerInfo const& + LedgerHeader const& info() const override { return info_; } void - setLedgerInfo(LedgerInfo const& info) + setLedgerInfo(LedgerHeader const& info) { info_ = info; } @@ -397,7 +397,7 @@ private: Fees fees_; Rules rules_; - LedgerInfo info_; + LedgerHeader info_; beast::Journal j_; }; @@ -423,7 +423,7 @@ pendSaveValidated( bool isCurrent); std::shared_ptr -loadLedgerHelper(LedgerInfo const& sinfo, Application& app, bool acquire); +loadLedgerHelper(LedgerHeader const& sinfo, Application& app, bool acquire); std::shared_ptr loadByIndex(std::uint32_t ledgerIndex, Application& app, bool acquire = true); @@ -457,7 +457,7 @@ std::pair, std::shared_ptr> deserializeTxPlusMeta(SHAMapItem const& item); uint256 -calculateLedgerHash(LedgerInfo const& info); +calculateLedgerHash(LedgerHeader const& info); } // namespace ripple diff --git a/src/xrpld/app/ledger/LedgerReplayer.h b/src/xrpld/app/ledger/LedgerReplayer.h index b05d92d05d..68a1c0da1d 100644 --- a/src/xrpld/app/ledger/LedgerReplayer.h +++ b/src/xrpld/app/ledger/LedgerReplayer.h @@ -85,7 +85,7 @@ public: */ void gotSkipList( - LedgerInfo const& info, + LedgerHeader const& info, boost::intrusive_ptr const& data); /** @@ -96,7 +96,7 @@ public: */ void gotReplayDelta( - LedgerInfo const& info, + LedgerHeader const& info, std::map>&& txns); /** Remove completed tasks */ diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index 4a91c597d5..91b1dca5e2 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -118,7 +118,7 @@ LedgerDeltaAcquire::pmDowncast() void LedgerDeltaAcquire::processData( - LedgerInfo const& info, + LedgerHeader const& info, std::map>&& orderedTxns) { ScopedLockType sl(mtx_); diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h index ece0ba44d5..a2c300c546 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h @@ -69,7 +69,7 @@ public: */ void processData( - LedgerInfo const& info, + LedgerHeader const& info, std::map>&& orderedTxns); /** diff --git a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp index 04a3d21b8f..1f89b6c044 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp @@ -152,7 +152,7 @@ LedgerReplayer::createDeltas(std::shared_ptr task) void LedgerReplayer::gotSkipList( - LedgerInfo const& info, + LedgerHeader const& info, boost::intrusive_ptr const& item) { std::shared_ptr skipList = {}; @@ -175,7 +175,7 @@ LedgerReplayer::gotSkipList( void LedgerReplayer::gotReplayDelta( - LedgerInfo const& info, + LedgerHeader const& info, std::map>&& txns) { std::shared_ptr delta = {}; diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index 85eb3feaf1..7e8ff9e541 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -37,7 +37,7 @@ void fillJson( Object& json, bool closed, - LedgerInfo const& info, + LedgerHeader const& info, bool bFull, unsigned apiVersion) { @@ -80,7 +80,7 @@ fillJson( template void -fillJsonBinary(Object& json, bool closed, LedgerInfo const& info) +fillJsonBinary(Object& json, bool closed, LedgerHeader const& info) { if (!closed) json[jss::closed] = false; diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index 18a5536cf6..102479544b 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -127,14 +127,14 @@ public: * @param ledgerSeq Ledger sequence. * @return The ledger if found, otherwise no value. */ - virtual std::optional + virtual std::optional getLedgerInfoByIndex(LedgerIndex ledgerSeq) = 0; /** * @brief getNewestLedgerInfo Returns the info of the newest saved ledger. * @return Ledger info if found, otherwise no value. */ - virtual std::optional + virtual std::optional getNewestLedgerInfo() = 0; /** @@ -143,7 +143,7 @@ public: * @param ledgerHash Hash of the ledger. * @return Ledger if found, otherwise no value. */ - virtual std::optional + virtual std::optional getLedgerInfoByHash(uint256 const& ledgerHash) = 0; /** diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index 4ebcb4390e..cf668137ea 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -100,7 +100,7 @@ public: * @param ledgerFirstIndex Minimum ledger sequence. * @return Ledger info if found, otherwise no value. */ - virtual std::optional + virtual std::optional getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; /** @@ -110,7 +110,7 @@ public: * @param ledgerFirstIndex Minimum ledger sequence. * @return Ledger info if found, otherwise no value. */ - virtual std::optional + virtual std::optional getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0; /** diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 04f328390d..a7b35a5305 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -391,7 +391,7 @@ saveValidatedLedger( * @param j Journal. * @return Ledger info or no value if the ledger was not found. */ -static std::optional +static std::optional getLedgerInfo( soci::session& session, std::string const& sqlSuffix, @@ -425,7 +425,7 @@ getLedgerInfo( using time_point = NetClock::time_point; using duration = NetClock::duration; - LedgerInfo info; + LedgerHeader info; if (hash && !info.hash.parseHex(*hash)) { @@ -461,7 +461,7 @@ getLedgerInfo( return info; } -std::optional +std::optional getLedgerInfoByIndex( soci::session& session, LedgerIndex ledgerSeq, @@ -472,7 +472,7 @@ getLedgerInfoByIndex( return getLedgerInfo(session, s.str(), j); } -std::optional +std::optional getNewestLedgerInfo(soci::session& session, beast::Journal j) { std::ostringstream s; @@ -480,7 +480,7 @@ getNewestLedgerInfo(soci::session& session, beast::Journal j) return getLedgerInfo(session, s.str(), j); } -std::optional +std::optional getLimitedOldestLedgerInfo( soci::session& session, LedgerIndex ledgerFirstIndex, @@ -492,7 +492,7 @@ getLimitedOldestLedgerInfo( return getLedgerInfo(session, s.str(), j); } -std::optional +std::optional getLimitedNewestLedgerInfo( soci::session& session, LedgerIndex ledgerFirstIndex, @@ -504,7 +504,7 @@ getLimitedNewestLedgerInfo( return getLedgerInfo(session, s.str(), j); } -std::optional +std::optional getLedgerInfoByHash( soci::session& session, uint256 const& ledgerHash, diff --git a/src/xrpld/app/rdb/backend/detail/Node.h b/src/xrpld/app/rdb/backend/detail/Node.h index 2c0fd69445..fbf06083d6 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.h +++ b/src/xrpld/app/rdb/backend/detail/Node.h @@ -123,7 +123,7 @@ saveValidatedLedger( * @param j Journal. * @return Ledger or none if ledger not found. */ -std::optional +std::optional getLedgerInfoByIndex( soci::session& session, LedgerIndex ledgerSeq, @@ -135,7 +135,7 @@ getLedgerInfoByIndex( * @param j Journal. * @return Ledger info or none if ledger not found. */ -std::optional +std::optional getNewestLedgerInfo(soci::session& session, beast::Journal j); /** @@ -146,7 +146,7 @@ getNewestLedgerInfo(soci::session& session, beast::Journal j); * @param j Journal. * @return Ledger info or none if ledger not found. */ -std::optional +std::optional getLimitedOldestLedgerInfo( soci::session& session, LedgerIndex ledgerFirstIndex, @@ -160,7 +160,7 @@ getLimitedOldestLedgerInfo( * @param j Journal. * @return Ledger info or none if ledger not found. */ -std::optional +std::optional getLimitedNewestLedgerInfo( soci::session& session, LedgerIndex ledgerFirstIndex, @@ -173,7 +173,7 @@ getLimitedNewestLedgerInfo( * @param j Journal. * @return Ledger or none if ledger not found. */ -std::optional +std::optional getLedgerInfoByHash( soci::session& session, uint256 const& ledgerHash, diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 944ed814f5..b789685211 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -73,19 +73,19 @@ public: std::shared_ptr const& ledger, bool current) override; - std::optional + std::optional getLedgerInfoByIndex(LedgerIndex ledgerSeq) override; - std::optional + std::optional getNewestLedgerInfo() override; - std::optional + std::optional getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) override; - std::optional + std::optional getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) override; - std::optional + std::optional getLedgerInfoByHash(uint256 const& ledgerHash) override; uint256 @@ -399,7 +399,7 @@ SQLiteDatabaseImp::saveValidatedLedger( return true; } -std::optional +std::optional SQLiteDatabaseImp::getLedgerInfoByIndex(LedgerIndex ledgerSeq) { if (existsLedger()) @@ -414,7 +414,7 @@ SQLiteDatabaseImp::getLedgerInfoByIndex(LedgerIndex ledgerSeq) return {}; } -std::optional +std::optional SQLiteDatabaseImp::getNewestLedgerInfo() { if (existsLedger()) @@ -429,7 +429,7 @@ SQLiteDatabaseImp::getNewestLedgerInfo() return {}; } -std::optional +std::optional SQLiteDatabaseImp::getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) { if (existsLedger()) @@ -445,7 +445,7 @@ SQLiteDatabaseImp::getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) return {}; } -std::optional +std::optional SQLiteDatabaseImp::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) { if (existsLedger()) @@ -461,7 +461,7 @@ SQLiteDatabaseImp::getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) return {}; } -std::optional +std::optional SQLiteDatabaseImp::getLedgerInfoByHash(uint256 const& ledgerHash) { if (existsLedger()) diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 0a973a9218..1a0995442b 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -3227,7 +3227,7 @@ PeerImp::sendLedgerBase( { JLOG(p_journal_.trace()) << "sendLedgerBase: Base data"; - Serializer s(sizeof(LedgerInfo)); + Serializer s(sizeof(LedgerHeader)); addRaw(ledger->info(), s); ledgerData.add_nodes()->set_nodedata(s.getDataPtr(), s.getLength()); From 62efecbfb11bf5892c679692be8e98a6a45d92e8 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 10 Dec 2025 16:04:37 -0500 Subject: [PATCH 04/62] refactor: rename info() to header() (#6138) This change renames all the `info()` functions to `header()`, since they return `LedgerHeader` structs. It also renames the underlying variables from `info_` to `header_`. --- include/xrpl/ledger/CachedView.h | 4 +- include/xrpl/ledger/OpenView.h | 4 +- include/xrpl/ledger/ReadView.h | 6 +- include/xrpl/ledger/detail/ApplyViewBase.h | 2 +- src/libxrpl/ledger/ApplyViewBase.cpp | 4 +- src/libxrpl/ledger/CredentialHelpers.cpp | 4 +- src/libxrpl/ledger/OpenView.cpp | 22 +-- src/libxrpl/ledger/View.cpp | 43 ++--- src/test/app/AMM_test.cpp | 2 +- src/test/app/AccountDelete_test.cpp | 2 +- src/test/app/Credentials_test.cpp | 8 +- src/test/app/DepositAuth_test.cpp | 8 +- src/test/app/LedgerHistory_test.cpp | 6 +- src/test/app/LedgerMaster_test.cpp | 4 +- src/test/app/LedgerReplay_test.cpp | 50 ++--- src/test/app/Loan_test.cpp | 4 +- src/test/app/NFToken_test.cpp | 5 +- src/test/app/NetworkID_test.cpp | 2 +- src/test/app/Offer_test.cpp | 5 +- src/test/app/Oracle_test.cpp | 6 +- src/test/app/PayChan_test.cpp | 16 +- src/test/app/PermissionedDEX_test.cpp | 4 +- src/test/app/RCLValidations_test.cpp | 4 +- src/test/app/Regression_test.cpp | 6 +- src/test/app/TxQ_test.cpp | 12 +- src/test/app/Vault_test.cpp | 2 +- src/test/consensus/NegativeUNL_test.cpp | 4 +- src/test/jtx/impl/Env.cpp | 7 +- src/test/jtx/impl/Oracle.cpp | 2 +- src/test/ledger/Directory_test.cpp | 2 +- src/test/ledger/SkipList_test.cpp | 29 +-- src/test/ledger/View_test.cpp | 4 +- src/test/rpc/AccountLines_test.cpp | 12 +- src/test/rpc/AccountTx_test.cpp | 24 +-- src/test/rpc/DepositAuthorized_test.cpp | 2 +- src/test/rpc/LedgerData_test.cpp | 2 +- src/test/rpc/LedgerEntry_test.cpp | 29 +-- src/test/rpc/LedgerRPC_test.cpp | 18 +- src/test/rpc/LedgerRequest_test.cpp | 2 +- src/test/rpc/Simulate_test.cpp | 2 +- src/test/rpc/Subscribe_test.cpp | 8 +- src/test/rpc/Transaction_test.cpp | 16 +- src/test/server/ServerStatus_test.cpp | 4 +- src/xrpld/app/consensus/RCLConsensus.cpp | 22 +-- src/xrpld/app/consensus/RCLCxLedger.h | 14 +- src/xrpld/app/consensus/RCLValidations.cpp | 4 +- src/xrpld/app/ledger/Ledger.cpp | 131 +++++++------- src/xrpld/app/ledger/Ledger.h | 18 +- src/xrpld/app/ledger/LedgerHistory.cpp | 36 ++-- src/xrpld/app/ledger/detail/BuildLedger.cpp | 10 +- src/xrpld/app/ledger/detail/InboundLedger.cpp | 53 +++--- src/xrpld/app/ledger/detail/LedgerCleaner.cpp | 14 +- .../app/ledger/detail/LedgerDeltaAcquire.cpp | 6 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 171 +++++++++--------- .../ledger/detail/LedgerReplayMsgHandler.cpp | 4 +- .../app/ledger/detail/LedgerReplayTask.cpp | 4 +- src/xrpld/app/ledger/detail/LedgerToJson.cpp | 6 +- src/xrpld/app/ledger/detail/LocalTxs.cpp | 2 +- src/xrpld/app/main/Application.cpp | 26 +-- src/xrpld/app/misc/FeeVoteImpl.cpp | 2 +- src/xrpld/app/misc/NegativeUNLVote.cpp | 10 +- src/xrpld/app/misc/NetworkOPs.cpp | 84 +++++---- src/xrpld/app/misc/PermissionedDEXHelpers.cpp | 2 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 2 +- src/xrpld/app/misc/detail/AMMUtils.cpp | 9 +- src/xrpld/app/misc/detail/TxQ.cpp | 11 +- src/xrpld/app/paths/PathRequest.cpp | 2 +- src/xrpld/app/paths/RippleLineCache.cpp | 6 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 39 ++-- src/xrpld/app/tx/detail/AMMBid.cpp | 2 +- src/xrpld/app/tx/detail/Credentials.cpp | 6 +- src/xrpld/app/tx/detail/Escrow.cpp | 6 +- src/xrpld/app/tx/detail/LoanSet.cpp | 2 +- src/xrpld/app/tx/detail/PayChan.cpp | 10 +- src/xrpld/app/tx/detail/SetOracle.cpp | 2 +- src/xrpld/overlay/detail/Handshake.cpp | 4 +- src/xrpld/overlay/detail/PeerImp.cpp | 10 +- src/xrpld/rpc/BookChanges.h | 8 +- src/xrpld/rpc/detail/DeliveredAmount.cpp | 2 +- src/xrpld/rpc/detail/RPCLedgerHelpers.cpp | 10 +- src/xrpld/rpc/handlers/AMMInfo.cpp | 4 +- src/xrpld/rpc/handlers/AccountTx.cpp | 7 +- src/xrpld/rpc/handlers/CanDelete.cpp | 2 +- src/xrpld/rpc/handlers/DepositAuthorized.cpp | 2 +- src/xrpld/rpc/handlers/LedgerClosed.cpp | 4 +- src/xrpld/rpc/handlers/LedgerData.cpp | 4 +- src/xrpld/rpc/handlers/LedgerHandler.cpp | 4 +- src/xrpld/rpc/handlers/LedgerHeader.cpp | 2 +- src/xrpld/rpc/handlers/LedgerRequest.cpp | 2 +- src/xrpld/rpc/handlers/Tx.cpp | 8 +- 90 files changed, 609 insertions(+), 582 deletions(-) diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index ad1125637b..b78c046f58 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -48,9 +48,9 @@ public: } LedgerHeader const& - info() const override + header() const override { - return base_.info(); + return base_.header(); } Fees const& diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index 9027f57b97..2b4bd8a31f 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -82,7 +82,7 @@ private: monotonic_resource_; txs_map txs_; Rules rules_; - LedgerHeader info_; + LedgerHeader header_; ReadView const* base_; detail::RawStateTable items_; std::shared_ptr hold_; @@ -189,7 +189,7 @@ public: // ReadView LedgerHeader const& - info() const override; + header() const override; Fees const& fees() const override; diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index 4108b19967..70a5fbc006 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -81,7 +81,7 @@ public: /** Returns information about the ledger. */ virtual LedgerHeader const& - info() const = 0; + header() const = 0; /** Returns true if this reflects an open ledger. */ virtual bool @@ -91,14 +91,14 @@ public: NetClock::time_point parentCloseTime() const { - return info().parentCloseTime; + return header().parentCloseTime; } /** Returns the sequence number of the base ledger. */ LedgerIndex seq() const { - return info().seq; + return header().seq; } /** Returns the fees for the base ledger. */ diff --git a/include/xrpl/ledger/detail/ApplyViewBase.h b/include/xrpl/ledger/detail/ApplyViewBase.h index 7bf490cd9c..a75f94ac16 100644 --- a/include/xrpl/ledger/detail/ApplyViewBase.h +++ b/include/xrpl/ledger/detail/ApplyViewBase.h @@ -28,7 +28,7 @@ public: open() const override; LedgerHeader const& - info() const override; + header() const override; Fees const& fees() const override; diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index f296c3cef2..554822acda 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -17,9 +17,9 @@ ApplyViewBase::open() const } LedgerHeader const& -ApplyViewBase::info() const +ApplyViewBase::header() const { - return base_->info(); + return base_->header(); } Fees const& diff --git a/src/libxrpl/ledger/CredentialHelpers.cpp b/src/libxrpl/ledger/CredentialHelpers.cpp index cbca7eb192..aea783b676 100644 --- a/src/libxrpl/ledger/CredentialHelpers.cpp +++ b/src/libxrpl/ledger/CredentialHelpers.cpp @@ -22,7 +22,7 @@ checkExpired( bool removeExpired(ApplyView& view, STVector256 const& arr, beast::Journal const j) { - auto const closeTime = view.info().parentCloseTime; + auto const closeTime = view.header().parentCloseTime; bool foundExpired = false; for (auto const& h : arr) @@ -181,7 +181,7 @@ validDomain(ReadView const& view, uint256 domainID, AccountID const& subject) if (!slePD) return tecOBJECT_NOT_FOUND; - auto const closeTime = view.info().parentCloseTime; + auto const closeTime = view.header().parentCloseTime; bool foundExpired = false; for (auto const& h : slePD->getFieldArray(sfAcceptedCredentials)) { diff --git a/src/libxrpl/ledger/OpenView.cpp b/src/libxrpl/ledger/OpenView.cpp index 25b2ba8a0c..8ddb11abd0 100644 --- a/src/libxrpl/ledger/OpenView.cpp +++ b/src/libxrpl/ledger/OpenView.cpp @@ -61,7 +61,7 @@ OpenView::OpenView(OpenView const& rhs) boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)} , txs_{rhs.txs_, monotonic_resource_.get()} , rules_{rhs.rules_} - , info_{rhs.info_} + , header_{rhs.header_} , base_{rhs.base_} , items_{rhs.items_} , hold_{rhs.hold_} @@ -76,15 +76,15 @@ OpenView::OpenView( boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)} , txs_{monotonic_resource_.get()} , rules_(rules) - , info_(base->info()) + , header_(base->header()) , base_(base) , hold_(std::move(hold)) { - info_.validated = false; - info_.accepted = false; - info_.seq = base_->info().seq + 1; - info_.parentCloseTime = base_->info().closeTime; - info_.parentHash = base_->info().hash; + header_.validated = false; + header_.accepted = false; + header_.seq = base_->header().seq + 1; + header_.parentCloseTime = base_->header().closeTime; + header_.parentHash = base_->header().hash; } OpenView::OpenView(ReadView const* base, std::shared_ptr hold) @@ -92,7 +92,7 @@ OpenView::OpenView(ReadView const* base, std::shared_ptr hold) boost::container::pmr::monotonic_buffer_resource>(initialBufferSize)} , txs_{monotonic_resource_.get()} , rules_(base->rules()) - , info_(base->info()) + , header_(base->header()) , base_(base) , hold_(std::move(hold)) , open_(base->open()) @@ -116,9 +116,9 @@ OpenView::apply(TxsRawView& to) const //--- LedgerHeader const& -OpenView::info() const +OpenView::header() const { - return info_; + return header_; } Fees const& @@ -230,7 +230,7 @@ void OpenView::rawDestroyXRP(XRPAmount const& fee) { items_.destroyXRP(fee); - // VFALCO Deduct from info_.totalDrops ? + // VFALCO Deduct from header_.totalDrops ? // What about child views? } diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index 33c6cf69ec..d5297479e8 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -907,14 +907,14 @@ areCompatible( { bool ret = true; - if (validLedger.info().seq < testLedger.info().seq) + if (validLedger.header().seq < testLedger.header().seq) { // valid -> ... -> test auto hash = hashOfSeq( testLedger, - validLedger.info().seq, + validLedger.header().seq, beast::Journal{beast::Journal::getNullSink()}); - if (hash && (*hash != validLedger.info().hash)) + if (hash && (*hash != validLedger.header().hash)) { JLOG(s) << reason << " incompatible with valid ledger"; @@ -923,14 +923,14 @@ areCompatible( ret = false; } } - else if (validLedger.info().seq > testLedger.info().seq) + else if (validLedger.header().seq > testLedger.header().seq) { // test -> ... -> valid auto hash = hashOfSeq( validLedger, - testLedger.info().seq, + testLedger.header().seq, beast::Journal{beast::Journal::getNullSink()}); - if (hash && (*hash != testLedger.info().hash)) + if (hash && (*hash != testLedger.header().hash)) { JLOG(s) << reason << " incompatible preceding ledger"; @@ -940,8 +940,8 @@ areCompatible( } } else if ( - (validLedger.info().seq == testLedger.info().seq) && - (validLedger.info().hash != testLedger.info().hash)) + (validLedger.header().seq == testLedger.header().seq) && + (validLedger.header().hash != testLedger.header().hash)) { // Same sequence number, different hash JLOG(s) << reason << " incompatible ledger"; @@ -951,11 +951,11 @@ areCompatible( if (!ret) { - JLOG(s) << "Val: " << validLedger.info().seq << " " - << to_string(validLedger.info().hash); + JLOG(s) << "Val: " << validLedger.header().seq << " " + << to_string(validLedger.header().hash); - JLOG(s) << "New: " << testLedger.info().seq << " " - << to_string(testLedger.info().hash); + JLOG(s) << "New: " << testLedger.header().seq << " " + << to_string(testLedger.header().hash); } return ret; @@ -971,7 +971,7 @@ areCompatible( { bool ret = true; - if (testLedger.info().seq > validIndex) + if (testLedger.header().seq > validIndex) { // Ledger we are testing follows last valid ledger auto hash = hashOfSeq( @@ -987,8 +987,8 @@ areCompatible( } } else if ( - (validIndex == testLedger.info().seq) && - (testLedger.info().hash != validHash)) + (validIndex == testLedger.header().seq) && + (testLedger.header().hash != validHash)) { JLOG(s) << reason << " incompatible ledger"; @@ -999,8 +999,8 @@ areCompatible( { JLOG(s) << "Val: " << validIndex << " " << to_string(validHash); - JLOG(s) << "New: " << testLedger.info().seq << " " - << to_string(testLedger.info().hash); + JLOG(s) << "New: " << testLedger.header().seq << " " + << to_string(testLedger.header().hash); } return ret; @@ -1071,9 +1071,9 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal) return std::nullopt; } if (seq == ledger.seq()) - return ledger.info().hash; + return ledger.header().hash; if (seq == (ledger.seq() - 1)) - return ledger.info().parentHash; + return ledger.header().parentHash; if (int diff = ledger.seq() - seq; diff <= 256) { @@ -1095,7 +1095,7 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal) else { JLOG(journal.warn()) - << "Ledger " << ledger.seq() << ":" << ledger.info().hash + << "Ledger " << ledger.seq() << ":" << ledger.header().hash << " missing normal list"; } } @@ -1180,7 +1180,8 @@ pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey) for (std::uint16_t i = 0; i < maxAccountAttempts; ++i) { ripesha_hasher rsh; - auto const hash = sha512Half(i, view.info().parentHash, pseudoOwnerKey); + auto const hash = + sha512Half(i, view.header().parentHash, pseudoOwnerKey); rsh(hash.data(), hash.size()); AccountID const ret{static_cast(rsh)}; if (!view.read(keylet::account(ret))) diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 5a1816ebae..611932e825 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -3646,7 +3646,7 @@ private: auto const pk = carol.pk(); auto const settleDelay = 100s; NetClock::time_point const cancelAfter = - env.current()->info().parentCloseTime + 200s; + env.current()->header().parentCloseTime + 200s; env(paychan::create( carol, ammAlice.ammAccount(), diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index f22f9c4165..91164d3e4e 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -922,7 +922,7 @@ public: auto jv = credentials::create(john, carol, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 20; diff --git a/src/test/app/Credentials_test.cpp b/src/test/app/Credentials_test.cpp index fd4a7f41a6..c4a5ee1c7c 100644 --- a/src/test/app/Credentials_test.cpp +++ b/src/test/app/Credentials_test.cpp @@ -336,7 +336,7 @@ struct Credentials_test : public beast::unit_test::suite auto const credKey = credentials::keylet(subject, issuer, credType); auto jv = credentials::create(subject, issuer, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count(); jv[sfExpiration.jsonName] = t + 20; @@ -498,7 +498,7 @@ struct Credentials_test : public beast::unit_test::suite auto jv = credentials::create(subject, issuer, credType); // current time in ripple epoch - 1s uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() - 1; @@ -725,7 +725,7 @@ struct Credentials_test : public beast::unit_test::suite testcase("CredentialsAccept fail, expired credentials."); auto jv = credentials::create(subject, issuer, credType2); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count(); jv[sfExpiration.jsonName] = t; @@ -870,7 +870,7 @@ struct Credentials_test : public beast::unit_test::suite auto jv = credentials::create(subject, issuer, credType); // current time in ripple epoch + 1000s uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 1000; diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index 54d5dd6254..ed727c2fa0 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -1107,7 +1107,7 @@ struct DepositPreauth_test : public beast::unit_test::suite // Current time in ripple epoch. // Every time ledger close, unittest timer increase by 10s uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 60; @@ -1122,7 +1122,7 @@ struct DepositPreauth_test : public beast::unit_test::suite // Create credential which not expired jv = credentials::create(alice, issuer, credType2); uint32_t const t2 = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 1000; @@ -1199,7 +1199,7 @@ struct DepositPreauth_test : public beast::unit_test::suite { auto jv = credentials::create(gw, issuer, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 40; @@ -1252,7 +1252,7 @@ struct DepositPreauth_test : public beast::unit_test::suite // Create credentials auto jv = credentials::create(zelda, issuer, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 50; diff --git a/src/test/app/LedgerHistory_test.cpp b/src/test/app/LedgerHistory_test.cpp index e286440679..3223e9e1d8 100644 --- a/src/test/app/LedgerHistory_test.cpp +++ b/src/test/app/LedgerHistory_test.cpp @@ -43,7 +43,7 @@ public: env.app().getNodeFamily()); } auto res = std::make_shared( - *prev, prev->info().closeTime + closeOffset); + *prev, prev->header().closeTime + closeOffset); if (stx) { @@ -62,8 +62,8 @@ public: // Accept ledger res->setAccepted( - res->info().closeTime, - res->info().closeTimeResolution, + res->header().closeTime, + res->header().closeTimeResolution, true /* close time correct*/); lh.insert(res, false); return res; diff --git a/src/test/app/LedgerMaster_test.cpp b/src/test/app/LedgerMaster_test.cpp index 5b815caeda..451e4f9068 100644 --- a/src/test/app/LedgerMaster_test.cpp +++ b/src/test/app/LedgerMaster_test.cpp @@ -37,7 +37,7 @@ class LedgerMaster_test : public beast::unit_test::suite // build ledgers std::vector> txns; std::vector> metas; - auto const startLegSeq = env.current()->info().seq; + auto const startLegSeq = env.current()->header().seq; for (int i = 0; i < 2; ++i) { env(noop(alice)); @@ -48,7 +48,7 @@ class LedgerMaster_test : public beast::unit_test::suite } // add last (empty) ledger env.close(); - auto const endLegSeq = env.closed()->info().seq; + auto const endLegSeq = env.closed()->header().seq; // test invalid range { diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index 9edaaec0a5..a468629de9 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -40,7 +40,7 @@ struct LedgerReplay_test : public beast::unit_test::suite LedgerMaster& ledgerMaster = env.app().getLedgerMaster(); auto const lastClosed = ledgerMaster.getClosedLedger(); auto const lastClosedParent = - ledgerMaster.getLedgerByHash(lastClosed->info().parentHash); + ledgerMaster.getLedgerByHash(lastClosed->header().parentHash); auto const replayed = buildLedger( LedgerReplay(lastClosedParent, lastClosed), @@ -48,7 +48,7 @@ struct LedgerReplay_test : public beast::unit_test::suite env.app(), env.journal); - BEAST_EXPECT(replayed->info().hash == lastClosed->info().hash); + BEAST_EXPECT(replayed->header().hash == lastClosed->header().hash); } }; @@ -610,7 +610,7 @@ public: auto const l = ledgerMaster.getLedgerByHash(hash); if (!l) return false; - hash = l->info().parentHash; + hash = l->header().parentHash; } return true; } @@ -890,7 +890,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite // request, missing key auto request = std::make_shared(); request->set_ledgerhash( - l->info().hash.data(), l->info().hash.size()); + l->header().hash.data(), l->header().hash.size()); request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE); auto reply = std::make_shared( server.msgHandler.processProofPathRequest(request)); @@ -914,7 +914,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite // good request auto request = std::make_shared(); request->set_ledgerhash( - l->info().hash.data(), l->info().hash.size()); + l->header().hash.data(), l->header().hash.size()); request->set_type(protocol::TMLedgerMapType::lmACCOUNT_STATE); request->set_key( keylet::skip().key.data(), keylet::skip().key.size()); @@ -970,7 +970,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite // good request auto request = std::make_shared(); request->set_ledgerhash( - l->info().hash.data(), l->info().hash.size()); + l->header().hash.data(), l->header().hash.size()); auto reply = std::make_shared( server.msgHandler.processReplayDeltaRequest(request)); BEAST_EXPECT(!reply->has_error()); @@ -1132,7 +1132,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite NetworkOfTwo net(*this, {totalReplay + 1}, psBhvr, ilBhvr, peerFeature); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; for (int i = 0; i < totalReplay; ++i) { BEAST_EXPECT(l); @@ -1140,7 +1140,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite { net.client.ledgerMaster.storeLedger(l); l = net.server.ledgerMaster.getLedgerByHash( - l->info().parentHash); + l->header().parentHash); } else break; @@ -1175,7 +1175,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite PeerFeature::None); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1220,10 +1220,10 @@ struct LedgerReplayer_test : public beast::unit_test::suite // feed client with start ledger since InboundLedgers drops all auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; for (int i = 0; i < totalReplay - 1; ++i) { - l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash); + l = net.server.ledgerMaster.getLedgerByHash(l->header().parentHash); } net.client.ledgerMaster.storeLedger(l); @@ -1258,7 +1258,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1288,7 +1288,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1333,14 +1333,14 @@ struct LedgerReplayer_test : public beast::unit_test::suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.ledgerMaster.storeLedger(l); net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); - auto delta = net.client.findLedgerDeltaAcquire(l->info().parentHash); + auto delta = net.client.findLedgerDeltaAcquire(l->header().parentHash); delta->processData( - l->info(), // wrong ledger info + l->header(), // wrong ledger info std::map>()); BEAST_EXPECT(net.client.taskStatus(delta) == TaskStatus::Failed); BEAST_EXPECT( @@ -1367,7 +1367,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite InboundLedgersBehavior::Good, PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); std::vector deltaStatuses( @@ -1392,9 +1392,9 @@ struct LedgerReplayer_test : public beast::unit_test::suite // no overlap for (int i = 0; i < totalReplay + 2; ++i) { - l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash); + l = net.server.ledgerMaster.getLedgerByHash(l->header().parentHash); } - auto finalHash_early = l->info().hash; + auto finalHash_early = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash_early, totalReplay); BEAST_EXPECT(net.client.waitAndCheckStatus( @@ -1407,8 +1407,8 @@ struct LedgerReplayer_test : public beast::unit_test::suite BEAST_EXPECT(net.client.countsAsExpected(3, 2, 2 * (totalReplay - 1))); // partial overlap - l = net.server.ledgerMaster.getLedgerByHash(l->info().parentHash); - auto finalHash_moreEarly = l->info().parentHash; + l = net.server.ledgerMaster.getLedgerByHash(l->header().parentHash); + auto finalHash_moreEarly = l->header().parentHash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash_moreEarly, totalReplay); BEAST_EXPECT(net.client.waitAndCheckStatus( @@ -1479,7 +1479,7 @@ struct LedgerReplayerTimeout_test : public beast::unit_test::suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1510,7 +1510,7 @@ struct LedgerReplayerTimeout_test : public beast::unit_test::suite PeerFeature::LedgerReplayEnabled); auto l = net.server.ledgerMaster.getClosedLedger(); - uint256 finalHash = l->info().hash; + uint256 finalHash = l->header().hash; net.client.ledgerMaster.storeLedger(l); net.client.replayer.replay( InboundLedger::Reason::GENERIC, finalHash, totalReplay); @@ -1558,11 +1558,11 @@ struct LedgerReplayerLong_test : public beast::unit_test::suite auto l = net.server.ledgerMaster.getClosedLedger(); for (int i = 0; i < rounds; ++i) { - finishHashes.push_back(l->info().hash); + finishHashes.push_back(l->header().hash); for (int j = 0; j < totalReplay; ++j) { l = net.server.ledgerMaster.getLedgerByHash( - l->info().parentHash); + l->header().parentHash); } } BEAST_EXPECT(finishHashes.size() == rounds); diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index b2ad47c2b4..f7672fd380 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -1398,7 +1398,7 @@ protected: env.close(); auto const startDate = - env.current()->info().parentCloseTime.time_since_epoch().count(); + env.current()->header().parentCloseTime.time_since_epoch().count(); if (auto const brokerSle = env.le(keylet::loanbroker(broker.brokerID)); BEAST_EXPECT(brokerSle)) @@ -3761,7 +3761,7 @@ protected: env.close(); - auto const startDate = env.current()->info().parentCloseTime; + auto const startDate = env.current()->header().parentCloseTime; // Loan is successfully created { diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 5f57322be1..5ff0ac17ae 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -57,7 +57,10 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite std::uint32_t lastClose(test::jtx::Env& env) { - return env.current()->info().parentCloseTime.time_since_epoch().count(); + return env.current() + ->header() + .parentCloseTime.time_since_epoch() + .count(); } void diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index 01db95835e..49ca453ebb 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -112,7 +112,7 @@ public: jvn[jss::TransactionType] = jss::AccountSet; jvn[jss::Fee] = to_string(env.current()->fees().base); jvn[jss::Sequence] = env.seq(alice); - jvn[jss::LastLedgerSequence] = env.current()->info().seq + 2; + jvn[jss::LastLedgerSequence] = env.current()->header().seq + 2; auto jt = env.jtnofill(jvn); Serializer s; jt.stx->add(s); diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 2cbf2598e1..9cf8a7b1f2 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -20,7 +20,10 @@ class OfferBaseUtil_test : public beast::unit_test::suite std::uint32_t lastClose(jtx::Env& env) { - return env.current()->info().parentCloseTime.time_since_epoch().count(); + return env.current() + ->header() + .parentCloseTime.time_since_epoch() + .count(); } static auto diff --git a/src/test/app/Oracle_test.cpp b/src/test/app/Oracle_test.cpp index 42f2455f31..470bcd7950 100644 --- a/src/test/app/Oracle_test.cpp +++ b/src/test/app/Oracle_test.cpp @@ -252,7 +252,9 @@ private: static_cast(env.current()->fees().base.drops()); auto closeTime = [&]() { return duration_cast( - env.current()->info().closeTime.time_since_epoch() - + env.current() + ->header() + .closeTime.time_since_epoch() - 10'000s) .count(); }; @@ -559,7 +561,7 @@ private: BEAST_EXPECT(oracle.exists()); BEAST_EXPECT(oracle1.exists()); auto const index = env.closed()->seq(); - auto const hash = env.closed()->info().hash; + auto const hash = env.closed()->header().hash; for (int i = 0; i < 256; ++i) env.close(); env(acctdelete(owner, alice), fee(acctDelFee)); diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index 59c404ae28..3f350626ea 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -322,7 +322,7 @@ struct PayChan_test : public beast::unit_test::suite auto const pk = alice.pk(); auto const settleDelay = 100s; NetClock::time_point const cancelAfter = - env.current()->info().parentCloseTime + 3600s; + env.current()->header().parentCloseTime + 3600s; auto const channelFunds = XRP(1000); auto const chan = channel(alice, bob, env.seq(alice)); env(create(alice, bob, channelFunds, settleDelay, pk, cancelAfter)); @@ -354,7 +354,7 @@ struct PayChan_test : public beast::unit_test::suite auto const pk = alice.pk(); auto const settleDelay = 100s; NetClock::time_point const cancelAfter = - env.current()->info().parentCloseTime + 3600s; + env.current()->header().parentCloseTime + 3600s; auto const channelFunds = XRP(1000); auto const chan = channel(alice, bob, env.seq(alice)); env(create(alice, bob, channelFunds, settleDelay, pk, cancelAfter)); @@ -385,7 +385,7 @@ struct PayChan_test : public beast::unit_test::suite auto const settleDelay = 100s; auto const channelFunds = XRP(1000); NetClock::time_point const cancelAfter = - env.current()->info().parentCloseTime - 1s; + env.current()->header().parentCloseTime - 1s; auto const txResult = withFixPayChan ? ter(tecEXPIRED) : ter(tesSUCCESS); env(create( @@ -409,7 +409,7 @@ struct PayChan_test : public beast::unit_test::suite auto const settleDelay = 100s; auto const channelFunds = XRP(1000); NetClock::time_point const cancelAfter = - env.current()->info().parentCloseTime; + env.current()->header().parentCloseTime; env(create( alice, bob, channelFunds, settleDelay, pk, cancelAfter), ter(tesSUCCESS)); @@ -430,7 +430,7 @@ struct PayChan_test : public beast::unit_test::suite env.fund(XRP(10000), alice, bob, carol); auto const pk = alice.pk(); auto const settleDelay = 3600s; - auto const closeTime = env.current()->info().parentCloseTime; + auto const closeTime = env.current()->header().parentCloseTime; auto const minExpiration = closeTime + settleDelay; NetClock::time_point const cancelAfter = closeTime + 7200s; auto const channelFunds = XRP(1000); @@ -496,7 +496,7 @@ struct PayChan_test : public beast::unit_test::suite auto const pk = alice.pk(); auto const settleDelay = 3600s; NetClock::time_point const settleTimepoint = - env.current()->info().parentCloseTime + settleDelay; + env.current()->header().parentCloseTime + settleDelay; auto const channelFunds = XRP(1000); auto const chan = channel(alice, bob, env.seq(alice)); env(create(alice, bob, channelFunds, settleDelay, pk)); @@ -861,7 +861,7 @@ struct PayChan_test : public beast::unit_test::suite { // create credentials auto jv = credentials::create(alice, carol, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 100; @@ -1910,7 +1910,7 @@ struct PayChan_test : public beast::unit_test::suite env.close(); // settle delay hasn't elapsed. Channels should exist. BEAST_EXPECT(channelExists(*env.current(), chan)); - auto const closeTime = env.current()->info().parentCloseTime; + auto const closeTime = env.current()->header().parentCloseTime; auto const minExpiration = closeTime + settleDelay; env.close(minExpiration); env(claim(alice, chan), txflags(tfClose)); diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index 25d94a968b..4b7a1db1be 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -242,7 +242,7 @@ class PermissionedDEX_test : public beast::unit_test::suite auto jv = credentials::create(devin, domainOwner, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count(); jv[sfExpiration.jsonName] = t + 20; @@ -797,7 +797,7 @@ class PermissionedDEX_test : public beast::unit_test::suite auto jv = credentials::create(devin, domainOwner, credType); uint32_t const t = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count(); jv[sfExpiration.jsonName] = t + 20; diff --git a/src/test/app/RCLValidations_test.cpp b/src/test/app/RCLValidations_test.cpp index 2edf61c8c2..2d3c4f2af5 100644 --- a/src/test/app/RCLValidations_test.cpp +++ b/src/test/app/RCLValidations_test.cpp @@ -111,13 +111,13 @@ class RCLValidations_test : public beast::unit_test::suite { std::shared_ptr ledger = history.back(); RCLValidatedLedger a{ledger, env.journal}; - BEAST_EXPECT(a.seq() == ledger->info().seq); + BEAST_EXPECT(a.seq() == ledger->header().seq); BEAST_EXPECT(a.minSeq() == a.seq() - maxAncestors); // Ensure the ancestral 256 ledgers have proper ID for (Seq s = a.seq(); s > 0; s--) { if (s >= a.minSeq()) - BEAST_EXPECT(a[s] == history[s - 1]->info().hash); + BEAST_EXPECT(a[s] == history[s - 1]->header().hash); else BEAST_EXPECT(a[s] == ID{0}); } diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index 81184a595b..be51d9c96e 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -50,7 +50,7 @@ struct Regression_test : public beast::unit_test::suite std::vector{}, env.app().getNodeFamily()); auto expectedDrops = INITIAL_XRP; - BEAST_EXPECT(closed->info().drops == expectedDrops); + BEAST_EXPECT(closed->header().drops == expectedDrops); auto const aliceXRP = 400; auto const aliceAmount = XRP(aliceXRP); @@ -70,7 +70,7 @@ struct Regression_test : public beast::unit_test::suite accum.apply(*next); } expectedDrops -= next->fees().base; - BEAST_EXPECT(next->info().drops == expectedDrops); + BEAST_EXPECT(next->header().drops == expectedDrops); { auto const sle = next->read(keylet::account(Account("alice").id())); BEAST_EXPECT(sle); @@ -101,7 +101,7 @@ struct Regression_test : public beast::unit_test::suite BEAST_EXPECT(balance == XRP(0)); } expectedDrops -= aliceXRP * dropsPerXRP; - BEAST_EXPECT(next->info().drops == expectedDrops); + BEAST_EXPECT(next->header().drops == expectedDrops); } void diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index e59cf7deff..0af91f25a6 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -726,7 +726,7 @@ public: env(noop(daria)); checkMetrics(*this, env, 0, std::nullopt, 3, 2); - BEAST_EXPECT(env.current()->info().seq == 6); + BEAST_EXPECT(env.current()->header().seq == 6); // Fail to queue an item with a low LastLedgerSeq env(noop(alice), last_ledger_seq(7), ter(telCAN_NOT_QUEUE)); // Queue an item with a sufficient LastLedgerSeq. @@ -1075,7 +1075,7 @@ public: // Alice - fill up the queue std::int64_t aliceFee = 27; aliceSeq = env.seq(alice); - auto lastLedgerSeq = env.current()->info().seq + 2; + auto lastLedgerSeq = env.current()->header().seq + 2; for (auto i = 0; i < 7; i++) { env(noop(alice), @@ -2683,7 +2683,7 @@ public: checkMetrics(*this, env, 0, std::nullopt, 2, 1); auto const aliceSeq = env.seq(alice); - BEAST_EXPECT(env.current()->info().seq == 3); + BEAST_EXPECT(env.current()->header().seq == 3); env(noop(alice), seq(aliceSeq), last_ledger_seq(5), ter(terQUEUED)); env(noop(alice), seq(aliceSeq + 1), last_ledger_seq(5), ter(terQUEUED)); env(noop(alice), @@ -2779,7 +2779,7 @@ public: checkMetrics(*this, env, 0, std::nullopt, 2, 1); auto const aliceSeq = env.seq(alice); - BEAST_EXPECT(env.current()->info().seq == 3); + BEAST_EXPECT(env.current()->header().seq == 3); // Start by procuring tickets for alice to use to keep her queue full // without affecting the sequence gap that will appear later. @@ -2932,7 +2932,7 @@ public: // Queue up several transactions for alice sign-and-submit auto const aliceSeq = env.seq(alice); - auto const lastLedgerSeq = env.current()->info().seq + 2; + auto const lastLedgerSeq = env.current()->header().seq + 2; auto submitParams = Json::Value(Json::objectValue); for (int i = 0; i < 5; ++i) @@ -3073,7 +3073,7 @@ public: prevLedgerWithQueue[jss::account] = alice.human(); prevLedgerWithQueue[jss::queue] = true; prevLedgerWithQueue[jss::ledger_index] = 3; - BEAST_EXPECT(env.current()->info().seq > 3); + BEAST_EXPECT(env.current()->header().seq > 3); { // account_info without the "queue" argument. diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index ce76e06912..a07045743e 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -3520,7 +3520,7 @@ class Vault_test : public beast::unit_test::suite { testcase("private vault expired authorization"); uint32_t const closeTime = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count(); { diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index 5b7eebed2f..a1000c0d49 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -621,7 +621,7 @@ struct NetworkHistory keyPair.second, v, [&](STValidation& v) { - v.setFieldH256(sfLedgerHash, ledger->info().hash); + v.setFieldH256(sfLedgerHash, ledger->header().hash); v.setFieldU32(sfLedgerSequence, ledger->seq()); v.setFlag(vfFullValidation); }); @@ -1773,7 +1773,7 @@ class NegativeUNLVoteFilterValidations_test : public beast::unit_test::suite keys.second, calcNodeID(keys.first), [&](STValidation& v) { - v.setFieldH256(sfLedgerHash, l->info().hash); + v.setFieldH256(sfLedgerHash, l->header().hash); v.setFieldU32(sfLedgerSequence, l->seq()); v.setFlag(vfFullValidation); }); diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 9ce76d01c9..311a5dde3a 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -67,7 +67,8 @@ Env::AppBundle::AppBundle( app->logs().threshold(thresh); if (!app->setup({})) Throw("Env::AppBundle: setup failed"); - timeKeeper->set(app->getLedgerMaster().getClosedLedger()->info().closeTime); + timeKeeper->set( + app->getLedgerMaster().getClosedLedger()->header().closeTime); app->start(false /*don't start timers*/); thread = std::thread([&]() { app->run(); }); @@ -107,7 +108,7 @@ Env::close( // Round up to next distinguishable value using namespace std::chrono_literals; bool res = true; - closeTime += closed()->info().closeTimeResolution - 1s; + closeTime += closed()->header().closeTimeResolution - 1s; timeKeeper().set(closeTime); // Go through the rpc interface unless we need to simulate // a specific consensus delay. @@ -130,7 +131,7 @@ Env::close( res = false; } } - timeKeeper().set(closed()->info().closeTime); + timeKeeper().set(closed()->header().closeTime); return res; } diff --git a/src/test/jtx/impl/Oracle.cpp b/src/test/jtx/impl/Oracle.cpp index 4c5fab3b61..e3396f3ebc 100644 --- a/src/test/jtx/impl/Oracle.cpp +++ b/src/test/jtx/impl/Oracle.cpp @@ -216,7 +216,7 @@ Oracle::set(UpdateArg const& arg) else jv[jss::LastUpdateTime] = to_string( duration_cast( - env_.current()->info().closeTime.time_since_epoch()) + env_.current()->header().closeTime.time_since_epoch()) .count() + epoch_offset.count()); Json::Value dataSeries(Json::arrayValue); diff --git a/src/test/ledger/Directory_test.cpp b/src/test/ledger/Directory_test.cpp index b927103f8f..68c3286660 100644 --- a/src/test/ledger/Directory_test.cpp +++ b/src/test/ledger/Directory_test.cpp @@ -436,7 +436,7 @@ struct Directory_test : public beast::unit_test::suite // exist env(offer(alice, XRP(1), USD(1))); auto const txID = to_string(env.tx()->getTransactionID()); - auto const ledgerSeq = env.current()->info().seq; + auto const ledgerSeq = env.current()->header().seq; env.close(); // Make sure the fields only exist if the object is touched env(noop(gw)); diff --git a/src/test/ledger/SkipList_test.cpp b/src/test/ledger/SkipList_test.cpp index b84f002503..4869036014 100644 --- a/src/test/ledger/SkipList_test.cpp +++ b/src/test/ledger/SkipList_test.cpp @@ -35,32 +35,35 @@ class SkipList_test : public beast::unit_test::suite { auto l = *(std::next(std::begin(history))); - BEAST_EXPECT((*std::begin(history))->info().seq < l->info().seq); BEAST_EXPECT( - !hashOfSeq(*l, l->info().seq + 1, env.journal).has_value()); + (*std::begin(history))->header().seq < l->header().seq); BEAST_EXPECT( - hashOfSeq(*l, l->info().seq, env.journal) == l->info().hash); + !hashOfSeq(*l, l->header().seq + 1, env.journal).has_value()); BEAST_EXPECT( - hashOfSeq(*l, l->info().seq - 1, env.journal) == - l->info().parentHash); - BEAST_EXPECT(!hashOfSeq(*history.back(), l->info().seq, env.journal) - .has_value()); + hashOfSeq(*l, l->header().seq, env.journal) == + l->header().hash); + BEAST_EXPECT( + hashOfSeq(*l, l->header().seq - 1, env.journal) == + l->header().parentHash); + BEAST_EXPECT( + !hashOfSeq(*history.back(), l->header().seq, env.journal) + .has_value()); } // ledger skip lists store up to the previous 256 hashes for (auto i = history.crbegin(); i != history.crend(); i += 256) { for (auto n = i; - n != std::next(i, (*i)->info().seq - 256 > 1 ? 257 : 256); + n != std::next(i, (*i)->header().seq - 256 > 1 ? 257 : 256); ++n) { BEAST_EXPECT( - hashOfSeq(**i, (*n)->info().seq, env.journal) == - (*n)->info().hash); + hashOfSeq(**i, (*n)->header().seq, env.journal) == + (*n)->header().hash); } // edge case accessing beyond 256 - BEAST_EXPECT(!hashOfSeq(**i, (*i)->info().seq - 258, env.journal) + BEAST_EXPECT(!hashOfSeq(**i, (*i)->header().seq - 258, env.journal) .has_value()); } @@ -71,8 +74,8 @@ class SkipList_test : public beast::unit_test::suite for (auto n = std::next(i, 512); n != history.crend(); n += 256) { BEAST_EXPECT( - hashOfSeq(**i, (*n)->info().seq, env.journal) == - (*n)->info().hash); + hashOfSeq(**i, (*n)->header().seq, env.journal) == + (*n)->header().hash); } } } diff --git a/src/test/ledger/View_test.cpp b/src/test/ledger/View_test.cpp index 9c7a5a286e..a8f3f7fc3b 100644 --- a/src/test/ledger/View_test.cpp +++ b/src/test/ledger/View_test.cpp @@ -1019,8 +1019,8 @@ class View_test : public beast::unit_test::suite // Try the other interface. // Note that the different interface has different outcomes. - auto const& iA3 = rdViewA3->info(); - auto const& iA4 = rdViewA4->info(); + auto const& iA3 = rdViewA3->header(); + auto const& iA4 = rdViewA4->header(); BEAST_EXPECT(areCompatible(iA3.hash, iA3.seq, *rdViewA4, jStream, "")); BEAST_EXPECT(areCompatible(iA4.hash, iA4.seq, *rdViewA3, jStream, "")); diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index 2bc6c38779..200331b9be 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -68,7 +68,7 @@ public: } env.fund(XRP(10000), alice); env.close(); - LedgerHeader const ledger3Info = env.closed()->info(); + LedgerHeader const ledger3Info = env.closed()->header(); BEAST_EXPECT(ledger3Info.seq == 3); { @@ -118,7 +118,7 @@ public: env(pay(gw1, alice, gw1Currency(50 + c))); } env.close(); - LedgerHeader const ledger4Info = env.closed()->info(); + LedgerHeader const ledger4Info = env.closed()->header(); BEAST_EXPECT(ledger4Info.seq == 4); // Add another set of trust lines in another ledger so we can see @@ -153,7 +153,7 @@ public: tfSetNoRipple | tfSetFreeze | tfSetDeepFreeze)); } env.close(); - LedgerHeader const ledger58Info = env.closed()->info(); + LedgerHeader const ledger58Info = env.closed()->header(); BEAST_EXPECT(ledger58Info.seq == 58); // A re-usable test for historic ledgers. @@ -817,7 +817,7 @@ public: } env.fund(XRP(10000), alice); env.close(); - LedgerHeader const ledger3Info = env.closed()->info(); + LedgerHeader const ledger3Info = env.closed()->header(); BEAST_EXPECT(ledger3Info.seq == 3); { @@ -899,7 +899,7 @@ public: env(pay(gw1, alice, gw1Currency(50 + c))); } env.close(); - LedgerHeader const ledger4Info = env.closed()->info(); + LedgerHeader const ledger4Info = env.closed()->header(); BEAST_EXPECT(ledger4Info.seq == 4); // Add another set of trust lines in another ledger so we can see @@ -934,7 +934,7 @@ public: tfSetNoRipple | tfSetFreeze | tfSetDeepFreeze)); } env.close(); - LedgerHeader const ledger58Info = env.closed()->info(); + LedgerHeader const ledger58Info = env.closed()->header(); BEAST_EXPECT(ledger58Info.seq == 58); // A re-usable test for historic ledgers. diff --git a/src/test/rpc/AccountTx_test.cpp b/src/test/rpc/AccountTx_test.cpp index f55d053c9e..f9f21c5e87 100644 --- a/src/test/rpc/AccountTx_test.cpp +++ b/src/test/rpc/AccountTx_test.cpp @@ -242,7 +242,7 @@ class AccountTx_test : public beast::unit_test::suite env.rpc("json", "account_tx", to_string(p)), rpcLGR_IDX_MALFORMED)); - p[jss::ledger_index_min] = env.current()->info().seq; + p[jss::ledger_index_min] = env.current()->header().seq; BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), (apiVersion == 1 ? rpcLGR_IDXS_INVALID @@ -256,7 +256,7 @@ class AccountTx_test : public beast::unit_test::suite BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); - p[jss::ledger_index_max] = env.current()->info().seq; + p[jss::ledger_index_max] = env.current()->header().seq; if (apiVersion < 2u) BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); @@ -269,11 +269,11 @@ class AccountTx_test : public beast::unit_test::suite BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); - p[jss::ledger_index_max] = env.closed()->info().seq; + p[jss::ledger_index_max] = env.closed()->header().seq; BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); - p[jss::ledger_index_max] = env.closed()->info().seq - 1; + p[jss::ledger_index_max] = env.closed()->header().seq - 1; BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); } @@ -281,19 +281,19 @@ class AccountTx_test : public beast::unit_test::suite { Json::Value p{jParams}; - p[jss::ledger_index] = env.closed()->info().seq; + p[jss::ledger_index] = env.closed()->header().seq; BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); - p[jss::ledger_index] = env.closed()->info().seq - 1; + p[jss::ledger_index] = env.closed()->header().seq - 1; BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); - p[jss::ledger_index] = env.current()->info().seq; + p[jss::ledger_index] = env.current()->header().seq; BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), rpcLGR_NOT_VALIDATED)); - p[jss::ledger_index] = env.current()->info().seq + 1; + p[jss::ledger_index] = env.current()->header().seq + 1; BEAST_EXPECT(isErr( env.rpc("json", "account_tx", to_string(p)), rpcLGR_NOT_FOUND)); } @@ -302,11 +302,11 @@ class AccountTx_test : public beast::unit_test::suite { Json::Value p{jParams}; - p[jss::ledger_hash] = to_string(env.closed()->info().hash); + p[jss::ledger_hash] = to_string(env.closed()->header().hash); BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); - p[jss::ledger_hash] = to_string(env.closed()->info().parentHash); + p[jss::ledger_hash] = to_string(env.closed()->header().parentHash); BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p)))); } @@ -333,7 +333,7 @@ class AccountTx_test : public beast::unit_test::suite // Ledger index max only { Json::Value p{jParams}; - p[jss::ledger_index_max] = env.current()->info().seq; + p[jss::ledger_index_max] = env.current()->header().seq; if (apiVersion < 2u) BEAST_EXPECT(hasTxs( env.rpc(apiVersion, "json", "account_tx", to_string(p)))); @@ -903,7 +903,7 @@ class AccountTx_test : public beast::unit_test::suite // // ledger hash should be fixed regardless any change to account history // BEAST_EXPECT( - // to_string(env.closed()->info().hash) == + // to_string(env.closed()->header().hash) == // "0BD507BB87D3C0E73B462485E6E381798A8C82FC49BF17FE39C60E08A1AF035D"); // alice authorizes bob diff --git a/src/test/rpc/DepositAuthorized_test.cpp b/src/test/rpc/DepositAuthorized_test.cpp index 8ed52542d6..6e46b077b8 100644 --- a/src/test/rpc/DepositAuthorized_test.cpp +++ b/src/test/rpc/DepositAuthorized_test.cpp @@ -557,7 +557,7 @@ public: // check expired credentials char const credType2[] = "fghijk"; std::uint32_t const x = env.current() - ->info() + ->header() .parentCloseTime.time_since_epoch() .count() + 40; diff --git a/src/test/rpc/LedgerData_test.cpp b/src/test/rpc/LedgerData_test.cpp index 3705133432..9ac61c277a 100644 --- a/src/test/rpc/LedgerData_test.cpp +++ b/src/test/rpc/LedgerData_test.cpp @@ -217,7 +217,7 @@ public: if (BEAST_EXPECT(jrr.isMember(jss::ledger))) BEAST_EXPECT( jrr[jss::ledger][jss::ledger_hash] == - to_string(env.closed()->info().hash)); + to_string(env.closed()->header().hash)); } { // Closed ledger with binary form diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 372f5676b0..8e9be02dda 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -539,7 +539,7 @@ class LedgerEntry_test : public beast::unit_test::suite env.fund(XRP(10000), alice); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; { // Exercise ledger_closed along the way. Json::Value const jrr = env.rpc("ledger_closed")[jss::result]; @@ -646,7 +646,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(check::create(env.master, alice, XRP(100))); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; { // Request a check. Json::Value jvParams; @@ -765,7 +765,7 @@ class LedgerEntry_test : public beast::unit_test::suite env.close(); env(delegate::set(alice, bob, {"Payment", "CheckCreate"})); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; std::string delegateIndex; { // Request by account and authorize @@ -823,7 +823,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(deposit::auth(alice, becky)); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; std::string depositPreauthIndex; { // Request a depositPreauth by owner and authorized. @@ -1171,7 +1171,7 @@ class LedgerEntry_test : public beast::unit_test::suite } env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; { // Exercise ledger_closed along the way. Json::Value const jrr = env.rpc("ledger_closed")[jss::result]; @@ -1331,7 +1331,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(escrowCreate(alice, alice, XRP(333), env.now() + 2s)); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; std::string escrowIndex; { // Request the escrow using owner and sequence. @@ -1379,7 +1379,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(offer(alice, USD(321), XRP(322))); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; std::string offerIndex; { // Request the offer using owner and sequence. @@ -1443,7 +1443,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(payChanCreate(alice, env.master, XRP(57), 18s, alice.pk())); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; uint256 const payChanIndex{ keylet::payChan(alice, env.master, env.seq(alice) - 1).key}; @@ -1495,7 +1495,8 @@ class LedgerEntry_test : public beast::unit_test::suite // check both aliases for (auto const& fieldName : {jss::ripple_state, jss::state}) { - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{ + to_string(env.closed()->header().hash)}; { // Request the trust line using the accounts and currency. Json::Value jvParams; @@ -1637,7 +1638,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(ticket::create(env.master, 2)); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; // Request four tickets: one before the first one we created, the // two created tickets, and the ticket that would come after the // last created ticket. @@ -1734,7 +1735,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(didCreate(alice)); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; { // Request the DID using its index. @@ -1865,7 +1866,7 @@ class LedgerEntry_test : public beast::unit_test::suite tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback}); mptAlice.authorize({.account = bob, .holderCount = 1}); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; std::string const badMptID = "00000193B9DDCAF401B5B3B26875986043F82CD0D13B4315"; @@ -2024,7 +2025,7 @@ class LedgerEntry_test : public beast::unit_test::suite env(check::create(env.master, alice, XRP(100))); env.close(); - std::string const ledgerHash{to_string(env.closed()->info().hash)}; + std::string const ledgerHash{to_string(env.closed()->header().hash)}; { // Request a check. Json::Value const jrr = @@ -2095,7 +2096,7 @@ class LedgerEntry_XChain_test : public beast::unit_test::suite, createBridgeObjects(mcEnv, scEnv); - std::string const ledgerHash{to_string(mcEnv.closed()->info().hash)}; + std::string const ledgerHash{to_string(mcEnv.closed()->header().hash)}; std::string bridge_index; Json::Value mcBridge; { diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 4a90793fa2..7728973045 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -60,7 +60,7 @@ class LedgerRPC_test : public beast::unit_test::suite Env env{*this}; env.close(); - BEAST_EXPECT(env.current()->info().seq == 4); + BEAST_EXPECT(env.current()->header().seq == 4); { Json::Value jvParams; @@ -87,9 +87,9 @@ class LedgerRPC_test : public beast::unit_test::suite BEAST_EXPECT(jrr[jss::ledger][jss::closed] == false); BEAST_EXPECT( jrr[jss::ledger][jss::ledger_index] == - std::to_string(env.current()->info().seq)); + std::to_string(env.current()->header().seq)); BEAST_EXPECT( - jrr[jss::ledger_current_index] == env.current()->info().seq); + jrr[jss::ledger_current_index] == env.current()->header().seq); } } @@ -182,12 +182,12 @@ class LedgerRPC_test : public beast::unit_test::suite Env env{*this}; env.close(); - BEAST_EXPECT(env.current()->info().seq == 4); + BEAST_EXPECT(env.current()->header().seq == 4); { auto const jrr = env.rpc("ledger_current")[jss::result]; BEAST_EXPECT( - jrr[jss::ledger_current_index] == env.current()->info().seq); + jrr[jss::ledger_current_index] == env.current()->header().seq); } } @@ -475,7 +475,7 @@ class LedgerRPC_test : public beast::unit_test::suite env(noop(alice)); } - BEAST_EXPECT(env.current()->info().seq == 5); + BEAST_EXPECT(env.current()->header().seq == 5); // Put some txs in the queue // Alice auto aliceSeq = env.seq(alice); @@ -508,7 +508,7 @@ class LedgerRPC_test : public beast::unit_test::suite env.close(); env.close(); env.close(); - BEAST_EXPECT(env.current()->info().seq == 8); + BEAST_EXPECT(env.current()->header().seq == 8); jrr = env.rpc("json", "ledger", to_string(jv))[jss::result]; BEAST_EXPECT(jrr[jss::queue_data].size() == 11); @@ -517,7 +517,7 @@ class LedgerRPC_test : public beast::unit_test::suite jrr = env.rpc("json", "ledger", to_string(jv))[jss::result]; std::string const txid0 = [&]() { - auto const& parentHash = env.current()->info().parentHash; + auto const& parentHash = env.current()->header().parentHash; if (BEAST_EXPECT(jrr[jss::queue_data].size() == 2)) { std::string const txid1 = [&]() { @@ -559,7 +559,7 @@ class LedgerRPC_test : public beast::unit_test::suite jrr = env.rpc("json", "ledger", to_string(jv))[jss::result]; if (BEAST_EXPECT(jrr[jss::queue_data].size() == 2)) { - auto const& parentHash = env.current()->info().parentHash; + auto const& parentHash = env.current()->header().parentHash; auto const txid1 = [&]() { auto const& txj = jrr[jss::queue_data][1u]; BEAST_EXPECT(txj[jss::account] == alice.human()); diff --git a/src/test/rpc/LedgerRequest_test.cpp b/src/test/rpc/LedgerRequest_test.cpp index 68d29d1901..013d4cbe0f 100644 --- a/src/test/rpc/LedgerRequest_test.cpp +++ b/src/test/rpc/LedgerRequest_test.cpp @@ -32,7 +32,7 @@ public: env.close(); env.close(); - BEAST_EXPECT(env.current()->info().seq == 5); + BEAST_EXPECT(env.current()->header().seq == 5); { // arbitrary text is converted to 0. diff --git a/src/test/rpc/Simulate_test.cpp b/src/test/rpc/Simulate_test.cpp index d7018fdbbc..61d3f1ce6e 100644 --- a/src/test/rpc/Simulate_test.cpp +++ b/src/test/rpc/Simulate_test.cpp @@ -1027,7 +1027,7 @@ class Simulate_test : public beast::unit_test::suite auto jv = credentials::create(subject, issuer, credType); uint32_t const t = - env.current()->info().parentCloseTime.time_since_epoch().count(); + env.current()->header().parentCloseTime.time_since_epoch().count(); jv[sfExpiration.jsonName] = t; env(jv); env.close(); diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 98e86484f5..a4eea3f12c 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -469,11 +469,11 @@ public: return false; if (jv[jss::ledger_hash] != - to_string(env.closed()->info().hash)) + to_string(env.closed()->header().hash)) return false; if (jv[jss::ledger_index] != - std::to_string(env.closed()->info().seq)) + std::to_string(env.closed()->header().seq)) return false; if (jv[jss::flags] != (vfFullyCanonicalSig | vfFullValidation)) @@ -504,7 +504,7 @@ public: // Certain fields are only added on a flag ledger. bool const isFlagLedger = - (env.closed()->info().seq + 1) % 256 == 0; + (env.closed()->header().seq + 1) % 256 == 0; if (jv.isMember(jss::server_version) != isFlagLedger) return false; @@ -520,7 +520,7 @@ public: // Check stream update. Look at enough stream entries so we see // at least one flag ledger. - while (env.closed()->info().seq < 300) + while (env.closed()->header().seq < 300) { env.close(); using namespace std::chrono_literals; diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index f8ce2bc830..b1bea237f5 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -50,7 +50,7 @@ class Transaction_test : public beast::unit_test::suite std::vector> txns; std::vector> metas; - auto const startLegSeq = env.current()->info().seq; + auto const startLegSeq = env.current()->header().seq; for (int i = 0; i < 750; ++i) { env(noop(alice)); @@ -59,7 +59,7 @@ class Transaction_test : public beast::unit_test::suite metas.emplace_back( env.closed()->txRead(env.tx()->getTransactionID()).second); } - auto const endLegSeq = env.closed()->info().seq; + auto const endLegSeq = env.closed()->header().seq; // Find the existing transactions for (size_t i = 0; i < txns.size(); ++i) @@ -302,7 +302,7 @@ class Transaction_test : public beast::unit_test::suite std::vector> txns; std::vector> metas; - auto const startLegSeq = env.current()->info().seq; + auto const startLegSeq = env.current()->header().seq; for (int i = 0; i < 750; ++i) { env(noop(alice)); @@ -311,7 +311,7 @@ class Transaction_test : public beast::unit_test::suite metas.emplace_back( env.closed()->txRead(env.tx()->getTransactionID()).second); } - auto const endLegSeq = env.closed()->info().seq; + auto const endLegSeq = env.closed()->header().seq; // Find the existing transactions for (size_t i = 0; i < txns.size(); ++i) @@ -630,7 +630,7 @@ class Transaction_test : public beast::unit_test::suite auto const alice = Account("alice"); auto const bob = Account("bob"); - auto const startLegSeq = env.current()->info().seq; + auto const startLegSeq = env.current()->header().seq; env.fund(XRP(10000), alice, bob); env(pay(alice, bob, XRP(10))); env.close(); @@ -661,7 +661,7 @@ class Transaction_test : public beast::unit_test::suite Account const alice = Account("alice"); Account const bob = Account("bob"); - std::uint32_t const startLegSeq = env.current()->info().seq; + std::uint32_t const startLegSeq = env.current()->header().seq; env.fund(XRP(10000), alice, bob); env(pay(alice, bob, XRP(10))); env.close(); @@ -709,7 +709,7 @@ class Transaction_test : public beast::unit_test::suite env(pay(alice, bob, XRP(10))); env.close(); - auto const ledgerSeq = env.current()->info().seq; + auto const ledgerSeq = env.current()->header().seq; env(noop(alice), ter(tesSUCCESS)); env.close(); @@ -738,7 +738,7 @@ class Transaction_test : public beast::unit_test::suite auto const alice = Account("alice"); auto const bob = Account("bob"); - auto const startLegSeq = env.current()->info().seq; + auto const startLegSeq = env.current()->header().seq; env.fund(XRP(10000), alice, bob); env(pay(alice, bob, XRP(10))); env.close(); diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index 0a82c3b7e1..b93c3a30e7 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -842,7 +842,7 @@ class ServerStatus_test : public beast::unit_test::suite, // mark the Network as having an Amendment Warning, but won't fail env.app().getOPs().setAmendmentWarned(); - env.app().getOPs().beginConsensus(env.closed()->info().hash, {}); + env.app().getOPs().beginConsensus(env.closed()->header().hash, {}); // consensus doesn't change BEAST_EXPECT( @@ -973,7 +973,7 @@ class ServerStatus_test : public beast::unit_test::suite, // mark the Network as Amendment Blocked, but still won't fail until // ELB is enabled (next step) env.app().getOPs().setAmendmentBlocked(); - env.app().getOPs().beginConsensus(env.closed()->info().hash, {}); + env.app().getOPs().beginConsensus(env.closed()->header().hash, {}); // consensus now sees validation disabled BEAST_EXPECT( diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 09584f2e77..4c2ecbac10 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -135,11 +135,11 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& hash) !built->open() && built->isImmutable(), "ripple::RCLConsensus::Adaptor::acquireLedger : valid ledger state"); XRPL_ASSERT( - built->info().hash == hash, + built->header().hash == hash, "ripple::RCLConsensus::Adaptor::acquireLedger : ledger hash match"); // Notify inbound transactions of the new ledger sequence number - inboundTransactions_.newRound(built->info().seq); + inboundTransactions_.newRound(built->header().seq); return RCLCxLedger(built); } @@ -309,7 +309,7 @@ RCLConsensus::Adaptor::onClose( ledgerMaster_.applyHeldTransactions(); // Tell the ledger master not to acquire the ledger we're probably building - ledgerMaster_.setBuildingLedger(prevLedger->info().seq + 1); + ledgerMaster_.setBuildingLedger(prevLedger->header().seq + 1); auto initialLedger = app_.openLedger().current(); @@ -338,7 +338,7 @@ RCLConsensus::Adaptor::onClose( // pseudo-transactions auto validations = app_.validators().negativeUNLFilter( app_.getValidations().getTrustedForLedger( - prevLedger->info().parentHash, prevLedger->seq() - 1)); + prevLedger->header().parentHash, prevLedger->seq() - 1)); if (validations.size() >= app_.validators().quorum()) { feeVote_->doVoting(prevLedger, validations, initialSet); @@ -364,7 +364,7 @@ RCLConsensus::Adaptor::onClose( if (!wrongLCL) { - LedgerIndex const seq = prevLedger->info().seq + 1; + LedgerIndex const seq = prevLedger->header().seq + 1; RCLCensorshipDetector::TxIDSeqVec proposed; initialSet->visitLeaves( @@ -382,7 +382,7 @@ RCLConsensus::Adaptor::onClose( return Result{ std::move(initialSet), RCLCxPeerPos::Proposal{ - initialLedger->info().parentHash, + initialLedger->header().parentHash, RCLCxPeerPos::Proposal::seqJoin, setHash, closeTime, @@ -663,10 +663,10 @@ RCLConsensus::Adaptor::doAccept( // Do these need to exist? XRPL_ASSERT( - ledgerMaster_.getClosedLedger()->info().hash == built.id(), + ledgerMaster_.getClosedLedger()->header().hash == built.id(), "ripple::RCLConsensus::Adaptor::doAccept : ledger hash match"); XRPL_ASSERT( - app_.openLedger().current()->info().parentHash == built.id(), + app_.openLedger().current()->header().parentHash == built.id(), "ripple::RCLConsensus::Adaptor::doAccept : parent hash match"); } @@ -764,7 +764,7 @@ RCLConsensus::Adaptor::buildLCL( if (auto const replayData = ledgerMaster_.releaseReplay()) { XRPL_ASSERT( - replayData->parent()->info().hash == previousLedger.id(), + replayData->parent()->header().hash == previousLedger.id(), "ripple::RCLConsensus::Adaptor::buildLCL : parent hash match"); return buildLedger(*replayData, tapNONE, app_, j_); } @@ -786,7 +786,7 @@ RCLConsensus::Adaptor::buildLCL( // And stash the ledger in the ledger master if (ledgerMaster_.storeLedger(built)) JLOG(j_.debug()) << "Consensus built ledger we already had"; - else if (app_.getInboundLedgers().find(built->info().hash)) + else if (app_.getInboundLedgers().find(built->header().hash)) JLOG(j_.debug()) << "Consensus built ledger we were acquiring"; else JLOG(j_.debug()) << "Consensus built new ledger"; @@ -833,7 +833,7 @@ RCLConsensus::Adaptor::validate( // validated ledger. This may be the hash of the ledger we are // validating here, and that's fine. if (auto const vl = ledgerMaster_.getValidatedLedger()) - v.setFieldH256(sfValidatedHash, vl->info().hash); + v.setFieldH256(sfValidatedHash, vl->header().hash); v.setFieldU64(sfCookie, valCookie_); diff --git a/src/xrpld/app/consensus/RCLCxLedger.h b/src/xrpld/app/consensus/RCLCxLedger.h index 93b55d76d3..5671fa988d 100644 --- a/src/xrpld/app/consensus/RCLCxLedger.h +++ b/src/xrpld/app/consensus/RCLCxLedger.h @@ -41,49 +41,49 @@ public: Seq const& seq() const { - return ledger_->info().seq; + return ledger_->header().seq; } //! Unique identifier (hash) of this ledger. ID const& id() const { - return ledger_->info().hash; + return ledger_->header().hash; } //! Unique identifier (hash) of this ledger's parent. ID const& parentID() const { - return ledger_->info().parentHash; + return ledger_->header().parentHash; } //! Resolution used when calculating this ledger's close time. NetClock::duration closeTimeResolution() const { - return ledger_->info().closeTimeResolution; + return ledger_->header().closeTimeResolution; } //! Whether consensus process agreed on close time of the ledger. bool closeAgree() const { - return ripple::getCloseAgree(ledger_->info()); + return ripple::getCloseAgree(ledger_->header()); } //! The close time of this ledger NetClock::time_point closeTime() const { - return ledger_->info().closeTime; + return ledger_->header().closeTime; } //! The close time of this ledger's parent. NetClock::time_point parentCloseTime() const { - return ledger_->info().parentCloseTime; + return ledger_->header().parentCloseTime; } //! JSON representation of this ledger. diff --git a/src/xrpld/app/consensus/RCLValidations.cpp b/src/xrpld/app/consensus/RCLValidations.cpp index d6a8747c20..d24f24a5f1 100644 --- a/src/xrpld/app/consensus/RCLValidations.cpp +++ b/src/xrpld/app/consensus/RCLValidations.cpp @@ -23,7 +23,7 @@ RCLValidatedLedger::RCLValidatedLedger(MakeGenesis) RCLValidatedLedger::RCLValidatedLedger( std::shared_ptr const& ledger, beast::Journal j) - : ledgerID_{ledger->info().hash}, ledgerSeq_{ledger->seq()}, j_{j} + : ledgerID_{ledger->header().hash}, ledgerSeq_{ledger->seq()}, j_{j} { auto const hashIndex = ledger->read(keylet::skip()); if (hashIndex) @@ -136,7 +136,7 @@ RCLValidationsAdaptor::acquire(LedgerHash const& hash) !ledger->open() && ledger->isImmutable(), "ripple::RCLValidationsAdaptor::acquire : valid ledger state"); XRPL_ASSERT( - ledger->info().hash == hash, + ledger->header().hash == hash, "ripple::RCLValidationsAdaptor::acquire : ledger hash match"); return RCLValidatedLedger(std::move(ledger), j_); diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index aaf71b2dc3..055d9ddc9d 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -157,9 +157,9 @@ Ledger::Ledger( , rules_{config.features} , j_(beast::Journal(beast::Journal::getNullSink())) { - info_.seq = 1; - info_.drops = INITIAL_XRP; - info_.closeTimeResolution = ledgerGenesisTimeResolution; + header_.seq = 1; + header_.drops = INITIAL_XRP; + header_.closeTimeResolution = ledgerGenesisTimeResolution; static auto const id = calcAccountID( generateKeyPair(KeyType::secp256k1, generateSeed("masterpassphrase")) @@ -168,7 +168,7 @@ Ledger::Ledger( auto const sle = std::make_shared(keylet::account(id)); sle->setFieldU32(sfSequence, 1); sle->setAccountID(sfAccount, id); - sle->setFieldAmount(sfBalance, info_.drops); + sle->setFieldAmount(sfBalance, header_.drops); rawInsert(sle); } @@ -220,23 +220,25 @@ Ledger::Ledger( , txMap_(SHAMapType::TRANSACTION, info.txHash, family) , stateMap_(SHAMapType::STATE, info.accountHash, family) , rules_(config.features) - , info_(info) + , header_(info) , j_(j) { loaded = true; - if (info_.txHash.isNonZero() && - !txMap_.fetchRoot(SHAMapHash{info_.txHash}, nullptr)) + if (header_.txHash.isNonZero() && + !txMap_.fetchRoot(SHAMapHash{header_.txHash}, nullptr)) { loaded = false; - JLOG(j.warn()) << "Don't have transaction root for ledger" << info_.seq; + JLOG(j.warn()) << "Don't have transaction root for ledger" + << header_.seq; } - if (info_.accountHash.isNonZero() && - !stateMap_.fetchRoot(SHAMapHash{info_.accountHash}, nullptr)) + if (header_.accountHash.isNonZero() && + !stateMap_.fetchRoot(SHAMapHash{header_.accountHash}, nullptr)) { loaded = false; - JLOG(j.warn()) << "Don't have state data root for ledger" << info_.seq; + JLOG(j.warn()) << "Don't have state data root for ledger" + << header_.seq; } txMap_.setImmutable(); @@ -248,9 +250,9 @@ Ledger::Ledger( if (!loaded) { - info_.hash = calculateLedgerHash(info_); + header_.hash = calculateLedgerHash(header_); if (acquire) - family.missingNodeAcquireByHash(info_.hash, info_.seq); + family.missingNodeAcquireByHash(header_.hash, header_.seq); } } @@ -263,25 +265,26 @@ Ledger::Ledger(Ledger const& prevLedger, NetClock::time_point closeTime) , rules_(prevLedger.rules_) , j_(beast::Journal(beast::Journal::getNullSink())) { - info_.seq = prevLedger.info_.seq + 1; - info_.parentCloseTime = prevLedger.info_.closeTime; - info_.hash = prevLedger.info().hash + uint256(1); - info_.drops = prevLedger.info().drops; - info_.closeTimeResolution = prevLedger.info_.closeTimeResolution; - info_.parentHash = prevLedger.info().hash; - info_.closeTimeResolution = getNextLedgerTimeResolution( - prevLedger.info_.closeTimeResolution, - getCloseAgree(prevLedger.info()), - info_.seq); + header_.seq = prevLedger.header_.seq + 1; + header_.parentCloseTime = prevLedger.header_.closeTime; + header_.hash = prevLedger.header().hash + uint256(1); + header_.drops = prevLedger.header().drops; + header_.closeTimeResolution = prevLedger.header_.closeTimeResolution; + header_.parentHash = prevLedger.header().hash; + header_.closeTimeResolution = getNextLedgerTimeResolution( + prevLedger.header_.closeTimeResolution, + getCloseAgree(prevLedger.header()), + header_.seq); - if (prevLedger.info_.closeTime == NetClock::time_point{}) + if (prevLedger.header_.closeTime == NetClock::time_point{}) { - info_.closeTime = roundCloseTime(closeTime, info_.closeTimeResolution); + header_.closeTime = + roundCloseTime(closeTime, header_.closeTimeResolution); } else { - info_.closeTime = - prevLedger.info_.closeTime + info_.closeTimeResolution; + header_.closeTime = + prevLedger.header_.closeTime + header_.closeTimeResolution; } } @@ -290,10 +293,10 @@ Ledger::Ledger(LedgerHeader const& info, Config const& config, Family& family) , txMap_(SHAMapType::TRANSACTION, info.txHash, family) , stateMap_(SHAMapType::STATE, info.accountHash, family) , rules_{config.features} - , info_(info) + , header_(info) , j_(beast::Journal(beast::Journal::getNullSink())) { - info_.hash = calculateLedgerHash(info_); + header_.hash = calculateLedgerHash(header_); } Ledger::Ledger( @@ -307,9 +310,9 @@ Ledger::Ledger( , rules_{config.features} , j_(beast::Journal(beast::Journal::getNullSink())) { - info_.seq = ledgerSeq; - info_.closeTime = closeTime; - info_.closeTimeResolution = ledgerDefaultTimeResolution; + header_.seq = ledgerSeq; + header_.closeTime = closeTime; + header_.closeTimeResolution = ledgerDefaultTimeResolution; defaultFees(config); setup(); } @@ -321,12 +324,12 @@ Ledger::setImmutable(bool rehash) // place the hash transitions to valid if (!mImmutable && rehash) { - info_.txHash = txMap_.getHash().as_uint256(); - info_.accountHash = stateMap_.getHash().as_uint256(); + header_.txHash = txMap_.getHash().as_uint256(); + header_.accountHash = stateMap_.getHash().as_uint256(); } if (rehash) - info_.hash = calculateLedgerHash(info_); + header_.hash = calculateLedgerHash(header_); mImmutable = true; txMap_.setImmutable(); @@ -343,9 +346,9 @@ Ledger::setAccepted( // Used when we witnessed the consensus. XRPL_ASSERT(!open(), "ripple::Ledger::setAccepted : valid ledger state"); - info_.closeTime = closeTime; - info_.closeTimeResolution = closeResolution; - info_.closeFlags = correctCloseTime ? 0 : sLCF_NoConsensusTime; + header_.closeTime = closeTime; + header_.closeTimeResolution = closeResolution; + header_.closeFlags = correctCloseTime ? 0 : sLCF_NoConsensusTime; setImmutable(); } @@ -788,11 +791,11 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const std::vector missingNodes1; std::vector missingNodes2; - if (stateMap_.getHash().isZero() && !info_.accountHash.isZero() && - !stateMap_.fetchRoot(SHAMapHash{info_.accountHash}, nullptr)) + if (stateMap_.getHash().isZero() && !header_.accountHash.isZero() && + !stateMap_.fetchRoot(SHAMapHash{header_.accountHash}, nullptr)) { missingNodes1.emplace_back( - SHAMapType::STATE, SHAMapHash{info_.accountHash}); + SHAMapType::STATE, SHAMapHash{header_.accountHash}); } else { @@ -811,11 +814,11 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const } } - if (txMap_.getHash().isZero() && info_.txHash.isNonZero() && - !txMap_.fetchRoot(SHAMapHash{info_.txHash}, nullptr)) + if (txMap_.getHash().isZero() && header_.txHash.isNonZero() && + !txMap_.fetchRoot(SHAMapHash{header_.txHash}, nullptr)) { missingNodes2.emplace_back( - SHAMapType::TRANSACTION, SHAMapHash{info_.txHash}); + SHAMapType::TRANSACTION, SHAMapHash{header_.txHash}); } else { @@ -836,9 +839,9 @@ Ledger::walkLedger(beast::Journal j, bool parallel) const bool Ledger::assertSensible(beast::Journal ledgerJ) const { - if (info_.hash.isNonZero() && info_.accountHash.isNonZero() && - (info_.accountHash == stateMap_.getHash().as_uint256()) && - (info_.txHash == txMap_.getHash().as_uint256())) + if (header_.hash.isNonZero() && header_.accountHash.isNonZero() && + (header_.accountHash == stateMap_.getHash().as_uint256()) && + (header_.txHash == txMap_.getHash().as_uint256())) { return true; } @@ -846,8 +849,8 @@ Ledger::assertSensible(beast::Journal ledgerJ) const // LCOV_EXCL_START Json::Value j = getJson({*this, {}}); - j[jss::accountTreeHash] = to_string(info_.accountHash); - j[jss::transTreeHash] = to_string(info_.txHash); + j[jss::accountTreeHash] = to_string(header_.accountHash); + j[jss::transTreeHash] = to_string(header_.txHash); JLOG(ledgerJ.fatal()) << "ledger is not sensible" << j; @@ -862,10 +865,10 @@ Ledger::assertSensible(beast::Journal ledgerJ) const void Ledger::updateSkipList() { - if (info_.seq == 0) // genesis ledger has no previous ledger + if (header_.seq == 0) // genesis ledger has no previous ledger return; - std::uint32_t prevIndex = info_.seq - 1; + std::uint32_t prevIndex = header_.seq - 1; // update record of every 256th ledger if ((prevIndex & 0xff) == 0) @@ -889,7 +892,7 @@ Ledger::updateSkipList() XRPL_ASSERT( hashes.size() <= 256, "ripple::Ledger::updateSkipList : first maximum hashes size"); - hashes.push_back(info_.parentHash); + hashes.push_back(header_.parentHash); sle->setFieldV256(sfHashes, STVector256(hashes)); sle->setFieldU32(sfLastLedgerSequence, prevIndex); if (created) @@ -918,7 +921,7 @@ Ledger::updateSkipList() "ripple::Ledger::updateSkipList : second maximum hashes size"); if (hashes.size() == 256) hashes.erase(hashes.begin()); - hashes.push_back(info_.parentHash); + hashes.push_back(header_.parentHash); sle->setFieldV256(sfHashes, STVector256(hashes)); sle->setFieldU32(sfLastLedgerSequence, prevIndex); if (created) @@ -930,12 +933,12 @@ Ledger::updateSkipList() bool Ledger::isFlagLedger() const { - return info_.seq % FLAG_LEDGER_INTERVAL == 0; + return header_.seq % FLAG_LEDGER_INTERVAL == 0; } bool Ledger::isVotingLedger() const { - return (info_.seq + 1) % FLAG_LEDGER_INTERVAL == 0; + return (header_.seq + 1) % FLAG_LEDGER_INTERVAL == 0; } bool @@ -951,7 +954,7 @@ saveValidatedLedger( bool current) { auto j = app.journal("Ledger"); - auto seq = ledger->info().seq; + auto seq = ledger->header().seq; if (!app.pendingSaves().startWork(seq)) { // The save was completed synchronously @@ -982,13 +985,13 @@ pendSaveValidated( bool isCurrent) { if (!app.getHashRouter().setFlags( - ledger->info().hash, HashRouterFlags::SAVED)) + ledger->header().hash, HashRouterFlags::SAVED)) { // We have tried to save this ledger recently auto stream = app.journal("Ledger").debug(); - JLOG(stream) << "Double pend save for " << ledger->info().seq; + JLOG(stream) << "Double pend save for " << ledger->header().seq; - if (!isSynchronous || !app.pendingSaves().pending(ledger->info().seq)) + if (!isSynchronous || !app.pendingSaves().pending(ledger->header().seq)) { // Either we don't need it to be finished // or it is finished @@ -999,11 +1002,11 @@ pendSaveValidated( XRPL_ASSERT( ledger->isImmutable(), "ripple::pendSaveValidated : immutable ledger"); - if (!app.pendingSaves().shouldWork(ledger->info().seq, isSynchronous)) + if (!app.pendingSaves().shouldWork(ledger->header().seq, isSynchronous)) { auto stream = app.journal("Ledger").debug(); JLOG(stream) << "Pend save with seq in pending saves " - << ledger->info().seq; + << ledger->header().seq; return true; } @@ -1075,12 +1078,12 @@ finishLoadByIndexOrHash( return; XRPL_ASSERT( - ledger->info().seq < XRP_LEDGER_EARLIEST_FEES || + ledger->header().seq < XRP_LEDGER_EARLIEST_FEES || ledger->read(keylet::fees()), "ripple::finishLoadByIndexOrHash : valid ledger fees"); ledger->setImmutable(); - JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->info().hash); + JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->header().hash); ledger->setFull(); } @@ -1117,7 +1120,7 @@ loadByHash(uint256 const& ledgerHash, Application& app, bool acquire) std::shared_ptr ledger = loadLedgerHelper(*info, app, acquire); finishLoadByIndexOrHash(ledger, app.config(), app.journal("Ledger")); XRPL_ASSERT( - !ledger || ledger->info().hash == ledgerHash, + !ledger || ledger->header().hash == ledgerHash, "ripple::loadByHash : ledger hash match if loaded"); return ledger; } diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index cc3bc43c50..0e849389fd 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -130,15 +130,15 @@ public: } LedgerHeader const& - info() const override + header() const override { - return info_; + return header_; } void setLedgerInfo(LedgerHeader const& info) { - info_ = info; + header_ = info; } Fees const& @@ -213,7 +213,7 @@ public: void rawDestroyXRP(XRPAmount const& fee) override { - info_.drops -= fee; + header_.drops -= fee; } // @@ -244,7 +244,7 @@ public: void setValidated() const { - info_.validated = true; + header_.validated = true; } void @@ -276,15 +276,15 @@ public: setFull() const { txMap_.setFull(); - txMap_.setLedgerSeq(info_.seq); + txMap_.setLedgerSeq(header_.seq); stateMap_.setFull(); - stateMap_.setLedgerSeq(info_.seq); + stateMap_.setLedgerSeq(header_.seq); } void setTotalDrops(std::uint64_t totDrops) { - info_.drops = totDrops; + header_.drops = totDrops; } SHAMap const& @@ -397,7 +397,7 @@ private: Fees fees_; Rules rules_; - LedgerHeader info_; + LedgerHeader header_; beast::Journal j_; }; diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index 4f2660c70a..c084297641 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -47,9 +47,9 @@ LedgerHistory::insert( std::unique_lock sl(m_ledgers_by_hash.peekMutex()); bool const alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache( - ledger->info().hash, ledger); + ledger->header().hash, ledger); if (validated) - mLedgersByIndex[ledger->info().seq] = ledger->info().hash; + mLedgersByIndex[ledger->header().seq] = ledger->header().hash; return alreadyHad; } @@ -84,7 +84,7 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index) return ret; XRPL_ASSERT( - ret->info().seq == index, + ret->header().seq == index, "ripple::LedgerHistory::getLedgerBySeq : result sequence match"); { @@ -94,9 +94,9 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index) XRPL_ASSERT( ret->isImmutable(), "ripple::LedgerHistory::getLedgerBySeq : immutable result ledger"); - m_ledgers_by_hash.canonicalize_replace_client(ret->info().hash, ret); - mLedgersByIndex[ret->info().seq] = ret->info().hash; - return (ret->info().seq == index) ? ret : nullptr; + m_ledgers_by_hash.canonicalize_replace_client(ret->header().hash, ret); + mLedgersByIndex[ret->header().seq] = ret->header().hash; + return (ret->header().seq == index) ? ret : nullptr; } } @@ -112,7 +112,7 @@ LedgerHistory::getLedgerByHash(LedgerHash const& hash) "ripple::LedgerHistory::getLedgerByHash : immutable fetched " "ledger"); XRPL_ASSERT( - ret->info().hash == hash, + ret->header().hash == hash, "ripple::LedgerHistory::getLedgerByHash : fetched ledger hash " "match"); return ret; @@ -127,11 +127,11 @@ LedgerHistory::getLedgerByHash(LedgerHash const& hash) ret->isImmutable(), "ripple::LedgerHistory::getLedgerByHash : immutable loaded ledger"); XRPL_ASSERT( - ret->info().hash == hash, + ret->header().hash == hash, "ripple::LedgerHistory::getLedgerByHash : loaded ledger hash match"); - m_ledgers_by_hash.canonicalize_replace_client(ret->info().hash, ret); + m_ledgers_by_hash.canonicalize_replace_client(ret->header().hash, ret); XRPL_ASSERT( - ret->info().hash == hash, + ret->header().hash == hash, "ripple::LedgerHistory::getLedgerByHash : result hash match"); return ret; @@ -342,7 +342,7 @@ LedgerHistory::handleMismatch( } XRPL_ASSERT( - builtLedger->info().seq == validLedger->info().seq, + builtLedger->header().seq == validLedger->header().seq, "ripple::LedgerHistory::handleMismatch : sequence match"); if (auto stream = j_.debug()) @@ -356,14 +356,14 @@ LedgerHistory::handleMismatch( // failure from transaction processing difference // Disagreement over prior ledger indicates sync issue - if (builtLedger->info().parentHash != validLedger->info().parentHash) + if (builtLedger->header().parentHash != validLedger->header().parentHash) { JLOG(j_.error()) << "MISMATCH on prior ledger"; return; } // Disagreement over close time indicates Byzantine failure - if (builtLedger->info().closeTime != validLedger->info().closeTime) + if (builtLedger->header().closeTime != validLedger->header().closeTime) { JLOG(j_.error()) << "MISMATCH on close time"; return; @@ -434,8 +434,8 @@ LedgerHistory::builtLedger( uint256 const& consensusHash, Json::Value consensus) { - LedgerIndex index = ledger->info().seq; - LedgerHash hash = ledger->info().hash; + LedgerIndex index = ledger->header().seq; + LedgerHash hash = ledger->header().hash; XRPL_ASSERT( !hash.isZero(), "ripple::LedgerHistory::builtLedger : nonzero hash"); @@ -475,8 +475,8 @@ LedgerHistory::validatedLedger( std::shared_ptr const& ledger, std::optional const& consensusHash) { - LedgerIndex index = ledger->info().seq; - LedgerHash hash = ledger->info().hash; + LedgerIndex index = ledger->header().seq; + LedgerHash hash = ledger->header().hash; XRPL_ASSERT( !hash.isZero(), "ripple::LedgerHistory::validatedLedger : nonzero hash"); @@ -533,7 +533,7 @@ LedgerHistory::clearLedgerCachePrior(LedgerIndex seq) for (LedgerHash it : m_ledgers_by_hash.getKeys()) { auto const ledger = getLedgerByHash(it); - if (!ledger || ledger->info().seq < seq) + if (!ledger || ledger->header().seq < seq) m_ledgers_by_hash.del(it, false); } } diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index dd3593e1cf..d7153c0fe9 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -58,7 +58,7 @@ buildLedgerImpl( // Accept ledger XRPL_ASSERT( - built->info().seq < XRP_LEDGER_EARLIEST_FEES || + built->header().seq < XRP_LEDGER_EARLIEST_FEES || built->read(keylet::fees()), "ripple::buildLedgerImpl : valid ledger fees"); built->setAccepted(closeTime, closeResolution, closeTimeCorrect); @@ -213,13 +213,13 @@ buildLedger( { auto const& replayLedger = replayData.replay(); - JLOG(j.debug()) << "Report: Replay Ledger " << replayLedger->info().hash; + JLOG(j.debug()) << "Report: Replay Ledger " << replayLedger->header().hash; return buildLedgerImpl( replayData.parent(), - replayLedger->info().closeTime, - ((replayLedger->info().closeFlags & sLCF_NoConsensusTime) == 0), - replayLedger->info().closeTimeResolution, + replayLedger->header().closeTime, + ((replayLedger->header().closeFlags & sLCF_NoConsensusTime) == 0), + replayLedger->header().closeTimeResolution, app, j, [&](OpenView& accum, std::shared_ptr const& built) { diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index 5bfa9144d3..24de3cce14 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -102,7 +102,7 @@ InboundLedger::init(ScopedLockType& collectionLock) JLOG(journal_.debug()) << "Acquiring ledger we already have in " << " local store. " << hash_; XRPL_ASSERT( - mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES || + mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), "ripple::InboundLedger::init : valid ledger fees"); mLedger->setImmutable(); @@ -206,14 +206,15 @@ neededHashes( std::vector InboundLedger::neededTxHashes(int max, SHAMapSyncFilter* filter) const { - return neededHashes(mLedger->info().txHash, mLedger->txMap(), max, filter); + return neededHashes( + mLedger->header().txHash, mLedger->txMap(), max, filter); } std::vector InboundLedger::neededStateHashes(int max, SHAMapSyncFilter* filter) const { return neededHashes( - mLedger->info().accountHash, mLedger->stateMap(), max, filter); + mLedger->header().accountHash, mLedger->stateMap(), max, filter); } // See how much of the ledger data is stored locally @@ -229,8 +230,8 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) deserializePrefixedHeader(makeSlice(data)), app_.config(), app_.getNodeFamily()); - if (mLedger->info().hash != hash_ || - (mSeq != 0 && mSeq != mLedger->info().seq)) + if (mLedger->header().hash != hash_ || + (mSeq != 0 && mSeq != mLedger->header().seq)) { // We know for a fact the ledger can never be acquired JLOG(journal_.warn()) @@ -256,7 +257,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) { Blob blob{nodeObject->getData()}; dstDB.store( - hotLEDGER, std::move(blob), hash_, mLedger->info().seq); + hotLEDGER, std::move(blob), hash_, mLedger->header().seq); } } else @@ -274,11 +275,11 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) // Store the ledger header in the ledger's database mLedger->stateMap().family().db().store( - hotLEDGER, std::move(*data), hash_, mLedger->info().seq); + hotLEDGER, std::move(*data), hash_, mLedger->header().seq); } if (mSeq == 0) - mSeq = mLedger->info().seq; + mSeq = mLedger->header().seq; mLedger->stateMap().setLedgerSeq(mSeq); mLedger->txMap().setLedgerSeq(mSeq); mHaveHeader = true; @@ -286,7 +287,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) if (!mHaveTransactions) { - if (mLedger->info().txHash.isZero()) + if (mLedger->header().txHash.isZero()) { JLOG(journal_.trace()) << "No TXNs to fetch"; mHaveTransactions = true; @@ -296,7 +297,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) TransactionStateSF filter( mLedger->txMap().family().db(), app_.getLedgerMaster()); if (mLedger->txMap().fetchRoot( - SHAMapHash{mLedger->info().txHash}, &filter)) + SHAMapHash{mLedger->header().txHash}, &filter)) { if (neededTxHashes(1, &filter).empty()) { @@ -309,7 +310,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) if (!mHaveState) { - if (mLedger->info().accountHash.isZero()) + if (mLedger->header().accountHash.isZero()) { JLOG(journal_.fatal()) << "We are acquiring a ledger with a zero account hash"; @@ -319,7 +320,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) AccountStateSF filter( mLedger->stateMap().family().db(), app_.getLedgerMaster()); if (mLedger->stateMap().fetchRoot( - SHAMapHash{mLedger->info().accountHash}, &filter)) + SHAMapHash{mLedger->header().accountHash}, &filter)) { if (neededStateHashes(1, &filter).empty()) { @@ -334,7 +335,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) JLOG(journal_.debug()) << "Had everything locally"; complete_ = true; XRPL_ASSERT( - mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES || + mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), "ripple::InboundLedger::tryDB : valid ledger fees"); mLedger->setImmutable(); @@ -437,7 +438,7 @@ InboundLedger::done() if (complete_ && !failed_ && mLedger) { XRPL_ASSERT( - mLedger->info().seq < XRP_LEDGER_EARLIEST_FEES || + mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), "ripple::InboundLedger::done : valid ledger fees"); mLedger->setImmutable(); @@ -582,7 +583,7 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) } if (mLedger) - tmGL.set_ledgerseq(mLedger->info().seq); + tmGL.set_ledgerseq(mLedger->header().seq); if (reason != TriggerReason::reply) { @@ -744,7 +745,7 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) { JLOG(journal_.debug()) << "Done:" << (complete_ ? " complete" : "") - << (failed_ ? " failed " : " ") << mLedger->info().seq; + << (failed_ ? " failed " : " ") << mLedger->header().seq; sl.unlock(); done(); } @@ -808,17 +809,17 @@ InboundLedger::takeHeader(std::string const& data) auto* f = &app_.getNodeFamily(); mLedger = std::make_shared( deserializeHeader(makeSlice(data)), app_.config(), *f); - if (mLedger->info().hash != hash_ || - (mSeq != 0 && mSeq != mLedger->info().seq)) + if (mLedger->header().hash != hash_ || + (mSeq != 0 && mSeq != mLedger->header().seq)) { JLOG(journal_.warn()) - << "Acquire hash mismatch: " << mLedger->info().hash + << "Acquire hash mismatch: " << mLedger->header().hash << "!=" << hash_; mLedger.reset(); return false; } if (mSeq == 0) - mSeq = mLedger->info().seq; + mSeq = mLedger->header().seq; mLedger->stateMap().setLedgerSeq(mSeq); mLedger->txMap().setLedgerSeq(mSeq); mHaveHeader = true; @@ -828,10 +829,10 @@ InboundLedger::takeHeader(std::string const& data) s.addRaw(data.data(), data.size()); f->db().store(hotLEDGER, std::move(s.modData()), hash_, mSeq); - if (mLedger->info().txHash.isZero()) + if (mLedger->header().txHash.isZero()) mHaveTransactions = true; - if (mLedger->info().accountHash.isZero()) + if (mLedger->header().accountHash.isZero()) mHaveState = true; mLedger->txMap().setSynching(); @@ -871,12 +872,12 @@ InboundLedger::receiveNode(protocol::TMLedgerData& packet, SHAMapAddNode& san) if (packet.type() == protocol::liTX_NODE) return { mLedger->txMap(), - SHAMapHash{mLedger->info().txHash}, + SHAMapHash{mLedger->header().txHash}, std::make_unique( mLedger->txMap().family().db(), app_.getLedgerMaster())}; return { mLedger->stateMap(), - SHAMapHash{mLedger->info().accountHash}, + SHAMapHash{mLedger->header().accountHash}, std::make_unique( mLedger->stateMap().family().db(), app_.getLedgerMaster())}; }(); @@ -953,7 +954,7 @@ InboundLedger::takeAsRootNode(Slice const& data, SHAMapAddNode& san) AccountStateSF filter( mLedger->stateMap().family().db(), app_.getLedgerMaster()); san += mLedger->stateMap().addRootNode( - SHAMapHash{mLedger->info().accountHash}, data, &filter); + SHAMapHash{mLedger->header().accountHash}, data, &filter); return san.isGood(); } @@ -980,7 +981,7 @@ InboundLedger::takeTxRootNode(Slice const& data, SHAMapAddNode& san) TransactionStateSF filter( mLedger->txMap().family().db(), app_.getLedgerMaster()); san += mLedger->txMap().addRootNode( - SHAMapHash{mLedger->info().txHash}, data, &filter); + SHAMapHash{mLedger->header().txHash}, data, &filter); return san.isGood(); } diff --git a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp index 5de811fc39..639d8250ac 100644 --- a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp +++ b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp @@ -233,10 +233,10 @@ private: catch (SHAMapMissingNode const& mn) { JLOG(j_.warn()) - << "Ledger #" << ledger->info().seq << ": " << mn.what(); + << "Ledger #" << ledger->header().seq << ": " << mn.what(); app_.getInboundLedgers().acquire( - ledger->info().hash, - ledger->info().seq, + ledger->header().hash, + ledger->header().seq, InboundLedger::Reason::GENERIC); } return hash ? *hash : beast::zero; // kludge @@ -268,8 +268,8 @@ private: } auto dbLedger = loadByIndex(ledgerIndex, app_); - if (!dbLedger || (dbLedger->info().hash != ledgerHash) || - (dbLedger->info().parentHash != nodeLedger->info().parentHash)) + if (!dbLedger || (dbLedger->header().hash != ledgerHash) || + (dbLedger->header().parentHash != nodeLedger->header().parentHash)) { // Ideally we'd also check for more than one ledger with that index JLOG(j_.debug()) @@ -314,7 +314,7 @@ private: { LedgerHash ledgerHash; - if (!referenceLedger || (referenceLedger->info().seq < ledgerIndex)) + if (!referenceLedger || (referenceLedger->header().seq < ledgerIndex)) { referenceLedger = app_.getLedgerMaster().getValidatedLedger(); if (!referenceLedger) @@ -324,7 +324,7 @@ private: } } - if (referenceLedger->info().seq >= ledgerIndex) + if (referenceLedger->header().seq >= ledgerIndex) { // See if the hash for the ledger we need is in the reference ledger ledgerHash = getLedgerHash(referenceLedger, ledgerIndex); diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index 91b1dca5e2..c803c0bdd4 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -184,12 +184,12 @@ LedgerDeltaAcquire::tryBuild(std::shared_ptr const& parent) parent->seq() + 1 == replayTemp_->seq(), "ripple::LedgerDeltaAcquire::tryBuild : parent sequence match"); XRPL_ASSERT( - parent->info().hash == replayTemp_->info().parentHash, + parent->header().hash == replayTemp_->header().parentHash, "ripple::LedgerDeltaAcquire::tryBuild : parent hash match"); // build ledger LedgerReplay replayData(parent, replayTemp_, std::move(orderedTxns_)); fullLedger_ = buildLedger(replayData, tapNONE, app_, journal_); - if (fullLedger_ && fullLedger_->info().hash == hash_) + if (fullLedger_ && fullLedger_->header().hash == hash_) { JLOG(journal_.info()) << "Built " << hash_; onLedgerBuilt(sl); @@ -200,7 +200,7 @@ LedgerDeltaAcquire::tryBuild(std::shared_ptr const& parent) failed_ = true; complete_ = false; JLOG(journal_.error()) << "tryBuild failed " << hash_ << " with parent " - << parent->info().hash; + << parent->header().hash; Throw("Cannot replay ledger"); } } diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 0c3b3266d9..3e75a28abd 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -103,7 +103,7 @@ LedgerMaster::LedgerMaster( LedgerIndex LedgerMaster::getCurrentLedgerIndex() { - return app_.openLedger().current()->info().seq; + return app_.openLedger().current()->header().seq; } LedgerIndex @@ -227,7 +227,7 @@ LedgerMaster::setValidLedger(std::shared_ptr const& l) { auto validations = app_.validators().negativeUNLFilter( app_.getValidations().getTrustedForLedger( - l->info().hash, l->info().seq)); + l->header().hash, l->header().seq)); times.reserve(validations.size()); for (auto const& val : validations) times.push_back(val->getSignTime()); @@ -248,18 +248,18 @@ LedgerMaster::setValidLedger(std::shared_ptr const& l) } else { - signTime = l->info().closeTime; + signTime = l->header().closeTime; } mValidLedger.set(l); mValidLedgerSign = signTime.time_since_epoch().count(); XRPL_ASSERT( mValidLedgerSeq || !app_.getMaxDisallowedLedger() || - l->info().seq + max_ledger_difference_ > + l->header().seq + max_ledger_difference_ > app_.getMaxDisallowedLedger(), "ripple::LedgerMaster::setValidLedger : valid ledger sequence"); (void)max_ledger_difference_; - mValidLedgerSeq = l->info().seq; + mValidLedgerSeq = l->header().seq; app_.getOPs().updateLocalTx(*l); app_.getSHAMapStore().onLedgerClosed(getValidatedLedger()); @@ -304,8 +304,8 @@ void LedgerMaster::setPubLedger(std::shared_ptr const& l) { mPubLedger = l; - mPubLedgerClose = l->info().closeTime.time_since_epoch().count(); - mPubLedgerSeq = l->info().seq; + mPubLedgerClose = l->header().closeTime.time_since_epoch().count(); + mPubLedgerSeq = l->header().seq; } void @@ -328,11 +328,11 @@ LedgerMaster::canBeCurrent(std::shared_ptr const& ledger) // last validated ledger auto validLedger = getValidatedLedger(); - if (validLedger && (ledger->info().seq < validLedger->info().seq)) + if (validLedger && (ledger->header().seq < validLedger->header().seq)) { JLOG(m_journal.trace()) - << "Candidate for current ledger has low seq " << ledger->info().seq - << " < " << validLedger->info().seq; + << "Candidate for current ledger has low seq " + << ledger->header().seq << " < " << validLedger->header().seq; return false; } @@ -342,17 +342,17 @@ LedgerMaster::canBeCurrent(std::shared_ptr const& ledger) // few ledgers as our clock can be off when we first start up auto closeTime = app_.timeKeeper().closeTime(); - auto ledgerClose = ledger->info().parentCloseTime; + auto ledgerClose = ledger->header().parentCloseTime; using namespace std::chrono_literals; - if ((validLedger || (ledger->info().seq > 10)) && + if ((validLedger || (ledger->header().seq > 10)) && ((std::max(closeTime, ledgerClose) - std::min(closeTime, ledgerClose)) > 5min)) { JLOG(m_journal.warn()) << "Candidate for current ledger has close time " << to_string(ledgerClose) << " at network time " - << to_string(closeTime) << " seq " << ledger->info().seq; + << to_string(closeTime) << " seq " << ledger->header().seq; return false; } @@ -363,25 +363,25 @@ LedgerMaster::canBeCurrent(std::shared_ptr const& ledger) // every two seconds. The goal is to prevent a malicious ledger // from increasing our sequence unreasonably high - LedgerIndex maxSeq = validLedger->info().seq + 10; + LedgerIndex maxSeq = validLedger->header().seq + 10; - if (closeTime > validLedger->info().parentCloseTime) + if (closeTime > validLedger->header().parentCloseTime) maxSeq += std::chrono::duration_cast( - closeTime - validLedger->info().parentCloseTime) + closeTime - validLedger->header().parentCloseTime) .count() / 2; - if (ledger->info().seq > maxSeq) + if (ledger->header().seq > maxSeq) { JLOG(m_journal.warn()) << "Candidate for current ledger has high seq " - << ledger->info().seq << " > " << maxSeq; + << ledger->header().seq << " > " << maxSeq; return false; } JLOG(m_journal.trace()) - << "Acceptable seq range: " << validLedger->info().seq - << " <= " << ledger->info().seq << " <= " << maxSeq; + << "Acceptable seq range: " << validLedger->header().seq + << " <= " << ledger->header().seq << " <= " << maxSeq; } return true; @@ -422,7 +422,7 @@ LedgerMaster::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash) bool LedgerMaster::storeLedger(std::shared_ptr ledger) { - bool validated = ledger->info().validated; + bool validated = ledger->header().validated; // Returns true if we already had the ledger return mLedgerHistory.insert(std::move(ledger), validated); } @@ -439,7 +439,7 @@ LedgerMaster::applyHeldTransactions() std::lock_guard sl(m_mutex); // VFALCO NOTE The hash for an open ledger is undefined so we use // something that is a reasonable substitute. - CanonicalTXSet set(app_.openLedger().current()->info().parentHash); + CanonicalTXSet set(app_.openLedger().current()->header().parentHash); std::swap(mHeldTransactions, set); return set; }(); @@ -482,10 +482,10 @@ LedgerMaster::isValidated(ReadView const& ledger) if (ledger.open()) return false; - if (ledger.info().validated) + if (ledger.header().validated) return true; - auto const seq = ledger.info().seq; + auto const seq = ledger.header().seq; try { // Use the skip list in the last validated ledger to see if ledger @@ -493,7 +493,7 @@ LedgerMaster::isValidated(ReadView const& ledger) // validated). auto const hash = walkHashBySeq(seq, InboundLedger::Reason::GENERIC); - if (!hash || ledger.info().hash != *hash) + if (!hash || ledger.header().hash != *hash) { // This ledger's hash is not the hash of the validated ledger if (hash) @@ -503,7 +503,7 @@ LedgerMaster::isValidated(ReadView const& ledger) "ripple::LedgerMaster::isValidated : nonzero hash"); uint256 valHash = app_.getRelationalDatabase().getHashByIndex(seq); - if (valHash == ledger.info().hash) + if (valHash == ledger.header().hash) { // SQL database doesn't match ledger chain clearLedger(seq); @@ -519,7 +519,7 @@ LedgerMaster::isValidated(ReadView const& ledger) } // Mark ledger as validated to save time if we see it again. - ledger.info().validated = true; + ledger.header().validated = true; return true; } @@ -597,7 +597,7 @@ LedgerMaster::getEarliestFetch() { // The earliest ledger we will let people fetch is ledger zero, // unless that creates a larger range than allowed - std::uint32_t e = getClosedLedger()->info().seq; + std::uint32_t e = getClosedLedger()->header().seq; if (e > fetch_depth_) e -= fetch_depth_; @@ -609,8 +609,8 @@ LedgerMaster::getEarliestFetch() void LedgerMaster::tryFill(std::shared_ptr ledger) { - std::uint32_t seq = ledger->info().seq; - uint256 prevHash = ledger->info().parentHash; + std::uint32_t seq = ledger->header().seq; + uint256 prevHash = ledger->header().parentHash; std::map ledgerHashes; @@ -732,7 +732,7 @@ LedgerMaster::fixMismatch(ReadView const& ledger) int invalidate = 0; std::optional hash; - for (std::uint32_t lSeq = ledger.info().seq - 1; lSeq > 0; --lSeq) + for (std::uint32_t lSeq = ledger.header().seq - 1; lSeq > 0; --lSeq) { if (haveLedger(lSeq)) { @@ -754,7 +754,7 @@ LedgerMaster::fixMismatch(ReadView const& ledger) // try to close the seam auto otherLedger = getLedgerBySeq(lSeq); - if (otherLedger && (otherLedger->info().hash == *hash)) + if (otherLedger && (otherLedger->header().hash == *hash)) { // we closed the seam if (invalidate != 0) @@ -788,8 +788,8 @@ LedgerMaster::setFullLedger( bool isCurrent) { // A new ledger has been accepted as part of the trusted chain - JLOG(m_journal.debug()) << "Ledger " << ledger->info().seq - << " accepted :" << ledger->info().hash; + JLOG(m_journal.debug()) << "Ledger " << ledger->header().seq + << " accepted :" << ledger->header().hash; XRPL_ASSERT( ledger->stateMap().getHash().isNonZero(), "ripple::LedgerMaster::setFullLedger : nonzero ledger state hash"); @@ -803,23 +803,23 @@ 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 prevHash = - app_.getRelationalDatabase().getHashByIndex(ledger->info().seq - 1); - if (prevHash.isNonZero() && prevHash != ledger->info().parentHash) - clearLedger(ledger->info().seq - 1); + uint256 prevHash = app_.getRelationalDatabase().getHashByIndex( + ledger->header().seq - 1); + if (prevHash.isNonZero() && prevHash != ledger->header().parentHash) + clearLedger(ledger->header().seq - 1); } pendSaveValidated(app_, ledger, isSynchronous, isCurrent); { std::lock_guard ml(mCompleteLock); - mCompleteLedgers.insert(ledger->info().seq); + mCompleteLedgers.insert(ledger->header().seq); } { std::lock_guard ml(m_mutex); - if (ledger->info().seq > mValidLedgerSeq) + if (ledger->header().seq > mValidLedgerSeq) setValidLedger(ledger); if (!mPubLedger) { @@ -827,13 +827,13 @@ LedgerMaster::setFullLedger( app_.getOrderBookDB().setup(ledger); } - if (ledger->info().seq != 0 && haveLedger(ledger->info().seq - 1)) + if (ledger->header().seq != 0 && haveLedger(ledger->header().seq - 1)) { // we think we have the previous ledger, double check - auto prevLedger = getLedgerBySeq(ledger->info().seq - 1); + auto prevLedger = getLedgerBySeq(ledger->header().seq - 1); if (!prevLedger || - (prevLedger->info().hash != ledger->info().parentHash)) + (prevLedger->header().hash != ledger->header().parentHash)) { JLOG(m_journal.warn()) << "Acquired ledger invalidates previous ledger: " @@ -926,23 +926,23 @@ LedgerMaster::checkAccept(std::shared_ptr const& ledger) // publish? std::lock_guard ml(m_mutex); - if (ledger->info().seq <= mValidLedgerSeq) + if (ledger->header().seq <= mValidLedgerSeq) return; auto const minVal = getNeededValidations(); auto validations = app_.validators().negativeUNLFilter( app_.getValidations().getTrustedForLedger( - ledger->info().hash, ledger->info().seq)); + ledger->header().hash, ledger->header().seq)); auto const tvc = validations.size(); if (tvc < minVal) // nothing we can do { JLOG(m_journal.trace()) - << "Only " << tvc << " validations for " << ledger->info().hash; + << "Only " << tvc << " validations for " << ledger->header().hash; return; } JLOG(m_journal.info()) << "Advancing accepted ledger to " - << ledger->info().seq << " with >= " << minVal + << ledger->header().seq << " with >= " << minVal << " validations"; ledger->setValidated(); @@ -956,10 +956,10 @@ LedgerMaster::checkAccept(std::shared_ptr const& ledger) } std::uint32_t const base = app_.getFeeTrack().getLoadBase(); - auto fees = app_.getValidations().fees(ledger->info().hash, base); + auto fees = app_.getValidations().fees(ledger->header().hash, base); { auto fees2 = - app_.getValidations().fees(ledger->info().parentHash, base); + app_.getValidations().fees(ledger->header().parentHash, base); fees.reserve(fees.size() + fees2.size()); std::copy(fees2.begin(), fees2.end(), std::back_inserter(fees)); } @@ -1007,7 +1007,7 @@ LedgerMaster::checkAccept(std::shared_ptr const& ledger) { // Have not printed the warning before, check if need to print. auto const vals = app_.getValidations().getTrustedForLedger( - ledger->info().parentHash, ledger->info().seq - 1); + ledger->header().parentHash, ledger->header().seq - 1); std::size_t higherVersionCount = 0; std::size_t rippledCount = 0; for (auto const& v : vals) @@ -1077,10 +1077,10 @@ LedgerMaster::consensusBuilt( mLedgerHistory.builtLedger(ledger, consensusHash, std::move(consensus)); - if (ledger->info().seq <= mValidLedgerSeq) + if (ledger->header().seq <= mValidLedgerSeq) { auto stream = app_.journal("LedgerConsensus").info(); - JLOG(stream) << "Consensus built old ledger: " << ledger->info().seq + JLOG(stream) << "Consensus built old ledger: " << ledger->header().seq << " <= " << mValidLedgerSeq; return; } @@ -1088,7 +1088,7 @@ LedgerMaster::consensusBuilt( // See if this ledger can be the new fully-validated ledger checkAccept(ledger); - if (ledger->info().seq <= mValidLedgerSeq) + if (ledger->header().seq <= mValidLedgerSeq) { auto stream = app_.journal("LedgerConsensus").debug(); JLOG(stream) << "Consensus ledger fully validated"; @@ -1134,7 +1134,7 @@ LedgerMaster::consensusBuilt( auto const neededValidations = getNeededValidations(); auto maxSeq = mValidLedgerSeq.load(); - auto maxLedger = ledger->info().hash; + auto maxLedger = ledger->header().hash; // Of the ledgers with sufficient validations, // find the one with the highest sequence @@ -1145,7 +1145,7 @@ LedgerMaster::consensusBuilt( if (v.second.ledgerSeq_ == 0) { if (auto l = getLedgerByHash(v.first)) - v.second.ledgerSeq_ = l->info().seq; + v.second.ledgerSeq_ = l->header().seq; } if (v.second.ledgerSeq_ > maxSeq) @@ -1172,7 +1172,7 @@ LedgerMaster::getLedgerHashForHistory( std::optional ret; auto const& l{mHistLedger}; - if (l && l->info().seq >= index) + if (l && l->header().seq >= index) { ret = hashOfSeq(*l, index, m_journal); if (!ret) @@ -1230,7 +1230,7 @@ LedgerMaster::findNewLedgersToPublish( auto pubSeq = mPubLedgerSeq + 1; // Next sequence to publish auto valLedger = mValidLedger.get(); - std::uint32_t valSeq = valLedger->info().seq; + std::uint32_t valSeq = valLedger->header().seq; scope_unlock sul{sl}; try @@ -1276,7 +1276,7 @@ LedgerMaster::findNewLedgersToPublish( } // Did we acquire the next ledger we need to publish? - if (ledger && (ledger->info().seq == pubSeq)) + if (ledger && (ledger->header().seq == pubSeq)) { ledger->setValidated(); ret.push_back(ledger); @@ -1307,7 +1307,7 @@ LedgerMaster::findNewLedgersToPublish( while (startLedger->seq() + 1 < finishLedger->seq()) { if (auto const parent = mLedgerHistory.getLedgerByHash( - finishLedger->info().parentHash); + finishLedger->header().parentHash); parent) { finishLedger = parent; @@ -1318,13 +1318,13 @@ LedgerMaster::findNewLedgersToPublish( finishLedger->seq() - startLedger->seq() + 1; JLOG(m_journal.debug()) << "Publish LedgerReplays " << numberLedgers - << " ledgers, from seq=" << startLedger->info().seq << ", " - << startLedger->info().hash - << " to seq=" << finishLedger->info().seq << ", " - << finishLedger->info().hash; + << " ledgers, from seq=" << startLedger->header().seq + << ", " << startLedger->header().hash + << " to seq=" << finishLedger->header().seq << ", " + << finishLedger->header().hash; app_.getLedgerReplayer().replay( InboundLedger::Reason::GENERIC, - finishLedger->info().hash, + finishLedger->header().hash, numberLedgers); break; } @@ -1390,7 +1390,8 @@ LedgerMaster::updatePaths() std::lock_guard ml(m_mutex); if (!mValidLedger.empty() && - (!mPathLedger || (mPathLedger->info().seq != mValidLedgerSeq))) + (!mPathLedger || + (mPathLedger->header().seq != mValidLedgerSeq))) { // We have a new valid ledger since the last full pathfinding mPathLedger = mValidLedger.get(); lastLedger = mPathLedger; @@ -1412,7 +1413,7 @@ LedgerMaster::updatePaths() { // don't pathfind with a ledger that's more than 60 seconds old using namespace std::chrono; auto age = time_point_cast(app_.timeKeeper().closeTime()) - - lastLedger->info().closeTime; + lastLedger->header().closeTime; if (age > 1min) { JLOG(m_journal.debug()) @@ -1461,16 +1462,16 @@ LedgerMaster::updatePaths() { // our parent is the problem app_.getInboundLedgers().acquire( - lastLedger->info().parentHash, - lastLedger->info().seq - 1, + lastLedger->header().parentHash, + lastLedger->header().seq - 1, InboundLedger::Reason::GENERIC); } else { // this ledger is the problem app_.getInboundLedgers().acquire( - lastLedger->info().hash, - lastLedger->info().seq, + lastLedger->header().hash, + lastLedger->header().seq, InboundLedger::Reason::GENERIC); } } @@ -1635,7 +1636,7 @@ LedgerMaster::walkHashBySeq( std::shared_ptr const& referenceLedger, InboundLedger::Reason reason) { - if (!referenceLedger || (referenceLedger->info().seq < index)) + if (!referenceLedger || (referenceLedger->header().seq < index)) { // Nothing we can do. No validated ledger. return std::nullopt; @@ -1693,7 +1694,7 @@ LedgerMaster::getLedgerBySeq(std::uint32_t index) // Always prefer a validated ledger if (auto valid = mValidLedger.get()) { - if (valid->info().seq == index) + if (valid->header().seq == index) return valid; try @@ -1714,7 +1715,7 @@ LedgerMaster::getLedgerBySeq(std::uint32_t index) return ret; auto ret = mClosedLedger.get(); - if (ret && (ret->info().seq == index)) + if (ret && (ret->header().seq == index)) return ret; clearLedger(index); @@ -1728,7 +1729,7 @@ LedgerMaster::getLedgerByHash(uint256 const& hash) return ret; auto ret = mClosedLedger.get(); - if (ret && (ret->info().hash == hash)) + if (ret && (ret->header().hash == hash)) return ret; return {}; @@ -1818,7 +1819,7 @@ LedgerMaster::fetchForHistory( } if (ledger) { - auto seq = ledger->info().seq; + auto seq = ledger->header().seq; XRPL_ASSERT( seq == missing, "ripple::LedgerMaster::fetchForHistory : sequence match"); @@ -1832,7 +1833,7 @@ LedgerMaster::fetchForHistory( } if (fillInProgress == 0 && app_.getRelationalDatabase().getHashByIndex(seq - 1) == - ledger->info().parentHash) + ledger->header().parentHash) { { // Previous ledger is in DB @@ -1919,7 +1920,7 @@ LedgerMaster::doAdvance(std::unique_lock& sl) std::lock_guard sll(mCompleteLock); missing = prevMissing( mCompleteLedgers, - mPubLedger->info().seq, + mPubLedger->header().seq, app_.getNodeStore().earliestLedgerSeq()); } if (missing) @@ -1966,7 +1967,7 @@ LedgerMaster::doAdvance(std::unique_lock& sl) { scope_unlock sul{sl}; JLOG(m_journal.debug()) - << "tryAdvance publishing seq " << ledger->info().seq; + << "tryAdvance publishing seq " << ledger->header().seq; setFullLedger(ledger, true, true); } @@ -2118,14 +2119,14 @@ LedgerMaster::makeFetchPack( return; } - if (have->info().seq < getEarliestFetch()) + if (have->header().seq < getEarliestFetch()) { JLOG(m_journal.debug()) << "Peer requests fetch pack that is too early"; peer->charge(Resource::feeMalformedRequest, "get_object ledger early"); return; } - auto want = getLedgerByHash(have->info().parentHash); + auto want = getLedgerByHash(have->header().parentHash); if (!want) { @@ -2160,19 +2161,19 @@ LedgerMaster::makeFetchPack( // the same process adding the previous ledger to the FetchPack. do { - std::uint32_t lSeq = want->info().seq; + std::uint32_t lSeq = want->header().seq; { // Serialize the ledger header: hdr.erase(); hdr.add32(HashPrefix::ledgerMaster); - addRaw(want->info(), hdr); + addRaw(want->header(), hdr); // Add the data protocol::TMIndexedObject* obj = reply.add_objects(); obj->set_hash( - want->info().hash.data(), want->info().hash.size()); + want->header().hash.data(), want->header().hash.size()); obj->set_data(hdr.getDataPtr(), hdr.getLength()); obj->set_ledgerseq(lSeq); } @@ -2182,14 +2183,14 @@ LedgerMaster::makeFetchPack( // We use nullptr here because transaction maps are per ledger // and so the requestor is unlikely to already have it. - if (want->info().txHash.isNonZero()) + if (want->header().txHash.isNonZero()) populateFetchPack(want->txMap(), nullptr, 512, &reply, lSeq); if (reply.objects().size() >= 512) break; have = std::move(want); - want = getLedgerByHash(have->info().parentHash); + want = getLedgerByHash(have->header().parentHash); } while (want && UptimeClock::now() <= uptime + 1s); auto msg = std::make_shared(reply, protocol::mtGET_OBJECTS); diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp index da7f7db23d..0a070fdeb0 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp @@ -72,7 +72,7 @@ LedgerReplayMsgHandler::processProofPathRequest( // pack header Serializer nData(128); - addRaw(ledger->info(), nData); + addRaw(ledger->header(), nData); reply.set_ledgerheader(nData.getDataPtr(), nData.getLength()); // pack path for (auto const& b : *path) @@ -185,7 +185,7 @@ LedgerReplayMsgHandler::processReplayDeltaRequest( // pack header Serializer nData(128); - addRaw(ledger->info(), nData); + addRaw(ledger->header(), nData); reply.set_ledgerheader(nData.getDataPtr(), nData.getLength()); // pack transactions auto const& txMap = ledger->txMap(); diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index 4b068882c9..4e73b54d53 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -173,7 +173,7 @@ LedgerReplayTask::tryAdvance(ScopedLockType& sl) : ", waiting to fill parameter") << ", deltaIndex=" << deltaToBuild_ << ", totalDeltas=" << deltas_.size() << ", parent " - << (parent_ ? parent_->info().hash : uint256()); + << (parent_ ? parent_->header().hash : uint256()); bool shouldTry = parent_ && parameter_.full_ && parameter_.totalLedgers_ - 1 == deltas_.size(); @@ -191,7 +191,7 @@ LedgerReplayTask::tryAdvance(ScopedLockType& sl) if (auto l = delta->tryBuild(parent_); l) { JLOG(journal_.debug()) - << "Task " << hash_ << " got ledger " << l->info().hash + << "Task " << hash_ << " got ledger " << l->header().hash << " deltaIndex=" << deltaToBuild_ << " totalDeltas=" << deltas_.size(); parent_ = l; diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index 7e8ff9e541..f571669e5c 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -147,7 +147,7 @@ fillJsonTx( } if (!fill.ledger.open()) - txJson[jss::ledger_hash] = to_string(fill.ledger.info().hash); + txJson[jss::ledger_hash] = to_string(fill.ledger.header().hash); bool const validated = fill.context->ledgerMaster.isValidated(fill.ledger); @@ -305,12 +305,12 @@ fillJson(Object& json, LedgerFill const& fill) // Is there a way to report this back? auto bFull = isFull(fill); if (isBinary(fill)) - fillJsonBinary(json, !fill.ledger.open(), fill.ledger.info()); + fillJsonBinary(json, !fill.ledger.open(), fill.ledger.header()); else fillJson( json, !fill.ledger.open(), - fill.ledger.info(), + fill.ledger.header(), bFull, (fill.context ? fill.context->apiVersion : RPC::apiMaximumSupportedVersion)); diff --git a/src/xrpld/app/ledger/detail/LocalTxs.cpp b/src/xrpld/app/ledger/detail/LocalTxs.cpp index 557fde80ce..4d26b60a6f 100644 --- a/src/xrpld/app/ledger/detail/LocalTxs.cpp +++ b/src/xrpld/app/ledger/detail/LocalTxs.cpp @@ -126,7 +126,7 @@ public: std::lock_guard lock(m_lock); m_txns.remove_if([&view](auto const& txn) { - if (txn.isExpired(view.info().seq)) + if (txn.isExpired(view.header().seq)) return true; if (view.txExists(txn.getID())) return true; diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 2ba6630945..79b48e42b1 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -1384,7 +1384,7 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) // start first consensus round if (!m_networkOPs->beginConsensus( - m_ledgerMaster->getClosedLedger()->info().hash, {})) + m_ledgerMaster->getClosedLedger()->header().hash, {})) { JLOG(m_journal.fatal()) << "Unable to start consensus"; return false; @@ -1699,7 +1699,7 @@ ApplicationImp::startGenesisLedger() std::make_shared(*genesis, timeKeeper().closeTime()); next->updateSkipList(); XRPL_ASSERT( - next->info().seq < XRP_LEDGER_EARLIEST_FEES || + next->header().seq < XRP_LEDGER_EARLIEST_FEES || next->read(keylet::fees()), "ripple::ApplicationImp::startGenesisLedger : valid ledger fees"); next->setImmutable(); @@ -1721,7 +1721,7 @@ ApplicationImp::getLastFullLedger() return ledger; XRPL_ASSERT( - ledger->info().seq < XRP_LEDGER_EARLIEST_FEES || + ledger->header().seq < XRP_LEDGER_EARLIEST_FEES || ledger->read(keylet::fees()), "ripple::ApplicationImp::getLastFullLedger : valid ledger fees"); ledger->setImmutable(); @@ -1729,7 +1729,7 @@ ApplicationImp::getLastFullLedger() if (getLedgerMaster().haveLedger(seq)) ledger->setValidated(); - if (ledger->info().hash == hash) + if (ledger->header().hash == hash) { JLOG(j.trace()) << "Loaded ledger: " << hash; return ledger; @@ -1876,7 +1876,7 @@ ApplicationImp::loadLedgerFromFile(std::string const& name) loadLedger->stateMap().flushDirty(hotACCOUNT_NODE); XRPL_ASSERT( - loadLedger->info().seq < XRP_LEDGER_EARLIEST_FEES || + loadLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || loadLedger->read(keylet::fees()), "ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees"); loadLedger->setAccepted( @@ -1955,7 +1955,7 @@ ApplicationImp::loadOldLedger( JLOG(m_journal.info()) << "Loading parent ledger"; - loadLedger = loadByHash(replayLedger->info().parentHash, *this); + loadLedger = loadByHash(replayLedger->header().parentHash, *this); if (!loadLedger) { JLOG(m_journal.info()) @@ -1964,7 +1964,7 @@ ApplicationImp::loadOldLedger( // Try to build the ledger from the back end auto il = std::make_shared( *this, - replayLedger->info().parentHash, + replayLedger->header().parentHash, 0, InboundLedger::Reason::GENERIC, stopwatch(), @@ -1989,7 +1989,7 @@ ApplicationImp::loadOldLedger( using namespace date; static constexpr NetClock::time_point ledgerWarnTimePoint{ sys_days{January / 1 / 2018} - sys_days{January / 1 / 2000}}; - if (loadLedger->info().closeTime < ledgerWarnTimePoint) + if (loadLedger->header().closeTime < ledgerWarnTimePoint) { JLOG(m_journal.fatal()) << "\n\n*** WARNING ***\n" @@ -2003,10 +2003,10 @@ ApplicationImp::loadOldLedger( "get the older rules.\n*** CONTINUING ***\n"; } - JLOG(m_journal.info()) << "Loading ledger " << loadLedger->info().hash - << " seq:" << loadLedger->info().seq; + JLOG(m_journal.info()) << "Loading ledger " << loadLedger->header().hash + << " seq:" << loadLedger->header().seq; - if (loadLedger->info().accountHash.isZero()) + if (loadLedger->header().accountHash.isZero()) { // LCOV_EXCL_START JLOG(m_journal.fatal()) << "Ledger is empty."; @@ -2039,7 +2039,7 @@ ApplicationImp::loadOldLedger( } m_ledgerMaster->setLedgerRangePresent( - loadLedger->info().seq, loadLedger->info().seq); + loadLedger->header().seq, loadLedger->header().seq); m_ledgerMaster->switchLCL(loadLedger); loadLedger->setValidated(); @@ -2081,7 +2081,7 @@ ApplicationImp::loadOldLedger( if (trapTxID && !trapTxID_) { JLOG(m_journal.fatal()) - << "Ledger " << replayLedger->info().seq + << "Ledger " << replayLedger->header().seq << " does not contain the transaction hash " << *trapTxID; return false; } diff --git a/src/xrpld/app/misc/FeeVoteImpl.cpp b/src/xrpld/app/misc/FeeVoteImpl.cpp index f116150681..88c33bd66b 100644 --- a/src/xrpld/app/misc/FeeVoteImpl.cpp +++ b/src/xrpld/app/misc/FeeVoteImpl.cpp @@ -266,7 +266,7 @@ FeeVoteImpl::doVoting( auto const baseReserve = baseReserveVote.getVotes(); auto const incReserve = incReserveVote.getVotes(); - auto const seq = lastClosedLedger->info().seq + 1; + auto const seq = lastClosedLedger->header().seq + 1; // add transactions to our position if (baseFee.second || baseReserve.second || incReserve.second) diff --git a/src/xrpld/app/misc/NegativeUNLVote.cpp b/src/xrpld/app/misc/NegativeUNLVote.cpp index e325403336..23d3248ba6 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.cpp +++ b/src/xrpld/app/misc/NegativeUNLVote.cpp @@ -59,7 +59,7 @@ NegativeUNLVote::doVoting( } } - auto const seq = prevLedger->info().seq + 1; + auto const seq = prevLedger->header().seq + 1; purgeNewValidators(seq); // Process the table and find all candidates to disable or to re-enable @@ -69,8 +69,8 @@ NegativeUNLVote::doVoting( // Pick one to disable and one to re-enable if any, add ttUNL_MODIFY Tx if (!candidates.toDisableCandidates.empty()) { - auto n = - choose(prevLedger->info().hash, candidates.toDisableCandidates); + auto n = choose( + prevLedger->header().hash, candidates.toDisableCandidates); XRPL_ASSERT( nidToKeyMap.contains(n), "ripple::NegativeUNLVote::doVoting : found node to disable"); @@ -80,7 +80,7 @@ NegativeUNLVote::doVoting( if (!candidates.toReEnableCandidates.empty()) { auto n = choose( - prevLedger->info().hash, candidates.toReEnableCandidates); + prevLedger->header().hash, candidates.toReEnableCandidates); XRPL_ASSERT( nidToKeyMap.contains(n), "ripple::NegativeUNLVote::doVoting : found node to enable"); @@ -154,7 +154,7 @@ NegativeUNLVote::buildScoreTable( // Ask the validation container to keep enough validation message history // for next time. - auto const seq = prevLedger->info().seq + 1; + auto const seq = prevLedger->header().seq + 1; validations.setSeqToKeep(seq - 1, seq + FLAG_LEDGER_INTERVAL); // Find FLAG_LEDGER_INTERVAL (i.e. 256) previous ledger hashes diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 157de028e5..1b0b4e5143 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1514,7 +1514,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) std::optional validatedLedgerIndex; if (auto const l = m_ledgerMaster.getValidatedLedger()) - validatedLedgerIndex = l->info().seq; + validatedLedgerIndex = l->header().seq; auto newOL = app_.openLedger().current(); for (TransactionStatus& e : transactions) @@ -1882,8 +1882,8 @@ NetworkOPsImp::checkLastClosedLedger( if (!ourClosed) return false; - uint256 closedLedger = ourClosed->info().hash; - uint256 prevClosedLedger = ourClosed->info().parentHash; + uint256 closedLedger = ourClosed->header().hash; + uint256 prevClosedLedger = ourClosed->header().parentHash; JLOG(m_journal.trace()) << "OurClosed: " << closedLedger; JLOG(m_journal.trace()) << "PrevClosed: " << prevClosedLedger; @@ -1924,7 +1924,7 @@ NetworkOPsImp::checkLastClosedLedger( { // don't switch to our own previous ledger JLOG(m_journal.info()) << "We won't switch to our own previous ledger"; - networkClosed = ourClosed->info().hash; + networkClosed = ourClosed->header().hash; switchLedgers = false; } else @@ -1946,12 +1946,12 @@ NetworkOPsImp::checkLastClosedLedger( { // Don't switch to a ledger not on the validated chain // or with an invalid close time or sequence - networkClosed = ourClosed->info().hash; + networkClosed = ourClosed->header().hash; return false; } JLOG(m_journal.warn()) << "We are not running on the consensus ledger"; - JLOG(m_journal.info()) << "Our LCL: " << ourClosed->info().hash + JLOG(m_journal.info()) << "Our LCL: " << ourClosed->header().hash << getJson({*ourClosed, {}}); JLOG(m_journal.info()) << "Net LCL " << closedLedger; @@ -1977,7 +1977,7 @@ NetworkOPsImp::switchLastClosedLedger( { // set the newLCL as our last closed ledger -- this is abnormal code JLOG(m_journal.error()) - << "JUMP last closed ledger to " << newLCL->info().hash; + << "JUMP last closed ledger to " << newLCL->header().hash; clearNeedNetworkLedger(); @@ -2015,11 +2015,13 @@ NetworkOPsImp::switchLastClosedLedger( protocol::TMStatusChange s; s.set_newevent(protocol::neSWITCHED_LEDGER); - s.set_ledgerseq(newLCL->info().seq); + s.set_ledgerseq(newLCL->header().seq); s.set_networktime(app_.timeKeeper().now().time_since_epoch().count()); s.set_ledgerhashprevious( - newLCL->info().parentHash.begin(), newLCL->info().parentHash.size()); - s.set_ledgerhash(newLCL->info().hash.begin(), newLCL->info().hash.size()); + newLCL->header().parentHash.begin(), + newLCL->header().parentHash.size()); + s.set_ledgerhash( + newLCL->header().hash.begin(), newLCL->header().hash.size()); app_.overlay().foreach( send_always(std::make_shared(s, protocol::mtSTATUS_CHANGE))); @@ -2034,7 +2036,7 @@ NetworkOPsImp::beginConsensus( networkClosed.isNonZero(), "ripple::NetworkOPsImp::beginConsensus : nonzero input"); - auto closingInfo = m_ledgerMaster.getCurrentLedger()->info(); + auto closingInfo = m_ledgerMaster.getCurrentLedger()->header(); JLOG(m_journal.info()) << "Consensus time for #" << closingInfo.seq << " with LCL " << closingInfo.parentHash; @@ -2056,11 +2058,12 @@ NetworkOPsImp::beginConsensus( } XRPL_ASSERT( - prevLedger->info().hash == closingInfo.parentHash, + prevLedger->header().hash == closingInfo.parentHash, "ripple::NetworkOPsImp::beginConsensus : prevLedger hash matches " "parent"); XRPL_ASSERT( - closingInfo.parentHash == m_ledgerMaster.getClosedLedger()->info().hash, + closingInfo.parentHash == + m_ledgerMaster.getClosedLedger()->header().hash, "ripple::NetworkOPsImp::beginConsensus : closedLedger parent matches " "hash"); @@ -2147,7 +2150,7 @@ NetworkOPsImp::mapComplete(std::shared_ptr const& map, bool fromAcquire) void NetworkOPsImp::endConsensus(std::unique_ptr const& clog) { - uint256 deadLedger = m_ledgerMaster.getClosedLedger()->info().parentHash; + uint256 deadLedger = m_ledgerMaster.getClosedLedger()->header().parentHash; for (auto const& it : app_.overlay().getActivePeers()) { @@ -2193,8 +2196,9 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) // Note: Do not go to FULL if we don't have the previous ledger // check if the ledger is bad enough to go to CONNECTE D -- TODO auto current = m_ledgerMaster.getCurrentLedger(); - if (app_.timeKeeper().now() < (current->info().parentCloseTime + - 2 * current->info().closeTimeResolution)) + if (app_.timeKeeper().now() < + (current->header().parentCloseTime + + 2 * current->header().closeTimeResolution)) { setMode(OperatingMode::FULL); } @@ -2911,8 +2915,8 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) { XRPAmount const baseFee = lpClosed->fees().base; Json::Value l(Json::objectValue); - l[jss::seq] = Json::UInt(lpClosed->info().seq); - l[jss::hash] = to_string(lpClosed->info().hash); + l[jss::seq] = Json::UInt(lpClosed->header().seq); + l[jss::hash] = to_string(lpClosed->header().hash); if (!human) { @@ -2920,7 +2924,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) l[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped(); l[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped(); l[jss::close_time] = Json::Value::UInt( - lpClosed->info().closeTime.time_since_epoch().count()); + lpClosed->header().closeTime.time_since_epoch().count()); } else { @@ -2942,7 +2946,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) } else { - auto lCloseTime = lpClosed->info().closeTime; + auto lCloseTime = lpClosed->header().closeTime; auto closeTime = app_.timeKeeper().closeTime(); if (lCloseTime <= closeTime) { @@ -2962,8 +2966,8 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) auto lpPublished = m_ledgerMaster.getPublishedLedger(); if (!lpPublished) info[jss::published_ledger] = "none"; - else if (lpPublished->info().seq != lpClosed->info().seq) - info[jss::published_ledger] = lpPublished->info().seq; + else if (lpPublished->header().seq != lpClosed->header().seq) + info[jss::published_ledger] = lpPublished->header().seq; } accounting_.json(info); @@ -3083,12 +3087,12 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) // Holes are filled across connection loss or other catastrophe std::shared_ptr alpAccepted = - app_.getAcceptedLedgerCache().fetch(lpAccepted->info().hash); + app_.getAcceptedLedgerCache().fetch(lpAccepted->header().hash); if (!alpAccepted) { alpAccepted = std::make_shared(lpAccepted, app_); app_.getAcceptedLedgerCache().canonicalize_replace_client( - lpAccepted->info().hash, alpAccepted); + lpAccepted->header().hash, alpAccepted); } XRPL_ASSERT( @@ -3097,8 +3101,8 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) { JLOG(m_journal.debug()) - << "Publishing ledger " << lpAccepted->info().seq << " " - << lpAccepted->info().hash; + << "Publishing ledger " << lpAccepted->header().seq << " " + << lpAccepted->header().hash; std::lock_guard sl(mSubLock); @@ -3107,10 +3111,10 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) Json::Value jvObj(Json::objectValue); jvObj[jss::type] = "ledgerClosed"; - jvObj[jss::ledger_index] = lpAccepted->info().seq; - jvObj[jss::ledger_hash] = to_string(lpAccepted->info().hash); + jvObj[jss::ledger_index] = lpAccepted->header().seq; + jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt( - lpAccepted->info().closeTime.time_since_epoch().count()); + lpAccepted->header().closeTime.time_since_epoch().count()); jvObj[jss::network_id] = app_.config().NETWORK_ID; @@ -3273,27 +3277,27 @@ NetworkOPsImp::transJson( netID = transaction->getFieldU32(sfNetworkID); if (std::optional ctid = - RPC::encodeCTID(ledger->info().seq, txnSeq, netID); + RPC::encodeCTID(ledger->header().seq, txnSeq, netID); ctid) jvObj[jss::ctid] = *ctid; } if (!ledger->open()) - jvObj[jss::ledger_hash] = to_string(ledger->info().hash); + jvObj[jss::ledger_hash] = to_string(ledger->header().hash); if (validated) { - jvObj[jss::ledger_index] = ledger->info().seq; + jvObj[jss::ledger_index] = ledger->header().seq; jvObj[jss::transaction][jss::date] = - ledger->info().closeTime.time_since_epoch().count(); + ledger->header().closeTime.time_since_epoch().count(); jvObj[jss::validated] = true; - jvObj[jss::close_time_iso] = to_string_iso(ledger->info().closeTime); + jvObj[jss::close_time_iso] = to_string_iso(ledger->header().closeTime); // WRITEME: Put the account next seq here } else { jvObj[jss::validated] = false; - jvObj[jss::ledger_current_index] = ledger->info().seq; + jvObj[jss::ledger_current_index] = ledger->header().seq; } jvObj[jss::status] = validated ? "closed" : "proposed"; @@ -4177,9 +4181,9 @@ NetworkOPsImp::acceptLedger( // FIXME Could we improve on this and remove the need for a specialized // API in Consensus? - beginConsensus(m_ledgerMaster.getClosedLedger()->info().hash, {}); + beginConsensus(m_ledgerMaster.getClosedLedger()->header().hash, {}); mConsensus.simulate(app_.timeKeeper().closeTime(), consensusDelay); - return m_ledgerMaster.getCurrentLedger()->info().seq; + return m_ledgerMaster.getCurrentLedger()->header().seq; } // <-- bool: true=added, false=already there @@ -4188,10 +4192,10 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult) { if (auto lpClosed = m_ledgerMaster.getValidatedLedger()) { - jvResult[jss::ledger_index] = lpClosed->info().seq; - jvResult[jss::ledger_hash] = to_string(lpClosed->info().hash); + jvResult[jss::ledger_index] = lpClosed->header().seq; + jvResult[jss::ledger_hash] = to_string(lpClosed->header().hash); jvResult[jss::ledger_time] = Json::Value::UInt( - lpClosed->info().closeTime.time_since_epoch().count()); + lpClosed->header().closeTime.time_since_epoch().count()); if (!lpClosed->rules().enabled(featureXRPFees)) jvResult[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED; jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped(); diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp b/src/xrpld/app/misc/PermissionedDEXHelpers.cpp index d02ae8e180..bc90848428 100644 --- a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp +++ b/src/xrpld/app/misc/PermissionedDEXHelpers.cpp @@ -29,7 +29,7 @@ accountInDomain( return false; return !credentials::checkExpired( - sleCred, view.info().parentCloseTime); + sleCred, view.header().parentCloseTime); }); return inDomain; diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index d771145540..79c75ca0cf 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -278,7 +278,7 @@ SHAMapStoreImp::run() continue; } - LedgerIndex const validatedSeq = validatedLedger->info().seq; + LedgerIndex const validatedSeq = validatedLedger->header().seq; if (!lastRotated) { lastRotated = validatedSeq; diff --git a/src/xrpld/app/misc/detail/AMMUtils.cpp b/src/xrpld/app/misc/detail/AMMUtils.cpp index 84236b0b6e..ab0aec41b1 100644 --- a/src/xrpld/app/misc/detail/AMMUtils.cpp +++ b/src/xrpld/app/misc/detail/AMMUtils.cpp @@ -171,7 +171,7 @@ getTradingFee(ReadView const& view, SLE const& ammSle, AccountID const& account) // Not expired if (auto const expiration = auctionSlot[~sfExpiration]; duration_cast( - view.info().parentCloseTime.time_since_epoch()) + view.header().parentCloseTime.time_since_epoch()) .count() < expiration) { if (auctionSlot[~sfAccount] == account) @@ -347,9 +347,10 @@ initializeFeeAuctionVote( STObject& auctionSlot = ammSle->peekFieldObject(sfAuctionSlot); auctionSlot.setAccountID(sfAccount, account); // current + sec in 24h - auto const expiration = std::chrono::duration_cast( - view.info().parentCloseTime.time_since_epoch()) - .count() + + auto const expiration = + std::chrono::duration_cast( + view.header().parentCloseTime.time_since_epoch()) + .count() + TOTAL_TIME_SLOT_SECS; auctionSlot.setFieldU32(sfExpiration, expiration); auctionSlot.setFieldAmount(sfPrice, STAmount{lptIssue, 0}); diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index fd975f9178..35ae25c82f 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -82,7 +82,8 @@ TxQ::FeeMetrics::update( "ripple::TxQ::FeeMetrics::update : fee levels size"); JLOG((timeLeap ? j_.warn() : j_.debug())) - << "Ledger " << view.info().seq << " has " << size << " transactions. " + << "Ledger " << view.header().seq << " has " << size + << " transactions. " << "Ledgers are processing " << (timeLeap ? "slowly" : "as expected") << ". Expected transactions is currently " << txnsExpected_ << " and multiplier is " << escalationMultiplier_; @@ -384,7 +385,7 @@ TxQ::canBeHeld( // a realistic chance of getting into a ledger. auto const lastValid = getLastLedgerSequence(tx); if (lastValid && - *lastValid < view.info().seq + setup_.minimumLastLedgerBuffer) + *lastValid < view.header().seq + setup_.minimumLastLedgerBuffer) return telCAN_NOT_QUEUE; } @@ -1349,7 +1350,7 @@ TxQ::processClosedLedger(Application& app, ReadView const& view, bool timeLeap) feeMetrics_.update(app, view, timeLeap, setup_); auto const& snapshot = feeMetrics_.getSnapshot(); - auto ledgerSeq = view.info().seq; + auto ledgerSeq = view.header().seq; if (!timeLeap) maxSize_ = std::max( @@ -1548,7 +1549,7 @@ TxQ::accept(Application& app, OpenView& view) // ledger have been. Rebuild the queue using the open ledger's // parent hash, so that transactions paying the same fee are // reordered. - LedgerHash const& parentHash = view.info().parentHash; + LedgerHash const& parentHash = view.header().parentHash; if (parentHash == parentHash_) JLOG(j_.warn()) << "Parent ledger hash unchanged from " << parentHash; else @@ -1851,7 +1852,7 @@ TxQ::doRPC(Application& app) const auto& levels = ret[jss::levels] = Json::objectValue; - ret[jss::ledger_current_index] = view->info().seq; + ret[jss::ledger_current_index] = view->header().seq; ret[jss::expected_ledger_size] = std::to_string(metrics.txPerLedger); ret[jss::current_ledger_size] = std::to_string(metrics.txInLedger); ret[jss::current_queue_size] = std::to_string(metrics.txCount); diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index 5ab7766e30..6b7b35e366 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -207,7 +207,7 @@ PathRequest::isValid(std::shared_ptr const& crCache) (sleDest->getFlags() & lsfRequireDestTag); } - jvStatus[jss::ledger_hash] = to_string(lrLedger->info().hash); + jvStatus[jss::ledger_hash] = to_string(lrLedger->header().hash); jvStatus[jss::ledger_index] = lrLedger->seq(); return true; } diff --git a/src/xrpld/app/paths/RippleLineCache.cpp b/src/xrpld/app/paths/RippleLineCache.cpp index 8e35b771fd..498b060cb3 100644 --- a/src/xrpld/app/paths/RippleLineCache.cpp +++ b/src/xrpld/app/paths/RippleLineCache.cpp @@ -8,12 +8,12 @@ RippleLineCache::RippleLineCache( beast::Journal j) : ledger_(ledger), journal_(j) { - JLOG(journal_.debug()) << "created for ledger " << ledger_->info().seq; + JLOG(journal_.debug()) << "created for ledger " << ledger_->header().seq; } RippleLineCache::~RippleLineCache() { - JLOG(journal_.debug()) << "destroyed for ledger " << ledger_->info().seq + JLOG(journal_.debug()) << "destroyed for ledger " << ledger_->header().seq << " with " << lines_.size() << " accounts and " << totalLineCount_ << " distinct trust lines."; } @@ -99,7 +99,7 @@ RippleLineCache::getRippleLines( "ripple::RippleLineCache::getRippleLines : null or nonempty lines"); auto const size = it->second ? it->second->size() : 0; JLOG(journal_.trace()) << "getRippleLines for ledger " - << ledger_->info().seq << " found " << size + << ledger_->header().seq << " found " << size << (key.direction_ == LineDirection::outgoing ? " outgoing" : " incoming") diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index a7b35a5305..c8458d15db 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -177,13 +177,13 @@ saveValidatedLedger( bool current) { auto j = app.journal("Ledger"); - auto seq = ledger->info().seq; + auto seq = ledger->header().seq; // TODO(tom): Fix this hard-coded SQL! JLOG(j.trace()) << "saveValidatedLedger " << (current ? "" : "fromAcquire ") << seq; - if (!ledger->info().accountHash.isNonZero()) + if (!ledger->header().accountHash.isNonZero()) { // LCOV_EXCL_START JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}}); @@ -191,10 +191,11 @@ saveValidatedLedger( // LCOV_EXCL_STOP } - if (ledger->info().accountHash != ledger->stateMap().getHash().as_uint256()) + if (ledger->header().accountHash != + ledger->stateMap().getHash().as_uint256()) { // LCOV_EXCL_START - JLOG(j.fatal()) << "sAL: " << ledger->info().accountHash + JLOG(j.fatal()) << "sAL: " << ledger->header().accountHash << " != " << ledger->stateMap().getHash(); JLOG(j.fatal()) << "saveAcceptedLedger: seq=" << seq << ", current=" << current; @@ -204,33 +205,33 @@ saveValidatedLedger( } XRPL_ASSERT( - ledger->info().txHash == ledger->txMap().getHash().as_uint256(), + ledger->header().txHash == ledger->txMap().getHash().as_uint256(), "ripple::detail::saveValidatedLedger : transaction hash match"); // Save the ledger header in the hashed object store { Serializer s(128); s.add32(HashPrefix::ledgerMaster); - addRaw(ledger->info(), s); + addRaw(ledger->header(), s); app.getNodeStore().store( - hotLEDGER, std::move(s.modData()), ledger->info().hash, seq); + hotLEDGER, std::move(s.modData()), ledger->header().hash, seq); } std::shared_ptr aLedger; try { - aLedger = app.getAcceptedLedgerCache().fetch(ledger->info().hash); + aLedger = app.getAcceptedLedgerCache().fetch(ledger->header().hash); if (!aLedger) { aLedger = std::make_shared(ledger, app); app.getAcceptedLedgerCache().canonicalize_replace_client( - ledger->info().hash, aLedger); + ledger->header().hash, aLedger); } } catch (std::exception const&) { JLOG(j.warn()) << "An accepted ledger was missing nodes"; - app.getLedgerMaster().failedSave(seq, ledger->info().hash); + app.getLedgerMaster().failedSave(seq, ledger->header().hash); // Clients can now trust the database for information about this // ledger sequence. app.pendingSaves().finishWork(seq); @@ -357,18 +358,18 @@ saveValidatedLedger( soci::transaction tr(*db); - auto const hash = to_string(ledger->info().hash); - auto const parentHash = to_string(ledger->info().parentHash); - auto const drops = to_string(ledger->info().drops); + auto const hash = to_string(ledger->header().hash); + auto const parentHash = to_string(ledger->header().parentHash); + auto const drops = to_string(ledger->header().drops); auto const closeTime = - ledger->info().closeTime.time_since_epoch().count(); + ledger->header().closeTime.time_since_epoch().count(); auto const parentCloseTime = - ledger->info().parentCloseTime.time_since_epoch().count(); + ledger->header().parentCloseTime.time_since_epoch().count(); auto const closeTimeResolution = - ledger->info().closeTimeResolution.count(); - auto const closeFlags = ledger->info().closeFlags; - auto const accountHash = to_string(ledger->info().accountHash); - auto const txHash = to_string(ledger->info().txHash); + ledger->header().closeTimeResolution.count(); + auto const closeFlags = ledger->header().closeFlags; + auto const accountHash = to_string(ledger->header().accountHash); + auto const txHash = to_string(ledger->header().txHash); *db << addLedger, soci::use(hash), soci::use(seq), soci::use(parentHash), soci::use(drops), soci::use(closeTime), diff --git a/src/xrpld/app/tx/detail/AMMBid.cpp b/src/xrpld/app/tx/detail/AMMBid.cpp index 158f60e0e4..47b89417a3 100644 --- a/src/xrpld/app/tx/detail/AMMBid.cpp +++ b/src/xrpld/app/tx/detail/AMMBid.cpp @@ -180,7 +180,7 @@ applyBid( auto& auctionSlot = ammSle->peekFieldObject(sfAuctionSlot); auto const current = duration_cast( - ctx_.view().info().parentCloseTime.time_since_epoch()) + ctx_.view().header().parentCloseTime.time_since_epoch()) .count(); // Auction slot discounted fee auto const discountedFee = diff --git a/src/xrpld/app/tx/detail/Credentials.cpp b/src/xrpld/app/tx/detail/Credentials.cpp index e16a432656..274a25e0c6 100644 --- a/src/xrpld/app/tx/detail/Credentials.cpp +++ b/src/xrpld/app/tx/detail/Credentials.cpp @@ -104,7 +104,7 @@ CredentialCreate::doApply() if (optExp) { std::uint32_t const closeTime = - ctx_.view().info().parentCloseTime.time_since_epoch().count(); + ctx_.view().header().parentCloseTime.time_since_epoch().count(); if (closeTime > *optExp) { @@ -242,7 +242,7 @@ CredentialDelete::doApply() return tefINTERNAL; // LCOV_EXCL_LINE if ((subject != account_) && (issuer != account_) && - !checkExpired(sleCred, ctx_.view().info().parentCloseTime)) + !checkExpired(sleCred, ctx_.view().header().parentCloseTime)) { JLOG(j_.trace()) << "Can't delete non-expired credential."; return tecNO_PERMISSION; @@ -336,7 +336,7 @@ CredentialAccept::doApply() Keylet const credentialKey = keylet::credential(account_, issuer, credType); auto const sleCred = view().peek(credentialKey); // Checked in preclaim() - if (checkExpired(sleCred, view().info().parentCloseTime)) + if (checkExpired(sleCred, view().header().parentCloseTime)) { JLOG(j_.trace()) << "Credential is expired: " << sleCred->getText(); // delete expired credentials even if the transaction failed diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index c22b8145c6..e9aad6ad37 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -416,7 +416,7 @@ escrowLockApplyHelper( TER EscrowCreate::doApply() { - auto const closeTime = ctx_.view().info().parentCloseTime; + auto const closeTime = ctx_.view().header().parentCloseTime; if (ctx_.tx[~sfCancelAfter] && after(closeTime, ctx_.tx[sfCancelAfter])) return tecNO_PERMISSION; @@ -964,7 +964,7 @@ EscrowFinish::doApply() // If a cancel time is present, a finish operation should only succeed prior // to that time. - auto const now = ctx_.view().info().parentCloseTime; + auto const now = ctx_.view().header().parentCloseTime; // Too soon: can't execute before the finish time if ((*slep)[~sfFinishAfter] && !after(now, (*slep)[sfFinishAfter])) @@ -1226,7 +1226,7 @@ EscrowCancel::doApply() return tecNO_TARGET; } - auto const now = ctx_.view().info().parentCloseTime; + auto const now = ctx_.view().header().parentCloseTime; // No cancel time specified: can't execute at all. if (!(*slep)[~sfCancelAfter]) diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index 838e774cae..756ea53fc1 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -188,7 +188,7 @@ LoanSet::getValueFields() static std::uint32_t getStartDate(ReadView const& view) { - return view.info().closeTime.time_since_epoch().count(); + return view.header().closeTime.time_since_epoch().count(); } TER diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/xrpld/app/tx/detail/PayChan.cpp index ae47036ab6..40e760e5f5 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/xrpld/app/tx/detail/PayChan.cpp @@ -231,7 +231,7 @@ PayChanCreate::doApply() if (ctx_.view().rules().enabled(fixPayChanCancelAfter)) { - auto const closeTime = ctx_.view().info().parentCloseTime; + auto const closeTime = ctx_.view().header().parentCloseTime; if (ctx_.tx[~sfCancelAfter] && after(closeTime, ctx_.tx[sfCancelAfter])) return tecEXPIRED; } @@ -324,7 +324,7 @@ PayChanFund::doApply() { auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = - ctx_.view().info().parentCloseTime.time_since_epoch().count(); + ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (expiration && closeTime >= *expiration)) return closeChannel( @@ -338,7 +338,7 @@ PayChanFund::doApply() if (auto extend = ctx_.tx[~sfExpiration]) { auto minExpiration = - ctx_.view().info().parentCloseTime.time_since_epoch().count() + + ctx_.view().header().parentCloseTime.time_since_epoch().count() + (*slep)[sfSettleDelay]; if (expiration && *expiration < minExpiration) minExpiration = *expiration; @@ -481,7 +481,7 @@ PayChanClaim::doApply() { auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = - ctx_.view().info().parentCloseTime.time_since_epoch().count(); + ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (curExpiration && closeTime >= *curExpiration)) return closeChannel( @@ -549,7 +549,7 @@ PayChanClaim::doApply() slep, ctx_.view(), k.key, ctx_.app.journal("View")); auto const settleExpiration = - ctx_.view().info().parentCloseTime.time_since_epoch().count() + + ctx_.view().header().parentCloseTime.time_since_epoch().count() + (*slep)[sfSettleDelay]; if (!curExpiration || *curExpiration > settleExpiration) diff --git a/src/xrpld/app/tx/detail/SetOracle.cpp b/src/xrpld/app/tx/detail/SetOracle.cpp index cecb623d82..453d799b0d 100644 --- a/src/xrpld/app/tx/detail/SetOracle.cpp +++ b/src/xrpld/app/tx/detail/SetOracle.cpp @@ -51,7 +51,7 @@ SetOracle::preclaim(PreclaimContext const& ctx) // of the last closed ledger using namespace std::chrono; std::size_t const closeTime = - duration_cast(ctx.view.info().closeTime.time_since_epoch()) + duration_cast(ctx.view.header().closeTime.time_since_epoch()) .count(); std::size_t const lastUpdateTime = ctx.tx[sfLastUpdateTime]; if (lastUpdateTime < epoch_offset.count()) diff --git a/src/xrpld/overlay/detail/Handshake.cpp b/src/xrpld/overlay/detail/Handshake.cpp index 469dab6d9a..45dc37f52c 100644 --- a/src/xrpld/overlay/detail/Handshake.cpp +++ b/src/xrpld/overlay/detail/Handshake.cpp @@ -199,8 +199,8 @@ buildHandshake( if (auto const cl = app.getLedgerMaster().getClosedLedger()) { - h.insert("Closed-Ledger", strHex(cl->info().hash)); - h.insert("Previous-Ledger", strHex(cl->info().parentHash)); + h.insert("Closed-Ledger", strHex(cl->header().hash)); + h.insert("Previous-Ledger", strHex(cl->header().parentHash)); } } diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 1a0995442b..097eaae4d9 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -3228,7 +3228,7 @@ PeerImp::sendLedgerBase( JLOG(p_journal_.trace()) << "sendLedgerBase: Base data"; Serializer s(sizeof(LedgerHeader)); - addRaw(ledger->info(), s); + addRaw(ledger->header(), s); ledgerData.add_nodes()->set_nodedata(s.getDataPtr(), s.getLength()); auto const& stateMap{ledger->stateMap()}; @@ -3241,7 +3241,7 @@ PeerImp::sendLedgerBase( ledgerData.add_nodes()->set_nodedata( root.getDataPtr(), root.getLength()); - if (ledger->info().txHash != beast::zero) + if (ledger->header().txHash != beast::zero) { auto const& txMap{ledger->txMap()}; if (txMap.getHash() != beast::zero) @@ -3326,7 +3326,7 @@ PeerImp::getLedger(std::shared_ptr const& m) if (ledger) { // Validate retrieved ledger sequence - auto const ledgerSeq{ledger->info().seq}; + auto const ledgerSeq{ledger->header().seq}; if (m->has_ledgerseq()) { if (ledgerSeq != m->ledgerseq()) @@ -3440,9 +3440,9 @@ PeerImp::processLedgerRequest(std::shared_ptr const& m) return; // Fill out the reply - auto const ledgerHash{ledger->info().hash}; + auto const ledgerHash{ledger->header().hash}; ledgerData.set_ledgerhash(ledgerHash.begin(), ledgerHash.size()); - ledgerData.set_ledgerseq(ledger->info().seq); + ledgerData.set_ledgerseq(ledger->header().seq); ledgerData.set_type(itype); if (m->has_requestcookie()) ledgerData.set_requestcookie(m->requestcookie()); diff --git a/src/xrpld/rpc/BookChanges.h b/src/xrpld/rpc/BookChanges.h index 58e8c25dc1..c30dadb9fe 100644 --- a/src/xrpld/rpc/BookChanges.h +++ b/src/xrpld/rpc/BookChanges.h @@ -166,11 +166,11 @@ computeBookChanges(std::shared_ptr const& lpAccepted) jvObj[jss::type] = "bookChanges"; // retrieve validated information from LedgerHeader class - jvObj[jss::validated] = lpAccepted->info().validated; - jvObj[jss::ledger_index] = lpAccepted->info().seq; - jvObj[jss::ledger_hash] = to_string(lpAccepted->info().hash); + jvObj[jss::validated] = lpAccepted->header().validated; + jvObj[jss::ledger_index] = lpAccepted->header().seq; + jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt( - lpAccepted->info().closeTime.time_since_epoch().count()); + lpAccepted->header().closeTime.time_since_epoch().count()); jvObj[jss::changes] = Json::arrayValue; diff --git a/src/xrpld/rpc/detail/DeliveredAmount.cpp b/src/xrpld/rpc/detail/DeliveredAmount.cpp index 2191d2b338..bcc7c4389d 100644 --- a/src/xrpld/rpc/detail/DeliveredAmount.cpp +++ b/src/xrpld/rpc/detail/DeliveredAmount.cpp @@ -88,7 +88,7 @@ insertDeliveredAmount( std::shared_ptr const& serializedTx, TxMeta const& transactionMeta) { - auto const info = ledger.info(); + auto const info = ledger.header(); if (canHaveDeliveredAmount(serializedTx, transactionMeta)) { diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index 144378a1ec..d2bf7d5349 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -234,7 +234,7 @@ getLedger(T& ledger, uint32_t ledgerIndex, Context const& context) if (ledger == nullptr) { auto cur = context.ledgerMaster.getCurrentLedger(); - if (cur->info().seq == ledgerIndex) + if (cur->header().seq == ledgerIndex) { ledger = cur; } @@ -243,7 +243,7 @@ getLedger(T& ledger, uint32_t ledgerIndex, Context const& context) if (ledger == nullptr) return {rpcLGR_NOT_FOUND, "ledgerNotFound"}; - if (ledger->info().seq > context.ledgerMaster.getValidLedgerIndex() && + if (ledger->header().seq > context.ledgerMaster.getValidLedgerIndex() && isValidatedOld(context.ledgerMaster, context.app.config().standalone())) { ledger.reset(); @@ -307,7 +307,7 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context const& context) static auto const minSequenceGap = 10; - if (ledger->info().seq + minSequenceGap < + if (ledger->header().seq + minSequenceGap < context.ledgerMaster.getValidLedgerIndex()) { ledger.reset(); @@ -360,7 +360,7 @@ lookupLedger( if (auto status = ledgerFromRequest(ledger, context)) return status; - auto& info = ledger->info(); + auto& info = ledger->header(); if (!ledger->open()) { @@ -433,7 +433,7 @@ getOrAcquireLedger(RPC::JsonContext const& context) ledgerIndex = jsonIndex.asInt(); auto ledger = ledgerMaster.getValidatedLedger(); - if (ledgerIndex >= ledger->info().seq) + if (ledgerIndex >= ledger->header().seq) return Unexpected(RPC::make_param_error("Ledger index too large")); if (ledgerIndex <= 0) return Unexpected(RPC::make_param_error("Ledger index too small")); diff --git a/src/xrpld/rpc/handlers/AMMInfo.cpp b/src/xrpld/rpc/handlers/AMMInfo.cpp index 0504adca02..5ea826fce5 100644 --- a/src/xrpld/rpc/handlers/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/AMMInfo.cpp @@ -194,7 +194,7 @@ doAMMInfo(RPC::JsonContext& context) { Json::Value auction; auto const timeSlot = ammAuctionTimeSlot( - ledger->info().parentCloseTime.time_since_epoch().count(), + ledger->header().parentCloseTime.time_since_epoch().count(), auctionSlot); auction[jss::time_interval] = timeSlot ? *timeSlot : AUCTION_SLOT_TIME_INTERVALS; @@ -230,7 +230,7 @@ doAMMInfo(RPC::JsonContext& context) result[jss::amm] = std::move(ammResult); if (!result.isMember(jss::ledger_index) && !result.isMember(jss::ledger_hash)) - result[jss::ledger_current_index] = ledger->info().seq; + result[jss::ledger_current_index] = ledger->header().seq; result[jss::validated] = context.ledgerMaster.isValidated(*ledger); return result; diff --git a/src/xrpld/rpc/handlers/AccountTx.cpp b/src/xrpld/rpc/handlers/AccountTx.cpp index e248764194..efb246b4d5 100644 --- a/src/xrpld/rpc/handlers/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/AccountTx.cpp @@ -176,12 +176,13 @@ getLedgerRange( bool validated = context.ledgerMaster.isValidated(*ledgerView); - if (!validated || ledgerView->info().seq > uValidatedMax || - ledgerView->info().seq < uValidatedMin) + if (!validated || + ledgerView->header().seq > uValidatedMax || + ledgerView->header().seq < uValidatedMin) { return rpcLGR_NOT_VALIDATED; } - uLedgerMin = uLedgerMax = ledgerView->info().seq; + uLedgerMin = uLedgerMax = ledgerView->header().seq; } return RPC::Status::OK; }, diff --git a/src/xrpld/rpc/handlers/CanDelete.cpp b/src/xrpld/rpc/handlers/CanDelete.cpp index c950b7a23d..d07d344242 100644 --- a/src/xrpld/rpc/handlers/CanDelete.cpp +++ b/src/xrpld/rpc/handlers/CanDelete.cpp @@ -60,7 +60,7 @@ doCanDelete(RPC::JsonContext& context) if (!ledger) return RPC::make_error(rpcLGR_NOT_FOUND, "ledgerNotFound"); - canDeleteSeq = ledger->info().seq; + canDeleteSeq = ledger->header().seq; } else { diff --git a/src/xrpld/rpc/handlers/DepositAuthorized.cpp b/src/xrpld/rpc/handlers/DepositAuthorized.cpp index 707db63e36..7beaffaf99 100644 --- a/src/xrpld/rpc/handlers/DepositAuthorized.cpp +++ b/src/xrpld/rpc/handlers/DepositAuthorized.cpp @@ -135,7 +135,7 @@ doDepositAuthorized(RPC::JsonContext& context) } if (credentials::checkExpired( - sleCred, ledger->info().parentCloseTime)) + sleCred, ledger->header().parentCloseTime)) { RPC::inject_error( rpcBAD_CREDENTIALS, "credentials are expired", result); diff --git a/src/xrpld/rpc/handlers/LedgerClosed.cpp b/src/xrpld/rpc/handlers/LedgerClosed.cpp index d7911f6b5b..3628c0f8d6 100644 --- a/src/xrpld/rpc/handlers/LedgerClosed.cpp +++ b/src/xrpld/rpc/handlers/LedgerClosed.cpp @@ -14,8 +14,8 @@ doLedgerClosed(RPC::JsonContext& context) XRPL_ASSERT(ledger, "ripple::doLedgerClosed : non-null closed ledger"); Json::Value jvResult; - jvResult[jss::ledger_index] = ledger->info().seq; - jvResult[jss::ledger_hash] = to_string(ledger->info().hash); + jvResult[jss::ledger_index] = ledger->header().seq; + jvResult[jss::ledger_hash] = to_string(ledger->header().hash); return jvResult; } diff --git a/src/xrpld/rpc/handlers/LedgerData.cpp b/src/xrpld/rpc/handlers/LedgerData.cpp index c5e39f69b4..35e5055242 100644 --- a/src/xrpld/rpc/handlers/LedgerData.cpp +++ b/src/xrpld/rpc/handlers/LedgerData.cpp @@ -59,8 +59,8 @@ doLedgerData(RPC::JsonContext& context) if ((limit < 0) || ((limit > maxLimit) && (!isUnlimited(context.role)))) limit = maxLimit; - jvResult[jss::ledger_hash] = to_string(lpLedger->info().hash); - jvResult[jss::ledger_index] = lpLedger->info().seq; + jvResult[jss::ledger_hash] = to_string(lpLedger->header().hash); + jvResult[jss::ledger_index] = lpLedger->header().seq; if (!isMarker) { diff --git a/src/xrpld/rpc/handlers/LedgerHandler.cpp b/src/xrpld/rpc/handlers/LedgerHandler.cpp index 4483838fa0..14c6fc67d9 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerHandler.cpp @@ -103,7 +103,7 @@ doLedgerGrpc(RPC::GRPCContext& context) } Serializer s; - addRaw(ledger->info(), s, true); + addRaw(ledger->header(), s, true); response.set_ledger_header(s.peekData().data(), s.getLength()); @@ -139,7 +139,7 @@ doLedgerGrpc(RPC::GRPCContext& context) { JLOG(context.j.error()) << __func__ << " - Error deserializing transaction in ledger " - << ledger->info().seq + << ledger->header().seq << " . skipping transaction and following transactions. You " "should look into this further"; } diff --git a/src/xrpld/rpc/handlers/LedgerHeader.cpp b/src/xrpld/rpc/handlers/LedgerHeader.cpp index ebbd6beb01..8c34b8a7cc 100644 --- a/src/xrpld/rpc/handlers/LedgerHeader.cpp +++ b/src/xrpld/rpc/handlers/LedgerHeader.cpp @@ -21,7 +21,7 @@ doLedgerHeader(RPC::JsonContext& context) return jvResult; Serializer s; - addRaw(lpLedger->info(), s); + addRaw(lpLedger->header(), s); jvResult[jss::ledger_data] = strHex(s.peekData()); // This information isn't verified: they should only use it if they trust diff --git a/src/xrpld/rpc/handlers/LedgerRequest.cpp b/src/xrpld/rpc/handlers/LedgerRequest.cpp index 2846bb9f08..8ae0e543f2 100644 --- a/src/xrpld/rpc/handlers/LedgerRequest.cpp +++ b/src/xrpld/rpc/handlers/LedgerRequest.cpp @@ -24,7 +24,7 @@ doLedgerRequest(RPC::JsonContext& context) auto const& ledger = res.value(); Json::Value jvResult; - jvResult[jss::ledger_index] = ledger->info().seq; + jvResult[jss::ledger_index] = ledger->header().seq; addJson(jvResult, {*ledger, &context, 0}); return jvResult; } diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index 7aba4d5f84..e7e812563d 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -26,7 +26,7 @@ isValidated(LedgerMaster& ledgerMaster, std::uint32_t seq, uint256 const& hash) if (!ledgerMaster.haveLedger(seq)) return false; - if (seq > ledgerMaster.getValidatedLedger()->info().seq) + if (seq > ledgerMaster.getValidatedLedger()->header().seq) return false; return ledgerMaster.getHashBySeq(seq) == hash; @@ -130,7 +130,7 @@ doTxHelp(RPC::Context& context, TxArgs args) context.ledgerMaster.getLedgerBySeq(txn->getLedger()); if (ledger && !ledger->open()) - result.ledgerHash = ledger->info().hash; + result.ledgerHash = ledger->header().hash; if (ledger && meta) { @@ -143,7 +143,7 @@ doTxHelp(RPC::Context& context, TxArgs args) result.meta = meta; } result.validated = isValidated( - context.ledgerMaster, ledger->info().seq, ledger->info().hash); + context.ledgerMaster, ledger->header().seq, ledger->header().hash); if (result.validated) result.closeTime = context.ledgerMaster.getCloseTimeBySeq(txn->getLedger()); @@ -151,7 +151,7 @@ doTxHelp(RPC::Context& context, TxArgs args) // compute outgoing CTID if (meta->getAsObject().isFieldPresent(sfTransactionIndex)) { - uint32_t lgrSeq = ledger->info().seq; + uint32_t lgrSeq = ledger->header().seq; uint32_t txnIdx = meta->getAsObject().getFieldU32(sfTransactionIndex); uint32_t netID = context.app.config().NETWORK_ID; From 9eb84a561ef8bb066d89f098bd9b4ac71baed67c Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 11 Dec 2025 08:54:23 -0500 Subject: [PATCH 05/62] refactor: Rename `rippled` binary to `xrpld` (#5983) Per [XLS-0095](https://xls.xrpl.org/xls/XLS-0095-rename-rippled-to-xrpld.html), we are taking steps to rename ripple(d) to xrpl(d). This change modifies the binary name from `rippled` to `xrpld`, and creates a symlink named `rippled` that points to the `xrpld` binary. Note that https://github.com/XRPLF/rippled/pull/5975 renamed any references to `rippled` in the CMake files and their contents, but explicitly maintained the `rippled` binary name by adding an exception. This change now undoes this exception and adds an explicit symlink instead. --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +- .github/scripts/rename/README.md | 4 ++ .github/scripts/rename/binary.sh | 54 ++++++++++++++++++ .../workflows/reusable-build-test-config.yml | 14 ++--- .../workflows/reusable-check-levelization.yml | 2 +- .github/workflows/reusable-check-rename.yml | 2 + BUILD.md | 56 +++++++++---------- CONTRIBUTING.md | 14 ++--- cmake/XrplCore.cmake | 2 - cmake/XrplInstall.cmake | 4 +- 10 files changed, 108 insertions(+), 50 deletions(-) create mode 100755 .github/scripts/rename/binary.sh diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index cc921f5a55..9d1f1f4e6b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug Report -about: Create a report to help us improve rippled -title: "[Title with short description] (Version: [rippled version])" +about: Create a report to help us improve xrpld +title: "[Title with short description] (Version: [xrpld version])" labels: "" assignees: "" --- @@ -27,7 +27,7 @@ assignees: "" ## Environment - + ## Supporting Files diff --git a/.github/scripts/rename/README.md b/.github/scripts/rename/README.md index 7df661609b..836f3606ba 100644 --- a/.github/scripts/rename/README.md +++ b/.github/scripts/rename/README.md @@ -26,6 +26,9 @@ run from the repository root. references to `ripple` and `rippled` (with or without capital letters) to `xrpl` and `xrpld`, respectively. The name of the binary will remain as-is, and will only be renamed to `xrpld` by a later script. +4. `.github/scripts/rename/binary.sh`: This script will rename the binary from + `rippled` to `xrpld`, and reverses the symlink so that `rippled` points to + the `xrpld` binary. You can run all these scripts from the repository root as follows: @@ -33,4 +36,5 @@ You can run all these scripts from the repository root as follows: ./.github/scripts/rename/definitions.sh . ./.github/scripts/rename/copyright.sh . ./.github/scripts/rename/cmake.sh . +./.github/scripts/rename/binary.sh . ``` diff --git a/.github/scripts/rename/binary.sh b/.github/scripts/rename/binary.sh new file mode 100755 index 0000000000..deb4dd5fb4 --- /dev/null +++ b/.github/scripts/rename/binary.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# On MacOS, ensure that GNU sed is installed and available as `gsed`. +SED_COMMAND=sed +if [[ "${OSTYPE}" == 'darwin'* ]]; then + if ! command -v gsed &> /dev/null; then + echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'." + exit 1 + fi + SED_COMMAND=gsed +fi + +# This script changes the binary name from `rippled` to `xrpld`, and reverses +# the symlink that currently points from `xrpld` to `rippled` so that it points +# from `rippled` to `xrpld` instead. +# Usage: .github/scripts/rename/binary.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi +pushd ${DIRECTORY} + +# Remove the binary name override added by the cmake.sh script. +${SED_COMMAND} -z -i -E 's@\s+# For the time being.+"rippled"\)@@' cmake/XrplCore.cmake + +# Reverse the symlink. +${SED_COMMAND} -i -E 's@create_symbolic_link\(rippled@create_symbolic_link(xrpld@' cmake/XrplInstall.cmake +${SED_COMMAND} -i -E 's@/xrpld\$\{suffix\}@/rippled${suffix}@' cmake/XrplInstall.cmake + +# Rename references to the binary. +${SED_COMMAND} -i -E 's@rippled@xrpld@g' BUILD.md +${SED_COMMAND} -i -E 's@rippled@xrpld@g' CONTRIBUTING.md +${SED_COMMAND} -i -E 's@rippled@xrpld@g' .github/ISSUE_TEMPLATE/bug_report.md + +# Restore and/or fix certain renames. The pre-commit hook will update the +# formatting upon saving/committing. +${SED_COMMAND} -i -E 's@ripple/xrpld@XRPLF/rippled@g' BUILD.md +${SED_COMMAND} -i -E 's@XRPLF/xrpld@XRPLF/rippled@g' BUILD.md +${SED_COMMAND} -i -E 's@xrpld \(`xrpld`\)@xrpld@g' BUILD.md +${SED_COMMAND} -i -E 's@XRPLF/xrpld@XRPLF/rippled@g' CONTRIBUTING.md + +popd +echo "Processing complete." diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 8ce810aa2e..70d4f93e16 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -129,14 +129,14 @@ jobs: --parallel "${BUILD_NPROC}" \ --target "${CMAKE_TARGET}" - - name: Upload rippled artifact (Linux) + - name: Upload the binary (Linux) if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }} uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 env: BUILD_DIR: ${{ inputs.build_dir }} with: - name: rippled-${{ inputs.config_name }} - path: ${{ env.BUILD_DIR }}/rippled + name: xrpld-${{ inputs.config_name }} + path: ${{ env.BUILD_DIR }}/xrpld retention-days: 3 if-no-files-found: error @@ -144,8 +144,8 @@ jobs: if: ${{ runner.os == 'Linux' }} working-directory: ${{ inputs.build_dir }} run: | - ldd ./rippled - if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then + ldd ./xrpld + if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then echo 'The binary is statically linked.' else echo 'The binary is dynamically linked.' @@ -156,7 +156,7 @@ jobs: if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }} working-directory: ${{ inputs.build_dir }} run: | - ./rippled --version | grep libvoidstar + ./xrpld --version | grep libvoidstar - name: Run the separate tests if: ${{ !inputs.build_only }} @@ -177,7 +177,7 @@ jobs: env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} run: | - ./rippled --unittest --unittest-jobs "${BUILD_NPROC}" + ./xrpld --unittest --unittest-jobs "${BUILD_NPROC}" - name: Debug failure (Linux) if: ${{ failure() && runner.os == 'Linux' && !inputs.build_only }} diff --git a/.github/workflows/reusable-check-levelization.yml b/.github/workflows/reusable-check-levelization.yml index 3430ca28a2..29a1dc1480 100644 --- a/.github/workflows/reusable-check-levelization.yml +++ b/.github/workflows/reusable-check-levelization.yml @@ -25,7 +25,7 @@ jobs: env: MESSAGE: | - The dependency relationships between the modules in rippled have + The dependency relationships between the modules in xrpld have changed, which may be an improvement or a regression. A rule of thumb is that if your changes caused something to be diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index 0e42dc55ab..00ef7c6f14 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -25,6 +25,8 @@ jobs: run: .github/scripts/rename/copyright.sh . - name: Check CMake configs run: .github/scripts/rename/cmake.sh . + - name: Check binary name + run: .github/scripts/rename/binary.sh . - name: Check for differences env: MESSAGE: | diff --git a/BUILD.md b/BUILD.md index 54e02c6ae9..85b3e3ea74 100644 --- a/BUILD.md +++ b/BUILD.md @@ -10,7 +10,7 @@ ## Branches For a stable release, choose the `master` branch or one of the [tagged -releases](https://github.com/ripple/rippled/releases). +releases](https://github.com/XRPLF/rippled/releases). ```bash git checkout master @@ -33,7 +33,7 @@ git checkout develop See [System Requirements](https://xrpl.org/system-requirements.html). -Building rippled generally requires git, Python, Conan, CMake, and a C++ +Building xrpld generally requires git, Python, Conan, CMake, and a C++ compiler. Some guidance on setting up such a [C++ development environment can be found here](./docs/build/environment.md). @@ -45,7 +45,7 @@ found here](./docs/build/environment.md). It is possible to build with Conan 1.60+, but the instructions are significantly different, which is why we are not recommending it. -`rippled` is written in the C++20 dialect and includes the `` header. +`xrpld` is written in the C++20 dialect and includes the `` header. The [minimum compiler versions][2] required are: | Compiler | Version | @@ -66,7 +66,7 @@ Linux](./docs/build/environment.md#linux). ### Mac -Many rippled engineers use macOS for development. +Many xrpld engineers use macOS for development. Here are [sample instructions for setting up a C++ development environment on macOS](./docs/build/environment.md#macos). @@ -126,7 +126,7 @@ default profile. ### Patched recipes The recipes in Conan Center occasionally need to be patched for compatibility -with the latest version of `rippled`. We maintain a fork of the Conan Center +with the latest version of `xrpld`. We maintain a fork of the Conan Center [here](https://github.com/XRPLF/conan-center-index/) containing the patches. To ensure our patched recipes are used, you must add our Conan remote at a @@ -292,7 +292,7 @@ sed -i.bak -e 's|^compiler\.libcxx=.*$|compiler.libcxx=libstdc++11|' $(conan con to do that is to run the shortcut "x64 Native Tools Command Prompt" for the version of Visual Studio that you have installed. -Windows developers must also build `rippled` and its dependencies for the x64 +Windows developers must also build `xrpld` and its dependencies for the x64 architecture: ```bash @@ -422,9 +422,9 @@ tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS'] cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -Dxrpld=ON -Dtests=ON .. ``` - **Note:** You can pass build options for `rippled` in this step. + **Note:** You can pass build options for `xrpld` in this step. -4. Build `rippled`. +4. Build `xrpld`. For a single-configuration generator, it will build whatever configuration you passed for `CMAKE_BUILD_TYPE`. For a multi-configuration generator, you @@ -443,26 +443,26 @@ tools.build:cxxflags=['-DBOOST_ASIO_DISABLE_CONCEPTS'] cmake --build . --config Debug ``` -5. Test rippled. +5. Test xrpld. Single-config generators: ``` - ./rippled --unittest --unittest-jobs N + ./xrpld --unittest --unittest-jobs N ``` Multi-config generators: ``` - ./Release/rippled --unittest --unittest-jobs N - ./Debug/rippled --unittest --unittest-jobs N + ./Release/xrpld --unittest --unittest-jobs N + ./Debug/xrpld --unittest --unittest-jobs N ``` Replace the `--unittest-jobs` parameter N with the desired unit tests concurrency. Recommended setting is half of the number of available CPU cores. - The location of `rippled` binary in your build directory depends on your + The location of `xrpld` binary in your build directory depends on your CMake generator. Pass `--help` to see the rest of the command line options. ## Coverage report @@ -481,18 +481,18 @@ Prerequisites for the coverage report: A coverage report is created when the following steps are completed, in order: -1. `rippled` binary built with instrumentation data, enabled by the `coverage` +1. `xrpld` binary built with instrumentation data, enabled by the `coverage` option mentioned above 2. completed one or more run of the unit tests, which populates coverage capture data 3. completed run of the `gcovr` tool (which internally invokes either `gcov` or `llvm-cov`) to assemble both instrumentation data and the coverage capture data into a coverage report The last step of the above is automated into a single target `coverage`. The instrumented -`rippled` binary can also be used for regular development or testing work, at +`xrpld` binary can also be used for regular development or testing work, at the cost of extra disk space utilization and a small performance hit -(to store coverage capture data). Since `rippled` binary is simply a dependency of the +(to store coverage capture data). Since `xrpld` binary is simply a dependency of the coverage report target, it is possible to re-run the `coverage` target without -rebuilding the `rippled` binary. Note, running of the unit tests before the `coverage` +rebuilding the `xrpld` binary. Note, running of the unit tests before the `coverage` target is left to the developer. Each such run will append to the coverage data collected in the build directory. @@ -520,16 +520,16 @@ stored inside the build directory, as either of: ## Options -| Option | Default Value | Description | -| ---------- | ------------- | -------------------------------------------------------------------------- | -| `assert` | OFF | Enable assertions. | -| `coverage` | OFF | Prepare the coverage report. | -| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. | -| `tests` | OFF | Build tests. | -| `unity` | OFF | Configure a unity build. | -| `xrpld` | OFF | Build the xrpld (`rippled`) application, and not just the libxrpl library. | -| `werr` | OFF | Treat compilation warnings as errors | -| `wextra` | OFF | Enable additional compilation warnings | +| Option | Default Value | Description | +| ---------- | ------------- | ------------------------------------------------------------------ | +| `assert` | OFF | Enable assertions. | +| `coverage` | OFF | Prepare the coverage report. | +| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. | +| `tests` | OFF | Build tests. | +| `unity` | OFF | Configure a unity build. | +| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. | +| `werr` | OFF | Treat compilation warnings as errors | +| `wextra` | OFF | Enable additional compilation warnings | [Unity builds][5] may be faster for the first build (at the cost of much more memory) since they concatenate sources into fewer @@ -573,7 +573,7 @@ you might have generated CMake files for a different `build_type` than the `CMAKE_BUILD_TYPE` you passed to Conan. ``` -/rippled/.build/pb-xrpl.libpb/xrpl/proto/xrpl.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found +/xrpld/.build/pb-xrpl.libpb/xrpl/proto/xrpl.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found 10 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 760e11bea6..86cfa9dc6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ your verifying key. Please set up [signature verification][signing]. In general, external contributions should be developed in your personal [fork][forking]. Contributions from developers with write permissions -should be done in [the main repository][rippled] in a branch with +should be done in [the main repository][xrpld] in a branch with a permitted prefix. Permitted prefixes are: - XLS-[a-zA-Z0-9]+/.+ @@ -73,7 +73,7 @@ Ensure that your code compiles according to the build instructions in Please write tests for your code. If your test can be run offline, in under 60 seconds, then it can be an -automatic test run by `rippled --unittest`. +automatic test run by `xrpld --unittest`. Otherwise, it must be a manual test. If you create new source files, they must be organized as follows: @@ -256,13 +256,13 @@ pre-commit install We are using [Antithesis](https://antithesis.com/) for continuous fuzzing, and keep a copy of [Antithesis C++ SDK](https://github.com/antithesishq/antithesis-sdk-cpp/) in `external/antithesis-sdk`. One of the aims of fuzzing is to identify bugs -by finding external conditions which cause contracts violations inside `rippled`. +by finding external conditions which cause contracts violations inside `xrpld`. The contracts are expressed as `XRPL_ASSERT` or `UNREACHABLE` (defined in `include/xrpl/beast/utility/instrumentation.h`), which are effectively (outside of Antithesis) wrappers for `assert(...)` with added name. The purpose of name is to provide contracts with stable identity which does not rely on line numbers. -When `rippled` is built with the Antithesis instrumentation enabled +When `xrpld` is built with the Antithesis instrumentation enabled (using `voidstar` CMake option) and ran on the Antithesis platform, the contracts become [test properties](https://antithesis.com/docs/using_antithesis/properties.html); @@ -318,7 +318,7 @@ For this reason: To execute all unit tests: -`rippled --unittest --unittest-jobs=` +`xrpld --unittest --unittest-jobs=` (Note: Using multiple cores on a Mac M1 can cause spurious test failures. The cause is still under investigation. If you observe this problem, try specifying fewer jobs.) @@ -326,7 +326,7 @@ cause is still under investigation. If you observe this problem, try specifying To run a specific set of test suites: ``` -rippled --unittest TestSuiteName +xrpld --unittest TestSuiteName ``` Note: In this example, all tests with prefix `TestSuiteName` will be run, so if @@ -1075,7 +1075,7 @@ git fetch upstreams [contrib]: https://docs.github.com/en/get-started/quickstart/contributing-to-projects [squash]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits [forking]: https://github.com/XRPLF/rippled/fork -[rippled]: https://github.com/XRPLF/rippled +[xrpld]: https://github.com/XRPLF/rippled [signing]: https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification [setup-upstreams]: ./bin/git/setup-upstreams.sh [squash-branches]: ./bin/git/squash-branches.sh diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 40b5535fc7..e4f97c46c3 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -223,6 +223,4 @@ if(xrpld) src/test/ledger/Invariants_test.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE) endif() - # For the time being, we will keep the name of the binary as it was. - set_target_properties(xrpld PROPERTIES OUTPUT_NAME "rippled") endif() diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index 05ace6eeea..ca3ad11d74 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -67,8 +67,8 @@ if (is_root_project AND TARGET xrpld) install(CODE " set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\") include(create_symbolic_link) - create_symbolic_link(rippled${suffix} \ - \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/xrpld${suffix}) + create_symbolic_link(xrpld${suffix} \ + \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/rippled${suffix}) ") endif () From 496efb71ca1049ca3314f2f49d02e1ea8c2bff75 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 11 Dec 2025 15:30:54 +0000 Subject: [PATCH 06/62] refactor: Move JobQueue and related classes into xrpl.core module (#6121) --- .github/scripts/levelization/README.md | 52 +++++++++++++------ .../scripts/levelization/results/loops.txt | 6 --- .../scripts/levelization/results/ordering.txt | 18 +++++-- cmake/XrplCore.cmake | 11 +++- cmake/XrplInstall.cmake | 1 + .../xrpl}/core/ClosureCounter.h | 0 {src/xrpld => include/xrpl}/core/Coro.ipp | 0 {src/xrpld => include/xrpl}/core/Job.h | 5 +- {src/xrpld => include/xrpl}/core/JobQueue.h | 11 ++-- .../xrpld => include/xrpl}/core/JobTypeData.h | 3 +- .../xrpld => include/xrpl}/core/JobTypeInfo.h | 2 +- {src/xrpld => include/xrpl}/core/JobTypes.h | 4 +- {src/xrpld => include/xrpl}/core/LoadEvent.h | 0 .../xrpld => include/xrpl}/core/LoadMonitor.h | 3 +- .../perflog => include/xrpl/core}/PerfLog.h | 11 ++-- .../xrpl}/core/detail/Workers.h | 3 +- .../xrpl}/core/detail/semaphore.h | 0 src/{xrpld => libxrpl}/core/detail/Job.cpp | 3 +- .../core/detail/JobQueue.cpp | 5 +- .../core/detail/LoadEvent.cpp | 5 +- .../core/detail/LoadMonitor.cpp | 3 +- .../core/detail/Workers.cpp | 5 +- src/test/app/Path_test.cpp | 2 +- src/test/app/Transaction_ordering_test.cpp | 2 +- src/test/basics/PerfLog_test.cpp | 2 +- src/test/core/ClosureCounter_test.cpp | 3 +- src/test/core/Coroutine_test.cpp | 2 +- src/test/core/JobQueue_test.cpp | 3 +- src/test/core/Workers_test.cpp | 5 +- src/test/rpc/RobustTransaction_test.cpp | 3 +- src/xrpld/app/consensus/RCLConsensus.h | 2 +- src/xrpld/app/consensus/RCLValidations.cpp | 4 +- src/xrpld/app/ledger/ConsensusTransSetSF.cpp | 2 +- src/xrpld/app/ledger/Ledger.cpp | 2 +- src/xrpld/app/ledger/OrderBookDB.cpp | 2 +- src/xrpld/app/ledger/detail/InboundLedger.cpp | 2 +- .../app/ledger/detail/InboundLedgers.cpp | 4 +- .../app/ledger/detail/InboundTransactions.cpp | 2 +- .../app/ledger/detail/LedgerDeltaAcquire.cpp | 3 +- .../app/ledger/detail/TimeoutCounter.cpp | 3 +- src/xrpld/app/ledger/detail/TimeoutCounter.h | 2 +- src/xrpld/app/main/Application.cpp | 2 +- src/xrpld/app/main/GRPCServer.h | 2 +- src/xrpld/app/main/NodeStoreScheduler.h | 3 +- src/xrpld/app/misc/NetworkOPs.cpp | 2 +- src/xrpld/app/misc/NetworkOPs.h | 2 +- src/xrpld/app/paths/PathRequests.cpp | 2 +- src/xrpld/app/paths/Pathfinder.cpp | 2 +- src/xrpld/app/paths/Pathfinder.h | 2 +- src/xrpld/core/DatabaseCon.h | 3 +- src/xrpld/core/SociDB.h | 3 +- src/xrpld/overlay/detail/OverlayImpl.h | 2 +- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- src/xrpld/overlay/detail/PeerSet.cpp | 3 +- src/xrpld/perflog/detail/PerfLogImp.cpp | 2 +- src/xrpld/perflog/detail/PerfLogImp.h | 2 +- src/xrpld/rpc/Context.h | 2 +- src/xrpld/rpc/RPCSub.h | 3 +- src/xrpld/rpc/ServerHandler.h | 2 +- src/xrpld/rpc/detail/LegacyPathFind.cpp | 5 +- src/xrpld/rpc/detail/RPCHandler.cpp | 4 +- src/xrpld/rpc/detail/ServerHandler.cpp | 2 +- src/xrpld/rpc/handlers/LogRotate.cpp | 2 +- 63 files changed, 139 insertions(+), 116 deletions(-) rename {src/xrpld => include/xrpl}/core/ClosureCounter.h (100%) rename {src/xrpld => include/xrpl}/core/Coro.ipp (100%) rename {src/xrpld => include/xrpl}/core/Job.h (98%) rename {src/xrpld => include/xrpl}/core/JobQueue.h (98%) rename {src/xrpld => include/xrpl}/core/JobTypeData.h (97%) rename {src/xrpld => include/xrpl}/core/JobTypeInfo.h (98%) rename {src/xrpld => include/xrpl}/core/JobTypes.h (99%) rename {src/xrpld => include/xrpl}/core/LoadEvent.h (100%) rename {src/xrpld => include/xrpl}/core/LoadMonitor.h (97%) rename {src/xrpld/perflog => include/xrpl/core}/PerfLog.h (96%) rename {src/xrpld => include/xrpl}/core/detail/Workers.h (99%) rename {src/xrpld => include/xrpl}/core/detail/semaphore.h (100%) rename src/{xrpld => libxrpl}/core/detail/Job.cpp (98%) rename src/{xrpld => libxrpl}/core/detail/JobQueue.cpp (99%) rename src/{xrpld => libxrpl}/core/detail/LoadEvent.cpp (94%) rename src/{xrpld => libxrpl}/core/detail/LoadMonitor.cpp (99%) rename src/{xrpld => libxrpl}/core/detail/Workers.cpp (98%) diff --git a/.github/scripts/levelization/README.md b/.github/scripts/levelization/README.md index f3ba1e2518..3b77a192b9 100644 --- a/.github/scripts/levelization/README.md +++ b/.github/scripts/levelization/README.md @@ -3,21 +3,26 @@ Levelization is the term used to describe efforts to prevent rippled from having or creating cyclic dependencies. -rippled code is organized into directories under `src/rippled` (and +rippled code is organized into directories under `src/xrpld`, `src/libxrpl` (and `src/test`) representing modules. The modules are intended to be organized into "tiers" or "levels" such that a module from one level can only include code from lower levels. Additionally, a module -in one level should never include code in an `impl` folder of any level +in one level should never include code in an `impl` or `detail` folder of any level other than it's own. +The codebase is split into two main areas: + +- **libxrpl** (`src/libxrpl`, `include/xrpl`): Reusable library modules with public interfaces +- **xrpld** (`src/xrpld`): Application-specific implementation code + Unfortunately, over time, enforcement of levelization has been inconsistent, so the current state of the code doesn't necessarily reflect these rules. Whenever possible, developers should refactor any levelization violations they find (by moving files or individual classes). At the very least, don't make things worse. -The table below summarizes the _desired_ division of modules, based on the -state of the rippled code when it was created. The levels are numbered from +The table below summarizes the _desired_ division of modules, based on the current +state of the rippled code. The levels are numbered from the bottom up with the lower level, lower numbered, more independent modules listed first, and the higher level, higher numbered modules with more dependencies listed later. @@ -25,18 +30,33 @@ more dependencies listed later. **tl;dr:** The modules listed first are more independent than the modules listed later. +## libxrpl Modules (Reusable Libraries) + +| Level / Tier | Module(s) | +| ------------ | ----------------------------------- | +| 01 | xrpl/beast | +| 02 | xrpl/basics | +| 03 | xrpl/json xrpl/crypto | +| 04 | xrpl/protocol | +| 05 | xrpl/core xrpl/resource xrpl/server | +| 06 | xrpl/ledger xrpl/nodestore xrpl/net | +| 07 | xrpl/shamap | + +## xrpld Modules (Application Implementation) + +| Level / Tier | Module(s) | +| ------------ | -------------------------------- | +| 05 | xrpld/conditions xrpld/consensus | +| 06 | xrpld/core xrpld/peerfinder | +| 07 | xrpld/shamap xrpld/overlay | +| 08 | xrpld/app | +| 09 | xrpld/rpc | +| 10 | xrpld/perflog | + +## Test Modules + | Level / Tier | Module(s) | | ------------ | -------------------------------------------------------------------------------------------------------- | -| 01 | ripple/beast ripple/unity | -| 02 | ripple/basics | -| 03 | ripple/json ripple/crypto | -| 04 | ripple/protocol | -| 05 | ripple/core ripple/conditions ripple/consensus ripple/resource ripple/server | -| 06 | ripple/peerfinder ripple/ledger ripple/nodestore ripple/net | -| 07 | ripple/shamap ripple/overlay | -| 08 | ripple/app | -| 09 | ripple/rpc | -| 10 | ripple/perflog | | 11 | test/jtx test/beast test/csf | | 12 | test/unit_test | | 13 | test/crypto test/conditions test/json test/resource test/shamap test/peerfinder test/basics test/overlay | @@ -45,8 +65,8 @@ listed later. | 16 | test/rpc test/app | (Note that `test` levelization is _much_ less important and _much_ less -strictly enforced than `ripple` levelization, other than the requirement -that `test` code should _never_ be included in `ripple` code.) +strictly enforced than `xrpl`/`xrpld` levelization, other than the requirement +that `test` code should _never_ be included in `xrpl` or `xrpld` code.) ## Validation diff --git a/.github/scripts/levelization/results/loops.txt b/.github/scripts/levelization/results/loops.txt index d057391be9..d15843ceb0 100644 --- a/.github/scripts/levelization/results/loops.txt +++ b/.github/scripts/levelization/results/loops.txt @@ -19,12 +19,6 @@ Loop: xrpld.app xrpld.rpc Loop: xrpld.app xrpld.shamap xrpld.shamap ~= xrpld.app -Loop: xrpld.core xrpld.perflog - xrpld.perflog == xrpld.core - Loop: xrpld.overlay xrpld.rpc xrpld.rpc ~= xrpld.overlay -Loop: xrpld.perflog xrpld.rpc - xrpld.rpc ~= xrpld.perflog - diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 251e9c1957..c9c65fb0dd 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -1,4 +1,6 @@ libxrpl.basics > xrpl.basics +libxrpl.core > xrpl.basics +libxrpl.core > xrpl.core libxrpl.crypto > xrpl.basics libxrpl.json > xrpl.basics libxrpl.json > xrpl.json @@ -30,6 +32,7 @@ test.app > test.rpc test.app > test.toplevel test.app > test.unit_test test.app > xrpl.basics +test.app > xrpl.core test.app > xrpld.app test.app > xrpld.core test.app > xrpld.overlay @@ -42,7 +45,7 @@ test.app > xrpl.resource test.basics > test.jtx test.basics > test.unit_test test.basics > xrpl.basics -test.basics > xrpld.perflog +test.basics > xrpl.core test.basics > xrpld.rpc test.basics > xrpl.json test.basics > xrpl.protocol @@ -61,8 +64,8 @@ test.core > test.jtx test.core > test.toplevel test.core > test.unit_test test.core > xrpl.basics +test.core > xrpl.core test.core > xrpld.core -test.core > xrpld.perflog test.core > xrpl.json test.core > xrpl.server test.csf > xrpl.basics @@ -119,6 +122,7 @@ test.resource > xrpl.resource test.rpc > test.jtx test.rpc > test.toplevel test.rpc > xrpl.basics +test.rpc > xrpl.core test.rpc > xrpld.app test.rpc > xrpld.core test.rpc > xrpld.overlay @@ -146,6 +150,8 @@ test.unit_test > xrpl.basics tests.libxrpl > xrpl.basics tests.libxrpl > xrpl.json tests.libxrpl > xrpl.net +xrpl.core > xrpl.basics +xrpl.core > xrpl.json xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol @@ -165,9 +171,9 @@ xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol xrpld.app > test.unit_test xrpld.app > xrpl.basics +xrpld.app > xrpl.core xrpld.app > xrpld.conditions xrpld.app > xrpld.consensus -xrpld.app > xrpld.perflog xrpld.app > xrpl.json xrpld.app > xrpl.ledger xrpld.app > xrpl.net @@ -181,13 +187,14 @@ xrpld.consensus > xrpl.basics xrpld.consensus > xrpl.json xrpld.consensus > xrpl.protocol xrpld.core > xrpl.basics +xrpld.core > xrpl.core xrpld.core > xrpl.json xrpld.core > xrpl.net xrpld.core > xrpl.protocol xrpld.overlay > xrpl.basics +xrpld.overlay > xrpl.core xrpld.overlay > xrpld.core xrpld.overlay > xrpld.peerfinder -xrpld.overlay > xrpld.perflog xrpld.overlay > xrpl.json xrpld.overlay > xrpl.protocol xrpld.overlay > xrpl.resource @@ -196,8 +203,11 @@ xrpld.peerfinder > xrpl.basics xrpld.peerfinder > xrpld.core xrpld.peerfinder > xrpl.protocol xrpld.perflog > xrpl.basics +xrpld.perflog > xrpl.core +xrpld.perflog > xrpld.rpc xrpld.perflog > xrpl.json xrpld.rpc > xrpl.basics +xrpld.rpc > xrpl.core xrpld.rpc > xrpld.core xrpld.rpc > xrpl.json xrpld.rpc > xrpl.ledger diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index e4f97c46c3..12ba58d499 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -94,10 +94,18 @@ target_link_libraries(xrpl.libxrpl.protocol PUBLIC ) # Level 05 +add_module(xrpl core) +target_link_libraries(xrpl.libxrpl.core PUBLIC + xrpl.libxrpl.basics + xrpl.libxrpl.json + xrpl.libxrpl.protocol +) + +# Level 06 add_module(xrpl resource) target_link_libraries(xrpl.libxrpl.resource PUBLIC xrpl.libxrpl.protocol) -# Level 06 +# Level 07 add_module(xrpl net) target_link_libraries(xrpl.libxrpl.net PUBLIC xrpl.libxrpl.basics @@ -144,6 +152,7 @@ target_sources(xrpl.libxrpl PRIVATE ${sources}) target_link_modules(xrpl PUBLIC basics beast + core crypto json protocol diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index ca3ad11d74..67aca8f048 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -16,6 +16,7 @@ install ( xrpl.libxrpl xrpl.libxrpl.basics xrpl.libxrpl.beast + xrpl.libxrpl.core xrpl.libxrpl.crypto xrpl.libxrpl.json xrpl.libxrpl.ledger diff --git a/src/xrpld/core/ClosureCounter.h b/include/xrpl/core/ClosureCounter.h similarity index 100% rename from src/xrpld/core/ClosureCounter.h rename to include/xrpl/core/ClosureCounter.h diff --git a/src/xrpld/core/Coro.ipp b/include/xrpl/core/Coro.ipp similarity index 100% rename from src/xrpld/core/Coro.ipp rename to include/xrpl/core/Coro.ipp diff --git a/src/xrpld/core/Job.h b/include/xrpl/core/Job.h similarity index 98% rename from src/xrpld/core/Job.h rename to include/xrpl/core/Job.h index ac6278b3c8..35d42cfd0b 100644 --- a/src/xrpld/core/Job.h +++ b/include/xrpl/core/Job.h @@ -1,10 +1,9 @@ #ifndef XRPL_CORE_JOB_H_INCLUDED #define XRPL_CORE_JOB_H_INCLUDED -#include -#include - #include +#include +#include #include diff --git a/src/xrpld/core/JobQueue.h b/include/xrpl/core/JobQueue.h similarity index 98% rename from src/xrpld/core/JobQueue.h rename to include/xrpl/core/JobQueue.h index c5d36cd993..f8b727471b 100644 --- a/src/xrpld/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -1,12 +1,11 @@ #ifndef XRPL_CORE_JOBQUEUE_H_INCLUDED #define XRPL_CORE_JOBQUEUE_H_INCLUDED -#include -#include -#include -#include - #include +#include +#include +#include +#include #include #include @@ -385,7 +384,7 @@ private: } // namespace ripple -#include +#include namespace ripple { diff --git a/src/xrpld/core/JobTypeData.h b/include/xrpl/core/JobTypeData.h similarity index 97% rename from src/xrpld/core/JobTypeData.h rename to include/xrpl/core/JobTypeData.h index 337adcb0da..eb678d1a9a 100644 --- a/src/xrpld/core/JobTypeData.h +++ b/include/xrpl/core/JobTypeData.h @@ -1,10 +1,9 @@ #ifndef XRPL_CORE_JOBTYPEDATA_H_INCLUDED #define XRPL_CORE_JOBTYPEDATA_H_INCLUDED -#include - #include #include +#include namespace ripple { diff --git a/src/xrpld/core/JobTypeInfo.h b/include/xrpl/core/JobTypeInfo.h similarity index 98% rename from src/xrpld/core/JobTypeInfo.h rename to include/xrpl/core/JobTypeInfo.h index a58d5316a8..09c644fc23 100644 --- a/src/xrpld/core/JobTypeInfo.h +++ b/include/xrpl/core/JobTypeInfo.h @@ -1,7 +1,7 @@ #ifndef XRPL_CORE_JOBTYPEINFO_H_INCLUDED #define XRPL_CORE_JOBTYPEINFO_H_INCLUDED -#include +#include namespace ripple { diff --git a/src/xrpld/core/JobTypes.h b/include/xrpl/core/JobTypes.h similarity index 99% rename from src/xrpld/core/JobTypes.h rename to include/xrpl/core/JobTypes.h index bb5a8baf9c..d8e7b23bdf 100644 --- a/src/xrpld/core/JobTypes.h +++ b/include/xrpl/core/JobTypes.h @@ -1,8 +1,8 @@ #ifndef XRPL_CORE_JOBTYPES_H_INCLUDED #define XRPL_CORE_JOBTYPES_H_INCLUDED -#include -#include +#include +#include #include #include diff --git a/src/xrpld/core/LoadEvent.h b/include/xrpl/core/LoadEvent.h similarity index 100% rename from src/xrpld/core/LoadEvent.h rename to include/xrpl/core/LoadEvent.h diff --git a/src/xrpld/core/LoadMonitor.h b/include/xrpl/core/LoadMonitor.h similarity index 97% rename from src/xrpld/core/LoadMonitor.h rename to include/xrpl/core/LoadMonitor.h index a9ed66e0fe..539a4a0b99 100644 --- a/src/xrpld/core/LoadMonitor.h +++ b/include/xrpl/core/LoadMonitor.h @@ -1,10 +1,9 @@ #ifndef XRPL_CORE_LOADMONITOR_H_INCLUDED #define XRPL_CORE_LOADMONITOR_H_INCLUDED -#include - #include #include +#include #include #include diff --git a/src/xrpld/perflog/PerfLog.h b/include/xrpl/core/PerfLog.h similarity index 96% rename from src/xrpld/perflog/PerfLog.h rename to include/xrpl/core/PerfLog.h index f6c3d3b9ac..c74608d82a 100644 --- a/src/xrpld/perflog/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -1,9 +1,8 @@ -#ifndef XRPL_BASICS_PERFLOG_H -#define XRPL_BASICS_PERFLOG_H - -#include -#include +#ifndef XRPL_CORE_PERFLOG_H +#define XRPL_CORE_PERFLOG_H +#include +#include #include #include @@ -190,4 +189,4 @@ measureDurationAndLog( } // namespace perf } // namespace ripple -#endif // XRPL_BASICS_PERFLOG_H +#endif // XRPL_CORE_PERFLOG_H diff --git a/src/xrpld/core/detail/Workers.h b/include/xrpl/core/detail/Workers.h similarity index 99% rename from src/xrpld/core/detail/Workers.h rename to include/xrpl/core/detail/Workers.h index f6fe9226fc..5877638722 100644 --- a/src/xrpld/core/detail/Workers.h +++ b/include/xrpl/core/detail/Workers.h @@ -1,9 +1,8 @@ #ifndef XRPL_CORE_WORKERS_H_INCLUDED #define XRPL_CORE_WORKERS_H_INCLUDED -#include - #include +#include #include #include diff --git a/src/xrpld/core/detail/semaphore.h b/include/xrpl/core/detail/semaphore.h similarity index 100% rename from src/xrpld/core/detail/semaphore.h rename to include/xrpl/core/detail/semaphore.h diff --git a/src/xrpld/core/detail/Job.cpp b/src/libxrpl/core/detail/Job.cpp similarity index 98% rename from src/xrpld/core/detail/Job.cpp rename to src/libxrpl/core/detail/Job.cpp index e1e85d34eb..9caf8d180d 100644 --- a/src/xrpld/core/detail/Job.cpp +++ b/src/libxrpl/core/detail/Job.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace ripple { diff --git a/src/xrpld/core/detail/JobQueue.cpp b/src/libxrpl/core/detail/JobQueue.cpp similarity index 99% rename from src/xrpld/core/detail/JobQueue.cpp rename to src/libxrpl/core/detail/JobQueue.cpp index ff5c2211ef..817744cbc1 100644 --- a/src/xrpld/core/detail/JobQueue.cpp +++ b/src/libxrpl/core/detail/JobQueue.cpp @@ -1,7 +1,6 @@ -#include -#include - #include +#include +#include #include diff --git a/src/xrpld/core/detail/LoadEvent.cpp b/src/libxrpl/core/detail/LoadEvent.cpp similarity index 94% rename from src/xrpld/core/detail/LoadEvent.cpp rename to src/libxrpl/core/detail/LoadEvent.cpp index 878bb92d11..3237daabcf 100644 --- a/src/xrpld/core/detail/LoadEvent.cpp +++ b/src/libxrpl/core/detail/LoadEvent.cpp @@ -1,7 +1,6 @@ -#include -#include - #include +#include +#include namespace ripple { diff --git a/src/xrpld/core/detail/LoadMonitor.cpp b/src/libxrpl/core/detail/LoadMonitor.cpp similarity index 99% rename from src/xrpld/core/detail/LoadMonitor.cpp rename to src/libxrpl/core/detail/LoadMonitor.cpp index 5a03ab607b..7a1cce05f3 100644 --- a/src/xrpld/core/detail/LoadMonitor.cpp +++ b/src/libxrpl/core/detail/LoadMonitor.cpp @@ -1,7 +1,6 @@ -#include - #include #include +#include namespace ripple { diff --git a/src/xrpld/core/detail/Workers.cpp b/src/libxrpl/core/detail/Workers.cpp similarity index 98% rename from src/xrpld/core/detail/Workers.cpp rename to src/libxrpl/core/detail/Workers.cpp index 29328533ae..b354353844 100644 --- a/src/xrpld/core/detail/Workers.cpp +++ b/src/libxrpl/core/detail/Workers.cpp @@ -1,8 +1,7 @@ -#include -#include - #include #include +#include +#include namespace ripple { diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index f84a87ac8c..e481bd673b 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -4,11 +4,11 @@ #include #include -#include #include #include #include +#include #include #include #include diff --git a/src/test/app/Transaction_ordering_test.cpp b/src/test/app/Transaction_ordering_test.cpp index 80e7d43de6..2f67d8b414 100644 --- a/src/test/app/Transaction_ordering_test.cpp +++ b/src/test/app/Transaction_ordering_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include namespace ripple { namespace test { diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index 5862889354..dcb91d0fd3 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -1,12 +1,12 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/test/core/ClosureCounter_test.cpp b/src/test/core/ClosureCounter_test.cpp index dbe846c02d..23359596fd 100644 --- a/src/test/core/ClosureCounter_test.cpp +++ b/src/test/core/ClosureCounter_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include #include #include diff --git a/src/test/core/Coroutine_test.cpp b/src/test/core/Coroutine_test.cpp index 2b9bd0a248..47bd74a4a6 100644 --- a/src/test/core/Coroutine_test.cpp +++ b/src/test/core/Coroutine_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/src/test/core/JobQueue_test.cpp b/src/test/core/JobQueue_test.cpp index 0b6bbb13ae..2451827bda 100644 --- a/src/test/core/JobQueue_test.cpp +++ b/src/test/core/JobQueue_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include namespace ripple { namespace test { diff --git a/src/test/core/Workers_test.cpp b/src/test/core/Workers_test.cpp index d8152d3ea8..2ba8c2a0e0 100644 --- a/src/test/core/Workers_test.cpp +++ b/src/test/core/Workers_test.cpp @@ -1,7 +1,6 @@ -#include -#include - #include +#include +#include #include #include diff --git a/src/test/rpc/RobustTransaction_test.cpp b/src/test/rpc/RobustTransaction_test.cpp index 29305092c4..d52e08f7ac 100644 --- a/src/test/rpc/RobustTransaction_test.cpp +++ b/src/test/rpc/RobustTransaction_test.cpp @@ -1,9 +1,8 @@ #include #include -#include - #include +#include #include namespace ripple { diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index b9580be08a..a6a15395a3 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -8,9 +8,9 @@ #include #include #include -#include #include +#include #include #include diff --git a/src/xrpld/app/consensus/RCLValidations.cpp b/src/xrpld/app/consensus/RCLValidations.cpp index d24f24a5f1..827c417ba8 100644 --- a/src/xrpld/app/consensus/RCLValidations.cpp +++ b/src/xrpld/app/consensus/RCLValidations.cpp @@ -4,12 +4,12 @@ #include #include #include -#include #include -#include #include #include +#include +#include #include diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index fbac9c8553..d248a36987 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -2,9 +2,9 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 055d9ddc9d..bf5f442eee 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -7,12 +7,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 1a407d0d3d..00907ee2ce 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -4,9 +4,9 @@ #include #include #include -#include #include +#include #include namespace ripple { diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index 24de3cce14..cd42b4fe82 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -4,10 +4,10 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 7e1ba88094..fafcdb9161 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -2,13 +2,13 @@ #include #include #include -#include -#include #include #include #include #include +#include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/InboundTransactions.cpp b/src/xrpld/app/ledger/detail/InboundTransactions.cpp index 93e0fbdec0..b84a03e7bb 100644 --- a/src/xrpld/app/ledger/detail/InboundTransactions.cpp +++ b/src/xrpld/app/ledger/detail/InboundTransactions.cpp @@ -3,9 +3,9 @@ #include #include #include -#include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index c803c0bdd4..9c190ee376 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -4,9 +4,10 @@ #include #include #include -#include #include +#include + namespace ripple { LedgerDeltaAcquire::LedgerDeltaAcquire( diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp index 6db280ce8e..d4e7e9a73c 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp @@ -1,5 +1,6 @@ #include -#include + +#include namespace ripple { diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.h b/src/xrpld/app/ledger/detail/TimeoutCounter.h index e97882ef1e..1ce4c48415 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.h +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.h @@ -2,9 +2,9 @@ #define XRPL_APP_LEDGER_TIMEOUTCOUNTER_H_INCLUDED #include -#include #include +#include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 79b48e42b1..e28cd559e9 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index 1ea8706e40..eba666cc35 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -2,13 +2,13 @@ #define XRPL_CORE_GRPCSERVER_H_INCLUDED #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/main/NodeStoreScheduler.h b/src/xrpld/app/main/NodeStoreScheduler.h index c1234a84c4..6a5cb8e8ee 100644 --- a/src/xrpld/app/main/NodeStoreScheduler.h +++ b/src/xrpld/app/main/NodeStoreScheduler.h @@ -1,8 +1,7 @@ #ifndef XRPL_APP_MAIN_NODESTORESCHEDULER_H_INCLUDED #define XRPL_APP_MAIN_NODESTORESCHEDULER_H_INCLUDED -#include - +#include #include namespace ripple { diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 1b0b4e5143..39ec0b78c9 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -39,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/misc/NetworkOPs.h b/src/xrpld/app/misc/NetworkOPs.h index 544e6bfe93..15545153c7 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/src/xrpld/app/misc/NetworkOPs.h @@ -3,9 +3,9 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/app/paths/PathRequests.cpp b/src/xrpld/app/paths/PathRequests.cpp index d489dafcea..2d5b52d1f9 100644 --- a/src/xrpld/app/paths/PathRequests.cpp +++ b/src/xrpld/app/paths/PathRequests.cpp @@ -1,9 +1,9 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index 2debdc76b2..d3ed3fc38c 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -4,10 +4,10 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/Pathfinder.h b/src/xrpld/app/paths/Pathfinder.h index d019a8307e..91c0a033f1 100644 --- a/src/xrpld/app/paths/Pathfinder.h +++ b/src/xrpld/app/paths/Pathfinder.h @@ -3,9 +3,9 @@ #include #include -#include #include +#include #include #include diff --git a/src/xrpld/core/DatabaseCon.h b/src/xrpld/core/DatabaseCon.h index 84d2c375e0..b2f400780b 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/src/xrpld/core/DatabaseCon.h @@ -4,7 +4,8 @@ #include #include #include -#include + +#include #include diff --git a/src/xrpld/core/SociDB.h b/src/xrpld/core/SociDB.h index bf209d79f7..7e2c7323d8 100644 --- a/src/xrpld/core/SociDB.h +++ b/src/xrpld/core/SociDB.h @@ -14,9 +14,8 @@ #pragma clang diagnostic ignored "-Wdeprecated" #endif -#include - #include +#include #define SOCI_USE_BOOST #include diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index 765d2f38eb..18f2aa0c3f 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -2,7 +2,6 @@ #define XRPL_OVERLAY_OVERLAYIMPL_H_INCLUDED #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 097eaae4d9..7adfef4064 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -12,12 +12,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/overlay/detail/PeerSet.cpp b/src/xrpld/overlay/detail/PeerSet.cpp index ecf1164b2c..9f5b810ffc 100644 --- a/src/xrpld/overlay/detail/PeerSet.cpp +++ b/src/xrpld/overlay/detail/PeerSet.cpp @@ -1,8 +1,9 @@ #include -#include #include #include +#include + namespace ripple { class PeerSetImpl : public PeerSet diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index 170da708eb..8d6d68137a 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/perflog/detail/PerfLogImp.h b/src/xrpld/perflog/detail/PerfLogImp.h index ec4c87c29d..d8e5e7943d 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.h +++ b/src/xrpld/perflog/detail/PerfLogImp.h @@ -1,10 +1,10 @@ #ifndef XRPL_BASICS_PERFLOGIMP_H #define XRPL_BASICS_PERFLOGIMP_H -#include #include #include +#include #include diff --git a/src/xrpld/rpc/Context.h b/src/xrpld/rpc/Context.h index 0e15da3a39..1faafa1627 100644 --- a/src/xrpld/rpc/Context.h +++ b/src/xrpld/rpc/Context.h @@ -1,11 +1,11 @@ #ifndef XRPL_RPC_CONTEXT_H_INCLUDED #define XRPL_RPC_CONTEXT_H_INCLUDED -#include #include #include #include +#include namespace ripple { diff --git a/src/xrpld/rpc/RPCSub.h b/src/xrpld/rpc/RPCSub.h index db96ae79ee..ea0cc993e8 100644 --- a/src/xrpld/rpc/RPCSub.h +++ b/src/xrpld/rpc/RPCSub.h @@ -1,9 +1,10 @@ #ifndef XRPL_NET_RPCSUB_H_INCLUDED #define XRPL_NET_RPCSUB_H_INCLUDED -#include #include +#include + #include namespace ripple { diff --git a/src/xrpld/rpc/ServerHandler.h b/src/xrpld/rpc/ServerHandler.h index c499411366..4cf5a0ce88 100644 --- a/src/xrpld/rpc/ServerHandler.h +++ b/src/xrpld/rpc/ServerHandler.h @@ -3,9 +3,9 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/rpc/detail/LegacyPathFind.cpp b/src/xrpld/rpc/detail/LegacyPathFind.cpp index 7bf4758e37..c3bcd928cd 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.cpp +++ b/src/xrpld/rpc/detail/LegacyPathFind.cpp @@ -1,10 +1,11 @@ #include #include -#include -#include #include #include +#include +#include + namespace ripple { namespace RPC { diff --git a/src/xrpld/rpc/detail/RPCHandler.cpp b/src/xrpld/rpc/detail/RPCHandler.cpp index c712430f92..fca926a1c7 100644 --- a/src/xrpld/rpc/detail/RPCHandler.cpp +++ b/src/xrpld/rpc/detail/RPCHandler.cpp @@ -4,8 +4,6 @@ #include #include #include -#include -#include #include #include #include @@ -14,6 +12,8 @@ #include #include +#include +#include #include #include #include diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index 8a42153105..de44f93749 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/xrpld/rpc/handlers/LogRotate.cpp b/src/xrpld/rpc/handlers/LogRotate.cpp index 379d694c0f..595d84b191 100644 --- a/src/xrpld/rpc/handlers/LogRotate.cpp +++ b/src/xrpld/rpc/handlers/LogRotate.cpp @@ -1,8 +1,8 @@ #include -#include #include #include +#include namespace ripple { From 1eb0fdac6543706b4b9ddca57fd4102928a1f871 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 11 Dec 2025 11:51:49 -0500 Subject: [PATCH 07/62] refactor: Rename `ripple` namespace to `xrpl` (#5982) This change renames all occurrences of `namespace ripple` and `ripple::` to `namespace xrpl` and `xrpl::`, respectively, as well as the names of test suites. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts. --- .github/scripts/rename/README.md | 3 + .github/scripts/rename/namespace.sh | 58 +++++++++ .github/workflows/reusable-check-rename.yml | 2 + CONTRIBUTING.md | 2 +- include/xrpl/basics/Archive.h | 4 +- include/xrpl/basics/BasicConfig.h | 4 +- include/xrpl/basics/Blob.h | 4 +- include/xrpl/basics/Buffer.h | 6 +- include/xrpl/basics/ByteUtilities.h | 4 +- include/xrpl/basics/CompressionAlgorithms.h | 4 +- include/xrpl/basics/CountedObject.h | 4 +- include/xrpl/basics/DecayingSample.h | 4 +- include/xrpl/basics/Expected.h | 4 +- include/xrpl/basics/FileUtilities.h | 4 +- include/xrpl/basics/IntrusivePointer.h | 4 +- include/xrpl/basics/IntrusivePointer.ipp | 8 +- include/xrpl/basics/IntrusiveRefCounts.h | 26 ++-- include/xrpl/basics/KeyCache.h | 4 +- include/xrpl/basics/LocalValue.h | 4 +- include/xrpl/basics/Log.h | 4 +- include/xrpl/basics/MathUtilities.h | 4 +- include/xrpl/basics/Number.h | 4 +- include/xrpl/basics/README.md | 8 +- include/xrpl/basics/RangeSet.h | 6 +- include/xrpl/basics/Resolver.h | 4 +- include/xrpl/basics/ResolverAsio.h | 4 +- include/xrpl/basics/SHAMapHash.h | 4 +- include/xrpl/basics/SharedWeakCachePointer.h | 4 +- .../xrpl/basics/SharedWeakCachePointer.ipp | 4 +- include/xrpl/basics/SlabAllocator.h | 10 +- include/xrpl/basics/Slice.h | 6 +- include/xrpl/basics/StringUtilities.h | 4 +- include/xrpl/basics/TaggedCache.h | 4 +- include/xrpl/basics/TaggedCache.ipp | 4 +- include/xrpl/basics/ToString.h | 4 +- include/xrpl/basics/UnorderedContainers.h | 4 +- include/xrpl/basics/UptimeClock.h | 4 +- include/xrpl/basics/algorithm.h | 4 +- include/xrpl/basics/base64.h | 4 +- include/xrpl/basics/base_uint.h | 10 +- include/xrpl/basics/chrono.h | 4 +- include/xrpl/basics/comparators.h | 4 +- include/xrpl/basics/contract.h | 4 +- include/xrpl/basics/hardened_hash.h | 4 +- include/xrpl/basics/join.h | 4 +- include/xrpl/basics/make_SSLContext.h | 4 +- include/xrpl/basics/mulDiv.h | 4 +- .../xrpl/basics/partitioned_unordered_map.h | 6 +- include/xrpl/basics/random.h | 6 +- include/xrpl/basics/safe_cast.h | 4 +- include/xrpl/basics/scope.h | 6 +- include/xrpl/basics/spinlock.h | 6 +- include/xrpl/basics/strHex.h | 4 +- include/xrpl/basics/tagged_integer.h | 6 +- include/xrpl/core/ClosureCounter.h | 4 +- include/xrpl/core/Coro.ipp | 9 +- include/xrpl/core/Job.h | 4 +- include/xrpl/core/JobQueue.h | 8 +- include/xrpl/core/JobTypeData.h | 4 +- include/xrpl/core/JobTypeInfo.h | 4 +- include/xrpl/core/JobTypes.h | 10 +- include/xrpl/core/LoadEvent.h | 4 +- include/xrpl/core/LoadMonitor.h | 4 +- include/xrpl/core/PerfLog.h | 4 +- include/xrpl/core/detail/Workers.h | 4 +- include/xrpl/core/detail/semaphore.h | 6 +- include/xrpl/crypto/RFC1751.h | 4 +- include/xrpl/crypto/csprng.h | 4 +- include/xrpl/crypto/secure_erase.h | 4 +- include/xrpl/json/JsonPropertyStream.h | 4 +- include/xrpl/json/Writer.h | 2 +- include/xrpl/json/detail/json_assert.h | 2 +- include/xrpl/json/json_value.h | 4 +- include/xrpl/ledger/ApplyView.h | 6 +- include/xrpl/ledger/ApplyViewImpl.h | 4 +- include/xrpl/ledger/BookDirs.h | 4 +- include/xrpl/ledger/CachedSLEs.h | 2 +- include/xrpl/ledger/CachedView.h | 4 +- include/xrpl/ledger/CredentialHelpers.h | 4 +- include/xrpl/ledger/Dir.h | 4 +- include/xrpl/ledger/OpenView.h | 4 +- include/xrpl/ledger/PaymentSandbox.h | 4 +- include/xrpl/ledger/RawView.h | 4 +- include/xrpl/ledger/ReadView.h | 4 +- include/xrpl/ledger/Sandbox.h | 4 +- include/xrpl/ledger/View.h | 4 +- include/xrpl/ledger/detail/ApplyStateTable.h | 4 +- include/xrpl/ledger/detail/ApplyViewBase.h | 4 +- include/xrpl/ledger/detail/RawStateTable.h | 4 +- include/xrpl/ledger/detail/ReadViewFwdRange.h | 4 +- .../xrpl/ledger/detail/ReadViewFwdRange.ipp | 6 +- include/xrpl/net/AutoSocket.h | 2 +- include/xrpl/net/HTTPClient.h | 4 +- include/xrpl/net/HTTPClientSSLContext.h | 4 +- include/xrpl/net/RegisterSSLCerts.h | 4 +- include/xrpl/nodestore/Backend.h | 4 +- include/xrpl/nodestore/Database.h | 6 +- include/xrpl/nodestore/DatabaseRotating.h | 4 +- include/xrpl/nodestore/DummyScheduler.h | 4 +- include/xrpl/nodestore/Factory.h | 4 +- include/xrpl/nodestore/Manager.h | 4 +- include/xrpl/nodestore/NodeObject.h | 4 +- include/xrpl/nodestore/Scheduler.h | 4 +- include/xrpl/nodestore/Task.h | 4 +- include/xrpl/nodestore/Types.h | 4 +- include/xrpl/nodestore/detail/BatchWriter.h | 4 +- .../xrpl/nodestore/detail/DatabaseNodeImp.h | 6 +- .../nodestore/detail/DatabaseRotatingImp.h | 4 +- include/xrpl/nodestore/detail/DecodedBlob.h | 4 +- include/xrpl/nodestore/detail/EncodedBlob.h | 8 +- include/xrpl/nodestore/detail/ManagerImp.h | 4 +- include/xrpl/nodestore/detail/codec.h | 4 +- include/xrpl/nodestore/detail/varint.h | 4 +- include/xrpl/protocol/AMMCore.h | 4 +- include/xrpl/protocol/AccountID.h | 12 +- include/xrpl/protocol/AmountConversions.h | 15 +-- include/xrpl/protocol/ApiVersion.h | 6 +- include/xrpl/protocol/Asset.h | 4 +- include/xrpl/protocol/Batch.h | 4 +- include/xrpl/protocol/Book.h | 32 ++--- include/xrpl/protocol/BuildInfo.h | 4 +- include/xrpl/protocol/ErrorCodes.h | 4 +- include/xrpl/protocol/Feature.h | 10 +- include/xrpl/protocol/Fees.h | 4 +- include/xrpl/protocol/HashPrefix.h | 4 +- include/xrpl/protocol/IOUAmount.h | 4 +- include/xrpl/protocol/Indexes.h | 6 +- include/xrpl/protocol/InnerObjectFormats.h | 4 +- include/xrpl/protocol/Issue.h | 4 +- include/xrpl/protocol/KeyType.h | 4 +- include/xrpl/protocol/Keylet.h | 4 +- include/xrpl/protocol/KnownFormats.h | 4 +- include/xrpl/protocol/LedgerFormats.h | 4 +- include/xrpl/protocol/LedgerHeader.h | 4 +- include/xrpl/protocol/MPTAmount.h | 4 +- include/xrpl/protocol/MPTIssue.h | 4 +- include/xrpl/protocol/MultiApiJson.h | 8 +- .../xrpl/protocol/NFTSyntheticSerializer.h | 4 +- include/xrpl/protocol/NFTokenID.h | 4 +- include/xrpl/protocol/NFTokenOfferID.h | 4 +- include/xrpl/protocol/PayChan.h | 4 +- include/xrpl/protocol/Permissions.h | 4 +- include/xrpl/protocol/Protocol.h | 4 +- include/xrpl/protocol/PublicKey.h | 10 +- include/xrpl/protocol/Quality.h | 6 +- include/xrpl/protocol/QualityFunction.h | 4 +- include/xrpl/protocol/RPCErr.h | 4 +- include/xrpl/protocol/Rate.h | 4 +- include/xrpl/protocol/RippleLedgerHash.h | 2 +- include/xrpl/protocol/Rules.h | 4 +- include/xrpl/protocol/SField.h | 4 +- include/xrpl/protocol/SOTemplate.h | 4 +- include/xrpl/protocol/STAccount.h | 6 +- include/xrpl/protocol/STAmount.h | 12 +- include/xrpl/protocol/STArray.h | 4 +- include/xrpl/protocol/STBase.h | 4 +- include/xrpl/protocol/STBitString.h | 8 +- include/xrpl/protocol/STBlob.h | 4 +- include/xrpl/protocol/STCurrency.h | 4 +- include/xrpl/protocol/STExchange.h | 4 +- include/xrpl/protocol/STInteger.h | 10 +- include/xrpl/protocol/STIssue.h | 4 +- include/xrpl/protocol/STLedgerEntry.h | 4 +- include/xrpl/protocol/STNumber.h | 4 +- include/xrpl/protocol/STObject.h | 19 ++- include/xrpl/protocol/STParsedJSON.h | 4 +- include/xrpl/protocol/STPathSet.h | 8 +- include/xrpl/protocol/STTx.h | 4 +- include/xrpl/protocol/STValidation.h | 8 +- include/xrpl/protocol/STVector256.h | 4 +- include/xrpl/protocol/STXChainBridge.h | 4 +- include/xrpl/protocol/SecretKey.h | 4 +- include/xrpl/protocol/Seed.h | 4 +- include/xrpl/protocol/SeqProxy.h | 4 +- include/xrpl/protocol/Serializer.h | 9 +- include/xrpl/protocol/Sign.h | 4 +- include/xrpl/protocol/SystemParameters.h | 4 +- include/xrpl/protocol/TER.h | 4 +- include/xrpl/protocol/TxFlags.h | 4 +- include/xrpl/protocol/TxFormats.h | 4 +- include/xrpl/protocol/TxMeta.h | 4 +- include/xrpl/protocol/UintTypes.h | 12 +- include/xrpl/protocol/Units.h | 11 +- include/xrpl/protocol/XChainAttestations.h | 4 +- include/xrpl/protocol/XRPAmount.h | 4 +- include/xrpl/protocol/detail/STVar.h | 4 +- include/xrpl/protocol/detail/b58_utils.h | 12 +- include/xrpl/protocol/detail/secp256k1.h | 4 +- include/xrpl/protocol/detail/token_errors.h | 14 +- include/xrpl/protocol/digest.h | 4 +- include/xrpl/protocol/json_get_or_throw.h | 22 ++-- include/xrpl/protocol/jss.h | 4 +- include/xrpl/protocol/nft.h | 4 +- include/xrpl/protocol/nftPageMask.h | 4 +- include/xrpl/protocol/serialize.h | 4 +- include/xrpl/protocol/tokens.h | 4 +- include/xrpl/resource/Charge.h | 4 +- include/xrpl/resource/Consumer.h | 4 +- include/xrpl/resource/Disposition.h | 4 +- include/xrpl/resource/Fees.h | 4 +- include/xrpl/resource/Gossip.h | 4 +- include/xrpl/resource/ResourceManager.h | 4 +- include/xrpl/resource/Types.h | 4 +- include/xrpl/resource/detail/Entry.h | 4 +- include/xrpl/resource/detail/Import.h | 4 +- include/xrpl/resource/detail/Key.h | 4 +- include/xrpl/resource/detail/Kind.h | 4 +- include/xrpl/resource/detail/Logic.h | 8 +- include/xrpl/resource/detail/Tuning.h | 4 +- include/xrpl/server/Handoff.h | 4 +- include/xrpl/server/Port.h | 4 +- include/xrpl/server/Server.h | 4 +- include/xrpl/server/Session.h | 4 +- include/xrpl/server/SimpleWriter.h | 4 +- include/xrpl/server/WSSession.h | 4 +- include/xrpl/server/Writer.h | 4 +- include/xrpl/server/detail/BaseHTTPPeer.h | 4 +- include/xrpl/server/detail/BasePeer.h | 6 +- include/xrpl/server/detail/BaseWSPeer.h | 8 +- include/xrpl/server/detail/Door.h | 4 +- include/xrpl/server/detail/JSONRPCUtil.h | 4 +- include/xrpl/server/detail/LowestLayer.h | 4 +- include/xrpl/server/detail/PlainHTTPPeer.h | 4 +- include/xrpl/server/detail/PlainWSPeer.h | 4 +- include/xrpl/server/detail/SSLHTTPPeer.h | 4 +- include/xrpl/server/detail/SSLWSPeer.h | 4 +- include/xrpl/server/detail/ServerImpl.h | 4 +- include/xrpl/server/detail/Spawn.h | 4 +- include/xrpl/server/detail/io_list.h | 4 +- include/xrpl/shamap/Family.h | 4 +- include/xrpl/shamap/FullBelowCache.h | 4 +- include/xrpl/shamap/SHAMap.h | 11 +- .../xrpl/shamap/SHAMapAccountStateLeafNode.h | 4 +- include/xrpl/shamap/SHAMapAddNode.h | 4 +- include/xrpl/shamap/SHAMapInnerNode.h | 4 +- include/xrpl/shamap/SHAMapItem.h | 6 +- include/xrpl/shamap/SHAMapLeafNode.h | 4 +- include/xrpl/shamap/SHAMapMissingNode.h | 4 +- include/xrpl/shamap/SHAMapNodeID.h | 4 +- include/xrpl/shamap/SHAMapSyncFilter.h | 4 +- include/xrpl/shamap/SHAMapTreeNode.h | 4 +- include/xrpl/shamap/SHAMapTxLeafNode.h | 4 +- .../xrpl/shamap/SHAMapTxPlusMetaLeafNode.h | 4 +- include/xrpl/shamap/TreeNodeCache.h | 4 +- include/xrpl/shamap/detail/TaggedPointer.h | 4 +- include/xrpl/shamap/detail/TaggedPointer.ipp | 18 +-- src/libxrpl/basics/Archive.cpp | 4 +- src/libxrpl/basics/BasicConfig.cpp | 4 +- src/libxrpl/basics/CountedObject.cpp | 4 +- src/libxrpl/basics/FileUtilities.cpp | 4 +- src/libxrpl/basics/Log.cpp | 12 +- src/libxrpl/basics/Number.cpp | 17 ++- src/libxrpl/basics/ResolverAsio.cpp | 22 ++-- src/libxrpl/basics/StringUtilities.cpp | 4 +- src/libxrpl/basics/UptimeClock.cpp | 4 +- src/libxrpl/basics/base64.cpp | 4 +- src/libxrpl/basics/contract.cpp | 4 +- src/libxrpl/basics/make_SSLContext.cpp | 4 +- src/libxrpl/basics/mulDiv.cpp | 6 +- src/libxrpl/core/detail/Job.cpp | 4 +- src/libxrpl/core/detail/JobQueue.cpp | 50 ++++--- src/libxrpl/core/detail/LoadEvent.cpp | 6 +- src/libxrpl/core/detail/LoadMonitor.cpp | 4 +- src/libxrpl/core/detail/Workers.cpp | 6 +- src/libxrpl/crypto/RFC1751.cpp | 21 ++- src/libxrpl/crypto/csprng.cpp | 4 +- src/libxrpl/crypto/secure_erase.cpp | 4 +- src/libxrpl/json/JsonPropertyStream.cpp | 4 +- src/libxrpl/json/Object.cpp | 4 +- src/libxrpl/json/Writer.cpp | 4 +- src/libxrpl/json/json_reader.cpp | 2 +- src/libxrpl/json/json_value.cpp | 2 +- src/libxrpl/ledger/ApplyStateTable.cpp | 22 ++-- src/libxrpl/ledger/ApplyView.cpp | 10 +- src/libxrpl/ledger/ApplyViewBase.cpp | 4 +- src/libxrpl/ledger/ApplyViewImpl.cpp | 4 +- src/libxrpl/ledger/BookDirs.cpp | 18 +-- src/libxrpl/ledger/CachedView.cpp | 7 +- src/libxrpl/ledger/CredentialHelpers.cpp | 4 +- src/libxrpl/ledger/Dir.cpp | 14 +- src/libxrpl/ledger/OpenView.cpp | 4 +- src/libxrpl/ledger/PaymentSandbox.cpp | 14 +- src/libxrpl/ledger/RawStateTable.cpp | 11 +- src/libxrpl/ledger/ReadView.cpp | 4 +- src/libxrpl/ledger/View.cpp | 122 +++++++++--------- src/libxrpl/net/HTTPClient.cpp | 4 +- src/libxrpl/net/RegisterSSLCerts.cpp | 4 +- src/libxrpl/nodestore/BatchWriter.cpp | 6 +- src/libxrpl/nodestore/Database.cpp | 14 +- src/libxrpl/nodestore/DatabaseNodeImp.cpp | 4 +- src/libxrpl/nodestore/DatabaseRotatingImp.cpp | 4 +- src/libxrpl/nodestore/DecodedBlob.cpp | 6 +- src/libxrpl/nodestore/DummyScheduler.cpp | 4 +- src/libxrpl/nodestore/ManagerImp.cpp | 6 +- src/libxrpl/nodestore/NodeObject.cpp | 4 +- .../nodestore/backend/MemoryFactory.cpp | 10 +- src/libxrpl/nodestore/backend/NuDBFactory.cpp | 6 +- src/libxrpl/nodestore/backend/NullFactory.cpp | 4 +- .../nodestore/backend/RocksDBFactory.cpp | 13 +- src/libxrpl/protocol/AMMCore.cpp | 6 +- src/libxrpl/protocol/AccountID.cpp | 6 +- src/libxrpl/protocol/Asset.cpp | 4 +- src/libxrpl/protocol/Book.cpp | 4 +- src/libxrpl/protocol/BuildInfo.cpp | 4 +- src/libxrpl/protocol/ErrorCodes.cpp | 6 +- src/libxrpl/protocol/Feature.cpp | 16 +-- src/libxrpl/protocol/IOUAmount.cpp | 4 +- src/libxrpl/protocol/Indexes.cpp | 17 ++- src/libxrpl/protocol/InnerObjectFormats.cpp | 4 +- src/libxrpl/protocol/Issue.cpp | 4 +- src/libxrpl/protocol/Keylet.cpp | 6 +- src/libxrpl/protocol/LedgerFormats.cpp | 4 +- src/libxrpl/protocol/LedgerHeader.cpp | 4 +- src/libxrpl/protocol/MPTAmount.cpp | 4 +- src/libxrpl/protocol/MPTIssue.cpp | 4 +- .../protocol/NFTSyntheticSerializer.cpp | 4 +- src/libxrpl/protocol/NFTokenID.cpp | 4 +- src/libxrpl/protocol/NFTokenOfferID.cpp | 4 +- src/libxrpl/protocol/Permissions.cpp | 10 +- src/libxrpl/protocol/PublicKey.cpp | 4 +- src/libxrpl/protocol/Quality.cpp | 25 ++-- src/libxrpl/protocol/QualityFunction.cpp | 4 +- src/libxrpl/protocol/RPCErr.cpp | 4 +- src/libxrpl/protocol/Rate2.cpp | 16 +-- src/libxrpl/protocol/Rules.cpp | 10 +- src/libxrpl/protocol/SField.cpp | 12 +- src/libxrpl/protocol/SOTemplate.cpp | 4 +- src/libxrpl/protocol/STAccount.cpp | 8 +- src/libxrpl/protocol/STAmount.cpp | 38 +++--- src/libxrpl/protocol/STArray.cpp | 4 +- src/libxrpl/protocol/STBase.cpp | 14 +- src/libxrpl/protocol/STBlob.cpp | 8 +- src/libxrpl/protocol/STCurrency.cpp | 4 +- src/libxrpl/protocol/STInteger.cpp | 8 +- src/libxrpl/protocol/STIssue.cpp | 4 +- src/libxrpl/protocol/STLedgerEntry.cpp | 6 +- src/libxrpl/protocol/STNumber.cpp | 11 +- src/libxrpl/protocol/STObject.cpp | 6 +- src/libxrpl/protocol/STParsedJSON.cpp | 4 +- src/libxrpl/protocol/STPathSet.cpp | 8 +- src/libxrpl/protocol/STTx.cpp | 10 +- src/libxrpl/protocol/STValidation.cpp | 6 +- src/libxrpl/protocol/STVar.cpp | 6 +- src/libxrpl/protocol/STVector256.cpp | 8 +- src/libxrpl/protocol/STXChainBridge.cpp | 6 +- src/libxrpl/protocol/SecretKey.cpp | 4 +- src/libxrpl/protocol/Seed.cpp | 4 +- src/libxrpl/protocol/Serializer.cpp | 10 +- src/libxrpl/protocol/Sign.cpp | 4 +- src/libxrpl/protocol/TER.cpp | 4 +- src/libxrpl/protocol/TxFormats.cpp | 4 +- src/libxrpl/protocol/TxMeta.cpp | 23 ++-- src/libxrpl/protocol/UintTypes.cpp | 4 +- src/libxrpl/protocol/XChainAttestations.cpp | 6 +- src/libxrpl/protocol/digest.cpp | 4 +- src/libxrpl/protocol/tokens.cpp | 30 ++--- src/libxrpl/resource/Charge.cpp | 4 +- src/libxrpl/resource/Consumer.cpp | 13 +- src/libxrpl/resource/Fees.cpp | 4 +- src/libxrpl/resource/ResourceManager.cpp | 4 +- src/libxrpl/server/JSONRPCUtil.cpp | 4 +- src/libxrpl/server/Port.cpp | 4 +- src/libxrpl/shamap/SHAMap.cpp | 91 +++++++------ src/libxrpl/shamap/SHAMapDelta.cpp | 12 +- src/libxrpl/shamap/SHAMapInnerNode.cpp | 56 ++++---- src/libxrpl/shamap/SHAMapLeafNode.cpp | 14 +- src/libxrpl/shamap/SHAMapNodeID.cpp | 16 +-- src/libxrpl/shamap/SHAMapSync.cpp | 20 +-- src/libxrpl/shamap/SHAMapTreeNode.cpp | 4 +- src/test/app/AMMCalc_test.cpp | 6 +- src/test/app/AMMClawback_test.cpp | 6 +- src/test/app/AMMExtended_test.cpp | 6 +- src/test/app/AMM_test.cpp | 8 +- src/test/app/AccountDelete_test.cpp | 6 +- src/test/app/AccountTxPaging_test.cpp | 6 +- src/test/app/AmendmentTable_test.cpp | 8 +- src/test/app/Batch_test.cpp | 14 +- src/test/app/Check_test.cpp | 8 +- src/test/app/Clawback_test.cpp | 6 +- src/test/app/Credentials_test.cpp | 9 +- src/test/app/CrossingLimits_test.cpp | 6 +- src/test/app/DID_test.cpp | 6 +- src/test/app/DNS_test.cpp | 12 +- src/test/app/Delegate_test.cpp | 6 +- src/test/app/DeliverMin_test.cpp | 6 +- src/test/app/DepositAuth_test.cpp | 8 +- src/test/app/Discrepancy_test.cpp | 6 +- src/test/app/EscrowToken_test.cpp | 92 ++++++------- src/test/app/Escrow_test.cpp | 34 ++--- src/test/app/FeeVote_test.cpp | 6 +- src/test/app/FixNFTokenPageLinks_test.cpp | 6 +- src/test/app/Flow_test.cpp | 8 +- src/test/app/Freeze_test.cpp | 6 +- src/test/app/HashRouter_test.cpp | 6 +- src/test/app/Invariants_test.cpp | 18 +-- src/test/app/LPTokenTransfer_test.cpp | 6 +- src/test/app/LedgerHistory_test.cpp | 6 +- src/test/app/LedgerLoad_test.cpp | 6 +- src/test/app/LedgerMaster_test.cpp | 6 +- src/test/app/LedgerReplay_test.cpp | 17 ++- src/test/app/LoadFeeTrack_test.cpp | 6 +- src/test/app/LoanBroker_test.cpp | 8 +- src/test/app/Loan_test.cpp | 32 ++--- src/test/app/MPToken_test.cpp | 14 +- src/test/app/Manifest_test.cpp | 6 +- src/test/app/MultiSign_test.cpp | 10 +- src/test/app/NFTokenAuth_test.cpp | 6 +- src/test/app/NFTokenBurn_test.cpp | 6 +- src/test/app/NFTokenDir_test.cpp | 6 +- src/test/app/NFToken_test.cpp | 14 +- src/test/app/NetworkID_test.cpp | 6 +- src/test/app/NetworkOPs_test.cpp | 6 +- src/test/app/OfferStream_test.cpp | 6 +- src/test/app/Offer_test.cpp | 12 +- src/test/app/Oracle_test.cpp | 6 +- src/test/app/OversizeMeta_test.cpp | 12 +- src/test/app/Path_test.cpp | 6 +- src/test/app/PayChan_test.cpp | 10 +- src/test/app/PayStrand_test.cpp | 30 ++--- src/test/app/PermissionedDEX_test.cpp | 6 +- src/test/app/PermissionedDomains_test.cpp | 6 +- src/test/app/PseudoTx_test.cpp | 8 +- src/test/app/RCLValidations_test.cpp | 8 +- src/test/app/ReducedOffer_test.cpp | 6 +- src/test/app/Regression_test.cpp | 10 +- src/test/app/SHAMapStore_test.cpp | 6 +- src/test/app/SetAuth_test.cpp | 6 +- src/test/app/SetRegularKey_test.cpp | 6 +- src/test/app/SetTrust_test.cpp | 6 +- src/test/app/TheoreticalQuality_test.cpp | 6 +- src/test/app/Ticket_test.cpp | 6 +- src/test/app/Transaction_ordering_test.cpp | 6 +- src/test/app/TrustAndBalance_test.cpp | 6 +- src/test/app/TxQ_test.cpp | 30 ++--- src/test/app/ValidatorKeys_test.cpp | 6 +- src/test/app/ValidatorList_test.cpp | 8 +- src/test/app/ValidatorSite_test.cpp | 6 +- src/test/app/Vault_test.cpp | 36 +++--- src/test/app/XChain_test.cpp | 8 +- src/test/app/tx/apply_test.cpp | 6 +- src/test/basics/Buffer_test.cpp | 6 +- src/test/basics/DetectCrash_test.cpp | 4 +- src/test/basics/Expected_test.cpp | 6 +- src/test/basics/FileUtilities_test.cpp | 8 +- src/test/basics/IOUAmount_test.cpp | 8 +- src/test/basics/IntrusiveShared_test.cpp | 6 +- src/test/basics/KeyCache_test.cpp | 6 +- src/test/basics/Number_test.cpp | 6 +- src/test/basics/PerfLog_test.cpp | 8 +- src/test/basics/StringUtilities_test.cpp | 6 +- src/test/basics/TaggedCache_test.cpp | 6 +- src/test/basics/Units_test.cpp | 6 +- src/test/basics/XRPAmount_test.cpp | 8 +- src/test/basics/base58_test.cpp | 38 +++--- src/test/basics/base_uint_test.cpp | 10 +- src/test/basics/hardened_hash_test.cpp | 14 +- src/test/basics/join_test.cpp | 6 +- src/test/beast/IPEndpointCommon.h | 2 +- src/test/beast/IPEndpoint_test.cpp | 2 +- .../beast/beast_CurrentThreadName_test.cpp | 4 +- src/test/conditions/PreimageSha256_test.cpp | 6 +- .../consensus/ByzantineFailureSim_test.cpp | 6 +- src/test/consensus/Consensus_test.cpp | 6 +- .../DistributedValidatorsSim_test.cpp | 6 +- src/test/consensus/LedgerTiming_test.cpp | 6 +- src/test/consensus/LedgerTrie_test.cpp | 6 +- src/test/consensus/NegativeUNL_test.cpp | 20 +-- .../consensus/RCLCensorshipDetector_test.cpp | 6 +- src/test/consensus/ScaleFreeSim_test.cpp | 6 +- src/test/consensus/Validations_test.cpp | 6 +- src/test/core/ClosureCounter_test.cpp | 6 +- src/test/core/Config_test.cpp | 10 +- src/test/core/Coroutine_test.cpp | 6 +- src/test/core/JobQueue_test.cpp | 6 +- src/test/core/SociDB_test.cpp | 6 +- src/test/core/Workers_test.cpp | 6 +- src/test/csf/BasicNetwork.h | 4 +- src/test/csf/BasicNetwork_test.cpp | 6 +- src/test/csf/CollectorRef.h | 4 +- src/test/csf/Digraph.h | 4 +- src/test/csf/Digraph_test.cpp | 6 +- src/test/csf/Histogram.h | 4 +- src/test/csf/Histogram_test.cpp | 6 +- src/test/csf/Peer.h | 4 +- src/test/csf/PeerGroup.h | 4 +- src/test/csf/Proposal.h | 4 +- src/test/csf/Scheduler.h | 4 +- src/test/csf/Scheduler_test.cpp | 6 +- src/test/csf/Sim.h | 4 +- src/test/csf/SimTime.h | 4 +- src/test/csf/TrustGraph.h | 4 +- src/test/csf/Tx.h | 4 +- src/test/csf/Validation.h | 4 +- src/test/csf/collectors.h | 4 +- src/test/csf/events.h | 4 +- src/test/csf/impl/Sim.cpp | 4 +- src/test/csf/impl/ledgers.cpp | 4 +- src/test/csf/ledgers.h | 8 +- src/test/csf/random.h | 4 +- src/test/csf/submitters.h | 4 +- src/test/csf/timers.h | 4 +- src/test/json/Object_test.cpp | 4 +- src/test/json/TestOutputSuite.h | 4 +- src/test/jtx/AMM.h | 4 +- src/test/jtx/AMMTest.h | 4 +- src/test/jtx/AbstractClient.h | 4 +- src/test/jtx/Account.h | 4 +- src/test/jtx/CaptureLogs.h | 4 +- src/test/jtx/CheckMessageLogs.h | 4 +- src/test/jtx/Env.h | 4 +- src/test/jtx/Env_ss.h | 4 +- src/test/jtx/Env_test.cpp | 6 +- src/test/jtx/JSONRPCClient.h | 4 +- src/test/jtx/JTx.h | 4 +- src/test/jtx/ManualTimeKeeper.h | 4 +- src/test/jtx/Oracle.h | 4 +- src/test/jtx/PathSet.h | 4 +- src/test/jtx/SignerUtils.h | 4 +- src/test/jtx/TestHelpers.h | 4 +- src/test/jtx/TestSuite.h | 4 +- src/test/jtx/TrustedPublisherServer.h | 7 +- src/test/jtx/WSClient.h | 4 +- src/test/jtx/WSClient_test.cpp | 6 +- src/test/jtx/account_txn_id.h | 4 +- src/test/jtx/acctdelete.h | 4 +- src/test/jtx/amount.h | 22 ++-- src/test/jtx/attester.h | 4 +- src/test/jtx/balance.h | 4 +- src/test/jtx/basic_prop.h | 4 +- src/test/jtx/batch.h | 4 +- src/test/jtx/check.h | 4 +- src/test/jtx/credentials.h | 4 +- src/test/jtx/delegate.h | 4 +- src/test/jtx/delivermin.h | 4 +- src/test/jtx/deposit.h | 4 +- src/test/jtx/did.h | 4 +- src/test/jtx/directory.h | 4 +- src/test/jtx/domain.h | 4 +- src/test/jtx/envconfig.h | 6 +- src/test/jtx/escrow.h | 4 +- src/test/jtx/fee.h | 4 +- src/test/jtx/flags.h | 4 +- src/test/jtx/impl/AMM.cpp | 6 +- src/test/jtx/impl/AMMTest.cpp | 4 +- src/test/jtx/impl/Account.cpp | 4 +- src/test/jtx/impl/Env.cpp | 4 +- src/test/jtx/impl/JSONRPCClient.cpp | 4 +- src/test/jtx/impl/Oracle.cpp | 4 +- src/test/jtx/impl/TestHelpers.cpp | 4 +- src/test/jtx/impl/WSClient.cpp | 4 +- src/test/jtx/impl/account_txn_id.cpp | 4 +- src/test/jtx/impl/acctdelete.cpp | 4 +- src/test/jtx/impl/amount.cpp | 4 +- src/test/jtx/impl/attester.cpp | 4 +- src/test/jtx/impl/balance.cpp | 4 +- src/test/jtx/impl/batch.cpp | 8 +- src/test/jtx/impl/check.cpp | 4 +- src/test/jtx/impl/creds.cpp | 4 +- src/test/jtx/impl/delegate.cpp | 4 +- src/test/jtx/impl/delivermin.cpp | 4 +- src/test/jtx/impl/deposit.cpp | 4 +- src/test/jtx/impl/dids.cpp | 4 +- src/test/jtx/impl/directory.cpp | 4 +- src/test/jtx/impl/domain.cpp | 4 +- src/test/jtx/impl/envconfig.cpp | 4 +- src/test/jtx/impl/escrow.cpp | 6 +- src/test/jtx/impl/fee.cpp | 4 +- src/test/jtx/impl/flags.cpp | 4 +- src/test/jtx/impl/invoice_id.cpp | 4 +- src/test/jtx/impl/jtx_json.cpp | 4 +- src/test/jtx/impl/last_ledger_sequence.cpp | 4 +- src/test/jtx/impl/ledgerStateFixes.cpp | 4 +- src/test/jtx/impl/memo.cpp | 4 +- src/test/jtx/impl/mpt.cpp | 6 +- src/test/jtx/impl/multisign.cpp | 6 +- src/test/jtx/impl/offer.cpp | 4 +- src/test/jtx/impl/owners.cpp | 4 +- src/test/jtx/impl/paths.cpp | 4 +- src/test/jtx/impl/pay.cpp | 4 +- src/test/jtx/impl/permissioned_dex.cpp | 4 +- src/test/jtx/impl/permissioned_domains.cpp | 4 +- src/test/jtx/impl/quality2.cpp | 4 +- src/test/jtx/impl/rate.cpp | 4 +- src/test/jtx/impl/regkey.cpp | 4 +- src/test/jtx/impl/sendmax.cpp | 4 +- src/test/jtx/impl/seq.cpp | 4 +- src/test/jtx/impl/sig.cpp | 4 +- src/test/jtx/impl/tag.cpp | 4 +- src/test/jtx/impl/testline.cpp | 4 +- src/test/jtx/impl/ticket.cpp | 4 +- src/test/jtx/impl/token.cpp | 6 +- src/test/jtx/impl/trust.cpp | 4 +- src/test/jtx/impl/txflags.cpp | 4 +- src/test/jtx/impl/utility.cpp | 6 +- src/test/jtx/impl/vault.cpp | 4 +- src/test/jtx/impl/xchain_bridge.cpp | 4 +- src/test/jtx/invoice_id.h | 4 +- src/test/jtx/jtx_json.h | 4 +- src/test/jtx/last_ledger_sequence.h | 4 +- src/test/jtx/ledgerStateFix.h | 4 +- src/test/jtx/memo.h | 4 +- src/test/jtx/mpt.h | 4 +- src/test/jtx/multisign.h | 4 +- src/test/jtx/noop.h | 4 +- src/test/jtx/offer.h | 4 +- src/test/jtx/owners.h | 4 +- src/test/jtx/paths.h | 4 +- src/test/jtx/pay.h | 4 +- src/test/jtx/permissioned_dex.h | 4 +- src/test/jtx/permissioned_domains.h | 6 +- src/test/jtx/prop.h | 4 +- src/test/jtx/quality.h | 4 +- src/test/jtx/rate.h | 4 +- src/test/jtx/regkey.h | 4 +- src/test/jtx/require.h | 4 +- src/test/jtx/requires.h | 4 +- src/test/jtx/rpc.h | 4 +- src/test/jtx/sendmax.h | 4 +- src/test/jtx/seq.h | 4 +- src/test/jtx/sig.h | 4 +- src/test/jtx/tag.h | 4 +- src/test/jtx/tags.h | 4 +- src/test/jtx/ter.h | 4 +- src/test/jtx/testline.h | 4 +- src/test/jtx/ticket.h | 4 +- src/test/jtx/token.h | 4 +- src/test/jtx/trust.h | 4 +- src/test/jtx/txflags.h | 4 +- src/test/jtx/utility.h | 4 +- src/test/jtx/vault.h | 4 +- src/test/jtx/xchain_bridge.h | 4 +- src/test/ledger/BookDirs_test.cpp | 6 +- src/test/ledger/Directory_test.cpp | 6 +- src/test/ledger/PaymentSandbox_test.cpp | 6 +- src/test/ledger/PendingSaves_test.cpp | 6 +- src/test/ledger/SkipList_test.cpp | 6 +- src/test/ledger/View_test.cpp | 8 +- src/test/nodestore/Backend_test.cpp | 6 +- src/test/nodestore/Basics_test.cpp | 6 +- src/test/nodestore/Database_test.cpp | 10 +- src/test/nodestore/NuDBFactory_test.cpp | 6 +- src/test/nodestore/TestBase.h | 4 +- src/test/nodestore/Timing_test.cpp | 6 +- src/test/nodestore/import_test.cpp | 6 +- src/test/nodestore/varint_test.cpp | 6 +- src/test/overlay/ProtocolVersion_test.cpp | 6 +- src/test/overlay/cluster_test.cpp | 8 +- src/test/overlay/compression_test.cpp | 48 +++---- src/test/overlay/handshake_test.cpp | 6 +- src/test/overlay/reduce_relay_test.cpp | 12 +- src/test/overlay/short_read_test.cpp | 6 +- src/test/overlay/traffic_count_test.cpp | 6 +- src/test/overlay/tx_reduce_relay_test.cpp | 6 +- src/test/peerfinder/Livecache_test.cpp | 14 +- src/test/peerfinder/PeerFinder_test.cpp | 10 +- src/test/protocol/ApiVersion_test.cpp | 6 +- src/test/protocol/BuildInfo_test.cpp | 6 +- src/test/protocol/Hooks_test.cpp | 6 +- src/test/protocol/InnerObjectFormats_test.cpp | 6 +- src/test/protocol/Issue_test.cpp | 6 +- src/test/protocol/Memo_test.cpp | 6 +- src/test/protocol/MultiApiJson_test.cpp | 8 +- src/test/protocol/PublicKey_test.cpp | 6 +- src/test/protocol/Quality_test.cpp | 6 +- src/test/protocol/STAccount_test.cpp | 6 +- src/test/protocol/STAmount_test.cpp | 6 +- src/test/protocol/STInteger_test.cpp | 6 +- src/test/protocol/STIssue_test.cpp | 6 +- src/test/protocol/STNumber_test.cpp | 6 +- src/test/protocol/STObject_test.cpp | 8 +- src/test/protocol/STParsedJSON_test.cpp | 6 +- src/test/protocol/STTx_test.cpp | 36 +++--- src/test/protocol/STValidation_test.cpp | 14 +- src/test/protocol/SecretKey_test.cpp | 6 +- src/test/protocol/Seed_test.cpp | 6 +- src/test/protocol/SeqProxy_test.cpp | 6 +- src/test/protocol/Serializer_test.cpp | 6 +- src/test/protocol/TER_test.cpp | 6 +- src/test/resource/Logic_test.cpp | 6 +- src/test/rpc/AMMInfo_test.cpp | 6 +- src/test/rpc/AccountCurrencies_test.cpp | 6 +- src/test/rpc/AccountInfo_test.cpp | 9 +- src/test/rpc/AccountLines_test.cpp | 6 +- src/test/rpc/AccountObjects_test.cpp | 6 +- src/test/rpc/AccountOffers_test.cpp | 6 +- src/test/rpc/AccountSet_test.cpp | 9 +- src/test/rpc/AccountTx_test.cpp | 6 +- src/test/rpc/AmendmentBlocked_test.cpp | 6 +- src/test/rpc/BookChanges_test.cpp | 6 +- src/test/rpc/Book_test.cpp | 6 +- src/test/rpc/Connect_test.cpp | 6 +- src/test/rpc/DeliveredAmount_test.cpp | 6 +- src/test/rpc/DepositAuthorized_test.cpp | 6 +- src/test/rpc/Feature_test.cpp | 26 ++-- src/test/rpc/GRPCTestClientBase.h | 4 +- src/test/rpc/GatewayBalances_test.cpp | 6 +- src/test/rpc/GetAggregatePrice_test.cpp | 6 +- src/test/rpc/GetCounts_test.cpp | 6 +- src/test/rpc/Handler_test.cpp | 8 +- src/test/rpc/JSONRPC_test.cpp | 6 +- src/test/rpc/KeyGeneration_test.cpp | 8 +- src/test/rpc/LedgerClosed_test.cpp | 6 +- src/test/rpc/LedgerData_test.cpp | 6 +- src/test/rpc/LedgerEntry_test.cpp | 16 +-- src/test/rpc/LedgerHeader_test.cpp | 6 +- src/test/rpc/LedgerRPC_test.cpp | 6 +- src/test/rpc/LedgerRequest_test.cpp | 6 +- src/test/rpc/ManifestRPC_test.cpp | 6 +- src/test/rpc/NoRippleCheck_test.cpp | 12 +- src/test/rpc/NoRipple_test.cpp | 6 +- src/test/rpc/OwnerInfo_test.cpp | 6 +- src/test/rpc/Peers_test.cpp | 6 +- src/test/rpc/RPCCall_test.cpp | 6 +- src/test/rpc/RPCHelpers_test.cpp | 6 +- src/test/rpc/RPCOverload_test.cpp | 6 +- src/test/rpc/RobustTransaction_test.cpp | 6 +- src/test/rpc/Roles_test.cpp | 6 +- src/test/rpc/ServerDefinitions_test.cpp | 6 +- src/test/rpc/ServerInfo_test.cpp | 6 +- src/test/rpc/Simulate_test.cpp | 6 +- src/test/rpc/Status_test.cpp | 4 +- src/test/rpc/Subscribe_test.cpp | 6 +- src/test/rpc/TransactionEntry_test.cpp | 6 +- src/test/rpc/TransactionHistory_test.cpp | 6 +- src/test/rpc/Transaction_test.cpp | 6 +- src/test/rpc/ValidatorInfo_test.cpp | 6 +- src/test/rpc/ValidatorRPC_test.cpp | 6 +- src/test/rpc/Version_test.cpp | 6 +- src/test/server/ServerStatus_test.cpp | 6 +- src/test/server/Server_test.cpp | 6 +- src/test/shamap/FetchPack_test.cpp | 8 +- src/test/shamap/SHAMapSync_test.cpp | 6 +- src/test/shamap/SHAMap_test.cpp | 8 +- src/test/shamap/common.h | 4 +- src/test/unit_test/FileDirGuard.h | 4 +- src/test/unit_test/SuiteJournal.h | 4 +- src/test/unit_test/multi_runner.cpp | 4 +- src/test/unit_test/multi_runner.h | 4 +- src/tests/libxrpl/basics/RangeSet.cpp | 2 +- src/tests/libxrpl/basics/Slice.cpp | 2 +- src/tests/libxrpl/basics/base64.cpp | 2 +- src/tests/libxrpl/basics/contract.cpp | 2 +- src/tests/libxrpl/basics/mulDiv.cpp | 2 +- src/tests/libxrpl/basics/scope.cpp | 2 +- src/tests/libxrpl/basics/tagged_integer.cpp | 2 +- src/tests/libxrpl/crypto/csprng.cpp | 2 +- src/tests/libxrpl/json/Output.cpp | 2 +- src/tests/libxrpl/json/Value.cpp | 4 +- src/tests/libxrpl/json/Writer.cpp | 2 +- src/tests/libxrpl/net/HTTPClient.cpp | 2 +- .../app/consensus/RCLCensorshipDetector.h | 4 +- src/xrpld/app/consensus/RCLConsensus.cpp | 20 +-- src/xrpld/app/consensus/RCLConsensus.h | 4 +- src/xrpld/app/consensus/RCLCxLedger.h | 8 +- src/xrpld/app/consensus/RCLCxPeerPos.cpp | 6 +- src/xrpld/app/consensus/RCLCxPeerPos.h | 4 +- src/xrpld/app/consensus/RCLCxTx.h | 8 +- src/xrpld/app/consensus/RCLValidations.cpp | 12 +- src/xrpld/app/consensus/RCLValidations.h | 8 +- .../app/ledger/AbstractFetchPackContainer.h | 4 +- src/xrpld/app/ledger/AcceptedLedger.cpp | 4 +- src/xrpld/app/ledger/AcceptedLedger.h | 4 +- src/xrpld/app/ledger/AcceptedLedgerTx.cpp | 8 +- src/xrpld/app/ledger/AcceptedLedgerTx.h | 4 +- src/xrpld/app/ledger/AccountStateSF.cpp | 4 +- src/xrpld/app/ledger/AccountStateSF.h | 4 +- src/xrpld/app/ledger/BookListeners.cpp | 4 +- src/xrpld/app/ledger/BookListeners.h | 4 +- src/xrpld/app/ledger/BuildLedger.h | 4 +- src/xrpld/app/ledger/ConsensusTransSetSF.cpp | 8 +- src/xrpld/app/ledger/ConsensusTransSetSF.h | 4 +- src/xrpld/app/ledger/InboundLedger.h | 4 +- src/xrpld/app/ledger/InboundLedgers.h | 4 +- src/xrpld/app/ledger/InboundTransactions.h | 4 +- src/xrpld/app/ledger/Ledger.cpp | 26 ++-- src/xrpld/app/ledger/Ledger.h | 4 +- src/xrpld/app/ledger/LedgerCleaner.h | 4 +- src/xrpld/app/ledger/LedgerHistory.cpp | 32 +++-- src/xrpld/app/ledger/LedgerHistory.h | 4 +- src/xrpld/app/ledger/LedgerHolder.h | 4 +- src/xrpld/app/ledger/LedgerMaster.h | 4 +- src/xrpld/app/ledger/LedgerReplay.h | 4 +- src/xrpld/app/ledger/LedgerReplayTask.h | 4 +- src/xrpld/app/ledger/LedgerReplayer.h | 4 +- src/xrpld/app/ledger/LedgerToJson.h | 4 +- src/xrpld/app/ledger/LocalTxs.h | 4 +- src/xrpld/app/ledger/OpenLedger.h | 6 +- src/xrpld/app/ledger/OrderBookDB.cpp | 6 +- src/xrpld/app/ledger/OrderBookDB.h | 4 +- src/xrpld/app/ledger/PendingSaves.h | 4 +- src/xrpld/app/ledger/TransactionMaster.h | 4 +- src/xrpld/app/ledger/TransactionStateSF.cpp | 6 +- src/xrpld/app/ledger/TransactionStateSF.h | 4 +- src/xrpld/app/ledger/detail/BuildLedger.cpp | 10 +- src/xrpld/app/ledger/detail/InboundLedger.cpp | 21 ++- .../app/ledger/detail/InboundLedgers.cpp | 13 +- .../app/ledger/detail/InboundTransactions.cpp | 4 +- src/xrpld/app/ledger/detail/LedgerCleaner.cpp | 9 +- .../app/ledger/detail/LedgerDeltaAcquire.cpp | 10 +- .../app/ledger/detail/LedgerDeltaAcquire.h | 4 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 30 ++--- src/xrpld/app/ledger/detail/LedgerReplay.cpp | 4 +- .../ledger/detail/LedgerReplayMsgHandler.cpp | 4 +- .../ledger/detail/LedgerReplayMsgHandler.h | 4 +- .../app/ledger/detail/LedgerReplayTask.cpp | 12 +- .../app/ledger/detail/LedgerReplayer.cpp | 6 +- src/xrpld/app/ledger/detail/LedgerToJson.cpp | 4 +- src/xrpld/app/ledger/detail/LocalTxs.cpp | 4 +- src/xrpld/app/ledger/detail/OpenLedger.cpp | 6 +- .../app/ledger/detail/SkipListAcquire.cpp | 8 +- src/xrpld/app/ledger/detail/SkipListAcquire.h | 8 +- .../app/ledger/detail/TimeoutCounter.cpp | 6 +- src/xrpld/app/ledger/detail/TimeoutCounter.h | 6 +- .../app/ledger/detail/TransactionAcquire.cpp | 4 +- .../app/ledger/detail/TransactionAcquire.h | 4 +- .../app/ledger/detail/TransactionMaster.cpp | 4 +- src/xrpld/app/main/Application.cpp | 35 +++-- src/xrpld/app/main/Application.h | 4 +- src/xrpld/app/main/CollectorManager.cpp | 4 +- src/xrpld/app/main/CollectorManager.h | 4 +- src/xrpld/app/main/DBInit.h | 4 +- src/xrpld/app/main/GRPCServer.cpp | 8 +- src/xrpld/app/main/GRPCServer.h | 4 +- src/xrpld/app/main/LoadManager.cpp | 7 +- src/xrpld/app/main/LoadManager.h | 4 +- src/xrpld/app/main/Main.cpp | 10 +- src/xrpld/app/main/NodeIdentity.cpp | 4 +- src/xrpld/app/main/NodeIdentity.h | 4 +- src/xrpld/app/main/NodeStoreScheduler.cpp | 4 +- src/xrpld/app/main/NodeStoreScheduler.h | 4 +- src/xrpld/app/main/Tuning.h | 4 +- src/xrpld/app/misc/AMMHelpers.h | 4 +- src/xrpld/app/misc/AMMUtils.h | 4 +- src/xrpld/app/misc/AmendmentTable.h | 4 +- src/xrpld/app/misc/CanonicalTXSet.cpp | 4 +- src/xrpld/app/misc/CanonicalTXSet.h | 4 +- src/xrpld/app/misc/DelegateUtils.h | 4 +- src/xrpld/app/misc/DeliverMax.h | 4 +- src/xrpld/app/misc/FeeVote.h | 4 +- src/xrpld/app/misc/FeeVoteImpl.cpp | 6 +- src/xrpld/app/misc/HashRouter.cpp | 6 +- src/xrpld/app/misc/HashRouter.h | 4 +- src/xrpld/app/misc/LendingHelpers.h | 6 +- src/xrpld/app/misc/LoadFeeTrack.h | 4 +- src/xrpld/app/misc/Manifest.h | 4 +- src/xrpld/app/misc/NegativeUNLVote.cpp | 11 +- src/xrpld/app/misc/NegativeUNLVote.h | 4 +- src/xrpld/app/misc/NetworkOPs.cpp | 53 ++++---- src/xrpld/app/misc/NetworkOPs.h | 4 +- src/xrpld/app/misc/PermissionedDEXHelpers.cpp | 4 +- src/xrpld/app/misc/PermissionedDEXHelpers.h | 4 +- src/xrpld/app/misc/SHAMapStore.h | 4 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 16 +-- src/xrpld/app/misc/SHAMapStoreImp.h | 4 +- src/xrpld/app/misc/Transaction.h | 4 +- src/xrpld/app/misc/TxQ.h | 4 +- src/xrpld/app/misc/ValidatorKeys.h | 4 +- src/xrpld/app/misc/ValidatorList.h | 9 +- src/xrpld/app/misc/ValidatorSite.h | 4 +- src/xrpld/app/misc/detail/AMMHelpers.cpp | 6 +- src/xrpld/app/misc/detail/AMMUtils.cpp | 6 +- src/xrpld/app/misc/detail/AccountTxPaging.cpp | 4 +- src/xrpld/app/misc/detail/AccountTxPaging.h | 4 +- src/xrpld/app/misc/detail/AmendmentTable.cpp | 12 +- src/xrpld/app/misc/detail/DelegateUtils.cpp | 4 +- src/xrpld/app/misc/detail/DeliverMax.cpp | 4 +- src/xrpld/app/misc/detail/LendingHelpers.cpp | 118 +++++++++-------- src/xrpld/app/misc/detail/LoadFeeTrack.cpp | 4 +- src/xrpld/app/misc/detail/Manifest.cpp | 13 +- src/xrpld/app/misc/detail/Transaction.cpp | 6 +- src/xrpld/app/misc/detail/TxQ.cpp | 62 +++++---- src/xrpld/app/misc/detail/ValidatorKeys.cpp | 4 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 65 +++++----- src/xrpld/app/misc/detail/ValidatorSite.cpp | 8 +- src/xrpld/app/misc/detail/Work.h | 4 +- src/xrpld/app/misc/detail/WorkBase.h | 6 +- src/xrpld/app/misc/detail/WorkFile.h | 6 +- src/xrpld/app/misc/detail/WorkPlain.h | 4 +- src/xrpld/app/misc/detail/WorkSSL.cpp | 4 +- src/xrpld/app/misc/detail/WorkSSL.h | 4 +- src/xrpld/app/paths/AMMContext.h | 4 +- src/xrpld/app/paths/AMMLiquidity.h | 4 +- src/xrpld/app/paths/AMMOffer.h | 4 +- src/xrpld/app/paths/AccountCurrencies.cpp | 4 +- src/xrpld/app/paths/AccountCurrencies.h | 4 +- src/xrpld/app/paths/Credit.cpp | 12 +- src/xrpld/app/paths/Credit.h | 4 +- src/xrpld/app/paths/Flow.cpp | 6 +- src/xrpld/app/paths/Flow.h | 4 +- src/xrpld/app/paths/PathRequest.cpp | 7 +- src/xrpld/app/paths/PathRequest.h | 4 +- src/xrpld/app/paths/PathRequests.cpp | 4 +- src/xrpld/app/paths/PathRequests.h | 4 +- src/xrpld/app/paths/Pathfinder.cpp | 16 +-- src/xrpld/app/paths/Pathfinder.h | 4 +- src/xrpld/app/paths/RippleCalc.cpp | 4 +- src/xrpld/app/paths/RippleCalc.h | 4 +- src/xrpld/app/paths/RippleLineCache.cpp | 10 +- src/xrpld/app/paths/RippleLineCache.h | 6 +- src/xrpld/app/paths/TrustLine.cpp | 4 +- src/xrpld/app/paths/TrustLine.h | 4 +- src/xrpld/app/paths/detail/AMMLiquidity.cpp | 6 +- src/xrpld/app/paths/detail/AMMOffer.cpp | 4 +- src/xrpld/app/paths/detail/AmountSpec.h | 17 ++- src/xrpld/app/paths/detail/BookStep.cpp | 21 ++- src/xrpld/app/paths/detail/DirectStep.cpp | 14 +- src/xrpld/app/paths/detail/FlatSets.h | 4 +- src/xrpld/app/paths/detail/FlowDebugInfo.h | 12 +- src/xrpld/app/paths/detail/PathfinderUtils.h | 4 +- src/xrpld/app/paths/detail/PaySteps.cpp | 14 +- src/xrpld/app/paths/detail/StepChecks.h | 6 +- src/xrpld/app/paths/detail/Steps.h | 6 +- src/xrpld/app/paths/detail/StrandFlow.h | 20 +-- .../app/paths/detail/XRPEndpointStep.cpp | 10 +- src/xrpld/app/rdb/PeerFinder.h | 4 +- src/xrpld/app/rdb/RelationalDatabase.h | 6 +- src/xrpld/app/rdb/State.h | 4 +- src/xrpld/app/rdb/Vacuum.h | 4 +- src/xrpld/app/rdb/Wallet.h | 4 +- src/xrpld/app/rdb/backend/SQLiteDatabase.h | 4 +- src/xrpld/app/rdb/backend/detail/Node.cpp | 12 +- src/xrpld/app/rdb/backend/detail/Node.h | 4 +- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 10 +- src/xrpld/app/rdb/detail/PeerFinder.cpp | 4 +- .../app/rdb/detail/RelationalDatabase.cpp | 4 +- src/xrpld/app/rdb/detail/State.cpp | 4 +- src/xrpld/app/rdb/detail/Vacuum.cpp | 4 +- src/xrpld/app/rdb/detail/Wallet.cpp | 4 +- src/xrpld/app/tx/apply.h | 4 +- src/xrpld/app/tx/applySteps.h | 4 +- src/xrpld/app/tx/detail/AMMBid.cpp | 8 +- src/xrpld/app/tx/detail/AMMBid.h | 4 +- src/xrpld/app/tx/detail/AMMClawback.cpp | 4 +- src/xrpld/app/tx/detail/AMMClawback.h | 4 +- src/xrpld/app/tx/detail/AMMCreate.cpp | 4 +- src/xrpld/app/tx/detail/AMMCreate.h | 4 +- src/xrpld/app/tx/detail/AMMDelete.cpp | 4 +- src/xrpld/app/tx/detail/AMMDelete.h | 4 +- src/xrpld/app/tx/detail/AMMDeposit.cpp | 6 +- src/xrpld/app/tx/detail/AMMDeposit.h | 4 +- src/xrpld/app/tx/detail/AMMVote.cpp | 6 +- src/xrpld/app/tx/detail/AMMVote.h | 4 +- src/xrpld/app/tx/detail/AMMWithdraw.cpp | 6 +- src/xrpld/app/tx/detail/AMMWithdraw.h | 4 +- src/xrpld/app/tx/detail/ApplyContext.cpp | 6 +- src/xrpld/app/tx/detail/ApplyContext.h | 4 +- src/xrpld/app/tx/detail/Batch.cpp | 8 +- src/xrpld/app/tx/detail/Batch.h | 4 +- src/xrpld/app/tx/detail/BookTip.cpp | 4 +- src/xrpld/app/tx/detail/BookTip.h | 4 +- src/xrpld/app/tx/detail/CancelCheck.cpp | 4 +- src/xrpld/app/tx/detail/CancelCheck.h | 4 +- src/xrpld/app/tx/detail/CancelOffer.cpp | 4 +- src/xrpld/app/tx/detail/CancelOffer.h | 4 +- src/xrpld/app/tx/detail/CashCheck.cpp | 4 +- src/xrpld/app/tx/detail/CashCheck.h | 4 +- src/xrpld/app/tx/detail/Change.cpp | 8 +- src/xrpld/app/tx/detail/Change.h | 4 +- src/xrpld/app/tx/detail/Clawback.cpp | 4 +- src/xrpld/app/tx/detail/Clawback.h | 4 +- src/xrpld/app/tx/detail/CreateCheck.cpp | 4 +- src/xrpld/app/tx/detail/CreateCheck.h | 4 +- src/xrpld/app/tx/detail/CreateOffer.cpp | 16 +-- src/xrpld/app/tx/detail/CreateOffer.h | 4 +- src/xrpld/app/tx/detail/CreateTicket.cpp | 4 +- src/xrpld/app/tx/detail/CreateTicket.h | 4 +- src/xrpld/app/tx/detail/Credentials.cpp | 4 +- src/xrpld/app/tx/detail/Credentials.h | 4 +- src/xrpld/app/tx/detail/DID.cpp | 4 +- src/xrpld/app/tx/detail/DID.h | 4 +- src/xrpld/app/tx/detail/DelegateSet.cpp | 4 +- src/xrpld/app/tx/detail/DelegateSet.h | 4 +- src/xrpld/app/tx/detail/DeleteAccount.cpp | 16 +-- src/xrpld/app/tx/detail/DeleteAccount.h | 4 +- src/xrpld/app/tx/detail/DeleteOracle.cpp | 4 +- src/xrpld/app/tx/detail/DeleteOracle.h | 4 +- src/xrpld/app/tx/detail/DepositPreauth.cpp | 4 +- src/xrpld/app/tx/detail/DepositPreauth.h | 4 +- src/xrpld/app/tx/detail/Escrow.cpp | 10 +- src/xrpld/app/tx/detail/Escrow.h | 4 +- src/xrpld/app/tx/detail/InvariantCheck.cpp | 76 ++++++----- src/xrpld/app/tx/detail/InvariantCheck.h | 6 +- src/xrpld/app/tx/detail/LedgerStateFix.cpp | 4 +- src/xrpld/app/tx/detail/LedgerStateFix.h | 4 +- .../app/tx/detail/LoanBrokerCoverClawback.cpp | 4 +- .../app/tx/detail/LoanBrokerCoverClawback.h | 4 +- .../app/tx/detail/LoanBrokerCoverDeposit.cpp | 4 +- .../app/tx/detail/LoanBrokerCoverDeposit.h | 4 +- .../app/tx/detail/LoanBrokerCoverWithdraw.cpp | 4 +- .../app/tx/detail/LoanBrokerCoverWithdraw.h | 4 +- src/xrpld/app/tx/detail/LoanBrokerDelete.cpp | 4 +- src/xrpld/app/tx/detail/LoanBrokerDelete.h | 4 +- src/xrpld/app/tx/detail/LoanBrokerSet.cpp | 4 +- src/xrpld/app/tx/detail/LoanBrokerSet.h | 4 +- src/xrpld/app/tx/detail/LoanDelete.cpp | 6 +- src/xrpld/app/tx/detail/LoanDelete.h | 4 +- src/xrpld/app/tx/detail/LoanManage.cpp | 4 +- src/xrpld/app/tx/detail/LoanManage.h | 4 +- src/xrpld/app/tx/detail/LoanPay.cpp | 44 +++---- src/xrpld/app/tx/detail/LoanPay.h | 4 +- src/xrpld/app/tx/detail/LoanSet.cpp | 16 +-- src/xrpld/app/tx/detail/LoanSet.h | 4 +- src/xrpld/app/tx/detail/MPTokenAuthorize.cpp | 4 +- src/xrpld/app/tx/detail/MPTokenAuthorize.h | 4 +- .../app/tx/detail/MPTokenIssuanceCreate.cpp | 4 +- .../app/tx/detail/MPTokenIssuanceCreate.h | 4 +- .../app/tx/detail/MPTokenIssuanceDestroy.cpp | 4 +- .../app/tx/detail/MPTokenIssuanceDestroy.h | 4 +- .../app/tx/detail/MPTokenIssuanceSet.cpp | 4 +- src/xrpld/app/tx/detail/MPTokenIssuanceSet.h | 4 +- .../app/tx/detail/NFTokenAcceptOffer.cpp | 4 +- src/xrpld/app/tx/detail/NFTokenAcceptOffer.h | 4 +- src/xrpld/app/tx/detail/NFTokenBurn.cpp | 4 +- src/xrpld/app/tx/detail/NFTokenBurn.h | 4 +- .../app/tx/detail/NFTokenCancelOffer.cpp | 4 +- src/xrpld/app/tx/detail/NFTokenCancelOffer.h | 4 +- .../app/tx/detail/NFTokenCreateOffer.cpp | 4 +- src/xrpld/app/tx/detail/NFTokenCreateOffer.h | 4 +- src/xrpld/app/tx/detail/NFTokenMint.cpp | 6 +- src/xrpld/app/tx/detail/NFTokenMint.h | 4 +- src/xrpld/app/tx/detail/NFTokenModify.cpp | 4 +- src/xrpld/app/tx/detail/NFTokenModify.h | 4 +- src/xrpld/app/tx/detail/NFTokenUtils.cpp | 22 ++-- src/xrpld/app/tx/detail/NFTokenUtils.h | 6 +- src/xrpld/app/tx/detail/Offer.h | 6 +- src/xrpld/app/tx/detail/OfferStream.cpp | 6 +- src/xrpld/app/tx/detail/OfferStream.h | 4 +- src/xrpld/app/tx/detail/PayChan.cpp | 8 +- src/xrpld/app/tx/detail/PayChan.h | 4 +- src/xrpld/app/tx/detail/Payment.cpp | 6 +- src/xrpld/app/tx/detail/Payment.h | 4 +- .../tx/detail/PermissionedDomainDelete.cpp | 10 +- .../app/tx/detail/PermissionedDomainDelete.h | 4 +- .../app/tx/detail/PermissionedDomainSet.cpp | 4 +- .../app/tx/detail/PermissionedDomainSet.h | 4 +- src/xrpld/app/tx/detail/SetAccount.cpp | 4 +- src/xrpld/app/tx/detail/SetAccount.h | 4 +- src/xrpld/app/tx/detail/SetOracle.cpp | 4 +- src/xrpld/app/tx/detail/SetOracle.h | 4 +- src/xrpld/app/tx/detail/SetRegularKey.cpp | 4 +- src/xrpld/app/tx/detail/SetRegularKey.h | 4 +- src/xrpld/app/tx/detail/SetSignerList.cpp | 16 +-- src/xrpld/app/tx/detail/SetSignerList.h | 4 +- src/xrpld/app/tx/detail/SetTrust.cpp | 14 +- src/xrpld/app/tx/detail/SetTrust.h | 4 +- src/xrpld/app/tx/detail/SignerEntries.cpp | 4 +- src/xrpld/app/tx/detail/SignerEntries.h | 4 +- src/xrpld/app/tx/detail/Transactor.cpp | 30 ++--- src/xrpld/app/tx/detail/Transactor.h | 6 +- src/xrpld/app/tx/detail/VaultClawback.cpp | 8 +- src/xrpld/app/tx/detail/VaultClawback.h | 4 +- src/xrpld/app/tx/detail/VaultCreate.cpp | 4 +- src/xrpld/app/tx/detail/VaultCreate.h | 4 +- src/xrpld/app/tx/detail/VaultDelete.cpp | 4 +- src/xrpld/app/tx/detail/VaultDelete.h | 4 +- src/xrpld/app/tx/detail/VaultDeposit.cpp | 8 +- src/xrpld/app/tx/detail/VaultDeposit.h | 4 +- src/xrpld/app/tx/detail/VaultSet.cpp | 4 +- src/xrpld/app/tx/detail/VaultSet.h | 4 +- src/xrpld/app/tx/detail/VaultWithdraw.cpp | 6 +- src/xrpld/app/tx/detail/VaultWithdraw.h | 4 +- src/xrpld/app/tx/detail/XChainBridge.cpp | 10 +- src/xrpld/app/tx/detail/XChainBridge.h | 4 +- src/xrpld/app/tx/detail/apply.cpp | 4 +- src/xrpld/app/tx/detail/applySteps.cpp | 15 +-- src/xrpld/conditions/Condition.h | 4 +- src/xrpld/conditions/Fulfillment.h | 4 +- src/xrpld/conditions/detail/Condition.cpp | 4 +- src/xrpld/conditions/detail/Fulfillment.cpp | 4 +- src/xrpld/conditions/detail/PreimageSha256.h | 4 +- src/xrpld/conditions/detail/error.cpp | 4 +- src/xrpld/conditions/detail/error.h | 6 +- src/xrpld/conditions/detail/utils.h | 4 +- src/xrpld/consensus/Consensus.cpp | 4 +- src/xrpld/consensus/Consensus.h | 23 ++-- src/xrpld/consensus/ConsensusParms.h | 6 +- src/xrpld/consensus/ConsensusProposal.h | 4 +- src/xrpld/consensus/ConsensusTypes.h | 6 +- src/xrpld/consensus/DisputedTx.h | 4 +- src/xrpld/consensus/LedgerTiming.h | 4 +- src/xrpld/consensus/LedgerTrie.h | 22 ++-- src/xrpld/consensus/Validations.h | 8 +- src/xrpld/core/Config.h | 4 +- src/xrpld/core/ConfigSections.h | 4 +- src/xrpld/core/DatabaseCon.h | 6 +- src/xrpld/core/SociDB.h | 4 +- src/xrpld/core/TimeKeeper.h | 4 +- src/xrpld/core/detail/Config.cpp | 27 ++-- src/xrpld/core/detail/DatabaseCon.cpp | 6 +- src/xrpld/core/detail/SociDB.cpp | 6 +- src/xrpld/overlay/Cluster.h | 4 +- src/xrpld/overlay/ClusterNode.h | 4 +- src/xrpld/overlay/Compression.h | 12 +- src/xrpld/overlay/Message.h | 4 +- src/xrpld/overlay/Overlay.h | 4 +- src/xrpld/overlay/Peer.h | 4 +- src/xrpld/overlay/PeerReservationTable.h | 4 +- src/xrpld/overlay/PeerSet.h | 4 +- src/xrpld/overlay/ReduceRelayCommon.h | 4 +- src/xrpld/overlay/Slot.h | 8 +- src/xrpld/overlay/Squelch.h | 4 +- src/xrpld/overlay/detail/Cluster.cpp | 4 +- src/xrpld/overlay/detail/ConnectAttempt.cpp | 10 +- src/xrpld/overlay/detail/ConnectAttempt.h | 4 +- src/xrpld/overlay/detail/Handshake.cpp | 8 +- src/xrpld/overlay/detail/Handshake.h | 4 +- src/xrpld/overlay/detail/Message.cpp | 14 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 22 ++-- src/xrpld/overlay/detail/OverlayImpl.h | 8 +- src/xrpld/overlay/detail/PeerImp.cpp | 46 +++---- src/xrpld/overlay/detail/PeerImp.h | 6 +- .../overlay/detail/PeerReservationTable.cpp | 4 +- src/xrpld/overlay/detail/PeerSet.cpp | 6 +- src/xrpld/overlay/detail/ProtocolMessage.h | 12 +- src/xrpld/overlay/detail/ProtocolVersion.cpp | 4 +- src/xrpld/overlay/detail/ProtocolVersion.h | 4 +- src/xrpld/overlay/detail/TrafficCount.cpp | 4 +- src/xrpld/overlay/detail/TrafficCount.h | 6 +- src/xrpld/overlay/detail/Tuning.h | 4 +- src/xrpld/overlay/detail/TxMetrics.cpp | 4 +- src/xrpld/overlay/detail/TxMetrics.h | 4 +- src/xrpld/overlay/detail/ZeroCopyStream.h | 6 +- src/xrpld/overlay/make_Overlay.h | 4 +- src/xrpld/overlay/predicates.h | 4 +- src/xrpld/peerfinder/PeerfinderManager.h | 6 +- src/xrpld/peerfinder/Slot.h | 4 +- src/xrpld/peerfinder/detail/Bootcache.cpp | 4 +- src/xrpld/peerfinder/detail/Bootcache.h | 8 +- src/xrpld/peerfinder/detail/Checker.h | 4 +- src/xrpld/peerfinder/detail/Counts.h | 12 +- src/xrpld/peerfinder/detail/Endpoint.cpp | 4 +- src/xrpld/peerfinder/detail/Fixed.h | 4 +- src/xrpld/peerfinder/detail/Handouts.h | 6 +- src/xrpld/peerfinder/detail/Livecache.h | 10 +- src/xrpld/peerfinder/detail/Logic.h | 26 ++-- .../peerfinder/detail/PeerfinderConfig.cpp | 6 +- .../peerfinder/detail/PeerfinderManager.cpp | 4 +- src/xrpld/peerfinder/detail/SlotImp.cpp | 16 +-- src/xrpld/peerfinder/detail/SlotImp.h | 4 +- src/xrpld/peerfinder/detail/Source.h | 4 +- src/xrpld/peerfinder/detail/SourceStrings.cpp | 4 +- src/xrpld/peerfinder/detail/SourceStrings.h | 4 +- src/xrpld/peerfinder/detail/Store.h | 4 +- src/xrpld/peerfinder/detail/StoreSqdb.h | 4 +- src/xrpld/peerfinder/detail/Tuning.h | 4 +- src/xrpld/peerfinder/make_Manager.h | 4 +- src/xrpld/perflog/detail/PerfLogImp.cpp | 23 ++-- src/xrpld/perflog/detail/PerfLogImp.h | 6 +- src/xrpld/rpc/BookChanges.h | 4 +- src/xrpld/rpc/CTID.h | 4 +- src/xrpld/rpc/Context.h | 4 +- src/xrpld/rpc/DeliveredAmount.h | 4 +- src/xrpld/rpc/GRPCHandlers.h | 4 +- src/xrpld/rpc/InfoSub.h | 4 +- src/xrpld/rpc/MPTokenIssuanceID.h | 4 +- src/xrpld/rpc/Output.h | 4 +- src/xrpld/rpc/README.md | 2 +- src/xrpld/rpc/RPCCall.h | 4 +- src/xrpld/rpc/RPCHandler.h | 4 +- src/xrpld/rpc/RPCSub.h | 4 +- src/xrpld/rpc/Request.h | 4 +- src/xrpld/rpc/Role.h | 4 +- src/xrpld/rpc/ServerHandler.h | 4 +- src/xrpld/rpc/Status.h | 8 +- src/xrpld/rpc/detail/DeliveredAmount.cpp | 4 +- src/xrpld/rpc/detail/Handler.cpp | 12 +- src/xrpld/rpc/detail/Handler.h | 4 +- src/xrpld/rpc/detail/InfoSub.cpp | 6 +- src/xrpld/rpc/detail/LegacyPathFind.cpp | 4 +- src/xrpld/rpc/detail/LegacyPathFind.h | 4 +- src/xrpld/rpc/detail/MPTokenIssuanceID.cpp | 4 +- src/xrpld/rpc/detail/RPCCall.cpp | 12 +- src/xrpld/rpc/detail/RPCHandler.cpp | 4 +- src/xrpld/rpc/detail/RPCHelpers.cpp | 8 +- src/xrpld/rpc/detail/RPCHelpers.h | 4 +- src/xrpld/rpc/detail/RPCLedgerHelpers.cpp | 16 +-- src/xrpld/rpc/detail/RPCLedgerHelpers.h | 4 +- src/xrpld/rpc/detail/RPCSub.cpp | 4 +- src/xrpld/rpc/detail/Role.cpp | 6 +- src/xrpld/rpc/detail/ServerHandler.cpp | 4 +- src/xrpld/rpc/detail/Status.cpp | 8 +- src/xrpld/rpc/detail/TransactionSign.cpp | 8 +- src/xrpld/rpc/detail/TransactionSign.h | 4 +- src/xrpld/rpc/detail/Tuning.h | 4 +- src/xrpld/rpc/detail/WSInfoSub.h | 4 +- src/xrpld/rpc/handlers/AMMInfo.cpp | 10 +- src/xrpld/rpc/handlers/AccountChannels.cpp | 6 +- .../rpc/handlers/AccountCurrenciesHandler.cpp | 4 +- src/xrpld/rpc/handlers/AccountInfo.cpp | 6 +- src/xrpld/rpc/handlers/AccountLines.cpp | 6 +- src/xrpld/rpc/handlers/AccountObjects.cpp | 4 +- src/xrpld/rpc/handlers/AccountOffers.cpp | 6 +- src/xrpld/rpc/handlers/AccountTx.cpp | 11 +- src/xrpld/rpc/handlers/BlackList.cpp | 4 +- src/xrpld/rpc/handlers/BookOffers.cpp | 4 +- src/xrpld/rpc/handlers/CanDelete.cpp | 4 +- src/xrpld/rpc/handlers/Connect.cpp | 4 +- src/xrpld/rpc/handlers/ConsensusInfo.cpp | 4 +- src/xrpld/rpc/handlers/DepositAuthorized.cpp | 4 +- src/xrpld/rpc/handlers/DoManifest.cpp | 4 +- src/xrpld/rpc/handlers/Feature1.cpp | 4 +- src/xrpld/rpc/handlers/Fee1.cpp | 6 +- src/xrpld/rpc/handlers/FetchInfo.cpp | 4 +- src/xrpld/rpc/handlers/GatewayBalances.cpp | 4 +- src/xrpld/rpc/handlers/GetAggregatePrice.cpp | 4 +- src/xrpld/rpc/handlers/GetCounts.cpp | 4 +- src/xrpld/rpc/handlers/GetCounts.h | 2 +- src/xrpld/rpc/handlers/Handlers.h | 4 +- src/xrpld/rpc/handlers/LedgerAccept.cpp | 4 +- .../rpc/handlers/LedgerCleanerHandler.cpp | 4 +- src/xrpld/rpc/handlers/LedgerClosed.cpp | 6 +- src/xrpld/rpc/handlers/LedgerCurrent.cpp | 4 +- src/xrpld/rpc/handlers/LedgerData.cpp | 4 +- src/xrpld/rpc/handlers/LedgerDiff.cpp | 6 +- src/xrpld/rpc/handlers/LedgerEntry.cpp | 4 +- src/xrpld/rpc/handlers/LedgerEntryHelpers.h | 4 +- src/xrpld/rpc/handlers/LedgerHandler.cpp | 8 +- src/xrpld/rpc/handlers/LedgerHandler.h | 4 +- src/xrpld/rpc/handlers/LedgerHeader.cpp | 4 +- src/xrpld/rpc/handlers/LedgerRequest.cpp | 4 +- src/xrpld/rpc/handlers/LogLevel.cpp | 4 +- src/xrpld/rpc/handlers/LogRotate.cpp | 4 +- src/xrpld/rpc/handlers/NFTOffers.cpp | 4 +- src/xrpld/rpc/handlers/NoRippleCheck.cpp | 4 +- src/xrpld/rpc/handlers/OwnerInfo.cpp | 4 +- src/xrpld/rpc/handlers/PathFind.cpp | 4 +- src/xrpld/rpc/handlers/PayChanClaim.cpp | 6 +- src/xrpld/rpc/handlers/Peers.cpp | 4 +- src/xrpld/rpc/handlers/Ping.cpp | 4 +- src/xrpld/rpc/handlers/Print.cpp | 4 +- src/xrpld/rpc/handlers/Random.cpp | 4 +- src/xrpld/rpc/handlers/Reservations.cpp | 4 +- src/xrpld/rpc/handlers/RipplePathFind.cpp | 4 +- src/xrpld/rpc/handlers/ServerDefinitions.cpp | 8 +- src/xrpld/rpc/handlers/ServerInfo.cpp | 4 +- src/xrpld/rpc/handlers/ServerState.cpp | 4 +- src/xrpld/rpc/handlers/SignFor.cpp | 4 +- src/xrpld/rpc/handlers/SignHandler.cpp | 4 +- src/xrpld/rpc/handlers/Simulate.cpp | 4 +- src/xrpld/rpc/handlers/Stop.cpp | 4 +- src/xrpld/rpc/handlers/Submit.cpp | 4 +- src/xrpld/rpc/handlers/SubmitMultiSigned.cpp | 4 +- src/xrpld/rpc/handlers/Subscribe.cpp | 4 +- src/xrpld/rpc/handlers/TransactionEntry.cpp | 4 +- src/xrpld/rpc/handlers/Tx.cpp | 6 +- src/xrpld/rpc/handlers/TxHistory.cpp | 4 +- src/xrpld/rpc/handlers/TxReduceRelay.cpp | 4 +- src/xrpld/rpc/handlers/UnlList.cpp | 4 +- src/xrpld/rpc/handlers/Unsubscribe.cpp | 4 +- src/xrpld/rpc/handlers/ValidationCreate.cpp | 4 +- src/xrpld/rpc/handlers/ValidatorInfo.cpp | 4 +- src/xrpld/rpc/handlers/ValidatorListSites.cpp | 4 +- src/xrpld/rpc/handlers/Validators.cpp | 4 +- src/xrpld/rpc/handlers/VaultInfo.cpp | 4 +- src/xrpld/rpc/handlers/Version.h | 4 +- src/xrpld/rpc/handlers/WalletPropose.cpp | 4 +- src/xrpld/rpc/handlers/WalletPropose.h | 4 +- src/xrpld/rpc/json_body.h | 4 +- src/xrpld/shamap/NodeFamily.cpp | 4 +- src/xrpld/shamap/NodeFamily.h | 4 +- tests/conan/src/example.cpp | 2 +- 1261 files changed, 4220 insertions(+), 4235 deletions(-) create mode 100755 .github/scripts/rename/namespace.sh diff --git a/.github/scripts/rename/README.md b/.github/scripts/rename/README.md index 836f3606ba..392f0b1efc 100644 --- a/.github/scripts/rename/README.md +++ b/.github/scripts/rename/README.md @@ -29,6 +29,8 @@ run from the repository root. 4. `.github/scripts/rename/binary.sh`: This script will rename the binary from `rippled` to `xrpld`, and reverses the symlink so that `rippled` points to the `xrpld` binary. +5. `.github/scripts/rename/namespace.sh`: This script will rename the C++ + namespaces from `ripple` to `xrpl`. You can run all these scripts from the repository root as follows: @@ -37,4 +39,5 @@ You can run all these scripts from the repository root as follows: ./.github/scripts/rename/copyright.sh . ./.github/scripts/rename/cmake.sh . ./.github/scripts/rename/binary.sh . +./.github/scripts/rename/namespace.sh . ``` diff --git a/.github/scripts/rename/namespace.sh b/.github/scripts/rename/namespace.sh new file mode 100755 index 0000000000..30fd91bf2c --- /dev/null +++ b/.github/scripts/rename/namespace.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# On MacOS, ensure that GNU sed is installed and available as `gsed`. +SED_COMMAND=sed +if [[ "${OSTYPE}" == 'darwin'* ]]; then + if ! command -v gsed &> /dev/null; then + echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'." + exit 1 + fi + SED_COMMAND=gsed +fi + +# This script renames the `ripple` namespace to `xrpl` in this project. +# Specifically, it renames all occurrences of `namespace ripple` and `ripple::` +# to `namespace xrpl` and `xrpl::`, respectively, by scanning all header and +# source files in the specified directory and its subdirectories, as well as any +# occurrences in the documentation. It also renames them in the test suites. +# Usage: .github/scripts/rename/namespace.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi +pushd ${DIRECTORY} + +DIRECTORIES=("include" "src" "tests") +for DIRECTORY in "${DIRECTORIES[@]}"; do + echo "Processing directory: ${DIRECTORY}" + + find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" \) | while read -r FILE; do + echo "Processing file: ${FILE}" + ${SED_COMMAND} -i 's/namespace ripple/namespace xrpl/g' "${FILE}" + ${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}" + ${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' "${FILE}" + done +done + +# Special case for NuDBFactory that has ripple twice in the test suite name. +${SED_COMMAND} -i -E 's/(BEAST_DEFINE_TESTSUITE.+)ripple(.+)/\1xrpl\2/g' src/test/nodestore/NuDBFactory_test.cpp + +DIRECTORY=$1 +find "${DIRECTORY}" -type f -name "*.md" | while read -r FILE; do + echo "Processing file: ${FILE}" + ${SED_COMMAND} -i 's/ripple::/xrpl::/g' "${FILE}" +done + +popd +echo "Renaming complete." diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index 00ef7c6f14..fb9ed2c6a8 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -27,6 +27,8 @@ jobs: run: .github/scripts/rename/cmake.sh . - name: Check binary name run: .github/scripts/rename/binary.sh . + - name: Check namespaces + run: .github/scripts/rename/namespace.sh . - name: Check for differences env: MESSAGE: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86cfa9dc6d..5b578b7f13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -304,7 +304,7 @@ For this reason: - Example **bad** name `"RFC1751::insert(char* s, int x, int start, int length) : length is greater than or equal zero"` (missing namespace, unnecessary full function signature, description too verbose). - Good name: `"ripple::RFC1751::insert : minimum length"`. + Good name: `"xrpl::RFC1751::insert : minimum length"`. - In **few** well-justified cases a non-standard name can be used, in which case a comment should be placed to explain the rationale (example in `contract.cpp`) - Do **not** rename a contract without a good reason (e.g. the name no longer diff --git a/include/xrpl/basics/Archive.h b/include/xrpl/basics/Archive.h index 6dbb31f426..5f7c624084 100644 --- a/include/xrpl/basics/Archive.h +++ b/include/xrpl/basics/Archive.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Extract a tar archive compressed with lz4 @@ -17,6 +17,6 @@ extractTarLz4( boost::filesystem::path const& src, boost::filesystem::path const& dst); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/BasicConfig.h b/include/xrpl/basics/BasicConfig.h index 153936430a..573b26ae75 100644 --- a/include/xrpl/basics/BasicConfig.h +++ b/include/xrpl/basics/BasicConfig.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { using IniFileSections = std::unordered_map>; @@ -380,6 +380,6 @@ get_if_exists(Section const& section, std::string const& name, bool& v) return stat; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Blob.h b/include/xrpl/basics/Blob.h index c87a834fd4..986f829371 100644 --- a/include/xrpl/basics/Blob.h +++ b/include/xrpl/basics/Blob.h @@ -3,13 +3,13 @@ #include -namespace ripple { +namespace xrpl { /** Storage for linear binary data. Blocks of binary data appear often in various idioms and structures. */ using Blob = std::vector; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Buffer.h b/include/xrpl/basics/Buffer.h index c72ebba174..8ae745f6d1 100644 --- a/include/xrpl/basics/Buffer.h +++ b/include/xrpl/basics/Buffer.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Like std::vector but better. Meets the requirements of BufferFactory. @@ -96,7 +96,7 @@ public: XRPL_ASSERT( s.size() == 0 || size_ == 0 || s.data() < p_.get() || s.data() >= p_.get() + size_, - "ripple::Buffer::operator=(Slice) : input not a subset"); + "xrpl::Buffer::operator=(Slice) : input not a subset"); if (auto p = alloc(s.size())) std::memcpy(p, s.data(), s.size()); @@ -215,6 +215,6 @@ operator!=(Buffer const& lhs, Buffer const& rhs) noexcept return !(lhs == rhs); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/ByteUtilities.h b/include/xrpl/basics/ByteUtilities.h index 45df242720..88bb297346 100644 --- a/include/xrpl/basics/ByteUtilities.h +++ b/include/xrpl/basics/ByteUtilities.h @@ -1,7 +1,7 @@ #ifndef XRPL_BASICS_BYTEUTILITIES_H_INCLUDED #define XRPL_BASICS_BYTEUTILITIES_H_INCLUDED -namespace ripple { +namespace xrpl { template constexpr auto @@ -19,6 +19,6 @@ megabytes(T value) noexcept static_assert(kilobytes(2) == 2048, "kilobytes(2) == 2048"); static_assert(megabytes(3) == 3145728, "megabytes(3) == 3145728"); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/CompressionAlgorithms.h b/include/xrpl/basics/CompressionAlgorithms.h index 77747e1684..b373ac4605 100644 --- a/include/xrpl/basics/CompressionAlgorithms.h +++ b/include/xrpl/basics/CompressionAlgorithms.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace compression_algorithms { @@ -144,6 +144,6 @@ lz4Decompress( } // namespace compression_algorithms -} // namespace ripple +} // namespace xrpl #endif // XRPL_COMPRESSIONALGORITHMS_H_INCLUDED diff --git a/include/xrpl/basics/CountedObject.h b/include/xrpl/basics/CountedObject.h index d3a4f53caa..e464e470af 100644 --- a/include/xrpl/basics/CountedObject.h +++ b/include/xrpl/basics/CountedObject.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Manages all counted object types. */ class CountedObjects @@ -133,6 +133,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/DecayingSample.h b/include/xrpl/basics/DecayingSample.h index 78a50e9df2..c5e38d2e9a 100644 --- a/include/xrpl/basics/DecayingSample.h +++ b/include/xrpl/basics/DecayingSample.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Sampling function using exponential decay to provide a continuous value. @tparam The number of seconds in the decay window. @@ -131,6 +131,6 @@ private: time_point when_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Expected.h b/include/xrpl/basics/Expected.h index 8f3d026d9c..8cf479c1b6 100644 --- a/include/xrpl/basics/Expected.h +++ b/include/xrpl/basics/Expected.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** Expected is an approximation of std::expected (hoped for in C++23) @@ -232,6 +232,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_EXPECTED_H_INCLUDED diff --git a/include/xrpl/basics/FileUtilities.h b/include/xrpl/basics/FileUtilities.h index 8fb1368bfd..c4bc2cbe68 100644 --- a/include/xrpl/basics/FileUtilities.h +++ b/include/xrpl/basics/FileUtilities.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { std::string getFileContents( @@ -20,6 +20,6 @@ writeFileContents( boost::filesystem::path const& destPath, std::string const& contents); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/IntrusivePointer.h b/include/xrpl/basics/IntrusivePointer.h index 9e34c901f3..24521b95a7 100644 --- a/include/xrpl/basics/IntrusivePointer.h +++ b/include/xrpl/basics/IntrusivePointer.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { //------------------------------------------------------------------------------ @@ -492,5 +492,5 @@ dynamic_pointer_cast(TT const& v) return SharedPtr(DynamicCastTagSharedIntrusive{}, v); } } // namespace intr_ptr -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/IntrusivePointer.ipp b/include/xrpl/basics/IntrusivePointer.ipp index 7b0787634c..cfebb559fd 100644 --- a/include/xrpl/basics/IntrusivePointer.ipp +++ b/include/xrpl/basics/IntrusivePointer.ipp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { template template @@ -608,7 +608,7 @@ SharedWeakUnion::convertToStrong() [[maybe_unused]] auto action = p->releaseWeakRef(); XRPL_ASSERT( (action == ReleaseWeakRefAction::noop), - "ripple::SharedWeakUnion::convertToStrong : " + "xrpl::SharedWeakUnion::convertToStrong : " "action is noop"); unsafeSetRawPtr(p, RefStrength::strong); return true; @@ -637,7 +637,7 @@ SharedWeakUnion::convertToWeak() // We just added a weak ref. How could we destroy? // LCOV_EXCL_START UNREACHABLE( - "ripple::SharedWeakUnion::convertToWeak : destroying freshly " + "xrpl::SharedWeakUnion::convertToWeak : destroying freshly " "added ref"); delete p; unsafeSetRawPtr(nullptr); @@ -719,5 +719,5 @@ SharedWeakUnion::unsafeReleaseNoStore() } } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/IntrusiveRefCounts.h b/include/xrpl/basics/IntrusiveRefCounts.h index 653d149843..630c08395d 100644 --- a/include/xrpl/basics/IntrusiveRefCounts.h +++ b/include/xrpl/basics/IntrusiveRefCounts.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Action to perform when releasing a strong pointer. @@ -34,7 +34,7 @@ enum class ReleaseWeakRefAction { noop, destroy }; /** Implement the strong count, weak count, and bit flags for an intrusive pointer. - A class can satisfy the requirements of a ripple::IntrusivePointer by + A class can satisfy the requirements of a xrpl::IntrusivePointer by inheriting from this class. */ struct IntrusiveRefCounts @@ -257,7 +257,7 @@ IntrusiveRefCounts::releaseStrongRef() const RefCountPair const prevVal{prevIntVal}; XRPL_ASSERT( (prevVal.strong >= strongDelta), - "ripple::IntrusiveRefCounts::releaseStrongRef : previous ref " + "xrpl::IntrusiveRefCounts::releaseStrongRef : previous ref " "higher than new"); auto nextIntVal = prevIntVal - strongDelta; ReleaseStrongRefAction action = noop; @@ -282,7 +282,7 @@ IntrusiveRefCounts::releaseStrongRef() const // twice. XRPL_ASSERT( (action == noop) || !(prevIntVal & partialDestroyStartedMask), - "ripple::IntrusiveRefCounts::releaseStrongRef : not in partial " + "xrpl::IntrusiveRefCounts::releaseStrongRef : not in partial " "destroy"); return action; } @@ -314,7 +314,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const // can't happen twice. XRPL_ASSERT( (!prevVal.partialDestroyStartedBit), - "ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not in " + "xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not in " "partial destroy"); auto nextIntVal = prevIntVal + delta; @@ -336,7 +336,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const { XRPL_ASSERT( (!(prevIntVal & partialDestroyStartedMask)), - "ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not " + "xrpl::IntrusiveRefCounts::addWeakReleaseStrongRef : not " "started partial destroy"); return action; } @@ -408,11 +408,11 @@ inline IntrusiveRefCounts::~IntrusiveRefCounts() noexcept auto v = refCounts.load(std::memory_order_acquire); XRPL_ASSERT( (!(v & valueMask)), - "ripple::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero"); + "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero"); auto t = v & tagMask; XRPL_ASSERT( (!t || t == tagMask), - "ripple::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag"); + "xrpl::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag"); #endif } @@ -427,7 +427,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair( { XRPL_ASSERT( (strong < checkStrongMaxValue && weak < checkWeakMaxValue), - "ripple::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside " + "xrpl::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside " "range"); } @@ -438,7 +438,7 @@ inline IntrusiveRefCounts::RefCountPair::RefCountPair( { XRPL_ASSERT( (strong < checkStrongMaxValue && weak < checkWeakMaxValue), - "ripple::IntrusiveRefCounts::RefCountPair(CountType, CountType) : " + "xrpl::IntrusiveRefCounts::RefCountPair(CountType, CountType) : " "inputs inside range"); } @@ -447,7 +447,7 @@ IntrusiveRefCounts::RefCountPair::combinedValue() const noexcept { XRPL_ASSERT( (strong < checkStrongMaxValue && weak < checkWeakMaxValue), - "ripple::IntrusiveRefCounts::RefCountPair::combinedValue : inputs " + "xrpl::IntrusiveRefCounts::RefCountPair::combinedValue : inputs " "inside range"); return (static_cast(weak) << IntrusiveRefCounts::StrongCountNumBits) | @@ -465,7 +465,7 @@ partialDestructorFinished(T** o) XRPL_ASSERT( (!p.partialDestroyFinishedBit && p.partialDestroyStartedBit && !p.strong), - "ripple::partialDestructorFinished : not a weak ref"); + "xrpl::partialDestructorFinished : not a weak ref"); if (!p.weak) { // There was a weak count before the partial destructor ran (or we would @@ -479,5 +479,5 @@ partialDestructorFinished(T** o) } //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/KeyCache.h b/include/xrpl/basics/KeyCache.h index 1ab908256f..038bf7b9b7 100644 --- a/include/xrpl/basics/KeyCache.h +++ b/include/xrpl/basics/KeyCache.h @@ -4,10 +4,10 @@ #include #include -namespace ripple { +namespace xrpl { using KeyCache = TaggedCache; -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_KEYCACHE_H diff --git a/include/xrpl/basics/LocalValue.h b/include/xrpl/basics/LocalValue.h index 56026231ac..cc7c646fb0 100644 --- a/include/xrpl/basics/LocalValue.h +++ b/include/xrpl/basics/LocalValue.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -109,6 +109,6 @@ LocalValue::operator*() .emplace(this, std::make_unique>(t_)) .first->second->get()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index 134f1695d3..9443e8afdf 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { // DEPRECATED use beast::severities::Severity instead enum LogSeverity { @@ -271,6 +271,6 @@ setDebugLogSink(std::unique_ptr sink); beast::Journal debugLog(); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/MathUtilities.h b/include/xrpl/basics/MathUtilities.h index 99d99a15cd..bd8ea883fb 100644 --- a/include/xrpl/basics/MathUtilities.h +++ b/include/xrpl/basics/MathUtilities.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Calculate one number divided by another number in percentage. * The result is rounded up to the next integer, and capped in the range [0,100] @@ -44,6 +44,6 @@ static_assert(calculatePercent(50'000'000, 100'000'000) == 50); static_assert(calculatePercent(50'000'001, 100'000'000) == 51); static_assert(calculatePercent(99'999'999, 100'000'000) == 100); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 4a4ee1cacb..4420530239 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Number; @@ -402,6 +402,6 @@ public: operator=(NumberRoundModeGuard const&) = delete; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_NUMBER_H_INCLUDED diff --git a/include/xrpl/basics/README.md b/include/xrpl/basics/README.md index 290bb7ad0c..f8b19522cd 100644 --- a/include/xrpl/basics/README.md +++ b/include/xrpl/basics/README.md @@ -21,11 +21,11 @@ ripple/basic should contain no dependencies on other modules. - `std::set` - For sorted containers. -- `ripple::hash_set` +- `xrpl::hash_set` - Where inserts and contains need to be O(1). - For "small" sets, `std::set` might be faster and smaller. -- `ripple::hardened_hash_set` +- `xrpl::hardened_hash_set` - 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 @@ ripple/basic should contain no dependencies on other modules. The following container is deprecated - `std::unordered_set` -- Use `ripple::hash_set` instead, which uses a better hashing algorithm. -- Or use `ripple::hardened_hash_set` to prevent algorithmic complexity attacks. +- Use `xrpl::hash_set` instead, which uses a better hashing algorithm. +- Or use `xrpl::hardened_hash_set` to prevent algorithmic complexity attacks. diff --git a/include/xrpl/basics/RangeSet.h b/include/xrpl/basics/RangeSet.h index a77c5b403e..ee95577271 100644 --- a/include/xrpl/basics/RangeSet.h +++ b/include/xrpl/basics/RangeSet.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A closed interval over the domain T. @@ -85,7 +85,7 @@ to_string(RangeSet const& rs) std::string s; for (auto const& interval : rs) - s += ripple::to_string(interval) + ","; + s += xrpl::to_string(interval) + ","; s.pop_back(); return s; @@ -172,6 +172,6 @@ prevMissing(RangeSet const& rs, T t, T minVal = 0) return boost::icl::last(tgt); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/Resolver.h b/include/xrpl/basics/Resolver.h index fc529887b0..088b2e1d5b 100644 --- a/include/xrpl/basics/Resolver.h +++ b/include/xrpl/basics/Resolver.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Resolver { @@ -47,6 +47,6 @@ public: /** @} */ }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/ResolverAsio.h b/include/xrpl/basics/ResolverAsio.h index b609c11b1b..f2a3da0d58 100644 --- a/include/xrpl/basics/ResolverAsio.h +++ b/include/xrpl/basics/ResolverAsio.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { class ResolverAsio : public Resolver { @@ -17,6 +17,6 @@ public: New(boost::asio::io_context&, beast::Journal); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/SHAMapHash.h b/include/xrpl/basics/SHAMapHash.h index 12aef37dd0..eb635b516c 100644 --- a/include/xrpl/basics/SHAMapHash.h +++ b/include/xrpl/basics/SHAMapHash.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { // A SHAMapHash is the hash of a node in a SHAMap, and also the // type of the hash of the entire SHAMap. @@ -97,6 +97,6 @@ extract(SHAMapHash const& key) return *reinterpret_cast(key.as_uint256().data()); } -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_SHAMAP_HASH_H_INCLUDED diff --git a/include/xrpl/basics/SharedWeakCachePointer.h b/include/xrpl/basics/SharedWeakCachePointer.h index dbac85a2a9..49369265eb 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.h +++ b/include/xrpl/basics/SharedWeakCachePointer.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A combination of a std::shared_ptr and a std::weak_pointer. @@ -112,5 +112,5 @@ public: private: std::variant, std::weak_ptr> combo_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/SharedWeakCachePointer.ipp b/include/xrpl/basics/SharedWeakCachePointer.ipp index 59f5882637..376bf73251 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.ipp +++ b/include/xrpl/basics/SharedWeakCachePointer.ipp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { template SharedWeakCachePointer::SharedWeakCachePointer( SharedWeakCachePointer const& rhs) = default; @@ -169,5 +169,5 @@ SharedWeakCachePointer::convertToWeak() return false; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/SlabAllocator.h b/include/xrpl/basics/SlabAllocator.h index d27616ecdd..c67d1ee318 100644 --- a/include/xrpl/basics/SlabAllocator.h +++ b/include/xrpl/basics/SlabAllocator.h @@ -22,7 +22,7 @@ #include #endif -namespace ripple { +namespace xrpl { template class SlabAllocator @@ -128,7 +128,7 @@ class SlabAllocator { XRPL_ASSERT( own(ptr), - "ripple::SlabAllocator::SlabBlock::deallocate : own input"); + "xrpl::SlabAllocator::SlabBlock::deallocate : own input"); std::lock_guard l(m_); @@ -173,7 +173,7 @@ public: { XRPL_ASSERT( (itemAlignment_ & (itemAlignment_ - 1)) == 0, - "ripple::SlabAllocator::SlabAllocator : valid alignment"); + "xrpl::SlabAllocator::SlabAllocator : valid alignment"); } SlabAllocator(SlabAllocator const& other) = delete; @@ -285,7 +285,7 @@ public: { XRPL_ASSERT( ptr, - "ripple::SlabAllocator::SlabAllocator::deallocate : non-null " + "xrpl::SlabAllocator::SlabAllocator::deallocate : non-null " "input"); for (auto slab = slabs_.load(); slab != nullptr; slab = slab->next_) @@ -419,6 +419,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_SLABALLOCATOR_H_INCLUDED diff --git a/include/xrpl/basics/Slice.h b/include/xrpl/basics/Slice.h index 7733acab8e..aa98b0a358 100644 --- a/include/xrpl/basics/Slice.h +++ b/include/xrpl/basics/Slice.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { /** An immutable linear range of bytes. @@ -87,7 +87,7 @@ public: { XRPL_ASSERT( i < size_, - "ripple::Slice::operator[](std::size_t) const : valid input"); + "xrpl::Slice::operator[](std::size_t) const : valid input"); return data_[i]; } @@ -243,6 +243,6 @@ makeSlice(std::basic_string const& s) return Slice(s.data(), s.size()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/StringUtilities.h b/include/xrpl/basics/StringUtilities.h index a38107909a..ebe07e43bc 100644 --- a/include/xrpl/basics/StringUtilities.h +++ b/include/xrpl/basics/StringUtilities.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Format arbitrary binary data as an SQLite "blob literal". @@ -132,6 +132,6 @@ to_uint64(std::string const& s); bool isProperlyFormedTomlDomain(std::string_view domain); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 77b8b3c6d4..c1d4d26800 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Map/cache combination. This class implements a cache and a map. The cache keeps objects alive @@ -315,6 +315,6 @@ private: std::uint64_t m_misses; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index 558198883c..5114479921 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { template < class Key, @@ -1005,6 +1005,6 @@ TaggedCache< }); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/ToString.h b/include/xrpl/basics/ToString.h index dc6903aa8a..fe3a6a0893 100644 --- a/include/xrpl/basics/ToString.h +++ b/include/xrpl/basics/ToString.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** to_string() generalizes std::to_string to handle bools, chars, and strings. @@ -43,6 +43,6 @@ to_string(char const* s) return s; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/UnorderedContainers.h b/include/xrpl/basics/UnorderedContainers.h index 3b847e4fbb..fdd2518b1e 100644 --- a/include/xrpl/basics/UnorderedContainers.h +++ b/include/xrpl/basics/UnorderedContainers.h @@ -22,7 +22,7 @@ * what container it is. */ -namespace ripple { +namespace xrpl { // hash containers @@ -102,6 +102,6 @@ template < using hardened_hash_multiset = std::unordered_multiset; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/UptimeClock.h b/include/xrpl/basics/UptimeClock.h index 36f4897663..9e1ef10d19 100644 --- a/include/xrpl/basics/UptimeClock.h +++ b/include/xrpl/basics/UptimeClock.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Tracks program uptime to seconds precision. @@ -45,6 +45,6 @@ private: start_clock(); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/algorithm.h b/include/xrpl/basics/algorithm.h index ad59e9c282..d62ff17a75 100644 --- a/include/xrpl/basics/algorithm.h +++ b/include/xrpl/basics/algorithm.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // Requires: [first1, last1) and [first2, last2) are ordered ranges according to // comp. @@ -95,6 +95,6 @@ remove_if_intersect_or_match( return first1; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/base64.h b/include/xrpl/basics/base64.h index 0aa19e9e61..340e282f87 100644 --- a/include/xrpl/basics/base64.h +++ b/include/xrpl/basics/base64.h @@ -38,7 +38,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string base64_encode(std::uint8_t const* data, std::size_t len); @@ -53,6 +53,6 @@ base64_encode(std::string const& s) std::string base64_decode(std::string_view data); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index 4be4b35af3..a1ed223674 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -23,7 +23,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -275,7 +275,7 @@ public: { XRPL_ASSERT( c.size() * sizeof(typename Container::value_type) == size(), - "ripple::base_uint::base_uint(Container auto) : input size match"); + "xrpl::base_uint::base_uint(Container auto) : input size match"); std::memcpy(data_.data(), c.data(), size()); } @@ -288,7 +288,7 @@ public: { XRPL_ASSERT( c.size() * sizeof(typename Container::value_type) == size(), - "ripple::base_uint::operator=(Container auto) : input size match"); + "xrpl::base_uint::operator=(Container auto) : input size match"); std::memcpy(data_.data(), c.data(), size()); return *this; } @@ -648,12 +648,12 @@ 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 ripple +} // namespace xrpl namespace beast { template -struct is_uniquely_represented> +struct is_uniquely_represented> : public std::true_type { explicit is_uniquely_represented() = default; diff --git a/include/xrpl/basics/chrono.h b/include/xrpl/basics/chrono.h index 46b36ffb57..e343e8b49f 100644 --- a/include/xrpl/basics/chrono.h +++ b/include/xrpl/basics/chrono.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { // A few handy aliases @@ -104,6 +104,6 @@ stopwatch() return beast::get_abstract_clock(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/comparators.h b/include/xrpl/basics/comparators.h index 4858a0ad74..7c848f0b3b 100644 --- a/include/xrpl/basics/comparators.h +++ b/include/xrpl/basics/comparators.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { #ifdef _MSC_VER @@ -52,6 +52,6 @@ using equal_to = std::equal_to; #endif -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/contract.h b/include/xrpl/basics/contract.h index a0409ee6d7..63d1bb5a84 100644 --- a/include/xrpl/basics/contract.h +++ b/include/xrpl/basics/contract.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /* Programming By Contract @@ -52,6 +52,6 @@ Throw(Args&&... args) [[noreturn]] void LogicError(std::string const& how) noexcept; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/hardened_hash.h b/include/xrpl/basics/hardened_hash.h index c21cd48053..a25dcb3c34 100644 --- a/include/xrpl/basics/hardened_hash.h +++ b/include/xrpl/basics/hardened_hash.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -92,6 +92,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/join.h b/include/xrpl/basics/join.h index a4a537d6d0..79f716ec43 100644 --- a/include/xrpl/basics/join.h +++ b/include/xrpl/basics/join.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { template Stream& @@ -85,6 +85,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/make_SSLContext.h b/include/xrpl/basics/make_SSLContext.h index 6e25cfcac1..fb91dd40a9 100644 --- a/include/xrpl/basics/make_SSLContext.h +++ b/include/xrpl/basics/make_SSLContext.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Create a self-signed SSL context that allows anonymous Diffie Hellman. */ std::shared_ptr @@ -19,6 +19,6 @@ make_SSLContextAuthed( std::string const& chainFile, std::string const& cipherList); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/mulDiv.h b/include/xrpl/basics/mulDiv.h index 0ac9bb5ebc..fb38d0cd63 100644 --- a/include/xrpl/basics/mulDiv.h +++ b/include/xrpl/basics/mulDiv.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { auto constexpr muldiv_max = std::numeric_limits::max(); /** Return value*mul/div accurately. @@ -21,6 +21,6 @@ auto constexpr muldiv_max = std::numeric_limits::max(); std::optional mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/partitioned_unordered_map.h b/include/xrpl/basics/partitioned_unordered_map.h index 01872963fd..518686c533 100644 --- a/include/xrpl/basics/partitioned_unordered_map.h +++ b/include/xrpl/basics/partitioned_unordered_map.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { template static std::size_t @@ -242,7 +242,7 @@ public: map_.resize(partitions_); XRPL_ASSERT( partitions_, - "ripple::partitioned_unordered_map::partitioned_unordered_map : " + "xrpl::partitioned_unordered_map::partitioned_unordered_map : " "nonzero partitions"); } @@ -401,6 +401,6 @@ private: mutable partition_map_type map_{}; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_PARTITIONED_UNORDERED_MAP_H diff --git a/include/xrpl/basics/random.h b/include/xrpl/basics/random.h index 19f8b57285..737b8fef59 100644 --- a/include/xrpl/basics/random.h +++ b/include/xrpl/basics/random.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { #ifndef __INTELLISENSE__ static_assert( @@ -95,7 +95,7 @@ std::enable_if_t< Integral> rand_int(Engine& engine, Integral min, Integral max) { - XRPL_ASSERT(max > min, "ripple::rand_int : max over min inputs"); + XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs"); // This should have no state and constructing it should // be very cheap. If that turns out not to be the case @@ -186,6 +186,6 @@ rand_bool() } /** @} */ -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_RANDOM_H_INCLUDED diff --git a/include/xrpl/basics/safe_cast.h b/include/xrpl/basics/safe_cast.h index 1da44920ac..89de0eda6a 100644 --- a/include/xrpl/basics/safe_cast.h +++ b/include/xrpl/basics/safe_cast.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // safe_cast adds compile-time checks to a static_cast to ensure that // the destination can hold all values of the source. This is particularly @@ -80,6 +80,6 @@ inline constexpr std:: return unsafe_cast(static_cast>(s)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/scope.h b/include/xrpl/basics/scope.h index 710b31ec80..b7299a28fc 100644 --- a/include/xrpl/basics/scope.h +++ b/include/xrpl/basics/scope.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { // RAII scope helpers. As specified in Library Fundamental, Version 3 // Basic design of idea: https://www.youtube.com/watch?v=WjTrfoiB0MQ @@ -218,7 +218,7 @@ public: { XRPL_ASSERT( plock->owns_lock(), - "ripple::scope_unlock::scope_unlock : mutex must be locked"); + "xrpl::scope_unlock::scope_unlock : mutex must be locked"); plock->unlock(); } @@ -236,6 +236,6 @@ public: template scope_unlock(std::unique_lock&) -> scope_unlock; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/spinlock.h b/include/xrpl/basics/spinlock.h index 9ae7b0bb70..71ab29f381 100644 --- a/include/xrpl/basics/spinlock.h +++ b/include/xrpl/basics/spinlock.h @@ -13,7 +13,7 @@ #include #endif -namespace ripple { +namespace xrpl { namespace detail { /** Inform the processor that we are in a tight spin-wait loop. @@ -105,7 +105,7 @@ public: { XRPL_ASSERT( index >= 0 && (mask_ != 0), - "ripple::packed_spinlock::packed_spinlock : valid index and mask"); + "xrpl::packed_spinlock::packed_spinlock : valid index and mask"); } [[nodiscard]] bool @@ -206,6 +206,6 @@ public: }; /** @} */ -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/strHex.h b/include/xrpl/basics/strHex.h index bfba76003e..1c1d94bf32 100644 --- a/include/xrpl/basics/strHex.h +++ b/include/xrpl/basics/strHex.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { template std::string @@ -28,6 +28,6 @@ strHex(T const& from) return strHex(from.begin(), from.end()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/basics/tagged_integer.h b/include/xrpl/basics/tagged_integer.h index 1ad5279469..1d40b31cce 100644 --- a/include/xrpl/basics/tagged_integer.h +++ b/include/xrpl/basics/tagged_integer.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A type-safe wrap around standard integral types @@ -197,11 +197,11 @@ public: } }; -} // namespace ripple +} // namespace xrpl namespace beast { template -struct is_contiguously_hashable, HashAlgorithm> +struct is_contiguously_hashable, HashAlgorithm> : public is_contiguously_hashable { explicit is_contiguously_hashable() = default; diff --git a/include/xrpl/core/ClosureCounter.h b/include/xrpl/core/ClosureCounter.h index 6050e32618..d2be76fa8c 100644 --- a/include/xrpl/core/ClosureCounter.h +++ b/include/xrpl/core/ClosureCounter.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * The role of a `ClosureCounter` is to assist in shutdown by letting callers @@ -202,6 +202,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_CORE_CLOSURE_COUNTER_H_INCLUDED diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 8e14e88592..9f73d80647 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { template JobQueue::Coro::Coro( @@ -34,7 +34,7 @@ JobQueue::Coro::Coro( inline JobQueue::Coro::~Coro() { #ifndef NDEBUG - XRPL_ASSERT(finished_, "ripple::JobQueue::Coro::~Coro : is finished"); + XRPL_ASSERT(finished_, "xrpl::JobQueue::Coro::~Coro : is finished"); #endif } @@ -85,8 +85,7 @@ JobQueue::Coro::resume() detail::getLocalValues().reset(&lvs_); std::lock_guard lock(mutex_); XRPL_ASSERT( - static_cast(coro_), - "ripple::JobQueue::Coro::resume : is runnable"); + static_cast(coro_), "xrpl::JobQueue::Coro::resume : is runnable"); coro_(); detail::getLocalValues().release(); detail::getLocalValues().reset(saved); @@ -129,6 +128,6 @@ JobQueue::Coro::join() cv_.wait(lk, [this]() { return running_ == false; }); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/Job.h b/include/xrpl/core/Job.h index 35d42cfd0b..cb597b3860 100644 --- a/include/xrpl/core/Job.h +++ b/include/xrpl/core/Job.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { // Note that this queue should only be used for CPU-bound jobs // It is primarily intended for signature checking @@ -131,6 +131,6 @@ private: using JobCounter = ClosureCounter; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/JobQueue.h b/include/xrpl/core/JobQueue.h index f8b727471b..2a22b7f5c9 100644 --- a/include/xrpl/core/JobQueue.h +++ b/include/xrpl/core/JobQueue.h @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { namespace perf { class PerfLog; @@ -382,11 +382,11 @@ private: lock is released which only happens after the coroutine completes. */ -} // namespace ripple +} // namespace xrpl #include -namespace ripple { +namespace xrpl { template std::shared_ptr @@ -408,6 +408,6 @@ JobQueue::postCoro(JobType t, std::string const& name, F&& f) return coro; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/JobTypeData.h b/include/xrpl/core/JobTypeData.h index eb678d1a9a..377309aa3c 100644 --- a/include/xrpl/core/JobTypeData.h +++ b/include/xrpl/core/JobTypeData.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { struct JobTypeData { @@ -83,6 +83,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/JobTypeInfo.h b/include/xrpl/core/JobTypeInfo.h index 09c644fc23..a726fb276b 100644 --- a/include/xrpl/core/JobTypeInfo.h +++ b/include/xrpl/core/JobTypeInfo.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Holds all the 'static' information about a job, which does not change */ class JobTypeInfo @@ -78,6 +78,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/JobTypes.h b/include/xrpl/core/JobTypes.h index d8e7b23bdf..f7952ca9a2 100644 --- a/include/xrpl/core/JobTypes.h +++ b/include/xrpl/core/JobTypes.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class JobTypes { @@ -35,7 +35,7 @@ private: std::chrono::milliseconds peakLatency) { XRPL_ASSERT( m_map.find(jt) == m_map.end(), - "ripple::JobTypes::JobTypes::add : unique job type input"); + "xrpl::JobTypes::JobTypes::add : unique job type input"); [[maybe_unused]] auto const inserted = m_map @@ -48,7 +48,7 @@ private: XRPL_ASSERT( inserted == true, - "ripple::JobTypes::JobTypes::add : input is inserted"); + "xrpl::JobTypes::JobTypes::add : input is inserted"); }; // clang-format off @@ -122,7 +122,7 @@ public: get(JobType jt) const { Map::const_iterator const iter(m_map.find(jt)); - XRPL_ASSERT(iter != m_map.end(), "ripple::JobTypes::get : valid input"); + XRPL_ASSERT(iter != m_map.end(), "xrpl::JobTypes::get : valid input"); if (iter != m_map.end()) return iter->second; @@ -170,6 +170,6 @@ public: Map m_map; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/LoadEvent.h b/include/xrpl/core/LoadEvent.h index b6cd0ab500..8422fe883e 100644 --- a/include/xrpl/core/LoadEvent.h +++ b/include/xrpl/core/LoadEvent.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class LoadMonitor; @@ -65,6 +65,6 @@ private: std::chrono::steady_clock::duration timeRunning_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/LoadMonitor.h b/include/xrpl/core/LoadMonitor.h index 539a4a0b99..54cd607d5b 100644 --- a/include/xrpl/core/LoadMonitor.h +++ b/include/xrpl/core/LoadMonitor.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { // Monitors load levels and response times @@ -67,6 +67,6 @@ private: beast::Journal const j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index c74608d82a..eb009de433 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -17,7 +17,7 @@ namespace beast { class Journal; } -namespace ripple { +namespace xrpl { class Application; namespace perf { @@ -187,6 +187,6 @@ measureDurationAndLog( } } // namespace perf -} // namespace ripple +} // namespace xrpl #endif // XRPL_CORE_PERFLOG_H diff --git a/include/xrpl/core/detail/Workers.h b/include/xrpl/core/detail/Workers.h index 5877638722..3a77f9e769 100644 --- a/include/xrpl/core/detail/Workers.h +++ b/include/xrpl/core/detail/Workers.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace perf { class PerfLog; @@ -214,6 +214,6 @@ private: m_paused; // holds just paused workers }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/core/detail/semaphore.h b/include/xrpl/core/detail/semaphore.h index 8b784e3685..4249b3b860 100644 --- a/include/xrpl/core/detail/semaphore.h +++ b/include/xrpl/core/detail/semaphore.h @@ -1,6 +1,6 @@ /** * - * TODO: Remove ripple::basic_semaphore (and this file) and use + * TODO: Remove xrpl::basic_semaphore (and this file) and use * std::counting_semaphore. * * Background: @@ -32,7 +32,7 @@ #include #include -namespace ripple { +namespace xrpl { template class basic_semaphore @@ -87,6 +87,6 @@ public: using semaphore = basic_semaphore; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/crypto/RFC1751.h b/include/xrpl/crypto/RFC1751.h index 14c49d7fa9..a413c2ac8a 100644 --- a/include/xrpl/crypto/RFC1751.h +++ b/include/xrpl/crypto/RFC1751.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class RFC1751 { @@ -42,6 +42,6 @@ private: static char const* s_dictionary[]; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/crypto/csprng.h b/include/xrpl/crypto/csprng.h index cc5545750d..dc89da4f61 100644 --- a/include/xrpl/crypto/csprng.h +++ b/include/xrpl/crypto/csprng.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** A cryptographically secure random number engine @@ -70,6 +70,6 @@ public: csprng_engine& crypto_prng(); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/crypto/secure_erase.h b/include/xrpl/crypto/secure_erase.h index 586a8e50e6..3ecde0c7fa 100644 --- a/include/xrpl/crypto/secure_erase.h +++ b/include/xrpl/crypto/secure_erase.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Attempts to clear the given blob of memory. @@ -22,6 +22,6 @@ namespace ripple { void secure_erase(void* dest, std::size_t bytes); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/json/JsonPropertyStream.h b/include/xrpl/json/JsonPropertyStream.h index a7fe52dfb8..54cfcbfa04 100644 --- a/include/xrpl/json/JsonPropertyStream.h +++ b/include/xrpl/json/JsonPropertyStream.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A PropertyStream::Sink which produces a Json::Value of type objectValue. */ class JsonPropertyStream : public beast::PropertyStream @@ -66,6 +66,6 @@ protected: add(std::string const& v) override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/json/Writer.h b/include/xrpl/json/Writer.h index 12599a14d3..ab52427a5b 100644 --- a/include/xrpl/json/Writer.h +++ b/include/xrpl/json/Writer.h @@ -234,7 +234,7 @@ inline void check(bool condition, std::string const& message) { if (!condition) - ripple::Throw(message); + xrpl::Throw(message); } } // namespace Json diff --git a/include/xrpl/json/detail/json_assert.h b/include/xrpl/json/detail/json_assert.h index bd111ad90f..3092b65452 100644 --- a/include/xrpl/json/detail/json_assert.h +++ b/include/xrpl/json/detail/json_assert.h @@ -6,6 +6,6 @@ #define JSON_ASSERT_MESSAGE(condition, message) \ if (!(condition)) \ - ripple::Throw(message); + xrpl::Throw(message); #endif diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index c14d5d5127..2e38f2e75e 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -199,7 +199,7 @@ public: Value(UInt value); Value(double value); Value(char const* value); - Value(ripple::Number const& value); + Value(xrpl::Number const& value); /** \brief Constructs a value from a static string. * Like other value string constructor but do not duplicate the string for @@ -430,7 +430,7 @@ private: }; inline Value -to_json(ripple::Number const& number) +to_json(xrpl::Number const& number) { return to_string(number); } diff --git a/include/xrpl/ledger/ApplyView.h b/include/xrpl/ledger/ApplyView.h index 5e283641da..393af2a7fd 100644 --- a/include/xrpl/ledger/ApplyView.h +++ b/include/xrpl/ledger/ApplyView.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { enum ApplyFlags : std::uint32_t { tapNONE = 0x00, @@ -267,7 +267,7 @@ public: { // LCOV_EXCL_START UNREACHABLE( - "ripple::ApplyView::dirAppend : only Offers are appended to " + "xrpl::ApplyView::dirAppend : only Offers are appended to " "book directories"); // Only Offers are appended to book directories. Call dirInsert() // instead @@ -407,6 +407,6 @@ insertPage( std::function const&)> const& describe); } // namespace directory -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/ApplyViewImpl.h b/include/xrpl/ledger/ApplyViewImpl.h index c1e9ccd359..0c11726135 100644 --- a/include/xrpl/ledger/ApplyViewImpl.h +++ b/include/xrpl/ledger/ApplyViewImpl.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Editable, discardable view that can build metadata for one tx. @@ -75,6 +75,6 @@ private: std::optional deliver_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/BookDirs.h b/include/xrpl/ledger/BookDirs.h index 1019d02f52..daa1ef172a 100644 --- a/include/xrpl/ledger/BookDirs.h +++ b/include/xrpl/ledger/BookDirs.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class BookDirs { @@ -89,6 +89,6 @@ private: static beast::Journal j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/CachedSLEs.h b/include/xrpl/ledger/CachedSLEs.h index 0bec37f233..b478b78b7d 100644 --- a/include/xrpl/ledger/CachedSLEs.h +++ b/include/xrpl/ledger/CachedSLEs.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { using CachedSLEs = TaggedCache; } diff --git a/include/xrpl/ledger/CachedView.h b/include/xrpl/ledger/CachedView.h index b78c046f58..c1d66ecfc9 100644 --- a/include/xrpl/ledger/CachedView.h +++ b/include/xrpl/ledger/CachedView.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -164,6 +164,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/CredentialHelpers.h b/include/xrpl/ledger/CredentialHelpers.h index 42376846ae..52ddfe33aa 100644 --- a/include/xrpl/ledger/CredentialHelpers.h +++ b/include/xrpl/ledger/CredentialHelpers.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace credentials { // These function will be used by the code that use DepositPreauth / Credentials @@ -93,6 +93,6 @@ verifyDepositPreauth( std::shared_ptr const& sleDst, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/Dir.h b/include/xrpl/ledger/Dir.h index b421ac85e6..4b7327a015 100644 --- a/include/xrpl/ledger/Dir.h +++ b/include/xrpl/ledger/Dir.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A class that simplifies iterating ledger directory pages @@ -108,6 +108,6 @@ private: std::vector::const_iterator it_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/OpenView.h b/include/xrpl/ledger/OpenView.h index 2b4bd8a31f..bd90dbef18 100644 --- a/include/xrpl/ledger/OpenView.h +++ b/include/xrpl/ledger/OpenView.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Open ledger construction tag. @@ -252,6 +252,6 @@ public: std::shared_ptr const& metaData) override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/PaymentSandbox.h b/include/xrpl/ledger/PaymentSandbox.h index 03f1ec2d00..e1d197380d 100644 --- a/include/xrpl/ledger/PaymentSandbox.h +++ b/include/xrpl/ledger/PaymentSandbox.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -188,6 +188,6 @@ private: PaymentSandbox const* ps_ = nullptr; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/RawView.h b/include/xrpl/ledger/RawView.h index 94668b42a1..c0e81fb833 100644 --- a/include/xrpl/ledger/RawView.h +++ b/include/xrpl/ledger/RawView.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Interface for ledger entry changes. @@ -87,6 +87,6 @@ public: std::shared_ptr const& metaData) = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/ReadView.h b/include/xrpl/ledger/ReadView.h index 70a5fbc006..d2b6796ec9 100644 --- a/include/xrpl/ledger/ReadView.h +++ b/include/xrpl/ledger/ReadView.h @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { //------------------------------------------------------------------------------ @@ -258,7 +258,7 @@ makeRulesGivenLedger( DigestAwareReadView const& ledger, std::unordered_set> const& presets); -} // namespace ripple +} // namespace xrpl #include diff --git a/include/xrpl/ledger/Sandbox.h b/include/xrpl/ledger/Sandbox.h index 9c341c15c4..1e4a816529 100644 --- a/include/xrpl/ledger/Sandbox.h +++ b/include/xrpl/ledger/Sandbox.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Discardable, editable view to a ledger. @@ -39,6 +39,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/View.h b/include/xrpl/ledger/View.h index fc16d53e61..767622596b 100644 --- a/include/xrpl/ledger/View.h +++ b/include/xrpl/ledger/View.h @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { enum class WaiveTransferFee : bool { No = false, Yes }; enum class SkipEntry : bool { No = false, Yes }; @@ -1197,6 +1197,6 @@ sharesToAssetsWithdraw( bool after(NetClock::time_point now, std::uint32_t mark); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/detail/ApplyStateTable.h b/include/xrpl/ledger/detail/ApplyStateTable.h index 887e2e7770..f5ec0c9f51 100644 --- a/include/xrpl/ledger/detail/ApplyStateTable.h +++ b/include/xrpl/ledger/detail/ApplyStateTable.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { // Helper class that buffers modifications @@ -139,6 +139,6 @@ private: }; } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/detail/ApplyViewBase.h b/include/xrpl/ledger/detail/ApplyViewBase.h index a75f94ac16..9992d73ad1 100644 --- a/include/xrpl/ledger/detail/ApplyViewBase.h +++ b/include/xrpl/ledger/detail/ApplyViewBase.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { class ApplyViewBase : public ApplyView, public RawView @@ -106,6 +106,6 @@ protected: }; } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/detail/RawStateTable.h b/include/xrpl/ledger/detail/RawStateTable.h index b89e6e58a9..19d2882a63 100644 --- a/include/xrpl/ledger/detail/RawStateTable.h +++ b/include/xrpl/ledger/detail/RawStateTable.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { // Helper class that buffers raw modifications @@ -118,6 +118,6 @@ private: }; } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.h b/include/xrpl/ledger/detail/ReadViewFwdRange.h index 66984c8665..557bba4987 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.h +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class ReadView; @@ -130,6 +130,6 @@ protected: }; } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp index 451d612486..e86246133a 100644 --- a/include/xrpl/ledger/detail/ReadViewFwdRange.ipp +++ b/include/xrpl/ledger/detail/ReadViewFwdRange.ipp @@ -1,7 +1,7 @@ #ifndef XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED #define XRPL_LEDGER_READVIEWFWDRANGEINL_H_INCLUDED -namespace ripple { +namespace xrpl { namespace detail { template @@ -63,7 +63,7 @@ ReadViewFwdRange::iterator::operator==(iterator const& other) const { XRPL_ASSERT( view_ == other.view_, - "ripple::detail::ReadViewFwdRange::iterator::operator==(iterator) " + "xrpl::detail::ReadViewFwdRange::iterator::operator==(iterator) " "const : input view match"); if (impl_ != nullptr && other.impl_ != nullptr) @@ -115,6 +115,6 @@ ReadViewFwdRange::iterator::operator++(int) -> iterator } } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/net/AutoSocket.h b/include/xrpl/net/AutoSocket.h index 7cdef5ddd1..2fcba5780c 100644 --- a/include/xrpl/net/AutoSocket.h +++ b/include/xrpl/net/AutoSocket.h @@ -269,7 +269,7 @@ protected: error_code const& ec, size_t bytesTransferred) { - using namespace ripple; + using namespace xrpl; if (ec) { diff --git a/include/xrpl/net/HTTPClient.h b/include/xrpl/net/HTTPClient.h index fc0d416f02..6e4d4ce685 100644 --- a/include/xrpl/net/HTTPClient.h +++ b/include/xrpl/net/HTTPClient.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Provides an asynchronous HTTP client implementation with optional SSL. */ @@ -75,6 +75,6 @@ public: beast::Journal& j); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/net/HTTPClientSSLContext.h b/include/xrpl/net/HTTPClientSSLContext.h index a22ee839b8..b8dfbd3e09 100644 --- a/include/xrpl/net/HTTPClientSSLContext.h +++ b/include/xrpl/net/HTTPClientSSLContext.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { class HTTPClientSSLContext { @@ -176,6 +176,6 @@ private: bool const verify_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/net/RegisterSSLCerts.h b/include/xrpl/net/RegisterSSLCerts.h index 5b0879fe4d..f9b865c3aa 100644 --- a/include/xrpl/net/RegisterSSLCerts.h +++ b/include/xrpl/net/RegisterSSLCerts.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Register default SSL certificates. Register the system default SSL root certificates. On linux/mac, @@ -19,6 +19,6 @@ registerSSLCerts( boost::system::error_code&, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Backend.h b/include/xrpl/nodestore/Backend.h index 741145c9c9..0ea8835f61 100644 --- a/include/xrpl/nodestore/Backend.h +++ b/include/xrpl/nodestore/Backend.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** A backend used for the NodeStore. @@ -143,6 +143,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Database.h b/include/xrpl/nodestore/Database.h index b27bccf0f1..474f873876 100644 --- a/include/xrpl/nodestore/Database.h +++ b/include/xrpl/nodestore/Database.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -230,7 +230,7 @@ protected: { XRPL_ASSERT( count <= sz, - "ripple::NodeStore::Database::storeStats : valid inputs"); + "xrpl::NodeStore::Database::storeStats : valid inputs"); storeCount_ += count; storeSz_ += sz; } @@ -291,6 +291,6 @@ private: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/DatabaseRotating.h b/include/xrpl/nodestore/DatabaseRotating.h index ea4a966dde..85202e7a84 100644 --- a/include/xrpl/nodestore/DatabaseRotating.h +++ b/include/xrpl/nodestore/DatabaseRotating.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { /* This class has two key-value store Backend objects for persisting SHAMap @@ -39,6 +39,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/DummyScheduler.h b/include/xrpl/nodestore/DummyScheduler.h index a8d6fcec18..9ffe5ad80d 100644 --- a/include/xrpl/nodestore/DummyScheduler.h +++ b/include/xrpl/nodestore/DummyScheduler.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** Simple NodeStore Scheduler that just peforms the tasks synchronously. */ @@ -21,6 +21,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Factory.h b/include/xrpl/nodestore/Factory.h index 2309a0bf90..d6d33c4b64 100644 --- a/include/xrpl/nodestore/Factory.h +++ b/include/xrpl/nodestore/Factory.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -61,6 +61,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Manager.h b/include/xrpl/nodestore/Manager.h index 6764967353..fe4b1c614e 100644 --- a/include/xrpl/nodestore/Manager.h +++ b/include/xrpl/nodestore/Manager.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -83,6 +83,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/NodeObject.h b/include/xrpl/nodestore/NodeObject.h index 6e4eae2c81..6a69245fd2 100644 --- a/include/xrpl/nodestore/NodeObject.h +++ b/include/xrpl/nodestore/NodeObject.h @@ -7,7 +7,7 @@ // VFALCO NOTE Intentionally not in the NodeStore namespace -namespace ripple { +namespace xrpl { /** The types of node objects. */ enum NodeObjectType : std::uint32_t { @@ -81,6 +81,6 @@ private: Blob const mData; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Scheduler.h b/include/xrpl/nodestore/Scheduler.h index b9a9f8b5f4..0835e08fa2 100644 --- a/include/xrpl/nodestore/Scheduler.h +++ b/include/xrpl/nodestore/Scheduler.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { enum class FetchType { synchronous, async }; @@ -66,6 +66,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Task.h b/include/xrpl/nodestore/Task.h index 44b28ec9c6..bd21e61975 100644 --- a/include/xrpl/nodestore/Task.h +++ b/include/xrpl/nodestore/Task.h @@ -1,7 +1,7 @@ #ifndef XRPL_NODESTORE_TASK_H_INCLUDED #define XRPL_NODESTORE_TASK_H_INCLUDED -namespace ripple { +namespace xrpl { namespace NodeStore { /** Derived classes perform scheduled tasks. */ @@ -17,6 +17,6 @@ struct Task }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/Types.h b/include/xrpl/nodestore/Types.h index 38481c14e8..6763196860 100644 --- a/include/xrpl/nodestore/Types.h +++ b/include/xrpl/nodestore/Types.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { enum { @@ -37,6 +37,6 @@ using Batch = std::vector>; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/BatchWriter.h b/include/xrpl/nodestore/detail/BatchWriter.h index 3776029c25..f1faf0a612 100644 --- a/include/xrpl/nodestore/detail/BatchWriter.h +++ b/include/xrpl/nodestore/detail/BatchWriter.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** Batch-writing assist logic. @@ -78,6 +78,6 @@ private: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/DatabaseNodeImp.h b/include/xrpl/nodestore/detail/DatabaseNodeImp.h index b70fbf640b..bf222129cc 100644 --- a/include/xrpl/nodestore/detail/DatabaseNodeImp.h +++ b/include/xrpl/nodestore/detail/DatabaseNodeImp.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { class DatabaseNodeImp : public Database @@ -59,7 +59,7 @@ public: XRPL_ASSERT( backend_, - "ripple::NodeStore::DatabaseNodeImp::DatabaseNodeImp : non-null " + "xrpl::NodeStore::DatabaseNodeImp::DatabaseNodeImp : non-null " "backend"); } @@ -138,6 +138,6 @@ private: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h index 847bc08dbc..63d628a30a 100644 --- a/include/xrpl/nodestore/detail/DatabaseRotatingImp.h +++ b/include/xrpl/nodestore/detail/DatabaseRotatingImp.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { class DatabaseRotatingImp : public DatabaseRotating @@ -79,6 +79,6 @@ private: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/DecodedBlob.h b/include/xrpl/nodestore/detail/DecodedBlob.h index ed39bab39c..0eaa169269 100644 --- a/include/xrpl/nodestore/detail/DecodedBlob.h +++ b/include/xrpl/nodestore/detail/DecodedBlob.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** Parsed key/value blob into NodeObject components. @@ -43,6 +43,6 @@ private: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/EncodedBlob.h b/include/xrpl/nodestore/detail/EncodedBlob.h index 64442bf8c6..2cd35a7b6f 100644 --- a/include/xrpl/nodestore/detail/EncodedBlob.h +++ b/include/xrpl/nodestore/detail/EncodedBlob.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** Convert a NodeObject from in-memory to database format. @@ -64,7 +64,7 @@ public: : size_([&obj]() { XRPL_ASSERT( obj, - "ripple::NodeStore::EncodedBlob::EncodedBlob : non-null input"); + "xrpl::NodeStore::EncodedBlob::EncodedBlob : non-null input"); if (!obj) throw std::runtime_error( @@ -87,7 +87,7 @@ public: XRPL_ASSERT( ((ptr_ == payload_.data()) && (size_ <= payload_.size())) || ((ptr_ != payload_.data()) && (size_ > payload_.size())), - "ripple::NodeStore::EncodedBlob::~EncodedBlob : valid payload " + "xrpl::NodeStore::EncodedBlob::~EncodedBlob : valid payload " "pointer"); if (ptr_ != payload_.data()) @@ -114,6 +114,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/ManagerImp.h b/include/xrpl/nodestore/detail/ManagerImp.h index 139ca903c2..fd3de8a7ca 100644 --- a/include/xrpl/nodestore/detail/ManagerImp.h +++ b/include/xrpl/nodestore/detail/ManagerImp.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -50,6 +50,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/codec.h b/include/xrpl/nodestore/detail/codec.h index f3e80c5a6a..e02d3963bd 100644 --- a/include/xrpl/nodestore/detail/codec.h +++ b/include/xrpl/nodestore/detail/codec.h @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { template @@ -322,6 +322,6 @@ filter_inner(void* in, std::size_t in_size) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/nodestore/detail/varint.h b/include/xrpl/nodestore/detail/varint.h index a8f19d0871..7cf9fbaf4b 100644 --- a/include/xrpl/nodestore/detail/varint.h +++ b/include/xrpl/nodestore/detail/varint.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { // This is a variant of the base128 varint format from @@ -118,6 +118,6 @@ write(nudb::detail::ostream& os, std::size_t t) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/AMMCore.h b/include/xrpl/protocol/AMMCore.h index a55ae5490d..e259089367 100644 --- a/include/xrpl/protocol/AMMCore.h +++ b/include/xrpl/protocol/AMMCore.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { std::uint16_t constexpr TRADING_FEE_THRESHOLD = 1000; // 1% @@ -102,6 +102,6 @@ feeMultHalf(std::uint16_t tfee) return 1 - getFee(tfee) / 2; } -} // namespace ripple +} // namespace xrpl #endif // XRPL_PROTOCOL_AMMCORE_H_INCLUDED diff --git a/include/xrpl/protocol/AccountID.h b/include/xrpl/protocol/AccountID.h index ddf044e2aa..d61938e2a7 100644 --- a/include/xrpl/protocol/AccountID.h +++ b/include/xrpl/protocol/AccountID.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -103,15 +103,15 @@ operator<<(std::ostream& os, AccountID const& x) void initAccountIdCache(std::size_t count); -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ namespace Json { template <> -inline ripple::AccountID -getOrThrow(Json::Value const& v, ripple::SField const& field) +inline xrpl::AccountID +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; std::string const b58 = getOrThrow(v, field); if (auto const r = parseBase58(b58)) @@ -127,7 +127,7 @@ namespace std { // DEPRECATED // VFALCO Use beast::uhash or a hardened container template <> -struct hash : ripple::AccountID::hasher +struct hash : xrpl::AccountID::hasher { hash() = default; }; diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index 3c870ed4b1..195e373fa0 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { inline STAmount toSTAmount(IOUAmount const& iou, Issue const& iss) @@ -35,8 +35,7 @@ inline STAmount toSTAmount(XRPAmount const& xrp, Issue const& iss) { XRPL_ASSERT( - isXRP(iss.account) && isXRP(iss.currency), - "ripple::toSTAmount : is XRP"); + isXRP(iss.account) && isXRP(iss.currency), "xrpl::toSTAmount : is XRP"); return toSTAmount(xrp); } @@ -57,12 +56,12 @@ toAmount(STAmount const& amt) { XRPL_ASSERT( amt.mantissa() < std::numeric_limits::max(), - "ripple::toAmount : maximum mantissa"); + "xrpl::toAmount : maximum mantissa"); bool const isNeg = amt.negative(); std::int64_t const sMant = isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa(); - XRPL_ASSERT(!isXRP(amt), "ripple::toAmount : is not XRP"); + XRPL_ASSERT(!isXRP(amt), "xrpl::toAmount : is not XRP"); return IOUAmount(sMant, amt.exponent()); } @@ -72,12 +71,12 @@ toAmount(STAmount const& amt) { XRPL_ASSERT( amt.mantissa() < std::numeric_limits::max(), - "ripple::toAmount : maximum mantissa"); + "xrpl::toAmount : maximum mantissa"); bool const isNeg = amt.negative(); std::int64_t const sMant = isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa(); - XRPL_ASSERT(isXRP(amt), "ripple::toAmount : is XRP"); + XRPL_ASSERT(isXRP(amt), "xrpl::toAmount : is XRP"); return XRPAmount(sMant); } @@ -196,6 +195,6 @@ get(STAmount const& a) } } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index d83884008d..b2ee64621e 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * API version numbers used in later API versions @@ -64,7 +64,7 @@ setVersion(JsonObject& parent, unsigned int apiVersion, bool betaEnabled) { XRPL_ASSERT( apiVersion != apiInvalidVersion, - "ripple::RPC::setVersion : input is valid"); + "xrpl::RPC::setVersion : input is valid"); auto& retObj = addObject(parent, jss::version); if (apiVersion == apiVersionIfUnspecified) @@ -167,6 +167,6 @@ forAllApiVersions(Fn const& fn, Args&&... args) RPC::apiMaximumValidVersion>(fn, std::forward(args)...); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Asset.h b/include/xrpl/protocol/Asset.h index 7ad1e70256..b72c20d82c 100644 --- a/include/xrpl/protocol/Asset.h +++ b/include/xrpl/protocol/Asset.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Asset; class STAmount; @@ -233,6 +233,6 @@ validJSONAsset(Json::Value const& jv); Asset assetFromJson(Json::Value const& jv); -} // namespace ripple +} // namespace xrpl #endif // XRPL_PROTOCOL_ASSET_H_INCLUDED diff --git a/include/xrpl/protocol/Batch.h b/include/xrpl/protocol/Batch.h index 73dd15e6e2..1404c8069f 100644 --- a/include/xrpl/protocol/Batch.h +++ b/include/xrpl/protocol/Batch.h @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { inline void serializeBatch( @@ -17,4 +17,4 @@ serializeBatch( msg.addBitString(txid); } -} // namespace ripple +} // namespace xrpl diff --git a/include/xrpl/protocol/Book.h b/include/xrpl/protocol/Book.h index cbc6e862b8..ddd315de30 100644 --- a/include/xrpl/protocol/Book.h +++ b/include/xrpl/protocol/Book.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** Specifies an order book. The order book is a pair of Issues called in and out. @@ -87,28 +87,28 @@ operator<=>(Book const& lhs, Book const& rhs) } /** @} */ -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ namespace std { template <> -struct hash - : private boost::base_from_member, 0>, - private boost::base_from_member, 1> +struct hash + : private boost::base_from_member, 0>, + private boost::base_from_member, 1> { private: using currency_hash_type = - boost::base_from_member, 0>; + boost::base_from_member, 0>; using issuer_hash_type = - boost::base_from_member, 1>; + boost::base_from_member, 1>; public: hash() = default; using value_type = std::size_t; - using argument_type = ripple::Issue; + using argument_type = xrpl::Issue; value_type operator()(argument_type const& value) const @@ -124,11 +124,11 @@ public: //------------------------------------------------------------------------------ template <> -struct hash +struct hash { private: - using issue_hasher = std::hash; - using uint256_hasher = ripple::uint256::hasher; + using issue_hasher = std::hash; + using uint256_hasher = xrpl::uint256::hasher; issue_hasher m_issue_hasher; uint256_hasher m_uint256_hasher; @@ -137,7 +137,7 @@ public: hash() = default; using value_type = std::size_t; - using argument_type = ripple::Book; + using argument_type = xrpl::Book; value_type operator()(argument_type const& value) const @@ -159,21 +159,21 @@ public: namespace boost { template <> -struct hash : std::hash +struct hash : std::hash { hash() = default; - using Base = std::hash; + using Base = std::hash; // VFALCO NOTE broken in vs2012 // using Base::Base; // inherit ctors }; template <> -struct hash : std::hash +struct hash : std::hash { hash() = default; - using Base = std::hash; + using Base = std::hash; // VFALCO NOTE broken in vs2012 // using Base::Base; // inherit ctors }; diff --git a/include/xrpl/protocol/BuildInfo.h b/include/xrpl/protocol/BuildInfo.h index 8e692f7ca4..0b75f8b0a1 100644 --- a/include/xrpl/protocol/BuildInfo.h +++ b/include/xrpl/protocol/BuildInfo.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Versioning information for this build. */ // VFALCO The namespace is deprecated @@ -79,6 +79,6 @@ isNewerVersion(std::uint64_t version); } // namespace BuildInfo -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/ErrorCodes.h b/include/xrpl/protocol/ErrorCodes.h index 709a26093d..8d5d871aa1 100644 --- a/include/xrpl/protocol/ErrorCodes.h +++ b/include/xrpl/protocol/ErrorCodes.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { // VFALCO NOTE These are outside the RPC namespace @@ -360,6 +360,6 @@ error_code_http_status(error_code_i code); std::string rpcErrorString(Json::Value const& jv); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index 193f0665dc..317bde3ee6 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -63,7 +63,7 @@ * */ -namespace ripple { +namespace xrpl { enum class VoteBehavior : int { Obsolete = -1, DefaultNo = 0, DefaultYes }; enum class AmendmentSupport : int { Retired = -1, Supported = 0, Unsupported }; @@ -177,7 +177,7 @@ public: { XRPL_ASSERT( b.count() == count(), - "ripple::FeatureBitset::FeatureBitset(base) : count match"); + "xrpl::FeatureBitset::FeatureBitset(base) : count match"); } template @@ -186,7 +186,7 @@ public: initFromFeatures(f, std::forward(fs)...); XRPL_ASSERT( count() == (sizeof...(fs) + 1), - "ripple::FeatureBitset::FeatureBitset(uint256) : count and " + "xrpl::FeatureBitset::FeatureBitset(uint256) : count and " "sizeof... do match"); } @@ -197,7 +197,7 @@ public: set(featureToBitsetIndex(f)); XRPL_ASSERT( fs.size() == count(), - "ripple::FeatureBitset::FeatureBitset(Container auto) : count and " + "xrpl::FeatureBitset::FeatureBitset(Container auto) : count and " "size do match"); } @@ -365,6 +365,6 @@ foreachFeature(FeatureBitset bs, F&& f) #undef XRPL_FEATURE #pragma pop_macro("XRPL_FEATURE") -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Fees.h b/include/xrpl/protocol/Fees.h index 43ba6c9552..8c7cb51777 100644 --- a/include/xrpl/protocol/Fees.h +++ b/include/xrpl/protocol/Fees.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Reflects the fee settings for a particular ledger. @@ -33,6 +33,6 @@ struct Fees } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/HashPrefix.h b/include/xrpl/protocol/HashPrefix.h index 8c0cb53b5d..77529e9212 100644 --- a/include/xrpl/protocol/HashPrefix.h +++ b/include/xrpl/protocol/HashPrefix.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -82,6 +82,6 @@ hash_append(Hasher& h, HashPrefix const& hp) noexcept hash_append(h, static_cast(hp)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index da2dbb3fa7..60a61a5825 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Floating point representation of amounts with high dynamic range @@ -208,6 +208,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Indexes.h b/include/xrpl/protocol/Indexes.h index 69418fbd25..1cb22b4d6c 100644 --- a/include/xrpl/protocol/Indexes.h +++ b/include/xrpl/protocol/Indexes.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { class SeqProxy; /** Keylet computation funclets. @@ -203,7 +203,7 @@ inline Keylet page(Keylet const& root, std::uint64_t index = 0) noexcept { XRPL_ASSERT( - root.type == ltDIR_NODE, "ripple::keylet::page : valid root type"); + root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type"); return page(root.key, index); } /** @} */ @@ -393,6 +393,6 @@ std::array, 6> const directAccountKeylets{ MPTID makeMptID(std::uint32_t sequence, AccountID const& account); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/InnerObjectFormats.h b/include/xrpl/protocol/InnerObjectFormats.h index 36ed515147..6d656d0065 100644 --- a/include/xrpl/protocol/InnerObjectFormats.h +++ b/include/xrpl/protocol/InnerObjectFormats.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Manages the list of known inner object formats. */ @@ -23,6 +23,6 @@ public: findSOTemplateBySField(SField const& sField) const; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Issue.h b/include/xrpl/protocol/Issue.h index c079f6d121..519d7a96f3 100644 --- a/include/xrpl/protocol/Issue.h +++ b/include/xrpl/protocol/Issue.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A currency issued by an account. @see Currency, AccountID, Issue, Book @@ -113,6 +113,6 @@ isXRP(Issue const& issue) return issue.native(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/KeyType.h b/include/xrpl/protocol/KeyType.h index 055c2c1efa..454c88780d 100644 --- a/include/xrpl/protocol/KeyType.h +++ b/include/xrpl/protocol/KeyType.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { enum class KeyType { secp256k1 = 0, @@ -42,6 +42,6 @@ operator<<(Stream& s, KeyType type) return s << to_string(type); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Keylet.h b/include/xrpl/protocol/Keylet.h index 0508287574..4380fdfdac 100644 --- a/include/xrpl/protocol/Keylet.h +++ b/include/xrpl/protocol/Keylet.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class STLedgerEntry; @@ -30,6 +30,6 @@ struct Keylet check(STLedgerEntry const&) const; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/KnownFormats.h b/include/xrpl/protocol/KnownFormats.h index ebb159163f..a928ed52be 100644 --- a/include/xrpl/protocol/KnownFormats.h +++ b/include/xrpl/protocol/KnownFormats.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Manages a list of known formats. @@ -183,6 +183,6 @@ private: boost::container::flat_map types_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/LedgerFormats.h b/include/xrpl/protocol/LedgerFormats.h index 64ae604f64..b52a25af17 100644 --- a/include/xrpl/protocol/LedgerFormats.h +++ b/include/xrpl/protocol/LedgerFormats.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Identifiers for on-ledger objects. @@ -210,6 +210,6 @@ public: getInstance(); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/LedgerHeader.h b/include/xrpl/protocol/LedgerHeader.h index 80a481f7d1..641f794cdb 100644 --- a/include/xrpl/protocol/LedgerHeader.h +++ b/include/xrpl/protocol/LedgerHeader.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Information about the notional ledger backing the view. */ struct LedgerHeader @@ -73,6 +73,6 @@ deserializeHeader(Slice data, bool hasHash = false); LedgerHeader deserializePrefixedHeader(Slice data, bool hasHash = false); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/MPTAmount.h b/include/xrpl/protocol/MPTAmount.h index af14786501..cc9528a923 100644 --- a/include/xrpl/protocol/MPTAmount.h +++ b/include/xrpl/protocol/MPTAmount.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { class MPTAmount : private boost::totally_ordered, private boost::additive, @@ -150,6 +150,6 @@ mulRatio( return MPTAmount(r.convert_to()); } -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_MPTAMOUNT_H_INCLUDED diff --git a/include/xrpl/protocol/MPTIssue.h b/include/xrpl/protocol/MPTIssue.h index b8e184d3cd..b89b59ee0d 100644 --- a/include/xrpl/protocol/MPTIssue.h +++ b/include/xrpl/protocol/MPTIssue.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /* Adapt MPTID to provide the same interface as Issue. Enables using static * polymorphism by Asset and other classes. MPTID is a 192-bit concatenation @@ -77,6 +77,6 @@ to_string(MPTIssue const& mptIssue); MPTIssue mptIssueFromJson(Json::Value const& jv); -} // namespace ripple +} // namespace xrpl #endif // XRPL_PROTOCOL_MPTISSUE_H_INCLUDED diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index e8738e2f9e..edf19b6f37 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { template @@ -141,7 +141,7 @@ struct MultiApiJson { XRPL_ASSERT( valid(version) && index(version) >= 0 && index(version) < size, - "ripple::detail::MultiApiJson::operator() : valid " + "xrpl::detail::MultiApiJson::operator() : valid " "version"); return std::invoke( fn, @@ -161,7 +161,7 @@ struct MultiApiJson { XRPL_ASSERT( valid(version) && index(version) >= 0 && index(version) < size, - "ripple::detail::MultiApiJson::operator() : valid version"); + "xrpl::detail::MultiApiJson::operator() : valid version"); return std::invoke(fn, json.val[index(version)]); } } visitor = {}; @@ -217,6 +217,6 @@ struct MultiApiJson using MultiApiJson = detail:: MultiApiJson; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/NFTSyntheticSerializer.h b/include/xrpl/protocol/NFTSyntheticSerializer.h index 390d386410..7068ae34cd 100644 --- a/include/xrpl/protocol/NFTSyntheticSerializer.h +++ b/include/xrpl/protocol/NFTSyntheticSerializer.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -24,6 +24,6 @@ insertNFTSyntheticInJson( /** @} */ } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/NFTokenID.h b/include/xrpl/protocol/NFTokenID.h index 762af14d2f..03e30794d0 100644 --- a/include/xrpl/protocol/NFTokenID.h +++ b/include/xrpl/protocol/NFTokenID.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Add a `nftoken_ids` field to the `meta` output parameter. @@ -38,6 +38,6 @@ insertNFTokenID( TxMeta const& transactionMeta); /** @} */ -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/NFTokenOfferID.h b/include/xrpl/protocol/NFTokenOfferID.h index cf6427d201..5663653690 100644 --- a/include/xrpl/protocol/NFTokenOfferID.h +++ b/include/xrpl/protocol/NFTokenOfferID.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Add an `offer_id` field to the `meta` output parameter. @@ -33,6 +33,6 @@ insertNFTokenOfferID( TxMeta const& transactionMeta); /** @} */ -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/PayChan.h b/include/xrpl/protocol/PayChan.h index 5dcaa676a8..ad70913c45 100644 --- a/include/xrpl/protocol/PayChan.h +++ b/include/xrpl/protocol/PayChan.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { inline void serializePayChanAuthorization( @@ -19,6 +19,6 @@ serializePayChanAuthorization( msg.add64(amt.drops()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 16ee729fe4..252605e641 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * We have both transaction type permissions and granular type permissions. * Since we will reuse the TransactionFormats to parse the Transaction @@ -83,6 +83,6 @@ public: permissionToTxType(uint32_t const& value) const; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index ded16cad6d..fb315eace4 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** Protocol specific constants. @@ -297,6 +297,6 @@ std::size_t constexpr permissionMaxSize = 10; /** The maximum number of transactions that can be in a batch. */ std::size_t constexpr maxBatchTxCount = 8; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/PublicKey.h b/include/xrpl/protocol/PublicKey.h index 8d8062408b..51a7683ebc 100644 --- a/include/xrpl/protocol/PublicKey.h +++ b/include/xrpl/protocol/PublicKey.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A public key. @@ -260,16 +260,16 @@ getFingerprint( } return ss.str(); } -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ namespace Json { template <> -inline ripple::PublicKey -getOrThrow(Json::Value const& v, ripple::SField const& field) +inline xrpl::PublicKey +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; std::string const b58 = getOrThrow(v, field); if (auto pubKeyBlob = strUnHex(b58); publicKeyType(makeSlice(*pubKeyBlob))) { diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index 0e748e9b26..1fafa5e321 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents a pair of input and output currencies. @@ -281,7 +281,7 @@ public: { XRPL_ASSERT( q1.m_value > 0 && q2.m_value > 0, - "ripple::Quality::relativeDistance : minimum inputs"); + "xrpl::Quality::relativeDistance : minimum inputs"); if (q1.m_value == q2.m_value) // make expected common case fast return 0; @@ -395,6 +395,6 @@ Quality::ceil_out_strict( Quality composed_quality(Quality const& lhs, Quality const& rhs); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/QualityFunction.h b/include/xrpl/protocol/QualityFunction.h index 8013f0bf7b..b7ec11fa69 100644 --- a/include/xrpl/protocol/QualityFunction.h +++ b/include/xrpl/protocol/QualityFunction.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Average quality of a path as a function of `out`: q(out) = m * out + b, * where m = -1 / poolGets, b = poolPays / poolGets. If CLOB offer then @@ -83,6 +83,6 @@ QualityFunction::QualityFunction( b_ = amounts.out * cfee / amounts.in; } -} // namespace ripple +} // namespace xrpl #endif // XRPL_PROTOCOL_QUALITYFUNCTION_H_INCLUDED diff --git a/include/xrpl/protocol/RPCErr.h b/include/xrpl/protocol/RPCErr.h index 3436384d01..90df1562e7 100644 --- a/include/xrpl/protocol/RPCErr.h +++ b/include/xrpl/protocol/RPCErr.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // VFALCO NOTE these are deprecated bool @@ -11,6 +11,6 @@ isRpcError(Json::Value jvResult); Json::Value rpcError(int iError); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Rate.h b/include/xrpl/protocol/Rate.h index b0c641c499..b8173a9392 100644 --- a/include/xrpl/protocol/Rate.h +++ b/include/xrpl/protocol/Rate.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents a transfer rate @@ -83,6 +83,6 @@ transferFeeAsRate(std::uint16_t fee); /** A transfer rate signifying a 1:1 exchange */ extern Rate const parityRate; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/RippleLedgerHash.h b/include/xrpl/protocol/RippleLedgerHash.h index 4653e1a558..516ab49029 100644 --- a/include/xrpl/protocol/RippleLedgerHash.h +++ b/include/xrpl/protocol/RippleLedgerHash.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { using LedgerHash = uint256; diff --git a/include/xrpl/protocol/Rules.h b/include/xrpl/protocol/Rules.h index 40b84d1d3f..0ae6680d07 100644 --- a/include/xrpl/protocol/Rules.h +++ b/include/xrpl/protocol/Rules.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { bool isFeatureEnabled(uint256 const& feature); @@ -111,5 +111,5 @@ private: std::optional saved_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 82619b1ced..b1d353196d 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /* @@ -374,6 +374,6 @@ extern SField const sfGeneric; #undef UNTYPED_SFIELD #pragma pop_macro("UNTYPED_SFIELD") -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/SOTemplate.h b/include/xrpl/protocol/SOTemplate.h index 35e3b356be..559117c274 100644 --- a/include/xrpl/protocol/SOTemplate.h +++ b/include/xrpl/protocol/SOTemplate.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Kind of element in each entry of an SOTemplate. */ enum SOEStyle { @@ -154,6 +154,6 @@ private: std::vector indices_; // field num -> index }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STAccount.h b/include/xrpl/protocol/STAccount.h index b981ef91c2..7c193d3425 100644 --- a/include/xrpl/protocol/STAccount.h +++ b/include/xrpl/protocol/STAccount.h @@ -7,14 +7,14 @@ #include -namespace ripple { +namespace xrpl { 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 a ripple::uint160. However, so the serialized format of the + // overhead in a xrpl::uint160. However, so the serialized format of the // STAccount stays unchanged, we serialize and deserialize like an STBlob. AccountID value_; bool default_; @@ -112,6 +112,6 @@ operator<(AccountID const& lhs, STAccount const& rhs) return lhs < rhs.value(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 3ea45cc05b..79cbf51436 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { // Internal form: // 1: If amount is zero, then value is zero and offset is -100 @@ -347,7 +347,7 @@ STAmount::STAmount( // mValue is uint64, but needs to fit in the range of int64 XRPL_ASSERT( mValue <= std::numeric_limits::max(), - "ripple::STAmount::STAmount(SField, A, std::uint64_t, int, bool) : " + "xrpl::STAmount::STAmount(SField, A, std::uint64_t, int, bool) : " "maximum mantissa input"); canonicalize(); } @@ -748,15 +748,15 @@ canAdd(STAmount const& amt1, STAmount const& amt2); bool canSubtract(STAmount const& amt1, STAmount const& amt2); -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ namespace Json { template <> -inline ripple::STAmount -getOrThrow(Json::Value const& v, ripple::SField const& field) +inline xrpl::STAmount +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; Json::StaticString const& key = field.getJsonName(); if (!v.isMember(key)) Throw(key); diff --git a/include/xrpl/protocol/STArray.h b/include/xrpl/protocol/STArray.h index 88d2b04511..fb37e07226 100644 --- a/include/xrpl/protocol/STArray.h +++ b/include/xrpl/protocol/STArray.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class STArray final : public STBase, public CountedObject { @@ -291,6 +291,6 @@ STArray::erase(const_iterator first, const_iterator last) return v_.erase(first, last); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STBase.h b/include/xrpl/protocol/STBase.h index 64bd4f7ab8..f100b52426 100644 --- a/include/xrpl/protocol/STBase.h +++ b/include/xrpl/protocol/STBase.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { /// Note, should be treated as flags that can be | and & struct JsonOptions @@ -219,6 +219,6 @@ STBase::emplace(std::size_t n, void* buf, T&& val) return new (buf) U(std::forward(val)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STBitString.h b/include/xrpl/protocol/STBitString.h index 10c6fd95a0..2d26fe4bd7 100644 --- a/include/xrpl/protocol/STBitString.h +++ b/include/xrpl/protocol/STBitString.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { // The template parameter could be an unsigned type, however there's a bug in // gdb (last checked in gdb 12.1) that prevents gdb from finding the RTTI @@ -152,10 +152,10 @@ void STBitString::add(Serializer& s) const { XRPL_ASSERT( - getFName().isBinary(), "ripple::STBitString::add : field is binary"); + getFName().isBinary(), "xrpl::STBitString::add : field is binary"); XRPL_ASSERT( getFName().fieldType == getSType(), - "ripple::STBitString::add : field type match"); + "xrpl::STBitString::add : field type match"); s.addBitString(value_); } @@ -187,6 +187,6 @@ STBitString::isDefault() const return value_ == beast::zero; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STBlob.h b/include/xrpl/protocol/STBlob.h index 46b91d6ebb..dc3f95e218 100644 --- a/include/xrpl/protocol/STBlob.h +++ b/include/xrpl/protocol/STBlob.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { // variable length byte string class STBlob : public STBase, public CountedObject @@ -126,6 +126,6 @@ STBlob::setValue(Buffer&& b) value_ = std::move(b); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STCurrency.h b/include/xrpl/protocol/STCurrency.h index acb0e40019..1c59d48beb 100644 --- a/include/xrpl/protocol/STCurrency.h +++ b/include/xrpl/protocol/STCurrency.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class STCurrency final : public STBase { @@ -114,6 +114,6 @@ operator<(STCurrency const& lhs, Currency const& rhs) return lhs.currency() < rhs; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STExchange.h b/include/xrpl/protocol/STExchange.h index 771f6bd109..5f7e405599 100644 --- a/include/xrpl/protocol/STExchange.h +++ b/include/xrpl/protocol/STExchange.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Convert between serialized type U and C++ type T. */ template @@ -155,6 +155,6 @@ erase(STObject& st, TypedField const& f) st.makeFieldAbsent(f); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index 7513733e47..9c8af4c08c 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { template class STInteger : public STBase, public CountedObject> @@ -54,7 +54,7 @@ private: STBase* move(std::size_t n, void* buf) override; - friend class ripple::detail::STVar; + friend class xrpl::detail::STVar; }; using STUInt8 = STInteger; @@ -94,10 +94,10 @@ inline void STInteger::add(Serializer& s) const { XRPL_ASSERT( - getFName().isBinary(), "ripple::STInteger::add : field is binary"); + getFName().isBinary(), "xrpl::STInteger::add : field is binary"); XRPL_ASSERT( getFName().fieldType == getSType(), - "ripple::STInteger::add : field type match"); + "xrpl::STInteger::add : field type match"); s.addInteger(value_); } @@ -144,6 +144,6 @@ inline STInteger::operator Integer() const return value_; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STIssue.h b/include/xrpl/protocol/STIssue.h index 4f8509710c..6480482d08 100644 --- a/include/xrpl/protocol/STIssue.h +++ b/include/xrpl/protocol/STIssue.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class STIssue final : public STBase, CountedObject { @@ -150,6 +150,6 @@ operator<=>(STIssue const& lhs, Asset const& rhs) return lhs.asset_ <=> rhs; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STLedgerEntry.h b/include/xrpl/protocol/STLedgerEntry.h index 20a5ceda54..83e0f2cd27 100644 --- a/include/xrpl/protocol/STLedgerEntry.h +++ b/include/xrpl/protocol/STLedgerEntry.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class Rules; namespace test { @@ -108,6 +108,6 @@ STLedgerEntry::getType() const return type_; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STNumber.h b/include/xrpl/protocol/STNumber.h index 2ec3d66fd1..dfdb16af93 100644 --- a/include/xrpl/protocol/STNumber.h +++ b/include/xrpl/protocol/STNumber.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** * A serializable number. @@ -84,6 +84,6 @@ partsFromString(std::string const& number); STNumber numberFromJson(SField const& field, Json::Value const& value); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 1a553e0fbf..c6ca133e89 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { class STArray; @@ -772,7 +772,7 @@ STObject::Proxy::assign(U&& u) t = dynamic_cast(st_->getPField(*f_, true)); else t = dynamic_cast(st_->makeFieldPresent(*f_)); - XRPL_ASSERT(t, "ripple::STObject::Proxy::assign : type cast succeeded"); + XRPL_ASSERT(t, "xrpl::STObject::Proxy::assign : type cast succeeded"); *t = std::forward(u); } @@ -1064,18 +1064,17 @@ STObject::at(TypedField const& f) const return u->value(); XRPL_ASSERT( - mType, - "ripple::STObject::at(TypedField auto) : field template non-null"); + mType, "xrpl::STObject::at(TypedField auto) : field template non-null"); XRPL_ASSERT( b->getSType() == STI_NOTPRESENT, - "ripple::STObject::at(TypedField auto) : type not present"); + "xrpl::STObject::at(TypedField auto) : type not present"); if (mType->style(f) == soeOPTIONAL) Throw("Missing optional field: " + f.getName()); XRPL_ASSERT( mType->style(f) == soeDEFAULT, - "ripple::STObject::at(TypedField auto) : template style is default"); + "xrpl::STObject::at(TypedField auto) : template style is default"); // Used to help handle the case where value_type is a const reference, // otherwise we would return the address of a temporary. @@ -1095,16 +1094,16 @@ STObject::at(OptionaledField const& of) const { XRPL_ASSERT( mType, - "ripple::STObject::at(OptionaledField auto) : field template " + "xrpl::STObject::at(OptionaledField auto) : field template " "non-null"); XRPL_ASSERT( b->getSType() == STI_NOTPRESENT, - "ripple::STObject::at(OptionaledField auto) : type not present"); + "xrpl::STObject::at(OptionaledField auto) : type not present"); if (mType->style(*of.f) == soeOPTIONAL) return std::nullopt; XRPL_ASSERT( mType->style(*of.f) == soeDEFAULT, - "ripple::STObject::at(OptionaledField auto) : template style is " + "xrpl::STObject::at(OptionaledField auto) : template style is " "default"); return typename T::value_type{}; } @@ -1264,6 +1263,6 @@ STObject::peekField(SField const& field) return *cf; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STParsedJSON.h b/include/xrpl/protocol/STParsedJSON.h index 9bc8524f11..4be10840bd 100644 --- a/include/xrpl/protocol/STParsedJSON.h +++ b/include/xrpl/protocol/STParsedJSON.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Holds the serialized result of parsing an input JSON object. This does validation and checking on the provided JSON. @@ -35,6 +35,6 @@ public: Json::Value error; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STPathSet.h b/include/xrpl/protocol/STPathSet.h index 4b16e9cb1f..cb7db2edf0 100644 --- a/include/xrpl/protocol/STPathSet.h +++ b/include/xrpl/protocol/STPathSet.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { class STPathElement final : public CountedObject { @@ -241,7 +241,7 @@ inline STPathElement::STPathElement( mType |= typeAccount; XRPL_ASSERT( mAccountID != noAccount(), - "ripple::STPathElement::STPathElement : account is set"); + "xrpl::STPathElement::STPathElement : account is set"); } if (currency) @@ -256,7 +256,7 @@ inline STPathElement::STPathElement( mType |= typeIssuer; XRPL_ASSERT( mIssuerID != noAccount(), - "ripple::STPathElement::STPathElement : issuer is set"); + "xrpl::STPathElement::STPathElement : issuer is set"); } hash_value_ = get_hash(*this); @@ -504,6 +504,6 @@ STPathSet::emplace_back(Args&&... args) value.emplace_back(std::forward(args)...); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STTx.h b/include/xrpl/protocol/STTx.h index 02f865e349..182e13433d 100644 --- a/include/xrpl/protocol/STTx.h +++ b/include/xrpl/protocol/STTx.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { enum TxnSql : char { txnSqlNew = 'N', @@ -201,6 +201,6 @@ STTx::getTransactionID() const return tid_; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STValidation.h b/include/xrpl/protocol/STValidation.h index 07aef8316c..4d09397eaa 100644 --- a/include/xrpl/protocol/STValidation.h +++ b/include/xrpl/protocol/STValidation.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { // Validation flags @@ -175,7 +175,7 @@ STValidation::STValidation( XRPL_ASSERT( nodeID_.isNonZero(), - "ripple::STValidation::STValidation(SerialIter) : nonzero node"); + "xrpl::STValidation::STValidation(SerialIter) : nonzero node"); } /** Construct, sign and trust a new STValidation issued by this node. @@ -200,7 +200,7 @@ STValidation::STValidation( { XRPL_ASSERT( nodeID_.isNonZero(), - "ripple::STValidation::STValidation(PublicKey, SecretKey) : nonzero " + "xrpl::STValidation::STValidation(PublicKey, SecretKey) : nonzero " "node"); // First, set our own public key: @@ -267,6 +267,6 @@ STValidation::setSeen(NetClock::time_point s) seenTime_ = s; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index dc2276a250..94b16db90b 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class STVector256 : public STBase, public CountedObject { @@ -237,6 +237,6 @@ STVector256::clear() noexcept return mValue.clear(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/STXChainBridge.h b/include/xrpl/protocol/STXChainBridge.h index e7e687c2c9..89c6d60c13 100644 --- a/include/xrpl/protocol/STXChainBridge.h +++ b/include/xrpl/protocol/STXChainBridge.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Serializer; class STObject; @@ -212,6 +212,6 @@ STXChainBridge::dstChain(bool wasLockingChainSend) return ChainType::locking; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/SecretKey.h b/include/xrpl/protocol/SecretKey.h index fd36ce1a5b..d5f1ce303f 100644 --- a/include/xrpl/protocol/SecretKey.h +++ b/include/xrpl/protocol/SecretKey.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A secret key. */ class SecretKey @@ -162,6 +162,6 @@ sign(KeyType type, SecretKey const& sk, Slice const& message) } /** @} */ -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Seed.h b/include/xrpl/protocol/Seed.h index cda1a8e018..36b2bbfee3 100644 --- a/include/xrpl/protocol/Seed.h +++ b/include/xrpl/protocol/Seed.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Seeds are used to generate deterministic secret keys. */ class Seed @@ -117,6 +117,6 @@ toBase58(Seed const& seed) return encodeBase58Token(TokenType::FamilySeed, seed.data(), seed.size()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/SeqProxy.h b/include/xrpl/protocol/SeqProxy.h index 8ed2c45289..8dde232e75 100644 --- a/include/xrpl/protocol/SeqProxy.h +++ b/include/xrpl/protocol/SeqProxy.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A type that represents either a sequence value or a ticket value. @@ -146,6 +146,6 @@ public: return os; } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Serializer.h b/include/xrpl/protocol/Serializer.h index 44c4498cb7..f46073a977 100644 --- a/include/xrpl/protocol/Serializer.h +++ b/include/xrpl/protocol/Serializer.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { class Serializer { @@ -38,7 +38,7 @@ public: { XRPL_ASSERT( data, - "ripple::Serializer::Serializer(void const*) : non-null input"); + "xrpl::Serializer::Serializer(void const*) : non-null input"); std::memcpy(mData.data(), data, size); } } @@ -314,8 +314,7 @@ Serializer::addVL(Iter begin, Iter end, int len) len -= begin->size(); #endif } - XRPL_ASSERT( - len == 0, "ripple::Serializer::addVL : length matches distance"); + XRPL_ASSERT(len == 0, "xrpl::Serializer::addVL : length matches distance"); return ret; } @@ -453,6 +452,6 @@ SerialIter::getBitString() return base_uint::fromVoid(x); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/Sign.h b/include/xrpl/protocol/Sign.h index 9a27290924..6df4c55b65 100644 --- a/include/xrpl/protocol/Sign.h +++ b/include/xrpl/protocol/Sign.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Sign an STObject @@ -67,6 +67,6 @@ finishMultiSigningData(AccountID const& signingID, Serializer& s) s.addBitString(signingID); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/SystemParameters.h b/include/xrpl/protocol/SystemParameters.h index de78b65265..c0732bc9fe 100644 --- a/include/xrpl/protocol/SystemParameters.h +++ b/include/xrpl/protocol/SystemParameters.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { // Various protocol and system specific constant globals. @@ -60,7 +60,7 @@ constexpr std::ratio<80, 100> amendmentMajorityCalcThreshold; /** The minimum amount of time an amendment must hold a majority */ constexpr std::chrono::seconds const defaultAmendmentMajorityTime = weeks{2}; -} // namespace ripple +} // namespace xrpl /** Default peer port (IANA registered) */ inline std::uint16_t constexpr DEFAULT_PEER_PORT{2459}; diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index ad0719dbb1..de2f596127 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { // See https://xrpl.org/transaction-results.html // @@ -685,6 +685,6 @@ transHuman(TER code); std::optional transCode(std::string const& token); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/TxFlags.h b/include/xrpl/protocol/TxFlags.h index d4faed192c..194c4c6af1 100644 --- a/include/xrpl/protocol/TxFlags.h +++ b/include/xrpl/protocol/TxFlags.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Transaction flags. @@ -294,6 +294,6 @@ constexpr std::uint32_t const tfLoanManageMask = ~(tfUniversal | tfLoanDefault | // clang-format on -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/TxFormats.h b/include/xrpl/protocol/TxFormats.h index cf60b5081d..05f03c5cdc 100644 --- a/include/xrpl/protocol/TxFormats.h +++ b/include/xrpl/protocol/TxFormats.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Transaction type identifiers. @@ -76,6 +76,6 @@ public: getInstance(); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/TxMeta.h b/include/xrpl/protocol/TxMeta.h index 3ab58c9d0a..5b6716e380 100644 --- a/include/xrpl/protocol/TxMeta.h +++ b/include/xrpl/protocol/TxMeta.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { class TxMeta { @@ -117,6 +117,6 @@ private: STArray nodes_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/UintTypes.h b/include/xrpl/protocol/UintTypes.h index 480d8640ca..daa66e8286 100644 --- a/include/xrpl/protocol/UintTypes.h +++ b/include/xrpl/protocol/UintTypes.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { class CurrencyTag @@ -96,30 +96,30 @@ operator<<(std::ostream& os, Currency const& x) return os; } -} // namespace ripple +} // namespace xrpl namespace std { template <> -struct hash : ripple::Currency::hasher +struct hash : xrpl::Currency::hasher { hash() = default; }; template <> -struct hash : ripple::NodeID::hasher +struct hash : xrpl::NodeID::hasher { hash() = default; }; template <> -struct hash : ripple::Directory::hasher +struct hash : xrpl::Directory::hasher { hash() = default; }; template <> -struct hash : ripple::uint256::hasher +struct hash : xrpl::uint256::hasher { hash() = default; }; diff --git a/include/xrpl/protocol/Units.h b/include/xrpl/protocol/Units.h index e41f93b5b0..72114ad8fe 100644 --- a/include/xrpl/protocol/Units.h +++ b/include/xrpl/protocol/Units.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace unit { @@ -388,11 +388,10 @@ mulDivU(Source1 value, Dest mul, Source2 div) // split the asserts so if one hits, the user can tell which // without a debugger. XRPL_ASSERT( - value.value() >= 0, "ripple::unit::mulDivU : minimum value input"); + value.value() >= 0, "xrpl::unit::mulDivU : minimum value input"); XRPL_ASSERT( - mul.value() >= 0, "ripple::unit::mulDivU : minimum mul input"); - XRPL_ASSERT( - div.value() > 0, "ripple::unit::mulDivU : minimum div input"); + mul.value() >= 0, "xrpl::unit::mulDivU : minimum mul input"); + XRPL_ASSERT(div.value() > 0, "xrpl::unit::mulDivU : minimum div input"); return std::nullopt; } @@ -532,6 +531,6 @@ unsafe_cast(Src s) noexcept return Dest{unsafe_cast(s)}; } -} // namespace ripple +} // namespace xrpl #endif // PROTOCOL_UNITS_H_INCLUDED diff --git a/include/xrpl/protocol/XChainAttestations.h b/include/xrpl/protocol/XChainAttestations.h index 0b368aaa58..4dc9cfcf6a 100644 --- a/include/xrpl/protocol/XChainAttestations.h +++ b/include/xrpl/protocol/XChainAttestations.h @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Attestations { @@ -478,6 +478,6 @@ class XChainCreateAccountAttestations final using TBase::TBase; }; -} // namespace ripple +} // namespace xrpl #endif // STXCHAINATTESTATIONS_H_ diff --git a/include/xrpl/protocol/XRPAmount.h b/include/xrpl/protocol/XRPAmount.h index e102a3707f..ef283f4154 100644 --- a/include/xrpl/protocol/XRPAmount.h +++ b/include/xrpl/protocol/XRPAmount.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { class XRPAmount : private boost::totally_ordered, private boost::additive, @@ -287,6 +287,6 @@ mulRatio( return XRPAmount(r.convert_to()); } -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_XRPAMOUNT_H_INCLUDED diff --git a/include/xrpl/protocol/detail/STVar.h b/include/xrpl/protocol/detail/STVar.h index 9a8d85717f..540ba2bf77 100644 --- a/include/xrpl/protocol/detail/STVar.h +++ b/include/xrpl/protocol/detail/STVar.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { struct defaultObject_t @@ -162,6 +162,6 @@ operator!=(STVar const& lhs, STVar const& rhs) } } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/detail/b58_utils.h b/include/xrpl/protocol/detail/b58_utils.h index b96e34ebc5..4ea00e6d5e 100644 --- a/include/xrpl/protocol/detail/b58_utils.h +++ b/include/xrpl/protocol/detail/b58_utils.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { template using Result = boost::outcome_v2::result; @@ -112,7 +112,7 @@ inplace_bigint_div_rem(std::span numerator, std::uint64_t divisor) // the a null set of numbers to be zero, so the remainder is also zero. // LCOV_EXCL_START UNREACHABLE( - "ripple::b58_fast::detail::inplace_bigint_div_rem : empty " + "xrpl::b58_fast::detail::inplace_bigint_div_rem : empty " "numerator"); return 0; // LCOV_EXCL_STOP @@ -132,11 +132,11 @@ inplace_bigint_div_rem(std::span numerator, std::uint64_t divisor) unsigned __int128 const r = num - (denom128 * d); XRPL_ASSERT( d >> 64 == 0, - "ripple::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : " + "xrpl::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : " "valid division result"); XRPL_ASSERT( r >> 64 == 0, - "ripple::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : " + "xrpl::b58_fast::detail::inplace_bigint_div_rem::div_rem_64 : " "valid remainder"); return {static_cast(d), static_cast(r)}; }; @@ -163,7 +163,7 @@ b58_10_to_b58_be(std::uint64_t input) 430804206899405824; // 58^10; XRPL_ASSERT( input < B_58_10, - "ripple::b58_fast::detail::b58_10_to_b58_be : valid input"); + "xrpl::b58_fast::detail::b58_10_to_b58_be : valid input"); constexpr std::size_t resultSize = 10; std::array result{}; int i = 0; @@ -181,5 +181,5 @@ b58_10_to_b58_be(std::uint64_t input) } // namespace b58_fast #endif -} // namespace ripple +} // namespace xrpl #endif // XRPL_PROTOCOL_B58_UTILS_H_INCLUDED diff --git a/include/xrpl/protocol/detail/secp256k1.h b/include/xrpl/protocol/detail/secp256k1.h index c93734a539..c3ac76d7ed 100644 --- a/include/xrpl/protocol/detail/secp256k1.h +++ b/include/xrpl/protocol/detail/secp256k1.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { template secp256k1_context const* @@ -27,6 +27,6 @@ secp256k1Context() return h.impl; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/detail/token_errors.h b/include/xrpl/protocol/detail/token_errors.h index a40e992aec..1d5276e78b 100644 --- a/include/xrpl/protocol/detail/token_errors.h +++ b/include/xrpl/protocol/detail/token_errors.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { enum class TokenCodecErrc { success = 0, inputTooLarge, @@ -20,12 +20,12 @@ enum class TokenCodecErrc { namespace std { template <> -struct is_error_code_enum : true_type +struct is_error_code_enum : true_type { }; } // namespace std -namespace ripple { +namespace xrpl { namespace detail { class TokenCodecErrcCategory : public std::error_category { @@ -67,17 +67,17 @@ public: }; } // namespace detail -inline ripple::detail::TokenCodecErrcCategory const& +inline xrpl::detail::TokenCodecErrcCategory const& TokenCodecErrcCategory() { - static ripple::detail::TokenCodecErrcCategory c; + static xrpl::detail::TokenCodecErrcCategory c; return c; } inline std::error_code -make_error_code(ripple::TokenCodecErrc e) +make_error_code(xrpl::TokenCodecErrc e) { return {static_cast(e), TokenCodecErrcCategory()}; } -} // namespace ripple +} // namespace xrpl #endif // TOKEN_ERRORS_H_ diff --git a/include/xrpl/protocol/digest.h b/include/xrpl/protocol/digest.h index c42fe479da..bafac699f5 100644 --- a/include/xrpl/protocol/digest.h +++ b/include/xrpl/protocol/digest.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { /** Message digest functions used in the codebase @@ -226,6 +226,6 @@ sha512Half_s(Args const&... args) return static_cast(h); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/json_get_or_throw.h b/include/xrpl/protocol/json_get_or_throw.h index 74d1779339..bdf572bed6 100644 --- a/include/xrpl/protocol/json_get_or_throw.h +++ b/include/xrpl/protocol/json_get_or_throw.h @@ -53,16 +53,16 @@ struct JsonTypeMismatchError : std::exception template T -getOrThrow(Json::Value const& v, ripple::SField const& field) +getOrThrow(Json::Value const& v, xrpl::SField const& field) { static_assert(sizeof(T) == -1, "This function must be specialized"); } template <> inline std::string -getOrThrow(Json::Value const& v, ripple::SField const& field) +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; Json::StaticString const& key = field.getJsonName(); if (!v.isMember(key)) Throw(key); @@ -76,9 +76,9 @@ getOrThrow(Json::Value const& v, ripple::SField const& field) // Note, this allows integer numeric fields to act as bools template <> inline bool -getOrThrow(Json::Value const& v, ripple::SField const& field) +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; Json::StaticString const& key = field.getJsonName(); if (!v.isMember(key)) Throw(key); @@ -93,9 +93,9 @@ getOrThrow(Json::Value const& v, ripple::SField const& field) template <> inline std::uint64_t -getOrThrow(Json::Value const& v, ripple::SField const& field) +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; Json::StaticString const& key = field.getJsonName(); if (!v.isMember(key)) Throw(key); @@ -125,10 +125,10 @@ getOrThrow(Json::Value const& v, ripple::SField const& field) } template <> -inline ripple::Buffer -getOrThrow(Json::Value const& v, ripple::SField const& field) +inline xrpl::Buffer +getOrThrow(Json::Value const& v, xrpl::SField const& field) { - using namespace ripple; + using namespace xrpl; std::string const hex = getOrThrow(v, field); if (auto const r = strUnHex(hex)) { @@ -141,7 +141,7 @@ getOrThrow(Json::Value const& v, ripple::SField const& field) // This function may be used by external projects (like the witness server). template std::optional -getOptional(Json::Value const& v, ripple::SField const& field) +getOptional(Json::Value const& v, xrpl::SField const& field) { try { diff --git a/include/xrpl/protocol/jss.h b/include/xrpl/protocol/jss.h index b9a8945d21..d86ca9bf1f 100644 --- a/include/xrpl/protocol/jss.h +++ b/include/xrpl/protocol/jss.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace jss { // JSON static strings @@ -725,6 +725,6 @@ JSS(write_load); // out: GetCounts #undef JSS } // namespace jss -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/nft.h b/include/xrpl/protocol/nft.h index 2681be4aad..3a8cdcd6e2 100644 --- a/include/xrpl/protocol/nft.h +++ b/include/xrpl/protocol/nft.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace nft { // Separate taxons from regular integers. @@ -104,6 +104,6 @@ getIssuer(uint256 const& id) } } // namespace nft -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/nftPageMask.h b/include/xrpl/protocol/nftPageMask.h index 800899f7a7..4d23e45f53 100644 --- a/include/xrpl/protocol/nftPageMask.h +++ b/include/xrpl/protocol/nftPageMask.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace nft { // NFT directory pages order their contents based only on the low 96 bits of @@ -14,6 +14,6 @@ uint256 constexpr pageMask(std::string_view( "0000000000000000000000000000000000000000ffffffffffffffffffffffff")); } // namespace nft -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/serialize.h b/include/xrpl/protocol/serialize.h index ea93505736..eedf041baa 100644 --- a/include/xrpl/protocol/serialize.h +++ b/include/xrpl/protocol/serialize.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Serialize an object to a blob. */ template @@ -24,6 +24,6 @@ serializeHex(STObject const& o) return strHex(serializeBlob(o)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/protocol/tokens.h b/include/xrpl/protocol/tokens.h index 5e3fc222e8..ac13a10e06 100644 --- a/include/xrpl/protocol/tokens.h +++ b/include/xrpl/protocol/tokens.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { template using B58Result = Expected; @@ -111,6 +111,6 @@ b58_to_b256_be(std::string_view input, std::span out); } // namespace b58_fast #endif // _MSC_VER -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Charge.h b/include/xrpl/resource/Charge.h index 2236a60cd4..1edaca28b4 100644 --- a/include/xrpl/resource/Charge.h +++ b/include/xrpl/resource/Charge.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { /** A consumption charge. */ @@ -49,6 +49,6 @@ std::ostream& operator<<(std::ostream& os, Charge const& v); } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Consumer.h b/include/xrpl/resource/Consumer.h index 903e0e97a5..6e973d824c 100644 --- a/include/xrpl/resource/Consumer.h +++ b/include/xrpl/resource/Consumer.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { struct Entry; @@ -81,6 +81,6 @@ std::ostream& operator<<(std::ostream& os, Consumer const& v); } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Disposition.h b/include/xrpl/resource/Disposition.h index 5915b0059d..81675e8376 100644 --- a/include/xrpl/resource/Disposition.h +++ b/include/xrpl/resource/Disposition.h @@ -1,7 +1,7 @@ #ifndef XRPL_RESOURCE_DISPOSITION_H_INCLUDED #define XRPL_RESOURCE_DISPOSITION_H_INCLUDED -namespace ripple { +namespace xrpl { namespace Resource { /** The disposition of a consumer after applying a load charge. */ @@ -19,6 +19,6 @@ enum Disposition { }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Fees.h b/include/xrpl/resource/Fees.h index 4a099b9019..643a8e624c 100644 --- a/include/xrpl/resource/Fees.h +++ b/include/xrpl/resource/Fees.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { // clang-format off @@ -40,6 +40,6 @@ extern Charge const feeDrop; // The cost of being dropped for // clang-format on } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Gossip.h b/include/xrpl/resource/Gossip.h index 214e0e8c4d..dfd04288fc 100644 --- a/include/xrpl/resource/Gossip.h +++ b/include/xrpl/resource/Gossip.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { /** Data format for exchanging consumption information across peers. */ @@ -26,6 +26,6 @@ struct Gossip }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/ResourceManager.h b/include/xrpl/resource/ResourceManager.h index 7d29059292..19690d6bc4 100644 --- a/include/xrpl/resource/ResourceManager.h +++ b/include/xrpl/resource/ResourceManager.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { /** Tracks load and resource consumption. */ @@ -66,6 +66,6 @@ make_Manager( beast::Journal journal); } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/Types.h b/include/xrpl/resource/Types.h index 64628cf54a..8923933f0f 100644 --- a/include/xrpl/resource/Types.h +++ b/include/xrpl/resource/Types.h @@ -1,13 +1,13 @@ #ifndef XRPL_RESOURCE_TYPES_H_INCLUDED #define XRPL_RESOURCE_TYPES_H_INCLUDED -namespace ripple { +namespace xrpl { namespace Resource { struct Key; struct Entry; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Entry.h b/include/xrpl/resource/detail/Entry.h index b89d85d1f3..ce55c46064 100644 --- a/include/xrpl/resource/detail/Entry.h +++ b/include/xrpl/resource/detail/Entry.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { using clock_type = beast::abstract_clock; @@ -93,6 +93,6 @@ operator<<(std::ostream& os, Entry const& v) } } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Import.h b/include/xrpl/resource/detail/Import.h index a9711be3fc..d33bd5f156 100644 --- a/include/xrpl/resource/detail/Import.h +++ b/include/xrpl/resource/detail/Import.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { /** A set of imported consumer data from a gossip origin. */ @@ -31,6 +31,6 @@ struct Import }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Key.h b/include/xrpl/resource/detail/Key.h index 3df47d5afb..e63d2827ea 100644 --- a/include/xrpl/resource/detail/Key.h +++ b/include/xrpl/resource/detail/Key.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { // The consumer key @@ -47,6 +47,6 @@ struct Key }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Kind.h b/include/xrpl/resource/detail/Kind.h index 0a04b8e627..0e55b65780 100644 --- a/include/xrpl/resource/detail/Kind.h +++ b/include/xrpl/resource/detail/Kind.h @@ -1,7 +1,7 @@ #ifndef XRPL_RESOURCE_KIND_H_INCLUDED #define XRPL_RESOURCE_KIND_H_INCLUDED -namespace ripple { +namespace xrpl { namespace Resource { /** @@ -15,6 +15,6 @@ namespace Resource { enum Kind { kindInbound, kindOutbound, kindUnlimited }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Logic.h b/include/xrpl/resource/detail/Logic.h index a0c541b300..b1f90e0282 100644 --- a/include/xrpl/resource/detail/Logic.h +++ b/include/xrpl/resource/detail/Logic.h @@ -16,7 +16,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { class Logic @@ -385,7 +385,7 @@ public: Entry& entry(iter->second); XRPL_ASSERT( entry.refcount == 0, - "ripple::Resource::Logic::erase : entry not used"); + "xrpl::Resource::Logic::erase : entry not used"); inactive_.erase(inactive_.iterator_to(entry)); table_.erase(iter); } @@ -419,7 +419,7 @@ public: default: // LCOV_EXCL_START UNREACHABLE( - "ripple::Resource::Logic::release : invalid entry " + "xrpl::Resource::Logic::release : invalid entry " "kind"); break; // LCOV_EXCL_STOP @@ -568,6 +568,6 @@ public: }; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/resource/detail/Tuning.h b/include/xrpl/resource/detail/Tuning.h index 3013bb0e45..9d7ba31303 100644 --- a/include/xrpl/resource/detail/Tuning.h +++ b/include/xrpl/resource/detail/Tuning.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { /** Tunable constants. */ @@ -32,6 +32,6 @@ std::chrono::seconds constexpr secondsUntilExpiration{300}; std::chrono::seconds constexpr gossipExpirationSeconds{30}; } // namespace Resource -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/Handoff.h b/include/xrpl/server/Handoff.h index 993d61aec8..49a5851251 100644 --- a/include/xrpl/server/Handoff.h +++ b/include/xrpl/server/Handoff.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { using http_request_type = boost::beast::http::request; @@ -36,6 +36,6 @@ struct Handoff } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/Port.h b/include/xrpl/server/Port.h index 37b130ae04..995401f8fd 100644 --- a/include/xrpl/server/Port.h +++ b/include/xrpl/server/Port.h @@ -24,7 +24,7 @@ class context; } // namespace asio } // namespace boost -namespace ripple { +namespace xrpl { /** Configuration information for a Server listening port. */ struct Port @@ -104,6 +104,6 @@ struct ParsedPort void parse_Port(ParsedPort& port, Section const& section, std::ostream& log); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/Server.h b/include/xrpl/server/Server.h index 5dc6face66..b553b9e72a 100644 --- a/include/xrpl/server/Server.h +++ b/include/xrpl/server/Server.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { /** Create the HTTP server using the specified handler. */ template @@ -21,6 +21,6 @@ make_Server( return std::make_unique>(handler, io_context, journal); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/Session.h b/include/xrpl/server/Session.h index 52aa37572a..4570e90f7e 100644 --- a/include/xrpl/server/Session.h +++ b/include/xrpl/server/Session.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Persistent state information for a connection session. These values are preserved between calls for efficiency. @@ -111,6 +111,6 @@ public: websocketUpgrade() = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/SimpleWriter.h b/include/xrpl/server/SimpleWriter.h index 96e834df6a..cf41f1c82a 100644 --- a/include/xrpl/server/SimpleWriter.h +++ b/include/xrpl/server/SimpleWriter.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { /// Deprecated: Writer that serializes a HTTP/1 message class SimpleWriter : public Writer @@ -55,6 +55,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/WSSession.h b/include/xrpl/server/WSSession.h index 05558f1774..fb8af7118c 100644 --- a/include/xrpl/server/WSSession.h +++ b/include/xrpl/server/WSSession.h @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { class WSMsg { @@ -125,6 +125,6 @@ struct WSSession complete() = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/Writer.h b/include/xrpl/server/Writer.h index 7948547279..7e0c304ea9 100644 --- a/include/xrpl/server/Writer.h +++ b/include/xrpl/server/Writer.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Writer { @@ -37,6 +37,6 @@ public: data() = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index c68b7d91ec..5b7327c6b9 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -26,7 +26,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents an active connection. */ template @@ -511,6 +511,6 @@ BaseHTTPPeer::close(bool graceful) boost::beast::get_lowest_layer(impl().stream_).close(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index 3b524cbdd5..fa82a1bb37 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { // Common part of all peers template @@ -85,9 +85,9 @@ BasePeer::close() return post( strand_, std::bind(&BasePeer::close, impl().shared_from_this())); error_code ec; - ripple::get_lowest_layer(impl().ws_).socket().close(ec); + xrpl::get_lowest_layer(impl().ws_).socket().close(ec); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index dbf8d95cba..f0649b221c 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -19,7 +19,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents an active WebSocket connection. */ template @@ -508,17 +508,17 @@ BaseWSPeer::fail(error_code ec, String const& what) { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::BaseWSPeer::fail : strand in this thread"); + "xrpl::BaseWSPeer::fail : strand in this thread"); cancel_timer(); if (!ec_ && ec != boost::asio::error::operation_aborted) { ec_ = ec; JLOG(this->j_.trace()) << what << ": " << ec.message(); - ripple::get_lowest_layer(impl().ws_).socket().close(ec); + xrpl::get_lowest_layer(impl().ws_).socket().close(ec); } } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/Door.h b/include/xrpl/server/detail/Door.h index aef4b4d9d2..140afb1808 100644 --- a/include/xrpl/server/detail/Door.h +++ b/include/xrpl/server/detail/Door.h @@ -35,7 +35,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A listening socket. */ template @@ -500,6 +500,6 @@ Door::should_throttle_for_fds() #endif } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/JSONRPCUtil.h b/include/xrpl/server/detail/JSONRPCUtil.h index 8b2bfa4ac7..d75825a1ea 100644 --- a/include/xrpl/server/detail/JSONRPCUtil.h +++ b/include/xrpl/server/detail/JSONRPCUtil.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { void HTTPReply( @@ -14,6 +14,6 @@ HTTPReply( Json::Output const&, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/LowestLayer.h b/include/xrpl/server/detail/LowestLayer.h index c7430b5d9f..57647867e3 100644 --- a/include/xrpl/server/detail/LowestLayer.h +++ b/include/xrpl/server/detail/LowestLayer.h @@ -7,7 +7,7 @@ #include #endif -namespace ripple { +namespace xrpl { // Before boost 1.70, get_lowest_layer required an explicit templat parameter template @@ -21,6 +21,6 @@ get_lowest_layer(T& t) noexcept #endif } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/PlainHTTPPeer.h b/include/xrpl/server/detail/PlainHTTPPeer.h index cf2c871635..8f7d86f8e5 100644 --- a/include/xrpl/server/detail/PlainHTTPPeer.h +++ b/include/xrpl/server/detail/PlainHTTPPeer.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { template class PlainHTTPPeer @@ -154,6 +154,6 @@ PlainHTTPPeer::do_close() socket_.shutdown(socket_type::shutdown_send, ec); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/PlainWSPeer.h b/include/xrpl/server/detail/PlainWSPeer.h index 60223c896d..4d5c57533b 100644 --- a/include/xrpl/server/detail/PlainWSPeer.h +++ b/include/xrpl/server/detail/PlainWSPeer.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { template class PlainWSPeer : public BaseWSPeer>, @@ -58,6 +58,6 @@ PlainWSPeer::PlainWSPeer( { } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/SSLHTTPPeer.h b/include/xrpl/server/detail/SSLHTTPPeer.h index f60f7e82d9..56b2d1c52f 100644 --- a/include/xrpl/server/detail/SSLHTTPPeer.h +++ b/include/xrpl/server/detail/SSLHTTPPeer.h @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { template class SSLHTTPPeer : public BaseHTTPPeer>, @@ -204,6 +204,6 @@ SSLHTTPPeer::on_shutdown(error_code ec) stream_.next_layer().close(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/SSLWSPeer.h b/include/xrpl/server/detail/SSLWSPeer.h index c2076ed6a5..bb5da1c6e7 100644 --- a/include/xrpl/server/detail/SSLWSPeer.h +++ b/include/xrpl/server/detail/SSLWSPeer.h @@ -13,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { template class SSLWSPeer : public BaseWSPeer>, @@ -67,6 +67,6 @@ SSLWSPeer::SSLWSPeer( { } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/ServerImpl.h b/include/xrpl/server/detail/ServerImpl.h index a42966edd6..6ff93e83cb 100644 --- a/include/xrpl/server/detail/ServerImpl.h +++ b/include/xrpl/server/detail/ServerImpl.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { using Endpoints = std::unordered_map; @@ -189,6 +189,6 @@ ServerImpl::closed() { return ios_.closed(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/server/detail/Spawn.h b/include/xrpl/server/detail/Spawn.h index 2e80393af6..4c424a1956 100644 --- a/include/xrpl/server/detail/Spawn.h +++ b/include/xrpl/server/detail/Spawn.h @@ -9,7 +9,7 @@ #include #include -namespace ripple::util { +namespace xrpl::util { namespace impl { template @@ -84,6 +84,6 @@ spawn(Ctx&& ctx, F&& func) } } -} // namespace ripple::util +} // namespace xrpl::util #endif diff --git a/include/xrpl/server/detail/io_list.h b/include/xrpl/server/detail/io_list.h index 6b8e440d40..0e67595dbe 100644 --- a/include/xrpl/server/detail/io_list.h +++ b/include/xrpl/server/detail/io_list.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Manages a set of objects performing asynchronous I/O. */ class io_list final @@ -243,6 +243,6 @@ io_list::join() cv_.wait(lock, [&] { return closed_ && n_ == 0; }); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/Family.h b/include/xrpl/shamap/Family.h index e566145bec..6638d67df8 100644 --- a/include/xrpl/shamap/Family.h +++ b/include/xrpl/shamap/Family.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class Family { @@ -65,6 +65,6 @@ public: reset() = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/FullBelowCache.h b/include/xrpl/shamap/FullBelowCache.h index 81061cef59..9434b40011 100644 --- a/include/xrpl/shamap/FullBelowCache.h +++ b/include/xrpl/shamap/FullBelowCache.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -129,6 +129,6 @@ private: using FullBelowCache = detail::BasicFullBelowCache; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMap.h b/include/xrpl/shamap/SHAMap.h index 07db489a8f..94fd926718 100644 --- a/include/xrpl/shamap/SHAMap.h +++ b/include/xrpl/shamap/SHAMap.h @@ -19,7 +19,7 @@ #include #include -namespace ripple { +namespace xrpl { class SHAMapNodeID; class SHAMapSyncFilter; @@ -584,7 +584,7 @@ SHAMap::setImmutable() { XRPL_ASSERT( state_ != SHAMapState::Invalid, - "ripple::SHAMap::setImmutable : state is valid"); + "xrpl::SHAMap::setImmutable : state is valid"); state_ = SHAMapState::Immutable; } @@ -666,8 +666,7 @@ private: inline SHAMap::const_iterator::const_iterator(SHAMap const* map) : map_(map) { XRPL_ASSERT( - map_, - "ripple::SHAMap::const_iterator::const_iterator : non-null input"); + map_, "xrpl::SHAMap::const_iterator::const_iterator : non-null input"); if (auto temp = map_->peekFirstItem(stack_)) item_ = temp->peekItem().get(); @@ -721,7 +720,7 @@ operator==(SHAMap::const_iterator const& x, SHAMap::const_iterator const& y) { XRPL_ASSERT( x.map_ == y.map_, - "ripple::operator==(SHAMap::const_iterator, SHAMap::const_iterator) : " + "xrpl::operator==(SHAMap::const_iterator, SHAMap::const_iterator) : " "inputs map do match"); return x.item_ == y.item_; } @@ -744,6 +743,6 @@ SHAMap::end() const return const_iterator(this, nullptr); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapAccountStateLeafNode.h b/include/xrpl/shamap/SHAMapAccountStateLeafNode.h index 2486432453..288fc416b5 100644 --- a/include/xrpl/shamap/SHAMapAccountStateLeafNode.h +++ b/include/xrpl/shamap/SHAMapAccountStateLeafNode.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A leaf node for a state object. */ class SHAMapAccountStateLeafNode final @@ -68,6 +68,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapAddNode.h b/include/xrpl/shamap/SHAMapAddNode.h index 73e7a2efac..0385f64f52 100644 --- a/include/xrpl/shamap/SHAMapAddNode.h +++ b/include/xrpl/shamap/SHAMapAddNode.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // results of adding nodes class SHAMapAddNode @@ -161,6 +161,6 @@ SHAMapAddNode::get() const return ret; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapInnerNode.h b/include/xrpl/shamap/SHAMapInnerNode.h index 9488a12e6d..72a7fe52d4 100644 --- a/include/xrpl/shamap/SHAMapInnerNode.h +++ b/include/xrpl/shamap/SHAMapInnerNode.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { class SHAMapInnerNode final : public SHAMapTreeNode, public CountedObject @@ -202,5 +202,5 @@ SHAMapInnerNode::setFullBelowGen(std::uint32_t gen) fullBelowGen_ = gen; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapItem.h b/include/xrpl/shamap/SHAMapItem.h index f76a37e733..a69f40113d 100644 --- a/include/xrpl/shamap/SHAMapItem.h +++ b/include/xrpl/shamap/SHAMapItem.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { // an item stored in a SHAMap class SHAMapItem : public CountedObject @@ -143,7 +143,7 @@ make_shamapitem(uint256 const& tag, Slice data) { XRPL_ASSERT( data.size() <= megabytes(16), - "ripple::make_shamapitem : maximum input size"); + "xrpl::make_shamapitem : maximum input size"); std::uint8_t* raw = detail::slabber.allocate(data.size()); @@ -168,6 +168,6 @@ make_shamapitem(SHAMapItem const& other) return make_shamapitem(other.key(), other.slice()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapLeafNode.h b/include/xrpl/shamap/SHAMapLeafNode.h index 127e8c3680..d87ede16ad 100644 --- a/include/xrpl/shamap/SHAMapLeafNode.h +++ b/include/xrpl/shamap/SHAMapLeafNode.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { class SHAMapLeafNode : public SHAMapTreeNode { @@ -59,6 +59,6 @@ public: getString(SHAMapNodeID const&) const final override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapMissingNode.h b/include/xrpl/shamap/SHAMapMissingNode.h index 18c2636654..0cb18238af 100644 --- a/include/xrpl/shamap/SHAMapMissingNode.h +++ b/include/xrpl/shamap/SHAMapMissingNode.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { enum class SHAMapType { TRANSACTION = 1, // A tree of transactions @@ -50,6 +50,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapNodeID.h b/include/xrpl/shamap/SHAMapNodeID.h index dfac4fceb6..2a9e4446f4 100644 --- a/include/xrpl/shamap/SHAMapNodeID.h +++ b/include/xrpl/shamap/SHAMapNodeID.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Identifies a node inside a SHAMap */ class SHAMapNodeID : public CountedObject @@ -139,6 +139,6 @@ deserializeSHAMapNodeID(std::string const& s) [[nodiscard]] unsigned int selectBranch(SHAMapNodeID const& id, uint256 const& hash); -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapSyncFilter.h b/include/xrpl/shamap/SHAMapSyncFilter.h index 88c7eeec99..16b2389745 100644 --- a/include/xrpl/shamap/SHAMapSyncFilter.h +++ b/include/xrpl/shamap/SHAMapSyncFilter.h @@ -6,7 +6,7 @@ #include /** Callback for filtering SHAMap during sync. */ -namespace ripple { +namespace xrpl { class SHAMapSyncFilter { @@ -30,6 +30,6 @@ public: getNode(SHAMapHash const& nodeHash) const = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapTreeNode.h b/include/xrpl/shamap/SHAMapTreeNode.h index 245f8c8a7a..75992a9bce 100644 --- a/include/xrpl/shamap/SHAMapTreeNode.h +++ b/include/xrpl/shamap/SHAMapTreeNode.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { // These are wire-protocol identifiers used during serialization to encode the // type of a node. They should not be arbitrarily be changed. @@ -170,6 +170,6 @@ private: makeTransactionWithMeta(Slice data, SHAMapHash const& hash, bool hashValid); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapTxLeafNode.h b/include/xrpl/shamap/SHAMapTxLeafNode.h index e7dbd10fd6..e7b73ecde9 100644 --- a/include/xrpl/shamap/SHAMapTxLeafNode.h +++ b/include/xrpl/shamap/SHAMapTxLeafNode.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A leaf node for a transaction. No metadata is included. */ class SHAMapTxLeafNode final : public SHAMapLeafNode, @@ -64,6 +64,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h b/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h index 915c02e7f6..c38277ef73 100644 --- a/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h +++ b/include/xrpl/shamap/SHAMapTxPlusMetaLeafNode.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A leaf node for a transaction and its associated metadata. */ class SHAMapTxPlusMetaLeafNode final @@ -68,6 +68,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/TreeNodeCache.h b/include/xrpl/shamap/TreeNodeCache.h index bb6120e4a6..bf9797c745 100644 --- a/include/xrpl/shamap/TreeNodeCache.h +++ b/include/xrpl/shamap/TreeNodeCache.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { using TreeNodeCache = TaggedCache< uint256, @@ -13,6 +13,6 @@ using TreeNodeCache = TaggedCache< /*IsKeyCache*/ false, intr_ptr::SharedWeakUnionPtr, intr_ptr::SharedPtr>; -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/detail/TaggedPointer.h b/include/xrpl/shamap/detail/TaggedPointer.h index f3a616c052..53a53960d4 100644 --- a/include/xrpl/shamap/detail/TaggedPointer.h +++ b/include/xrpl/shamap/detail/TaggedPointer.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** TaggedPointer is a combination of a pointer and a mask stored in the lowest two bits. @@ -226,6 +226,6 @@ popcnt16(std::uint16_t a) #endif } -} // namespace ripple +} // namespace xrpl #endif diff --git a/include/xrpl/shamap/detail/TaggedPointer.ipp b/include/xrpl/shamap/detail/TaggedPointer.ipp index f3bd561e06..e88b4b11c4 100644 --- a/include/xrpl/shamap/detail/TaggedPointer.ipp +++ b/include/xrpl/shamap/detail/TaggedPointer.ipp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace { // Sparse array size boundaries. @@ -61,7 +61,7 @@ numAllocatedChildren(std::uint8_t n) { XRPL_ASSERT( n <= SHAMapInnerNode::branchFactor, - "ripple::numAllocatedChildren : valid input"); + "xrpl::numAllocatedChildren : valid input"); return *std::lower_bound(boundaries.begin(), boundaries.end(), n); } @@ -70,7 +70,7 @@ boundariesIndex(std::uint8_t numChildren) { XRPL_ASSERT( numChildren <= SHAMapInnerNode::branchFactor, - "ripple::boundariesIndex : valid input"); + "xrpl::boundariesIndex : valid input"); return std::distance( boundaries.begin(), std::lower_bound(boundaries.begin(), boundaries.end(), numChildren)); @@ -142,7 +142,7 @@ deallocateArrays(std::uint8_t boundaryIndex, void* p) { XRPL_ASSERT( isFromArrayFuns[boundaryIndex](p), - "ripple::deallocateArrays : valid inputs"); + "xrpl::deallocateArrays : valid inputs"); freeArrayFuns[boundaryIndex](p); } @@ -258,12 +258,12 @@ inline TaggedPointer::TaggedPointer(RawAllocateTag, std::uint8_t numChildren) auto [tag, p] = allocateArrays(numChildren); XRPL_ASSERT( tag < boundaries.size(), - "ripple::TaggedPointer::TaggedPointer(RawAllocateTag, std::uint8_t) : " + "xrpl::TaggedPointer::TaggedPointer(RawAllocateTag, std::uint8_t) : " "maximum tag"); XRPL_ASSERT( (reinterpret_cast(p) & ptrMask) == reinterpret_cast(p), - "ripple::TaggedPointer::TaggedPointer(RawAllocateTag, std::uint8_t) : " + "xrpl::TaggedPointer::TaggedPointer(RawAllocateTag, std::uint8_t) : " "valid pointer"); tp_ = reinterpret_cast(p) + tag; } @@ -276,7 +276,7 @@ inline TaggedPointer::TaggedPointer( { XRPL_ASSERT( toAllocate >= popcnt16(dstBranches), - "ripple::TaggedPointer::TaggedPointer(TaggedPointer&& ...) : minimum " + "xrpl::TaggedPointer::TaggedPointer(TaggedPointer&& ...) : minimum " "toAllocate input"); if (other.capacity() == numAllocatedChildren(toAllocate)) @@ -427,7 +427,7 @@ inline TaggedPointer::TaggedPointer( // If sparse, may need to run additional constructors XRPL_ASSERT( !dstIsDense || dstIndex == dstNumAllocated, - "ripple::TaggedPointer::TaggedPointer(TaggedPointer&& ...) : " + "xrpl::TaggedPointer::TaggedPointer(TaggedPointer&& ...) : " "non-sparse or valid sparse"); for (int i = dstIndex; i < dstNumAllocated; ++i) { @@ -575,4 +575,4 @@ inline TaggedPointer::~TaggedPointer() destroyHashesAndChildren(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/Archive.cpp b/src/libxrpl/basics/Archive.cpp index 14a043aff8..8ee23afda0 100644 --- a/src/libxrpl/basics/Archive.cpp +++ b/src/libxrpl/basics/Archive.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { void extractTarLz4( @@ -99,4 +99,4 @@ extractTarLz4( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/BasicConfig.cpp b/src/libxrpl/basics/BasicConfig.cpp index 63a001bcc3..a5ad7730dd 100644 --- a/src/libxrpl/basics/BasicConfig.cpp +++ b/src/libxrpl/basics/BasicConfig.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { Section::Section(std::string const& name) : name_(name) { @@ -183,4 +183,4 @@ operator<<(std::ostream& ss, BasicConfig const& c) return ss; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/CountedObject.cpp b/src/libxrpl/basics/CountedObject.cpp index 05ee345a54..bcdca9dfa4 100644 --- a/src/libxrpl/basics/CountedObject.cpp +++ b/src/libxrpl/basics/CountedObject.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { CountedObjects& CountedObjects::getInstance() noexcept @@ -36,4 +36,4 @@ CountedObjects::getCounts(int minimumThreshold) const return counts; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/FileUtilities.cpp b/src/libxrpl/basics/FileUtilities.cpp index 239a760999..981fdd5360 100644 --- a/src/libxrpl/basics/FileUtilities.cpp +++ b/src/libxrpl/basics/FileUtilities.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string getFileContents( @@ -85,4 +85,4 @@ writeFileContents( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/Log.cpp b/src/libxrpl/basics/Log.cpp index 0a0bb20135..33d6f6559e 100644 --- a/src/libxrpl/basics/Log.cpp +++ b/src/libxrpl/basics/Log.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { Logs::Sink::Sink( std::string const& partition, @@ -222,7 +222,7 @@ Logs::fromSeverity(beast::severities::Severity level) // LCOV_EXCL_START default: - UNREACHABLE("ripple::Logs::fromSeverity : invalid severity"); + UNREACHABLE("xrpl::Logs::fromSeverity : invalid severity"); [[fallthrough]]; // LCOV_EXCL_STOP case kFatal: @@ -250,7 +250,7 @@ Logs::toSeverity(LogSeverity level) return kError; // LCOV_EXCL_START default: - UNREACHABLE("ripple::Logs::toSeverity : invalid severity"); + UNREACHABLE("xrpl::Logs::toSeverity : invalid severity"); [[fallthrough]]; // LCOV_EXCL_STOP case lsFATAL: @@ -279,7 +279,7 @@ Logs::toString(LogSeverity s) return "Fatal"; // LCOV_EXCL_START default: - UNREACHABLE("ripple::Logs::toString : invalid severity"); + UNREACHABLE("xrpl::Logs::toString : invalid severity"); return "Unknown"; // LCOV_EXCL_STOP } @@ -345,7 +345,7 @@ Logs::format( break; // LCOV_EXCL_START default: - UNREACHABLE("ripple::Logs::format : invalid severity"); + UNREACHABLE("xrpl::Logs::format : invalid severity"); [[fallthrough]]; // LCOV_EXCL_STOP case kFatal: @@ -459,4 +459,4 @@ debugLog() return beast::Journal(debugSink().get()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 797ca83b67..96c13c9db8 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -20,7 +20,7 @@ using uint128_t = boost::multiprecision::uint128_t; using uint128_t = __uint128_t; #endif // !defined(_MSC_VER) -namespace ripple { +namespace xrpl { thread_local Number::rounding_mode Number::mode_ = Number::to_nearest; @@ -280,7 +280,7 @@ Number::operator+=(Number const& y) } XRPL_ASSERT( isnormal() && y.isnormal(), - "ripple::Number::operator+=(Number) : is normal"); + "xrpl::Number::operator+=(Number) : is normal"); auto xm = mantissa(); auto xe = exponent(); int xn = 1; @@ -396,7 +396,7 @@ Number::operator*=(Number const& y) } XRPL_ASSERT( isnormal() && y.isnormal(), - "ripple::Number::operator*=(Number) : is normal"); + "xrpl::Number::operator*=(Number) : is normal"); auto xm = mantissa(); auto xe = exponent(); int xn = 1; @@ -437,7 +437,7 @@ Number::operator*=(Number const& y) exponent_ = xe; XRPL_ASSERT( isnormal() || *this == Number{}, - "ripple::Number::operator*=(Number) : result is normal"); + "xrpl::Number::operator*=(Number) : result is normal"); return *this; } @@ -548,7 +548,7 @@ to_string(Number const& amount) } XRPL_ASSERT( - exponent + 43 > 0, "ripple::to_string(Number) : minimum exponent"); + exponent + 43 > 0, "xrpl::to_string(Number) : minimum exponent"); ptrdiff_t const pad_prefix = 27; ptrdiff_t const pad_suffix = 23; @@ -575,8 +575,7 @@ to_string(Number const& amount) pre_from += pad_prefix; XRPL_ASSERT( - post_to >= post_from, - "ripple::to_string(Number) : first distance check"); + post_to >= post_from, "xrpl::to_string(Number) : first distance check"); pre_from = std::find_if(pre_from, pre_to, [](char c) { return c != '0'; }); @@ -587,7 +586,7 @@ to_string(Number const& amount) XRPL_ASSERT( post_to >= post_from, - "ripple::to_string(Number) : second distance check"); + "xrpl::to_string(Number) : second distance check"); post_to = std::find_if( std::make_reverse_iterator(post_to), @@ -772,4 +771,4 @@ power(Number const& f, unsigned n, unsigned d) return root(power(f, n), d); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/ResolverAsio.cpp b/src/libxrpl/basics/ResolverAsio.cpp index d8275e0893..8b9b2a9c4c 100644 --- a/src/libxrpl/basics/ResolverAsio.cpp +++ b/src/libxrpl/basics/ResolverAsio.cpp @@ -26,7 +26,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Mix-in to track when all pending I/O is complete. Derived classes must be callable with this signature: @@ -46,7 +46,7 @@ public: // Destroying the object with I/O pending? Not a clean exit! XRPL_ASSERT( m_pending.load() == 0, - "ripple::AsyncObject::~AsyncObject : nothing pending"); + "xrpl::AsyncObject::~AsyncObject : nothing pending"); } /** RAII container that maintains the count of pending I/O. @@ -153,9 +153,9 @@ public: { XRPL_ASSERT( m_work.empty(), - "ripple::ResolverAsioImpl::~ResolverAsioImpl : no pending work"); + "xrpl::ResolverAsioImpl::~ResolverAsioImpl : no pending work"); XRPL_ASSERT( - m_stopped, "ripple::ResolverAsioImpl::~ResolverAsioImpl : stopped"); + m_stopped, "xrpl::ResolverAsioImpl::~ResolverAsioImpl : stopped"); } //------------------------------------------------------------------------- @@ -178,10 +178,10 @@ public: start() override { XRPL_ASSERT( - m_stopped == true, "ripple::ResolverAsioImpl::start : stopped"); + m_stopped == true, "xrpl::ResolverAsioImpl::start : stopped"); XRPL_ASSERT( m_stop_called == false, - "ripple::ResolverAsioImpl::start : not stopping"); + "xrpl::ResolverAsioImpl::start : not stopping"); if (m_stopped.exchange(false) == true) { @@ -229,10 +229,10 @@ public: { XRPL_ASSERT( m_stop_called == false, - "ripple::ResolverAsioImpl::resolve : not stopping"); + "xrpl::ResolverAsioImpl::resolve : not stopping"); XRPL_ASSERT( !names.empty(), - "ripple::ResolverAsioImpl::resolve : names non-empty"); + "xrpl::ResolverAsioImpl::resolve : names non-empty"); // TODO NIKB use rvalue references to construct and move // reducing cost. @@ -255,7 +255,7 @@ public: { XRPL_ASSERT( m_stop_called == true, - "ripple::ResolverAsioImpl::do_stop : stopping"); + "xrpl::ResolverAsioImpl::do_stop : stopping"); if (m_stopped.exchange(true) == false) { @@ -415,7 +415,7 @@ public: { XRPL_ASSERT( !names.empty(), - "ripple::ResolverAsioImpl::do_resolve : names non-empty"); + "xrpl::ResolverAsioImpl::do_resolve : names non-empty"); if (m_stop_called == false) { @@ -450,4 +450,4 @@ ResolverAsio::New(boost::asio::io_context& io_context, beast::Journal journal) //----------------------------------------------------------------------------- Resolver::~Resolver() = default; -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/StringUtilities.cpp b/src/libxrpl/basics/StringUtilities.cpp index 6d7ab326af..96b5cfdb9b 100644 --- a/src/libxrpl/basics/StringUtilities.cpp +++ b/src/libxrpl/basics/StringUtilities.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string sqlBlobLiteral(Blob const& blob) @@ -136,4 +136,4 @@ isProperlyFormedTomlDomain(std::string_view domain) return boost::regex_match(domain.begin(), domain.end(), re); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/UptimeClock.cpp b/src/libxrpl/basics/UptimeClock.cpp index dbfc0046a2..521a6a1313 100644 --- a/src/libxrpl/basics/UptimeClock.cpp +++ b/src/libxrpl/basics/UptimeClock.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { std::atomic UptimeClock::now_{0}; // seconds since start std::atomic UptimeClock::stop_{false}; // stop update thread @@ -54,4 +54,4 @@ UptimeClock::now() return time_point{duration{now_}}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/base64.cpp b/src/libxrpl/basics/base64.cpp index d0d11c85bb..4a5cbacaef 100644 --- a/src/libxrpl/basics/base64.cpp +++ b/src/libxrpl/basics/base64.cpp @@ -40,7 +40,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace base64 { @@ -232,4 +232,4 @@ base64_decode(std::string_view data) return dest; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/contract.cpp b/src/libxrpl/basics/contract.cpp index 81674de3c8..562d3a0944 100644 --- a/src/libxrpl/basics/contract.cpp +++ b/src/libxrpl/basics/contract.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { void LogThrow(std::string const& title) @@ -30,4 +30,4 @@ LogicError(std::string const& s) noexcept // LCOV_EXCL_STOP } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/make_SSLContext.cpp b/src/libxrpl/basics/make_SSLContext.cpp index 000f4375ab..579edb0f71 100644 --- a/src/libxrpl/basics/make_SSLContext.cpp +++ b/src/libxrpl/basics/make_SSLContext.cpp @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace openssl { namespace detail { @@ -385,4 +385,4 @@ make_SSLContextAuthed( return context; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/basics/mulDiv.cpp b/src/libxrpl/basics/mulDiv.cpp index 993cff7eb6..d8988b474e 100644 --- a/src/libxrpl/basics/mulDiv.cpp +++ b/src/libxrpl/basics/mulDiv.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { std::optional mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div) @@ -17,10 +17,10 @@ mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div) result /= div; - if (result > ripple::muldiv_max) + if (result > xrpl::muldiv_max) return std::nullopt; return static_cast(result); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/core/detail/Job.cpp b/src/libxrpl/core/detail/Job.cpp index 9caf8d180d..3968c3ede4 100644 --- a/src/libxrpl/core/detail/Job.cpp +++ b/src/libxrpl/core/detail/Job.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { Job::Job() : mType(jtINVALID), mJobIndex(0) { @@ -100,4 +100,4 @@ Job::operator<=(Job const& j) const return mJobIndex <= j.mJobIndex; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/core/detail/JobQueue.cpp b/src/libxrpl/core/detail/JobQueue.cpp index 817744cbc1..7393278fef 100644 --- a/src/libxrpl/core/detail/JobQueue.cpp +++ b/src/libxrpl/core/detail/JobQueue.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { JobQueue::JobQueue( int threadCount, @@ -38,8 +38,7 @@ JobQueue::JobQueue( std::forward_as_tuple(jt.type()), std::forward_as_tuple(jt, m_collector, logs))); XRPL_ASSERT( - result.second == true, - "ripple::JobQueue::JobQueue : jobs added"); + result.second == true, "xrpl::JobQueue::JobQueue : jobs added"); (void)result.second; } } @@ -66,12 +65,12 @@ JobQueue::addRefCountedJob( { XRPL_ASSERT( type != jtINVALID, - "ripple::JobQueue::addRefCountedJob : valid input job type"); + "xrpl::JobQueue::addRefCountedJob : valid input job type"); auto iter(m_jobData.find(type)); XRPL_ASSERT( iter != m_jobData.end(), - "ripple::JobQueue::addRefCountedJob : job type found in jobs"); + "xrpl::JobQueue::addRefCountedJob : job type found in jobs"); if (iter == m_jobData.end()) return false; @@ -84,7 +83,7 @@ JobQueue::addRefCountedJob( XRPL_ASSERT( (type >= jtCLIENT && type <= jtCLIENT_WEBSOCKET) || m_workers.getNumberOfThreads() > 0, - "ripple::JobQueue::addRefCountedJob : threads available or job " + "xrpl::JobQueue::addRefCountedJob : threads available or job " "requires no threads"); { @@ -96,10 +95,10 @@ JobQueue::addRefCountedJob( JobType const type(job.getType()); XRPL_ASSERT( type != jtINVALID, - "ripple::JobQueue::addRefCountedJob : has valid job type"); + "xrpl::JobQueue::addRefCountedJob : has valid job type"); XRPL_ASSERT( m_jobSet.find(job) != m_jobSet.end(), - "ripple::JobQueue::addRefCountedJob : job found"); + "xrpl::JobQueue::addRefCountedJob : job found"); perfLog_.jobQueue(type); JobTypeData& data(getJobTypeData(type)); @@ -161,7 +160,7 @@ JobQueue::makeLoadEvent(JobType t, std::string const& name) JobDataMap::iterator iter(m_jobData.find(t)); XRPL_ASSERT( iter != m_jobData.end(), - "ripple::JobQueue::makeLoadEvent : valid job type input"); + "xrpl::JobQueue::makeLoadEvent : valid job type input"); if (iter == m_jobData.end()) return {}; @@ -178,7 +177,7 @@ JobQueue::addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed) JobDataMap::iterator iter(m_jobData.find(t)); XRPL_ASSERT( iter != m_jobData.end(), - "ripple::JobQueue::addLoadEvents : valid job type input"); + "xrpl::JobQueue::addLoadEvents : valid job type input"); iter->second.load().addSamples(count, elapsed); } @@ -205,7 +204,7 @@ JobQueue::getJson(int c) for (auto& x : m_jobData) { XRPL_ASSERT( - x.first != jtINVALID, "ripple::JobQueue::getJson : valid job type"); + x.first != jtINVALID, "xrpl::JobQueue::getJson : valid job type"); if (x.first == jtGENERIC) continue; @@ -262,7 +261,7 @@ JobQueue::getJobTypeData(JobType type) JobDataMap::iterator c(m_jobData.find(type)); XRPL_ASSERT( c != m_jobData.end(), - "ripple::JobQueue::getJobTypeData : valid job type input"); + "xrpl::JobQueue::getJobTypeData : valid job type input"); // NIKB: This is ugly and I hate it. We must remove jtINVALID completely // and use something sane. @@ -289,11 +288,11 @@ JobQueue::stop() lock, [this] { return m_processCount == 0 && m_jobSet.empty(); }); XRPL_ASSERT( m_processCount == 0, - "ripple::JobQueue::stop : all processes completed"); + "xrpl::JobQueue::stop : all processes completed"); XRPL_ASSERT( - m_jobSet.empty(), "ripple::JobQueue::stop : all jobs completed"); + m_jobSet.empty(), "xrpl::JobQueue::stop : all jobs completed"); XRPL_ASSERT( - nSuspend_ == 0, "ripple::JobQueue::stop : no coros suspended"); + nSuspend_ == 0, "xrpl::JobQueue::stop : no coros suspended"); stopped_ = true; } } @@ -308,26 +307,26 @@ void JobQueue::getNextJob(Job& job) { XRPL_ASSERT( - !m_jobSet.empty(), "ripple::JobQueue::getNextJob : non-empty jobs"); + !m_jobSet.empty(), "xrpl::JobQueue::getNextJob : non-empty jobs"); std::set::const_iterator iter; for (iter = m_jobSet.begin(); iter != m_jobSet.end(); ++iter) { JobType const type = iter->getType(); XRPL_ASSERT( - type != jtINVALID, "ripple::JobQueue::getNextJob : valid job type"); + type != jtINVALID, "xrpl::JobQueue::getNextJob : valid job type"); JobTypeData& data(getJobTypeData(type)); XRPL_ASSERT( data.running <= getJobLimit(type), - "ripple::JobQueue::getNextJob : maximum jobs running"); + "xrpl::JobQueue::getNextJob : maximum jobs running"); // Run this job if we're running below the limit. if (data.running < getJobLimit(data.type())) { XRPL_ASSERT( data.waiting > 0, - "ripple::JobQueue::getNextJob : positive data waiting"); + "xrpl::JobQueue::getNextJob : positive data waiting"); --data.waiting; ++data.running; break; @@ -335,8 +334,7 @@ JobQueue::getNextJob(Job& job) } XRPL_ASSERT( - iter != m_jobSet.end(), - "ripple::JobQueue::getNextJob : found next job"); + iter != m_jobSet.end(), "xrpl::JobQueue::getNextJob : found next job"); job = *iter; m_jobSet.erase(iter); } @@ -345,8 +343,7 @@ void JobQueue::finishJob(JobType type) { XRPL_ASSERT( - type != jtINVALID, - "ripple::JobQueue::finishJob : valid input job type"); + type != jtINVALID, "xrpl::JobQueue::finishJob : valid input job type"); JobTypeData& data = getJobTypeData(type); @@ -355,7 +352,7 @@ JobQueue::finishJob(JobType type) { XRPL_ASSERT( data.running + data.waiting >= getJobLimit(type), - "ripple::JobQueue::finishJob : job limit"); + "xrpl::JobQueue::finishJob : job limit"); --data.deferred; m_workers.addTask(); @@ -422,10 +419,9 @@ JobQueue::getJobLimit(JobType type) { JobTypeInfo const& j(JobTypes::instance().get(type)); XRPL_ASSERT( - j.type() != jtINVALID, - "ripple::JobQueue::getJobLimit : valid job type"); + j.type() != jtINVALID, "xrpl::JobQueue::getJobLimit : valid job type"); return j.limit(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/core/detail/LoadEvent.cpp b/src/libxrpl/core/detail/LoadEvent.cpp index 3237daabcf..43a2c491c3 100644 --- a/src/libxrpl/core/detail/LoadEvent.cpp +++ b/src/libxrpl/core/detail/LoadEvent.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { LoadEvent::LoadEvent( LoadMonitor& monitor, @@ -63,7 +63,7 @@ LoadEvent::start() void LoadEvent::stop() { - XRPL_ASSERT(running_, "ripple::LoadEvent::stop : is running"); + XRPL_ASSERT(running_, "xrpl::LoadEvent::stop : is running"); auto const now = std::chrono::steady_clock::now(); @@ -74,4 +74,4 @@ LoadEvent::stop() monitor_.addLoadSample(*this); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/core/detail/LoadMonitor.cpp b/src/libxrpl/core/detail/LoadMonitor.cpp index 7a1cce05f3..fe2bb9e359 100644 --- a/src/libxrpl/core/detail/LoadMonitor.cpp +++ b/src/libxrpl/core/detail/LoadMonitor.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { /* @@ -182,4 +182,4 @@ LoadMonitor::getStats() return stats; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/core/detail/Workers.cpp b/src/libxrpl/core/detail/Workers.cpp index b354353844..aa4731a0ff 100644 --- a/src/libxrpl/core/detail/Workers.cpp +++ b/src/libxrpl/core/detail/Workers.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { Workers::Workers( Callback& callback, @@ -102,7 +102,7 @@ Workers::stop() XRPL_ASSERT( numberOfCurrentlyRunningTasks() == 0, - "ripple::Workers::stop : zero running tasks"); + "xrpl::Workers::stop : zero running tasks"); } void @@ -260,4 +260,4 @@ Workers::Worker::run() } while (!shouldExit); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/crypto/RFC1751.cpp b/src/libxrpl/crypto/RFC1751.cpp index 2b41e2ef38..86ee8ad382 100644 --- a/src/libxrpl/crypto/RFC1751.cpp +++ b/src/libxrpl/crypto/RFC1751.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { // // RFC 1751 code converted to C++/Boost. @@ -260,12 +260,12 @@ RFC1751::extract(char const* s, int start, int length) unsigned char cr; unsigned long x; - XRPL_ASSERT(length <= 11, "ripple::RFC1751::extract : maximum length"); - XRPL_ASSERT(start >= 0, "ripple::RFC1751::extract : minimum start"); - XRPL_ASSERT(length >= 0, "ripple::RFC1751::extract : minimum length"); + XRPL_ASSERT(length <= 11, "xrpl::RFC1751::extract : maximum length"); + XRPL_ASSERT(start >= 0, "xrpl::RFC1751::extract : minimum start"); + XRPL_ASSERT(length >= 0, "xrpl::RFC1751::extract : minimum length"); XRPL_ASSERT( start + length <= 66, - "ripple::RFC1751::extract : maximum start + length"); + "xrpl::RFC1751::extract : maximum start + length"); int const shiftR = 24 - (length + (start % 8)); cl = s[start / 8]; // get components @@ -312,12 +312,11 @@ RFC1751::insert(char* s, int x, int start, int length) unsigned long y; int shift; - XRPL_ASSERT(length <= 11, "ripple::RFC1751::insert : maximum length"); - XRPL_ASSERT(start >= 0, "ripple::RFC1751::insert : minimum start"); - XRPL_ASSERT(length >= 0, "ripple::RFC1751::insert : minimum length"); + XRPL_ASSERT(length <= 11, "xrpl::RFC1751::insert : maximum length"); + XRPL_ASSERT(start >= 0, "xrpl::RFC1751::insert : minimum start"); + XRPL_ASSERT(length >= 0, "xrpl::RFC1751::insert : minimum length"); XRPL_ASSERT( - start + length <= 66, - "ripple::RFC1751::insert : maximum start + length"); + start + length <= 66, "xrpl::RFC1751::insert : maximum start + length"); shift = ((8 - ((start + length) % 8)) % 8); y = (long)x << shift; @@ -508,4 +507,4 @@ RFC1751::getWordFromBlob(void const* blob, size_t bytes) [hash % (sizeof(s_dictionary) / sizeof(s_dictionary[0]))]; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/crypto/csprng.cpp b/src/libxrpl/crypto/csprng.cpp index e89129bfb0..5ee1700d7f 100644 --- a/src/libxrpl/crypto/csprng.cpp +++ b/src/libxrpl/crypto/csprng.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { csprng_engine::csprng_engine() { @@ -87,4 +87,4 @@ crypto_prng() return engine; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/crypto/secure_erase.cpp b/src/libxrpl/crypto/secure_erase.cpp index 6e27de59d0..5b65b342ec 100644 --- a/src/libxrpl/crypto/secure_erase.cpp +++ b/src/libxrpl/crypto/secure_erase.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { void secure_erase(void* dest, std::size_t bytes) @@ -12,4 +12,4 @@ secure_erase(void* dest, std::size_t bytes) OPENSSL_cleanse(dest, bytes); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/json/JsonPropertyStream.cpp b/src/libxrpl/json/JsonPropertyStream.cpp index fd4c0d575d..fb5a7b32a4 100644 --- a/src/libxrpl/json/JsonPropertyStream.cpp +++ b/src/libxrpl/json/JsonPropertyStream.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { JsonPropertyStream::JsonPropertyStream() : m_top(Json::objectValue) { @@ -161,4 +161,4 @@ JsonPropertyStream::add(std::string const& v) m_stack.back()->append(v); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/json/Object.cpp b/src/libxrpl/json/Object.cpp index ee63acc327..ea5e5a32d8 100644 --- a/src/libxrpl/json/Object.cpp +++ b/src/libxrpl/json/Object.cpp @@ -52,9 +52,9 @@ void Collection::checkWritable(std::string const& label) { if (!enabled_) - ripple::Throw(label + ": not enabled"); + xrpl::Throw(label + ": not enabled"); if (!writer_) - ripple::Throw(label + ": not writable"); + xrpl::Throw(label + ": not writable"); } //------------------------------------------------------------------------------ diff --git a/src/libxrpl/json/Writer.cpp b/src/libxrpl/json/Writer.cpp index e1ca1900f0..fcdceb7253 100644 --- a/src/libxrpl/json/Writer.cpp +++ b/src/libxrpl/json/Writer.cpp @@ -263,14 +263,14 @@ Writer::output(Json::Value const& value) void Writer::output(float f) { - auto s = ripple::to_string(f); + auto s = xrpl::to_string(f); impl_->output({s.data(), lengthWithoutTrailingZeros(s)}); } void Writer::output(double f) { - auto s = ripple::to_string(f); + auto s = xrpl::to_string(f); impl_->output({s.data(), lengthWithoutTrailingZeros(s)}); } diff --git a/src/libxrpl/json/json_reader.cpp b/src/libxrpl/json/json_reader.cpp index 4af0ed6ef0..c0843ca929 100644 --- a/src/libxrpl/json/json_reader.cpp +++ b/src/libxrpl/json/json_reader.cpp @@ -941,7 +941,7 @@ operator>>(std::istream& sin, Value& root) // XRPL_ASSERT(ok, "Json::operator>>() : parse succeeded"); if (!ok) - ripple::Throw(reader.getFormatedErrorMessages()); + xrpl::Throw(reader.getFormatedErrorMessages()); return sin; } diff --git a/src/libxrpl/json/json_value.cpp b/src/libxrpl/json/json_value.cpp index 1580e68255..b738774d79 100644 --- a/src/libxrpl/json/json_value.cpp +++ b/src/libxrpl/json/json_value.cpp @@ -218,7 +218,7 @@ Value::Value(char const* value) : type_(stringValue), allocated_(true) value_.string_ = valueAllocator()->duplicateStringValue(value); } -Value::Value(ripple::Number const& value) : type_(stringValue), allocated_(true) +Value::Value(xrpl::Number const& value) : type_(stringValue), allocated_(true) { auto const tmp = to_string(value); value_.string_ = diff --git a/src/libxrpl/ledger/ApplyStateTable.cpp b/src/libxrpl/ledger/ApplyStateTable.cpp index c236f0d1b5..94fd9d7273 100644 --- a/src/libxrpl/ledger/ApplyStateTable.cpp +++ b/src/libxrpl/ledger/ApplyStateTable.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { void @@ -143,7 +143,7 @@ ApplyStateTable::apply( { XRPL_ASSERT( origNode && curNode, - "ripple::detail::ApplyStateTable::apply : valid nodes for " + "xrpl::detail::ApplyStateTable::apply : valid nodes for " "deletion"); threadOwners(to, meta, origNode, newMod, j); @@ -178,7 +178,7 @@ ApplyStateTable::apply( { XRPL_ASSERT( curNode && origNode, - "ripple::detail::ApplyStateTable::apply : valid nodes for " + "xrpl::detail::ApplyStateTable::apply : valid nodes for " "modification"); if (curNode->isThreadedType( @@ -216,7 +216,7 @@ ApplyStateTable::apply( { XRPL_ASSERT( curNode && !origNode, - "ripple::detail::ApplyStateTable::apply : valid nodes for " + "xrpl::detail::ApplyStateTable::apply : valid nodes for " "creation"); threadOwners(to, meta, curNode, newMod, j); @@ -242,7 +242,7 @@ ApplyStateTable::apply( { // LCOV_EXCL_START UNREACHABLE( - "ripple::detail::ApplyStateTable::apply : unsupported " + "xrpl::detail::ApplyStateTable::apply : unsupported " "operation type"); // LCOV_EXCL_STOP } @@ -547,7 +547,7 @@ ApplyStateTable::threadItem(TxMeta& meta, std::shared_ptr const& sle) { XRPL_ASSERT( node.getFieldIndex(sfPreviousTxnLgrSeq) == -1, - "ripple::ApplyStateTable::threadItem : previous ledger is not " + "xrpl::ApplyStateTable::threadItem : previous ledger is not " "set"); node.setFieldH256(sfPreviousTxnID, prevTxID); node.setFieldU32(sfPreviousTxnLgrSeq, prevLgrID); @@ -555,11 +555,11 @@ ApplyStateTable::threadItem(TxMeta& meta, std::shared_ptr const& sle) XRPL_ASSERT( node.getFieldH256(sfPreviousTxnID) == prevTxID, - "ripple::ApplyStateTable::threadItem : previous transaction is a " + "xrpl::ApplyStateTable::threadItem : previous transaction is a " "match"); XRPL_ASSERT( node.getFieldU32(sfPreviousTxnLgrSeq) == prevLgrID, - "ripple::ApplyStateTable::threadItem : previous ledger is a match"); + "xrpl::ApplyStateTable::threadItem : previous ledger is a match"); } } @@ -576,7 +576,7 @@ ApplyStateTable::getForMod( { XRPL_ASSERT( miter->second, - "ripple::ApplyStateTable::getForMod : non-null result"); + "xrpl::ApplyStateTable::getForMod : non-null result"); return miter->second; } } @@ -634,7 +634,7 @@ ApplyStateTable::threadTx( // threadItem only applied to AccountRoot XRPL_ASSERT( sle->isThreadedType(base.rules()), - "ripple::ApplyStateTable::threadTx : SLE is threaded"); + "xrpl::ApplyStateTable::threadTx : SLE is threaded"); threadItem(meta, sle); } @@ -671,4 +671,4 @@ ApplyStateTable::threadOwners( } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/ApplyView.cpp b/src/libxrpl/ledger/ApplyView.cpp index 911bec1722..cfdbbbcb4d 100644 --- a/src/libxrpl/ledger/ApplyView.cpp +++ b/src/libxrpl/ledger/ApplyView.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace directory { @@ -135,9 +135,7 @@ insertPage( if (page != 1) node->setFieldU64(sfIndexPrevious, page - 1); XRPL_ASSERT_PARTS( - !nextPage, - "ripple::directory::insertPage", - "nextPage has default value"); + !nextPage, "xrpl::directory::insertPage", "nextPage has default value"); /* Reserved for future use when directory pages may be inserted in * between two other pages instead of only at the end of the chain. if (nextPage) @@ -193,7 +191,7 @@ ApplyView::emptyDirDelete(Keylet const& directory) node->getFieldH256(sfRootIndex) != directory.key) { // LCOV_EXCL_START - UNREACHABLE("ripple::ApplyView::emptyDirDelete : invalid node type"); + UNREACHABLE("xrpl::ApplyView::emptyDirDelete : invalid node type"); return false; // LCOV_EXCL_STOP } @@ -435,4 +433,4 @@ ApplyView::dirDelete( return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/ApplyViewBase.cpp b/src/libxrpl/ledger/ApplyViewBase.cpp index 554822acda..51abd8e4a6 100644 --- a/src/libxrpl/ledger/ApplyViewBase.cpp +++ b/src/libxrpl/ledger/ApplyViewBase.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace detail { ApplyViewBase::ApplyViewBase(ReadView const* base, ApplyFlags flags) @@ -155,4 +155,4 @@ ApplyViewBase::rawDestroyXRP(XRPAmount const& fee) } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/ApplyViewImpl.cpp b/src/libxrpl/ledger/ApplyViewImpl.cpp index 90652dd45b..b0aeb70228 100644 --- a/src/libxrpl/ledger/ApplyViewImpl.cpp +++ b/src/libxrpl/ledger/ApplyViewImpl.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { ApplyViewImpl::ApplyViewImpl(ReadView const* base, ApplyFlags flags) : ApplyViewBase(base, flags) @@ -37,4 +37,4 @@ ApplyViewImpl::visit( items_.visit(to, func); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/BookDirs.cpp b/src/libxrpl/ledger/BookDirs.cpp index 72387650ec..6dda4ffe51 100644 --- a/src/libxrpl/ledger/BookDirs.cpp +++ b/src/libxrpl/ledger/BookDirs.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { BookDirs::BookDirs(ReadView const& view, Book const& book) : view_(&view) @@ -11,13 +11,13 @@ BookDirs::BookDirs(ReadView const& view, Book const& book) , key_(view_->succ(root_, next_quality_).value_or(beast::zero)) { XRPL_ASSERT( - root_ != beast::zero, "ripple::BookDirs::BookDirs : nonzero root"); + root_ != beast::zero, "xrpl::BookDirs::BookDirs : nonzero root"); if (key_ != beast::zero) { if (!cdirFirst(*view_, key_, sle_, entry_, index_)) { // LCOV_EXCL_START - UNREACHABLE("ripple::BookDirs::BookDirs : directory is empty"); + UNREACHABLE("xrpl::BookDirs::BookDirs : directory is empty"); // LCOV_EXCL_STOP } } @@ -55,7 +55,7 @@ BookDirs::const_iterator::operator==( XRPL_ASSERT( view_ == other.view_ && root_ == other.root_, - "ripple::BookDirs::const_iterator::operator== : views and roots are " + "xrpl::BookDirs::const_iterator::operator== : views and roots are " "matching"); return entry_ == other.entry_ && cur_key_ == other.cur_key_ && index_ == other.index_; @@ -66,7 +66,7 @@ BookDirs::const_iterator::operator*() const { XRPL_ASSERT( index_ != beast::zero, - "ripple::BookDirs::const_iterator::operator* : nonzero index"); + "xrpl::BookDirs::const_iterator::operator* : nonzero index"); if (!cache_) cache_ = view_->read(keylet::offer(index_)); return *cache_; @@ -79,7 +79,7 @@ BookDirs::const_iterator::operator++() XRPL_ASSERT( index_ != zero, - "ripple::BookDirs::const_iterator::operator++ : nonzero index"); + "xrpl::BookDirs::const_iterator::operator++ : nonzero index"); if (!cdirNext(*view_, cur_key_, sle_, entry_, index_)) { if (index_ != 0 || @@ -94,7 +94,7 @@ BookDirs::const_iterator::operator++() { // LCOV_EXCL_START UNREACHABLE( - "ripple::BookDirs::const_iterator::operator++ : directory is " + "xrpl::BookDirs::const_iterator::operator++ : directory is " "empty"); // LCOV_EXCL_STOP } @@ -109,10 +109,10 @@ BookDirs::const_iterator::operator++(int) { XRPL_ASSERT( index_ != beast::zero, - "ripple::BookDirs::const_iterator::operator++(int) : nonzero index"); + "xrpl::BookDirs::const_iterator::operator++(int) : nonzero index"); const_iterator tmp(*this); ++(*this); return tmp; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/CachedView.cpp b/src/libxrpl/ledger/CachedView.cpp index 6463779845..19d4baa861 100644 --- a/src/libxrpl/ledger/CachedView.cpp +++ b/src/libxrpl/ledger/CachedView.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { bool @@ -39,8 +39,7 @@ CachedViewImpl::read(Keylet const& k) const }); // If the sle is null, then a failure must have occurred in base_.read() XRPL_ASSERT( - sle || baseRead, - "ripple::CachedView::read : null SLE result from base"); + sle || baseRead, "xrpl::CachedView::read : null SLE result from base"); if (cacheHit && baseRead) hitsexpired.increment(); else if (cacheHit) @@ -62,4 +61,4 @@ CachedViewImpl::read(Keylet const& k) const } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/CredentialHelpers.cpp b/src/libxrpl/ledger/CredentialHelpers.cpp index aea783b676..a0f1dce7d8 100644 --- a/src/libxrpl/ledger/CredentialHelpers.cpp +++ b/src/libxrpl/ledger/CredentialHelpers.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace credentials { bool @@ -374,4 +374,4 @@ verifyDepositPreauth( return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/Dir.cpp b/src/libxrpl/ledger/Dir.cpp index ef128b7c3d..d834216d24 100644 --- a/src/libxrpl/ledger/Dir.cpp +++ b/src/libxrpl/ledger/Dir.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { using const_iterator = Dir::const_iterator; @@ -43,7 +43,7 @@ const_iterator::operator==(const_iterator const& other) const XRPL_ASSERT( view_ == other.view_ && root_.key == other.root_.key, - "ripple::const_iterator::operator== : views and roots are matching"); + "xrpl::const_iterator::operator== : views and roots are matching"); return page_.key == other.page_.key && index_ == other.index_; } @@ -52,7 +52,7 @@ const_iterator::operator*() const { XRPL_ASSERT( index_ != beast::zero, - "ripple::const_iterator::operator* : nonzero index"); + "xrpl::const_iterator::operator* : nonzero index"); if (!cache_) cache_ = view_->read(keylet::child(index_)); return *cache_; @@ -63,7 +63,7 @@ const_iterator::operator++() { XRPL_ASSERT( index_ != beast::zero, - "ripple::const_iterator::operator++ : nonzero index"); + "xrpl::const_iterator::operator++ : nonzero index"); if (++it_ != std::end(*indexes_)) { index_ = *it_; @@ -79,7 +79,7 @@ const_iterator::operator++(int) { XRPL_ASSERT( index_ != beast::zero, - "ripple::const_iterator::operator++(int) : nonzero index"); + "xrpl::const_iterator::operator++(int) : nonzero index"); const_iterator tmp(*this); ++(*this); return tmp; @@ -98,7 +98,7 @@ const_iterator::next_page() { page_ = keylet::page(root_, next); sle_ = view_->read(page_); - XRPL_ASSERT(sle_, "ripple::const_iterator::next_page : non-null SLE"); + XRPL_ASSERT(sle_, "xrpl::const_iterator::next_page : non-null SLE"); indexes_ = &sle_->getFieldV256(sfIndexes); if (indexes_->empty()) { @@ -120,4 +120,4 @@ const_iterator::page_size() return indexes_->size(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/OpenView.cpp b/src/libxrpl/ledger/OpenView.cpp index 8ddb11abd0..5df3ed7cda 100644 --- a/src/libxrpl/ledger/OpenView.cpp +++ b/src/libxrpl/ledger/OpenView.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { class OpenView::txs_iter_impl : public txs_type::iter_base { @@ -250,4 +250,4 @@ OpenView::rawTxInsert( LogicError("rawTxInsert: duplicate TX id: " + to_string(key)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/PaymentSandbox.cpp b/src/libxrpl/ledger/PaymentSandbox.cpp index 94d30529bf..09600ae623 100644 --- a/src/libxrpl/ledger/PaymentSandbox.cpp +++ b/src/libxrpl/ledger/PaymentSandbox.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -28,10 +28,10 @@ DeferredCredits::credit( { XRPL_ASSERT( sender != receiver, - "ripple::detail::DeferredCredits::credit : sender is not receiver"); + "xrpl::detail::DeferredCredits::credit : sender is not receiver"); XRPL_ASSERT( !amount.negative(), - "ripple::detail::DeferredCredits::credit : positive amount"); + "xrpl::detail::DeferredCredits::credit : positive amount"); auto const k = makeKey(sender, receiver, amount.getCurrency()); auto i = credits_.find(k); @@ -234,14 +234,14 @@ PaymentSandbox::adjustOwnerCountHook( void PaymentSandbox::apply(RawView& to) { - XRPL_ASSERT(!ps_, "ripple::PaymentSandbox::apply : non-null sandbox"); + XRPL_ASSERT(!ps_, "xrpl::PaymentSandbox::apply : non-null sandbox"); items_.apply(to); } void PaymentSandbox::apply(PaymentSandbox& to) { - XRPL_ASSERT(ps_ == &to, "ripple::PaymentSandbox::apply : matching sandbox"); + XRPL_ASSERT(ps_ == &to, "xrpl::PaymentSandbox::apply : matching sandbox"); items_.apply(to); tab_.apply(to.tab_); } @@ -327,7 +327,7 @@ PaymentSandbox::balanceChanges(ReadView const& view) const auto const at = after->getType(); XRPL_ASSERT( at == before->getType(), - "ripple::PaymentSandbox::balanceChanges : after and before " + "xrpl::PaymentSandbox::balanceChanges : after and before " "types matching"); switch (at) { @@ -377,4 +377,4 @@ PaymentSandbox::xrpDestroyed() const return items_.dropsDestroyed(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/RawStateTable.cpp b/src/libxrpl/ledger/RawStateTable.cpp index 8ba97b76c2..b958e94c54 100644 --- a/src/libxrpl/ledger/RawStateTable.cpp +++ b/src/libxrpl/ledger/RawStateTable.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { class RawStateTable::sles_iter_impl : public ReadView::sles_type::iter_base @@ -46,7 +46,7 @@ public: { XRPL_ASSERT( end1_ == p->end1_ && end0_ == p->end0_, - "ripple::detail::RawStateTable::equal : matching end " + "xrpl::detail::RawStateTable::equal : matching end " "iterators"); return iter1_ == p->iter1_ && iter0_ == p->iter0_; } @@ -59,7 +59,7 @@ public: { XRPL_ASSERT( sle1_ || sle0_, - "ripple::detail::RawStateTable::increment : either SLE is " + "xrpl::detail::RawStateTable::increment : either SLE is " "non-null"); if (sle1_ && !sle0_) @@ -167,8 +167,7 @@ bool RawStateTable::exists(ReadView const& base, Keylet const& k) const { XRPL_ASSERT( - k.key.isNonZero(), - "ripple::detail::RawStateTable::exists : nonzero key"); + k.key.isNonZero(), "xrpl::detail::RawStateTable::exists : nonzero key"); auto const iter = items_.find(k.key); if (iter == items_.end()) return base.exists(k); @@ -339,4 +338,4 @@ RawStateTable::slesUpperBound(ReadView const& base, uint256 const& key) const } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/ReadView.cpp b/src/libxrpl/ledger/ReadView.cpp index 0d72a80b3c..e0764d6c81 100644 --- a/src/libxrpl/ledger/ReadView.cpp +++ b/src/libxrpl/ledger/ReadView.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { ReadView::sles_type::sles_type(ReadView const& view) : ReadViewFwdRange(view) { @@ -68,4 +68,4 @@ makeRulesGivenLedger( return Rules(presets); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index d5297479e8..c817a85b65 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -19,7 +19,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -40,7 +40,7 @@ internalDirNext( auto const& svIndexes = page->getFieldV256(sfIndexes); XRPL_ASSERT( index <= svIndexes.size(), - "ripple::detail::internalDirNext : index inside range"); + "xrpl::detail::internalDirNext : index inside range"); if (index >= svIndexes.size()) { @@ -57,7 +57,7 @@ internalDirNext( else page = view.peek(keylet::page(root, next)); - XRPL_ASSERT(page, "ripple::detail::internalDirNext : non-null root"); + XRPL_ASSERT(page, "xrpl::detail::internalDirNext : non-null root"); if (!page) return false; @@ -307,7 +307,7 @@ isVaultPseudoAccountFrozen( if (mptIssuer == nullptr) { // LCOV_EXCL_START - UNREACHABLE("ripple::isVaultPseudoAccountFrozen : null MPToken issuer"); + UNREACHABLE("xrpl::isVaultPseudoAccountFrozen : null MPToken issuer"); return false; // LCOV_EXCL_STOP } @@ -319,7 +319,7 @@ isVaultPseudoAccountFrozen( view.read(keylet::vault(mptIssuer->getFieldH256(sfVaultID))); if (vault == nullptr) { // LCOV_EXCL_START - UNREACHABLE("ripple::isVaultPseudoAccountFrozen : null vault"); + UNREACHABLE("xrpl::isVaultPseudoAccountFrozen : null vault"); return false; // LCOV_EXCL_STOP } @@ -711,7 +711,7 @@ confineOwnerCount( << "Account " << *id << " owner count set below 0!"; } adjusted = 0; - XRPL_ASSERT(!id, "ripple::confineOwnerCount : id is not set"); + XRPL_ASSERT(!id, "xrpl::confineOwnerCount : id is not set"); } } return adjusted; @@ -761,8 +761,7 @@ forEachItem( Keylet const& root, std::function const&)> const& f) { - XRPL_ASSERT( - root.type == ltDIR_NODE, "ripple::forEachItem : valid root type"); + XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::forEachItem : valid root type"); if (root.type != ltDIR_NODE) return; @@ -793,7 +792,7 @@ forEachItemAfter( std::function const&)> const& f) { XRPL_ASSERT( - root.type == ltDIR_NODE, "ripple::forEachItemAfter : valid root type"); + root.type == ltDIR_NODE, "xrpl::forEachItemAfter : valid root type"); if (root.type != ltDIR_NODE) return false; @@ -1084,7 +1083,7 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal) XRPL_ASSERT( hashIndex->getFieldU32(sfLastLedgerSequence) == (ledger.seq() - 1), - "ripple::hashOfSeq : matching ledger sequence"); + "xrpl::hashOfSeq : matching ledger sequence"); STVector256 vec = hashIndex->getFieldV256(sfHashes); if (vec.size() >= diff) return vec[vec.size() - diff]; @@ -1112,9 +1111,9 @@ hashOfSeq(ReadView const& ledger, LedgerIndex seq, beast::Journal journal) if (hashIndex) { auto const lastSeq = hashIndex->getFieldU32(sfLastLedgerSequence); - XRPL_ASSERT(lastSeq >= seq, "ripple::hashOfSeq : minimum last ledger"); + XRPL_ASSERT(lastSeq >= seq, "xrpl::hashOfSeq : minimum last ledger"); XRPL_ASSERT( - (lastSeq & 0xff) == 0, "ripple::hashOfSeq : valid last ledger"); + (lastSeq & 0xff) == 0, "xrpl::hashOfSeq : valid last ledger"); auto const diff = (lastSeq - seq) >> 8; STVector256 vec = hashIndex->getFieldV256(sfHashes); if (vec.size() > diff) @@ -1140,7 +1139,7 @@ adjustOwnerCount( { if (!sle) return; - XRPL_ASSERT(amount, "ripple::adjustOwnerCount : nonzero amount input"); + XRPL_ASSERT(amount, "xrpl::adjustOwnerCount : nonzero amount input"); std::uint32_t const current{sle->getFieldU32(sfOwnerCount)}; AccountID const id = (*sle)[sfAccount]; std::uint32_t const adjusted = confineOwnerCount(current, amount, id, j); @@ -1205,7 +1204,7 @@ getPseudoAccountFields() { // LCOV_EXCL_START LogicError( - "ripple::getPseudoAccountFields : unable to find account root " + "xrpl::getPseudoAccountFields : unable to find account root " "ledger " "format"); // LCOV_EXCL_STOP @@ -1258,7 +1257,7 @@ createPseudoAccount( [&ownerField](SField const* sf) -> bool { return *sf == ownerField; }) == 1, - "ripple::createPseudoAccount : valid owner field"); + "xrpl::createPseudoAccount : valid owner field"); auto const accountId = pseudoAccountAddress(view, pseudoOwnerKey); if (accountId == beast::zero) @@ -1577,7 +1576,7 @@ authorizeMPToken( { // LCOV_EXCL_START UNREACHABLE( - "ripple::authorizeMPToken : invalid issuance or issuers token"); + "xrpl::authorizeMPToken : invalid issuance or issuers token"); if (view.rules().enabled(featureLendingProtocol)) return tecINTERNAL; // LCOV_EXCL_STOP @@ -1661,7 +1660,7 @@ trustCreate( if (uLowAccountID == uHighAccountID) { // LCOV_EXCL_START - UNREACHABLE("ripple::trustCreate : trust line to self"); + UNREACHABLE("xrpl::trustCreate : trust line to self"); if (view.rules().enabled(featureLendingProtocol)) return tecINTERNAL; // LCOV_EXCL_STOP @@ -1689,14 +1688,14 @@ trustCreate( bool const bSetDst = saLimit.getIssuer() == uDstAccountID; bool const bSetHigh = bSrcHigh ^ bSetDst; - XRPL_ASSERT(sleAccount, "ripple::trustCreate : non-null SLE"); + XRPL_ASSERT(sleAccount, "xrpl::trustCreate : non-null SLE"); if (!sleAccount) return tefINTERNAL; // LCOV_EXCL_LINE XRPL_ASSERT( sleAccount->getAccountID(sfAccount) == (bSetHigh ? uHighAccountID : uLowAccountID), - "ripple::trustCreate : matching account ID"); + "xrpl::trustCreate : matching account ID"); auto const slePeer = view.peek(keylet::account(bSetHigh ? uLowAccountID : uHighAccountID)); if (!slePeer) @@ -1933,7 +1932,7 @@ offerDelete(ApplyView& view, std::shared_ptr const& sle, beast::Journal j) { XRPL_ASSERT( sle->isFlag(lsfHybrid) && sle->isFieldPresent(sfDomainID), - "ripple::offerDelete : should be a hybrid domain offer"); + "xrpl::offerDelete : should be a hybrid domain offer"); auto const& additionalBookDirs = sle->getFieldArray(sfAdditionalBooks); @@ -1976,23 +1975,23 @@ rippleCreditIOU( // Make sure issuer is involved. XRPL_ASSERT( !bCheckIssuer || uSenderID == issuer || uReceiverID == issuer, - "ripple::rippleCreditIOU : matching issuer or don't care"); + "xrpl::rippleCreditIOU : matching issuer or don't care"); (void)issuer; // Disallow sending to self. XRPL_ASSERT( uSenderID != uReceiverID, - "ripple::rippleCreditIOU : sender is not receiver"); + "xrpl::rippleCreditIOU : sender is not receiver"); bool const bSenderHigh = uSenderID > uReceiverID; auto const index = keylet::line(uSenderID, uReceiverID, currency); XRPL_ASSERT( !isXRP(uSenderID) && uSenderID != noAccount(), - "ripple::rippleCreditIOU : sender is not XRP"); + "xrpl::rippleCreditIOU : sender is not XRP"); XRPL_ASSERT( !isXRP(uReceiverID) && uReceiverID != noAccount(), - "ripple::rippleCreditIOU : receiver is not XRP"); + "xrpl::rippleCreditIOU : receiver is not XRP"); // If the line exists, modify it accordingly. if (auto const sleRippleState = view.peek(index)) @@ -2129,10 +2128,10 @@ rippleSendIOU( XRPL_ASSERT( !isXRP(uSenderID) && !isXRP(uReceiverID), - "ripple::rippleSendIOU : neither sender nor receiver is XRP"); + "xrpl::rippleSendIOU : neither sender nor receiver is XRP"); XRPL_ASSERT( uSenderID != uReceiverID, - "ripple::rippleSendIOU : sender is not receiver"); + "xrpl::rippleSendIOU : sender is not receiver"); if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount()) { @@ -2183,7 +2182,7 @@ rippleSendMultiIOU( auto const& issuer = issue.getIssuer(); XRPL_ASSERT( - !isXRP(senderID), "ripple::rippleSendMultiIOU : sender is not XRP"); + !isXRP(senderID), "xrpl::rippleSendMultiIOU : sender is not XRP"); // These may diverge STAmount takeFromSender{issue}; @@ -2203,7 +2202,7 @@ rippleSendMultiIOU( XRPL_ASSERT( !isXRP(receiverID), - "ripple::rippleSendMultiIOU : receiver is not XRP"); + "xrpl::rippleSendMultiIOU : receiver is not XRP"); if (senderID == issuer || receiverID == issuer || issuer == noAccount()) { @@ -2269,7 +2268,7 @@ accountSendIOU( // LCOV_EXCL_START XRPL_ASSERT( saAmount >= beast::zero && !saAmount.holds(), - "ripple::accountSendIOU : minimum amount and not MPT"); + "xrpl::accountSendIOU : minimum amount and not MPT"); // LCOV_EXCL_STOP } @@ -2383,7 +2382,7 @@ accountSendMultiIOU( { XRPL_ASSERT_PARTS( receivers.size() > 1, - "ripple::accountSendMultiIOU", + "xrpl::accountSendMultiIOU", "multiple recipients provided"); if (!issue.native()) @@ -2584,7 +2583,7 @@ rippleSendMPT( { XRPL_ASSERT( uSenderID != uReceiverID, - "ripple::rippleSendMPT : sender is not receiver"); + "xrpl::rippleSendMPT : sender is not receiver"); // Safe to get MPT since rippleSendMPT is only called by accountSendMPT auto const& issuer = saAmount.getIssuer(); @@ -2745,7 +2744,7 @@ accountSendMPT( { XRPL_ASSERT( saAmount >= beast::zero && saAmount.holds(), - "ripple::accountSendMPT : minimum amount and MPT"); + "xrpl::accountSendMPT : minimum amount and MPT"); /* If we aren't sending anything or if the sender is the same as the * receiver then we don't need to do anything. @@ -2806,7 +2805,7 @@ accountSendMulti( { XRPL_ASSERT_PARTS( receivers.size() > 1, - "ripple::accountSendMulti", + "xrpl::accountSendMulti", "multiple recipients provided"); return std::visit( [&](TIss const& issue) { @@ -2883,14 +2882,14 @@ issueIOU( { XRPL_ASSERT( !isXRP(account) && !isXRP(issue.account), - "ripple::issueIOU : neither account nor issuer is XRP"); + "xrpl::issueIOU : neither account nor issuer is XRP"); // Consistency check - XRPL_ASSERT(issue == amount.issue(), "ripple::issueIOU : matching issue"); + XRPL_ASSERT(issue == amount.issue(), "xrpl::issueIOU : matching issue"); // Can't send to self! XRPL_ASSERT( - issue.account != account, "ripple::issueIOU : not issuer account"); + issue.account != account, "xrpl::issueIOU : not issuer account"); JLOG(j.trace()) << "issueIOU: " << to_string(account) << ": " << amount.getFullText(); @@ -2983,14 +2982,14 @@ redeemIOU( { XRPL_ASSERT( !isXRP(account) && !isXRP(issue.account), - "ripple::redeemIOU : neither account nor issuer is XRP"); + "xrpl::redeemIOU : neither account nor issuer is XRP"); // Consistency check - XRPL_ASSERT(issue == amount.issue(), "ripple::redeemIOU : matching issue"); + XRPL_ASSERT(issue == amount.issue(), "xrpl::redeemIOU : matching issue"); // Can't send to self! XRPL_ASSERT( - issue.account != account, "ripple::redeemIOU : not issuer account"); + issue.account != account, "xrpl::redeemIOU : not issuer account"); JLOG(j.trace()) << "redeemIOU: " << to_string(account) << ": " << amount.getFullText(); @@ -3057,10 +3056,10 @@ transferXRP( beast::Journal j) { XRPL_ASSERT( - from != beast::zero, "ripple::transferXRP : nonzero from account"); - XRPL_ASSERT(to != beast::zero, "ripple::transferXRP : nonzero to account"); - XRPL_ASSERT(from != to, "ripple::transferXRP : sender is not receiver"); - XRPL_ASSERT(amount.native(), "ripple::transferXRP : amount is XRP"); + from != beast::zero, "xrpl::transferXRP : nonzero from account"); + XRPL_ASSERT(to != beast::zero, "xrpl::transferXRP : nonzero to account"); + XRPL_ASSERT(from != to, "xrpl::transferXRP : sender is not receiver"); + XRPL_ASSERT(amount.native(), "xrpl::transferXRP : amount is XRP"); SLE::pointer const sender = view.peek(keylet::account(from)); SLE::pointer const receiver = view.peek(keylet::account(to)); @@ -3194,7 +3193,7 @@ requireAuth( { XRPL_ASSERT( sleIssuance->getFieldU32(sfFlags) & lsfMPTRequireAuth, - "ripple::requireAuth : issuance requires authorization"); + "xrpl::requireAuth : issuance requires authorization"); // ter = tefINTERNAL | tecOBJECT_NOT_FOUND | tecNO_AUTH | tecEXPIRED if (auto const ter = credentials::validDomain(view, *maybeDomainID, account); @@ -3235,7 +3234,7 @@ enforceMPTokenAuthorization( XRPL_ASSERT( sleIssuance->isFlag(lsfMPTRequireAuth), - "ripple::enforceMPTokenAuthorization : authorization required"); + "xrpl::enforceMPTokenAuthorization : authorization required"); if (account == sleIssuance->at(sfIssuer)) return tefINTERNAL; // LCOV_EXCL_LINE @@ -3281,7 +3280,7 @@ enforceMPTokenAuthorization( // MPToken which requires authorization by the token issuer. XRPL_ASSERT( sleToken != nullptr && !maybeDomainID.has_value(), - "ripple::enforceMPTokenAuthorization : found MPToken"); + "xrpl::enforceMPTokenAuthorization : found MPToken"); if (sleToken->isFlag(lsfMPTAuthorized)) return tesSUCCESS; @@ -3293,7 +3292,7 @@ enforceMPTokenAuthorization( // lsfMPTAuthorized because it is meaningless. Return tesSUCCESS XRPL_ASSERT( maybeDomainID.has_value(), - "ripple::enforceMPTokenAuthorization : found MPToken for domain"); + "xrpl::enforceMPTokenAuthorization : found MPToken for domain"); return tesSUCCESS; } else if (authorizedByDomain) @@ -3302,7 +3301,7 @@ enforceMPTokenAuthorization( // authorized by domain. Proceed to create it, then return tesSUCCESS XRPL_ASSERT( maybeDomainID.has_value() && sleToken == nullptr, - "ripple::enforceMPTokenAuthorization : new MPToken for domain"); + "xrpl::enforceMPTokenAuthorization : new MPToken for domain"); if (auto const err = authorizeMPToken( view, priorBalance, // priorBalance @@ -3317,7 +3316,7 @@ enforceMPTokenAuthorization( // LCOV_EXCL_START UNREACHABLE( - "ripple::enforceMPTokenAuthorization : condition list is incomplete"); + "xrpl::enforceMPTokenAuthorization : condition list is incomplete"); return tefINTERNAL; // LCOV_EXCL_STOP } @@ -3441,7 +3440,7 @@ cleanupOnAccountDelete( // back to 'it' to "un-invalidate" the iterator. XRPL_ASSERT( uDirEntry >= 1, - "ripple::cleanupOnAccountDelete : minimum dir entries"); + "xrpl::cleanupOnAccountDelete : minimum dir entries"); if (uDirEntry == 0) { // LCOV_EXCL_START @@ -3529,8 +3528,7 @@ rippleCredit( else { XRPL_ASSERT( - !bCheckIssuer, - "ripple::rippleCredit : not checking issuer"); + !bCheckIssuer, "xrpl::rippleCredit : not checking issuer"); return rippleCreditMPT( view, uSenderID, uReceiverID, saAmount, j); } @@ -3546,10 +3544,10 @@ assetsToSharesDeposit( { XRPL_ASSERT( !assets.negative(), - "ripple::assetsToSharesDeposit : non-negative assets"); + "xrpl::assetsToSharesDeposit : non-negative assets"); XRPL_ASSERT( assets.asset() == vault->at(sfAsset), - "ripple::assetsToSharesDeposit : assets and vault match"); + "xrpl::assetsToSharesDeposit : assets and vault match"); if (assets.negative() || assets.asset() != vault->at(sfAsset)) return std::nullopt; // LCOV_EXCL_LINE @@ -3574,10 +3572,10 @@ sharesToAssetsDeposit( { XRPL_ASSERT( !shares.negative(), - "ripple::sharesToAssetsDeposit : non-negative shares"); + "xrpl::sharesToAssetsDeposit : non-negative shares"); XRPL_ASSERT( shares.asset() == vault->at(sfShareMPTID), - "ripple::sharesToAssetsDeposit : shares and vault match"); + "xrpl::sharesToAssetsDeposit : shares and vault match"); if (shares.negative() || shares.asset() != vault->at(sfShareMPTID)) return std::nullopt; // LCOV_EXCL_LINE @@ -3604,10 +3602,10 @@ assetsToSharesWithdraw( { XRPL_ASSERT( !assets.negative(), - "ripple::assetsToSharesDeposit : non-negative assets"); + "xrpl::assetsToSharesDeposit : non-negative assets"); XRPL_ASSERT( assets.asset() == vault->at(sfAsset), - "ripple::assetsToSharesWithdraw : assets and vault match"); + "xrpl::assetsToSharesWithdraw : assets and vault match"); if (assets.negative() || assets.asset() != vault->at(sfAsset)) return std::nullopt; // LCOV_EXCL_LINE @@ -3632,10 +3630,10 @@ sharesToAssetsWithdraw( { XRPL_ASSERT( !shares.negative(), - "ripple::sharesToAssetsDeposit : non-negative shares"); + "xrpl::sharesToAssetsDeposit : non-negative shares"); XRPL_ASSERT( shares.asset() == vault->at(sfShareMPTID), - "ripple::sharesToAssetsWithdraw : shares and vault match"); + "xrpl::sharesToAssetsWithdraw : shares and vault match"); if (shares.negative() || shares.asset() != vault->at(sfShareMPTID)) return std::nullopt; // LCOV_EXCL_LINE @@ -3758,7 +3756,7 @@ rippleUnlockEscrowMPT( if (!view.rules().enabled(fixTokenEscrowV1)) XRPL_ASSERT( netAmount == grossAmount, - "ripple::rippleUnlockEscrowMPT : netAmount == grossAmount"); + "xrpl::rippleUnlockEscrowMPT : netAmount == grossAmount"); auto const& issuer = netAmount.getIssuer(); auto const& mptIssue = netAmount.get(); @@ -3926,4 +3924,4 @@ after(NetClock::time_point now, std::uint32_t mark) return now.time_since_epoch().count() > mark; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/net/HTTPClient.cpp b/src/libxrpl/net/HTTPClient.cpp index 807b5f9823..6057d81a1e 100644 --- a/src/libxrpl/net/HTTPClient.cpp +++ b/src/libxrpl/net/HTTPClient.cpp @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { static std::optional httpClientSSLContext; @@ -605,4 +605,4 @@ HTTPClient::request( client->request(bSSL, deqSites, setRequest, timeout, complete); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/net/RegisterSSLCerts.cpp b/src/libxrpl/net/RegisterSSLCerts.cpp index b93e70463b..f489cf29a3 100644 --- a/src/libxrpl/net/RegisterSSLCerts.cpp +++ b/src/libxrpl/net/RegisterSSLCerts.cpp @@ -13,7 +13,7 @@ #include #endif -namespace ripple { +namespace xrpl { void registerSSLCerts( @@ -89,7 +89,7 @@ registerSSLCerts( #endif } -} // namespace ripple +} // namespace xrpl // There is a very unpleasant interaction between and // openssl x509 types (namely the former has macros that stomp diff --git a/src/libxrpl/nodestore/BatchWriter.cpp b/src/libxrpl/nodestore/BatchWriter.cpp index cb5f7bb436..3ce7900480 100644 --- a/src/libxrpl/nodestore/BatchWriter.cpp +++ b/src/libxrpl/nodestore/BatchWriter.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { BatchWriter::BatchWriter(Callback& callback, Scheduler& scheduler) @@ -66,7 +66,7 @@ BatchWriter::writeBatch() mWriteSet.swap(set); XRPL_ASSERT( mWriteSet.empty(), - "ripple::NodeStore::BatchWriter::writeBatch : writes not set"); + "xrpl::NodeStore::BatchWriter::writeBatch : writes not set"); mWriteLoad = set.size(); if (set.empty()) @@ -102,4 +102,4 @@ BatchWriter::waitForWriting() } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/Database.cpp b/src/libxrpl/nodestore/Database.cpp index e80efee115..41e8ac8632 100644 --- a/src/libxrpl/nodestore/Database.cpp +++ b/src/libxrpl/nodestore/Database.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { Database::Database( @@ -24,7 +24,7 @@ Database::Database( { XRPL_ASSERT( readThreads, - "ripple::NodeStore::Database::Database : nonzero threads input"); + "xrpl::NodeStore::Database::Database : nonzero threads input"); if (earliestLedgerSeq_ < 1) Throw("Invalid earliest_seq"); @@ -73,7 +73,7 @@ Database::Database( { XRPL_ASSERT( !it->second.empty(), - "ripple::NodeStore::Database::Database : non-empty " + "xrpl::NodeStore::Database::Database : non-empty " "data"); auto const& hash = it->first; @@ -150,7 +150,7 @@ Database::stop() { XRPL_ASSERT( steady_clock::now() - start < 30s, - "ripple::NodeStore::Database::stop : maximum stop duration"); + "xrpl::NodeStore::Database::stop : maximum stop duration"); std::this_thread::yield(); } @@ -203,7 +203,7 @@ Database::importInternal(Backend& dstBackend, Database& srcDB) srcDB.for_each([&](std::shared_ptr nodeObject) { XRPL_ASSERT( nodeObject, - "ripple::NodeStore::Database::importInternal : non-null node"); + "xrpl::NodeStore::Database::importInternal : non-null node"); if (!nodeObject) // This should never happen return; @@ -249,7 +249,7 @@ Database::getCountsJson(Json::Value& obj) { XRPL_ASSERT( obj.isObject(), - "ripple::NodeStore::Database::getCountsJson : valid input type"); + "xrpl::NodeStore::Database::getCountsJson : valid input type"); { std::unique_lock lock(readLock_); @@ -269,4 +269,4 @@ Database::getCountsJson(Json::Value& obj) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/DatabaseNodeImp.cpp b/src/libxrpl/nodestore/DatabaseNodeImp.cpp index a83d531b66..0578351e58 100644 --- a/src/libxrpl/nodestore/DatabaseNodeImp.cpp +++ b/src/libxrpl/nodestore/DatabaseNodeImp.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { void @@ -194,4 +194,4 @@ DatabaseNodeImp::fetchBatch(std::vector const& hashes) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp index dabe38ec8b..f51771f023 100644 --- a/src/libxrpl/nodestore/DatabaseRotatingImp.cpp +++ b/src/libxrpl/nodestore/DatabaseRotatingImp.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { DatabaseRotatingImp::DatabaseRotatingImp( @@ -192,4 +192,4 @@ DatabaseRotatingImp::for_each( } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/DecodedBlob.cpp b/src/libxrpl/nodestore/DecodedBlob.cpp index 11387ed8c8..e3d54fae78 100644 --- a/src/libxrpl/nodestore/DecodedBlob.cpp +++ b/src/libxrpl/nodestore/DecodedBlob.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { DecodedBlob::DecodedBlob(void const* key, void const* value, int valueBytes) @@ -56,7 +56,7 @@ DecodedBlob::createObject() { XRPL_ASSERT( m_success, - "ripple::NodeStore::DecodedBlob::createObject : valid object type"); + "xrpl::NodeStore::DecodedBlob::createObject : valid object type"); std::shared_ptr object; @@ -72,4 +72,4 @@ DecodedBlob::createObject() } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/DummyScheduler.cpp b/src/libxrpl/nodestore/DummyScheduler.cpp index 9ba7c25cfb..21c1b5c92e 100644 --- a/src/libxrpl/nodestore/DummyScheduler.cpp +++ b/src/libxrpl/nodestore/DummyScheduler.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { void @@ -21,4 +21,4 @@ DummyScheduler::onBatchWrite(BatchWriteReport const& report) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/ManagerImp.cpp b/src/libxrpl/nodestore/ManagerImp.cpp index 627550c4e9..b53d03e668 100644 --- a/src/libxrpl/nodestore/ManagerImp.cpp +++ b/src/libxrpl/nodestore/ManagerImp.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -95,7 +95,7 @@ ManagerImp::erase(Factory& factory) }); XRPL_ASSERT( iter != list_.end(), - "ripple::NodeStore::ManagerImp::erase : valid input"); + "xrpl::NodeStore::ManagerImp::erase : valid input"); list_.erase(iter); } @@ -121,4 +121,4 @@ Manager::instance() } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/NodeObject.cpp b/src/libxrpl/nodestore/NodeObject.cpp index 953a23b70e..3758862e18 100644 --- a/src/libxrpl/nodestore/NodeObject.cpp +++ b/src/libxrpl/nodestore/NodeObject.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { //------------------------------------------------------------------------------ @@ -40,4 +40,4 @@ NodeObject::getData() const return mData; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/backend/MemoryFactory.cpp b/src/libxrpl/nodestore/backend/MemoryFactory.cpp index d4f14b7560..923ae95ebb 100644 --- a/src/libxrpl/nodestore/backend/MemoryFactory.cpp +++ b/src/libxrpl/nodestore/backend/MemoryFactory.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { struct MemoryDB @@ -122,7 +122,7 @@ public: fetch(void const* key, std::shared_ptr* pObject) override { XRPL_ASSERT( - db_, "ripple::NodeStore::MemoryBackend::fetch : non-null database"); + db_, "xrpl::NodeStore::MemoryBackend::fetch : non-null database"); uint256 const hash(uint256::fromVoid(key)); std::lock_guard _(db_->mutex); @@ -159,7 +159,7 @@ public: store(std::shared_ptr const& object) override { XRPL_ASSERT( - db_, "ripple::NodeStore::MemoryBackend::store : non-null database"); + db_, "xrpl::NodeStore::MemoryBackend::store : non-null database"); std::lock_guard _(db_->mutex); db_->table.emplace(object->getHash(), object); } @@ -181,7 +181,7 @@ public: { XRPL_ASSERT( db_, - "ripple::NodeStore::MemoryBackend::for_each : non-null database"); + "xrpl::NodeStore::MemoryBackend::for_each : non-null database"); for (auto const& e : db_->table) f(e.second); } @@ -229,4 +229,4 @@ MemoryFactory::createInstance( } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/backend/NuDBFactory.cpp b/src/libxrpl/nodestore/backend/NuDBFactory.cpp index 9d4297ac27..71a5811162 100644 --- a/src/libxrpl/nodestore/backend/NuDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/NuDBFactory.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { class NuDBBackend : public Backend @@ -113,7 +113,7 @@ public: { // LCOV_EXCL_START UNREACHABLE( - "ripple::NodeStore::NuDBBackend::open : database is already " + "xrpl::NodeStore::NuDBBackend::open : database is already " "open"); JLOG(j_.error()) << "database is already open"; return; @@ -455,4 +455,4 @@ registerNuDBFactory(Manager& manager) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/backend/NullFactory.cpp b/src/libxrpl/nodestore/backend/NullFactory.cpp index f533693416..ffe1eb931f 100644 --- a/src/libxrpl/nodestore/backend/NullFactory.cpp +++ b/src/libxrpl/nodestore/backend/NullFactory.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { class NullBackend : public Backend @@ -126,4 +126,4 @@ registerNullFactory(Manager& manager) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp index 01e87f338e..97d5484554 100644 --- a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { class RocksDBEnv : public rocksdb::EnvWrapper @@ -213,7 +213,7 @@ public: { // LCOV_EXCL_START UNREACHABLE( - "ripple::NodeStore::RocksDBBackend::open : database is already " + "xrpl::NodeStore::RocksDBBackend::open : database is already " "open"); JLOG(m_journal.error()) << "database is already open"; return; @@ -261,8 +261,7 @@ public: fetch(void const* key, std::shared_ptr* pObject) override { XRPL_ASSERT( - m_db, - "ripple::NodeStore::RocksDBBackend::fetch : non-null database"); + m_db, "xrpl::NodeStore::RocksDBBackend::fetch : non-null database"); pObject->reset(); Status status(ok); @@ -340,7 +339,7 @@ public: { XRPL_ASSERT( m_db, - "ripple::NodeStore::RocksDBBackend::storeBatch : non-null " + "xrpl::NodeStore::RocksDBBackend::storeBatch : non-null " "database"); rocksdb::WriteBatch wb; @@ -375,7 +374,7 @@ public: { XRPL_ASSERT( m_db, - "ripple::NodeStore::RocksDBBackend::for_each : non-null database"); + "xrpl::NodeStore::RocksDBBackend::for_each : non-null database"); rocksdb::ReadOptions const options; std::unique_ptr it(m_db->NewIterator(options)); @@ -477,6 +476,6 @@ registerRocksDBFactory(Manager& manager) } } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/libxrpl/protocol/AMMCore.cpp b/src/libxrpl/protocol/AMMCore.cpp index a91da3ff6c..71ce6ea98e 100644 --- a/src/libxrpl/protocol/AMMCore.cpp +++ b/src/libxrpl/protocol/AMMCore.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { Currency ammLPTCurrency(Currency const& cur1, Currency const& cur2) @@ -93,7 +93,7 @@ ammAuctionTimeSlot(std::uint64_t current, STObject const& auctionSlot) auto const expiration = auctionSlot[sfExpiration]; XRPL_ASSERT( expiration >= TOTAL_TIME_SLOT_SECS, - "ripple::ammAuctionTimeSlot : minimum expiration"); + "xrpl::ammAuctionTimeSlot : minimum expiration"); if (expiration >= TOTAL_TIME_SLOT_SECS) { if (auto const start = expiration - TOTAL_TIME_SLOT_SECS; @@ -112,4 +112,4 @@ ammEnabled(Rules const& rules) return rules.enabled(featureAMM) && rules.enabled(fixUniversalNumber); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/AccountID.cpp b/src/libxrpl/protocol/AccountID.cpp index 4032d4f829..779018613f 100644 --- a/src/libxrpl/protocol/AccountID.cpp +++ b/src/libxrpl/protocol/AccountID.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -68,7 +68,7 @@ public: XRPL_ASSERT( ret.size() <= 38, - "ripple::detail::AccountIdCache : maximum result size"); + "xrpl::detail::AccountIdCache : maximum result size"); { std::lock_guard lock(sl); @@ -181,4 +181,4 @@ to_issuer(AccountID& issuer, std::string const& s) return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Asset.cpp b/src/libxrpl/protocol/Asset.cpp index 54c6732825..1a4a94f744 100644 --- a/src/libxrpl/protocol/Asset.cpp +++ b/src/libxrpl/protocol/Asset.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { AccountID const& Asset::getIssuer() const @@ -66,4 +66,4 @@ assetFromJson(Json::Value const& v) return mptIssueFromJson(v); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Book.cpp b/src/libxrpl/protocol/Book.cpp index 0315cf83ae..d26aaf3384 100644 --- a/src/libxrpl/protocol/Book.cpp +++ b/src/libxrpl/protocol/Book.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { bool isConsistent(Book const& book) @@ -32,4 +32,4 @@ reversed(Book const& book) return Book(book.out, book.in, book.domain); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/BuildInfo.cpp b/src/libxrpl/protocol/BuildInfo.cpp index 7690ae586b..472a8cb039 100644 --- a/src/libxrpl/protocol/BuildInfo.cpp +++ b/src/libxrpl/protocol/BuildInfo.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace BuildInfo { @@ -159,4 +159,4 @@ isNewerVersion(std::uint64_t version) } // namespace BuildInfo -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/ErrorCodes.cpp b/src/libxrpl/protocol/ErrorCodes.cpp index 5d7accb4a1..f37ba0c8e4 100644 --- a/src/libxrpl/protocol/ErrorCodes.cpp +++ b/src/libxrpl/protocol/ErrorCodes.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { namespace detail { @@ -205,8 +205,8 @@ rpcErrorString(Json::Value const& jv) { XRPL_ASSERT( RPC::contains_error(jv), - "ripple::RPC::rpcErrorString : input contains an error"); + "xrpl::RPC::rpcErrorString : input contains an error"); return jv[jss::error].asString() + jv[jss::error_message].asString(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Feature.cpp b/src/libxrpl/protocol/Feature.cpp index 10c42ccb8a..dc4fd105b5 100644 --- a/src/libxrpl/protocol/Feature.cpp +++ b/src/libxrpl/protocol/Feature.cpp @@ -19,10 +19,10 @@ #include #include -namespace ripple { +namespace xrpl { inline std::size_t -hash_value(ripple::uint256 const& feature) +hash_value(xrpl::uint256 const& feature) { std::size_t seed = 0; using namespace boost; @@ -205,7 +205,7 @@ public: FeatureCollections::FeatureCollections() { - features.reserve(ripple::detail::numFeatures); + features.reserve(xrpl::detail::numFeatures); } std::optional @@ -213,7 +213,7 @@ FeatureCollections::getRegisteredFeature(std::string const& name) const { XRPL_ASSERT( readOnly.load(), - "ripple::FeatureCollections::getRegisteredFeature : startup completed"); + "xrpl::FeatureCollections::getRegisteredFeature : startup completed"); Feature const* feature = getByName(name); if (feature) return feature->feature; @@ -294,7 +294,7 @@ FeatureCollections::featureToBitsetIndex(uint256 const& f) const { XRPL_ASSERT( readOnly.load(), - "ripple::FeatureCollections::featureToBitsetIndex : startup completed"); + "xrpl::FeatureCollections::featureToBitsetIndex : startup completed"); Feature const* feature = getByFeature(f); if (!feature) @@ -308,7 +308,7 @@ FeatureCollections::bitsetIndexToFeature(size_t i) const { XRPL_ASSERT( readOnly.load(), - "ripple::FeatureCollections::bitsetIndexToFeature : startup completed"); + "xrpl::FeatureCollections::bitsetIndexToFeature : startup completed"); Feature const& feature = getByIndex(i); return feature.feature; } @@ -318,7 +318,7 @@ FeatureCollections::featureToName(uint256 const& f) const { XRPL_ASSERT( readOnly.load(), - "ripple::FeatureCollections::featureToName : startup completed"); + "xrpl::FeatureCollections::featureToName : startup completed"); Feature const* feature = getByFeature(f); return feature ? feature->name : to_string(f); } @@ -452,4 +452,4 @@ featureToName(uint256 const& f) [[maybe_unused]] static bool const readOnlySet = featureCollections.registrationIsDone(); -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/IOUAmount.cpp b/src/libxrpl/protocol/IOUAmount.cpp index 3c893709d7..01283886e1 100644 --- a/src/libxrpl/protocol/IOUAmount.cpp +++ b/src/libxrpl/protocol/IOUAmount.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace { @@ -303,4 +303,4 @@ mulRatio( return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Indexes.cpp b/src/libxrpl/protocol/Indexes.cpp index b80f648c98..77fcd44a3e 100644 --- a/src/libxrpl/protocol/Indexes.cpp +++ b/src/libxrpl/protocol/Indexes.cpp @@ -25,7 +25,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Type-specific prefix for calculating ledger indices. @@ -97,8 +97,7 @@ indexHash(LedgerNameSpace space, Args const&... args) uint256 getBookBase(Book const& book) { - XRPL_ASSERT( - isConsistent(book), "ripple::getBookBase : input is consistent"); + XRPL_ASSERT(isConsistent(book), "xrpl::getBookBase : input is consistent"); auto const index = book.domain ? indexHash( LedgerNameSpace::BOOK_DIR, @@ -145,7 +144,7 @@ getTicketIndex(AccountID const& account, std::uint32_t ticketSeq) uint256 getTicketIndex(AccountID const& account, SeqProxy ticketSeq) { - XRPL_ASSERT(ticketSeq.isTicket(), "ripple::getTicketIndex : valid input"); + XRPL_ASSERT(ticketSeq.isTicket(), "xrpl::getTicketIndex : valid input"); return getTicketIndex(account, ticketSeq.value()); } @@ -232,7 +231,7 @@ line( // There is code in SetTrust that calls us with id0 == id1, to allow users // to locate and delete such "weird" trustlines. If we remove that code, we // could enable this assert: - // XRPL_ASSERT(id0 != id1, "ripple::keylet::line : accounts must be + // XRPL_ASSERT(id0 != id1, "xrpl::keylet::line : accounts must be // different"); // A trust line is shared between two accounts; while we typically think @@ -263,7 +262,7 @@ Keylet quality(Keylet const& k, std::uint64_t q) noexcept { XRPL_ASSERT( - k.type == ltDIR_NODE, "ripple::keylet::quality : valid input type"); + k.type == ltDIR_NODE, "xrpl::keylet::quality : valid input type"); // Indexes are stored in big endian format: they print as hex as stored. // Most significant bytes are first and the least significant bytes @@ -283,7 +282,7 @@ next_t::operator()(Keylet const& k) const { XRPL_ASSERT( k.type == ltDIR_NODE, - "ripple::keylet::next_t::operator() : valid input type"); + "xrpl::keylet::next_t::operator() : valid input type"); return {ltDIR_NODE, getQualityNext(k.key)}; } @@ -402,7 +401,7 @@ Keylet nftpage(Keylet const& k, uint256 const& token) { XRPL_ASSERT( - k.type == ltNFTOKEN_PAGE, "ripple::keylet::nftpage : valid input type"); + k.type == ltNFTOKEN_PAGE, "xrpl::keylet::nftpage : valid input type"); return {ltNFTOKEN_PAGE, (k.key & ~nft::pageMask) + (token & nft::pageMask)}; } @@ -577,4 +576,4 @@ permissionedDomain(uint256 const& domainID) noexcept } // namespace keylet -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/InnerObjectFormats.cpp b/src/libxrpl/protocol/InnerObjectFormats.cpp index d720c6c665..3eb73e7c9b 100644 --- a/src/libxrpl/protocol/InnerObjectFormats.cpp +++ b/src/libxrpl/protocol/InnerObjectFormats.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { InnerObjectFormats::InnerObjectFormats() { @@ -180,4 +180,4 @@ InnerObjectFormats::findSOTemplateBySField(SField const& sField) const return nullptr; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Issue.cpp b/src/libxrpl/protocol/Issue.cpp index 205648fe4d..b858a31e3e 100644 --- a/src/libxrpl/protocol/Issue.cpp +++ b/src/libxrpl/protocol/Issue.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string Issue::getText() const @@ -132,4 +132,4 @@ operator<<(std::ostream& os, Issue const& x) return os; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Keylet.cpp b/src/libxrpl/protocol/Keylet.cpp index 9d2202e19b..2c65bb9ed4 100644 --- a/src/libxrpl/protocol/Keylet.cpp +++ b/src/libxrpl/protocol/Keylet.cpp @@ -3,14 +3,14 @@ #include #include -namespace ripple { +namespace xrpl { bool Keylet::check(STLedgerEntry const& sle) const { XRPL_ASSERT( sle.getType() != ltANY || sle.getType() != ltCHILD, - "ripple::Keylet::check : valid input type"); + "xrpl::Keylet::check : valid input type"); if (type == ltANY) return true; @@ -21,4 +21,4 @@ Keylet::check(STLedgerEntry const& sle) const return sle.getType() == type && sle.key() == key; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/LedgerFormats.cpp b/src/libxrpl/protocol/LedgerFormats.cpp index 908b28ae43..2056cfab7b 100644 --- a/src/libxrpl/protocol/LedgerFormats.cpp +++ b/src/libxrpl/protocol/LedgerFormats.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { LedgerFormats::LedgerFormats() { @@ -40,4 +40,4 @@ LedgerFormats::getInstance() return instance; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/LedgerHeader.cpp b/src/libxrpl/protocol/LedgerHeader.cpp index 84d026b613..5258bdbc22 100644 --- a/src/libxrpl/protocol/LedgerHeader.cpp +++ b/src/libxrpl/protocol/LedgerHeader.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { void addRaw(LedgerHeader const& info, Serializer& s, bool includeHash) @@ -52,4 +52,4 @@ deserializePrefixedHeader(Slice data, bool hasHash) return deserializeHeader(data + 4, hasHash); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/MPTAmount.cpp b/src/libxrpl/protocol/MPTAmount.cpp index 046e81199a..1950407ab5 100644 --- a/src/libxrpl/protocol/MPTAmount.cpp +++ b/src/libxrpl/protocol/MPTAmount.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { MPTAmount& MPTAmount::operator+=(MPTAmount const& other) @@ -46,4 +46,4 @@ MPTAmount::minPositiveAmount() return MPTAmount{1}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/MPTIssue.cpp b/src/libxrpl/protocol/MPTIssue.cpp index c7d54ee6d6..c92ac60b73 100644 --- a/src/libxrpl/protocol/MPTIssue.cpp +++ b/src/libxrpl/protocol/MPTIssue.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { MPTIssue::MPTIssue(MPTID const& issuanceID) : mptID_(issuanceID) { @@ -88,4 +88,4 @@ mptIssueFromJson(Json::Value const& v) return MPTIssue{id}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/NFTSyntheticSerializer.cpp b/src/libxrpl/protocol/NFTSyntheticSerializer.cpp index ee677b798c..e4ce3b7611 100644 --- a/src/libxrpl/protocol/NFTSyntheticSerializer.cpp +++ b/src/libxrpl/protocol/NFTSyntheticSerializer.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { void @@ -22,4 +22,4 @@ insertNFTSyntheticInJson( } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/NFTokenID.cpp b/src/libxrpl/protocol/NFTokenID.cpp index 50a6f30bf8..64fadce3c9 100644 --- a/src/libxrpl/protocol/NFTokenID.cpp +++ b/src/libxrpl/protocol/NFTokenID.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { bool canHaveNFTokenID( @@ -184,4 +184,4 @@ insertNFTokenID( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/NFTokenOfferID.cpp b/src/libxrpl/protocol/NFTokenOfferID.cpp index 77b836207f..b1a08081c0 100644 --- a/src/libxrpl/protocol/NFTokenOfferID.cpp +++ b/src/libxrpl/protocol/NFTokenOfferID.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { bool canHaveNFTokenOfferID( @@ -64,4 +64,4 @@ insertNFTokenOfferID( response[jss::offer_id] = to_string(result.value()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Permissions.cpp b/src/libxrpl/protocol/Permissions.cpp index c73e38304f..a5d447a23c 100644 --- a/src/libxrpl/protocol/Permissions.cpp +++ b/src/libxrpl/protocol/Permissions.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { Permission::Permission() { @@ -71,7 +71,7 @@ Permission::Permission() for ([[maybe_unused]] auto const& permission : granularPermissionMap_) XRPL_ASSERT( permission.second > UINT16_MAX, - "ripple::Permission::granularPermissionMap_ : granular permission " + "xrpl::Permission::granularPermissionMap_ : granular permission " "value must not exceed the maximum uint16_t value."); } @@ -134,7 +134,7 @@ Permission::getTxFeature(TxType txType) const auto const txFeaturesIt = txFeatureMap_.find(txType); XRPL_ASSERT( txFeaturesIt != txFeatureMap_.end(), - "ripple::Permissions::getTxFeature : tx exists in txFeatureMap_"); + "xrpl::Permissions::getTxFeature : tx exists in txFeatureMap_"); if (txFeaturesIt->second == uint256{}) return std::nullopt; @@ -161,7 +161,7 @@ Permission::isDelegatable( auto const txFeaturesIt = txFeatureMap_.find(txType); XRPL_ASSERT( txFeaturesIt != txFeatureMap_.end(), - "ripple::Permissions::isDelegatable : tx exists in txFeatureMap_"); + "xrpl::Permissions::isDelegatable : tx exists in txFeatureMap_"); // Delegation is only allowed if the required amendment for the transaction // is enabled. For transactions that do not require an amendment, delegation @@ -188,4 +188,4 @@ Permission::permissionToTxType(uint32_t const& value) const return static_cast(value - 1); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/PublicKey.cpp b/src/libxrpl/protocol/PublicKey.cpp index 5e3a0b651b..2dcf484adc 100644 --- a/src/libxrpl/protocol/PublicKey.cpp +++ b/src/libxrpl/protocol/PublicKey.cpp @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { std::ostream& operator<<(std::ostream& os, PublicKey const& pk) @@ -301,4 +301,4 @@ calcNodeID(PublicKey const& pk) return NodeID{static_cast(h)}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Quality.cpp b/src/libxrpl/protocol/Quality.cpp index f20145036b..cd56f237fc 100644 --- a/src/libxrpl/protocol/Quality.cpp +++ b/src/libxrpl/protocol/Quality.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { Quality::Quality(std::uint64_t value) : m_value(value) { @@ -21,7 +21,7 @@ Quality::Quality(Amounts const& amount) Quality& Quality::operator++() { - XRPL_ASSERT(m_value > 0, "ripple::Quality::operator++() : minimum value"); + XRPL_ASSERT(m_value > 0, "xrpl::Quality::operator++() : minimum value"); --m_value; return *this; } @@ -39,7 +39,7 @@ Quality::operator--() { XRPL_ASSERT( m_value < std::numeric_limits::max(), - "ripple::Quality::operator--() : maximum value"); + "xrpl::Quality::operator--() : maximum value"); ++m_value; return *this; } @@ -70,11 +70,10 @@ ceil_in_impl( if (result.out > amount.out) result.out = amount.out; XRPL_ASSERT( - result.in == limit, "ripple::ceil_in_impl : result matches limit"); + result.in == limit, "xrpl::ceil_in_impl : result matches limit"); return result; } - XRPL_ASSERT( - amount.in <= limit, "ripple::ceil_in_impl : result inside limit"); + XRPL_ASSERT(amount.in <= limit, "xrpl::ceil_in_impl : result inside limit"); return amount; } @@ -111,12 +110,11 @@ ceil_out_impl( if (result.in > amount.in) result.in = amount.in; XRPL_ASSERT( - result.out == limit, - "ripple::ceil_out_impl : result matches limit"); + result.out == limit, "xrpl::ceil_out_impl : result matches limit"); return result; } XRPL_ASSERT( - amount.out <= limit, "ripple::ceil_out_impl : result inside limit"); + amount.out <= limit, "xrpl::ceil_out_impl : result inside limit"); return amount; } @@ -140,13 +138,12 @@ composed_quality(Quality const& lhs, Quality const& rhs) { STAmount const lhs_rate(lhs.rate()); XRPL_ASSERT( - lhs_rate != beast::zero, - "ripple::composed_quality : nonzero left input"); + lhs_rate != beast::zero, "xrpl::composed_quality : nonzero left input"); STAmount const rhs_rate(rhs.rate()); XRPL_ASSERT( rhs_rate != beast::zero, - "ripple::composed_quality : nonzero right input"); + "xrpl::composed_quality : nonzero right input"); STAmount const rate(mulRound(lhs_rate, rhs_rate, lhs_rate.asset(), true)); @@ -155,7 +152,7 @@ composed_quality(Quality const& lhs, Quality const& rhs) XRPL_ASSERT( (stored_exponent > 0) && (stored_exponent <= 255), - "ripple::composed_quality : valid exponent"); + "xrpl::composed_quality : valid exponent"); return Quality((stored_exponent << (64 - 8)) | stored_mantissa); } @@ -192,4 +189,4 @@ Quality::round(int digits) const return Quality{(exponent << (64 - 8)) | mantissa}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/QualityFunction.cpp b/src/libxrpl/protocol/QualityFunction.cpp index 8273743cfa..b254e1af86 100644 --- a/src/libxrpl/protocol/QualityFunction.cpp +++ b/src/libxrpl/protocol/QualityFunction.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { QualityFunction::QualityFunction( Quality const& quality, @@ -42,4 +42,4 @@ QualityFunction::outFromAvgQ(Quality const& quality) return std::nullopt; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/RPCErr.cpp b/src/libxrpl/protocol/RPCErr.cpp index 4984f91279..658dd06b3d 100644 --- a/src/libxrpl/protocol/RPCErr.cpp +++ b/src/libxrpl/protocol/RPCErr.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { struct RPCErr; @@ -23,4 +23,4 @@ isRpcError(Json::Value jvResult) return jvResult.isObject() && jvResult.isMember(jss::error); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Rate2.cpp b/src/libxrpl/protocol/Rate2.cpp index 36c6ae37f9..511b28cc67 100644 --- a/src/libxrpl/protocol/Rate2.cpp +++ b/src/libxrpl/protocol/Rate2.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { Rate const parityRate(QUALITY_ONE); @@ -33,7 +33,7 @@ transferFeeAsRate(std::uint16_t fee) STAmount multiply(STAmount const& amount, Rate const& rate) { - XRPL_ASSERT(rate.value, "ripple::nft::multiply : nonzero rate input"); + XRPL_ASSERT(rate.value, "xrpl::nft::multiply : nonzero rate input"); if (rate == parityRate) return amount; @@ -44,7 +44,7 @@ multiply(STAmount const& amount, Rate const& rate) STAmount multiplyRound(STAmount const& amount, Rate const& rate, bool roundUp) { - XRPL_ASSERT(rate.value, "ripple::nft::multiplyRound : nonzero rate input"); + XRPL_ASSERT(rate.value, "xrpl::nft::multiplyRound : nonzero rate input"); if (rate == parityRate) return amount; @@ -60,7 +60,7 @@ multiplyRound( bool roundUp) { XRPL_ASSERT( - rate.value, "ripple::nft::multiplyRound(Issue) : nonzero rate input"); + rate.value, "xrpl::nft::multiplyRound(Issue) : nonzero rate input"); if (rate == parityRate) { @@ -73,7 +73,7 @@ multiplyRound( STAmount divide(STAmount const& amount, Rate const& rate) { - XRPL_ASSERT(rate.value, "ripple::nft::divide : nonzero rate input"); + XRPL_ASSERT(rate.value, "xrpl::nft::divide : nonzero rate input"); if (rate == parityRate) return amount; @@ -84,7 +84,7 @@ divide(STAmount const& amount, Rate const& rate) STAmount divideRound(STAmount const& amount, Rate const& rate, bool roundUp) { - XRPL_ASSERT(rate.value, "ripple::nft::divideRound : nonzero rate input"); + XRPL_ASSERT(rate.value, "xrpl::nft::divideRound : nonzero rate input"); if (rate == parityRate) return amount; @@ -100,7 +100,7 @@ divideRound( bool roundUp) { XRPL_ASSERT( - rate.value, "ripple::nft::divideRound(Issue) : nonzero rate input"); + rate.value, "xrpl::nft::divideRound(Issue) : nonzero rate input"); if (rate == parityRate) return amount; @@ -108,4 +108,4 @@ divideRound( return divRound(amount, detail::as_amount(rate), asset, roundUp); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Rules.cpp b/src/libxrpl/protocol/Rules.cpp index 7d84c4e7da..b1f2c2d631 100644 --- a/src/libxrpl/protocol/Rules.cpp +++ b/src/libxrpl/protocol/Rules.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace { // Use a static inside a function to help prevent order-of-initialization issues @@ -82,7 +82,7 @@ public: return false; XRPL_ASSERT( presets_ == other.presets_, - "ripple::Rules::Impl::operator==(Impl) const : input presets do " + "xrpl::Rules::Impl::operator==(Impl) const : input presets do " "match"); return *digest_ == *other.digest_; } @@ -110,7 +110,7 @@ Rules::presets() const bool Rules::enabled(uint256 const& feature) const { - XRPL_ASSERT(impl_, "ripple::Rules::enabled : initialized"); + XRPL_ASSERT(impl_, "xrpl::Rules::enabled : initialized"); return impl_->enabled(feature); } @@ -120,7 +120,7 @@ Rules::operator==(Rules const& other) const { XRPL_ASSERT( impl_ && other.impl_, - "ripple::Rules::operator==(Rules) const : both initialized"); + "xrpl::Rules::operator==(Rules) const : both initialized"); if (impl_.get() == other.impl_.get()) return true; return *impl_ == *other.impl_; @@ -139,4 +139,4 @@ isFeatureEnabled(uint256 const& feature) return rules && rules->enabled(feature); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/SField.cpp b/src/libxrpl/protocol/SField.cpp index 61d7aff930..54402ea6e2 100644 --- a/src/libxrpl/protocol/SField.cpp +++ b/src/libxrpl/protocol/SField.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { // Storage for static const members. SField::IsSigning const SField::notSigning; @@ -84,10 +84,10 @@ SField::SField( { XRPL_ASSERT( !knownCodeToField.contains(fieldCode), - "ripple::SField::SField(tid,fv,fn,meta,signing) : fieldCode is unique"); + "xrpl::SField::SField(tid,fv,fn,meta,signing) : fieldCode is unique"); XRPL_ASSERT( !knownNameToField.contains(fieldName), - "ripple::SField::SField(tid,fv,fn,meta,signing) : fieldName is unique"); + "xrpl::SField::SField(tid,fv,fn,meta,signing) : fieldName is unique"); knownCodeToField[fieldCode] = this; knownNameToField[fieldName] = this; } @@ -104,10 +104,10 @@ SField::SField(private_access_tag_t, int fc, char const* fn) { XRPL_ASSERT( !knownCodeToField.contains(fieldCode), - "ripple::SField::SField(fc,fn) : fieldCode is unique"); + "xrpl::SField::SField(fc,fn) : fieldCode is unique"); XRPL_ASSERT( !knownNameToField.contains(fieldName), - "ripple::SField::SField(fc,fn) : fieldName is unique"); + "xrpl::SField::SField(fc,fn) : fieldName is unique"); knownCodeToField[fieldCode] = this; knownNameToField[fieldName] = this; } @@ -152,4 +152,4 @@ SField::getField(std::string const& fieldName) return sfInvalid; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/SOTemplate.cpp b/src/libxrpl/protocol/SOTemplate.cpp index 6bd5b7a5c6..46edf98710 100644 --- a/src/libxrpl/protocol/SOTemplate.cpp +++ b/src/libxrpl/protocol/SOTemplate.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { SOTemplate::SOTemplate( std::initializer_list uniqueFields, @@ -50,4 +50,4 @@ SOTemplate::getIndex(SField const& sField) const return indices_[sField.getNum()]; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STAccount.cpp b/src/libxrpl/protocol/STAccount.cpp index b452be7ee4..728fb25f6c 100644 --- a/src/libxrpl/protocol/STAccount.cpp +++ b/src/libxrpl/protocol/STAccount.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { STAccount::STAccount() : STBase(), value_(beast::zero), default_(true) { @@ -74,10 +74,10 @@ void STAccount::add(Serializer& s) const { XRPL_ASSERT( - getFName().isBinary(), "ripple::STAccount::add : field is binary"); + getFName().isBinary(), "xrpl::STAccount::add : field is binary"); XRPL_ASSERT( getFName().fieldType == STI_ACCOUNT, - "ripple::STAccount::add : valid field type"); + "xrpl::STAccount::add : valid field type"); // Preserve the serialization behavior of an STBlob: // o If we are default (all zeros) serialize as an empty blob. @@ -107,4 +107,4 @@ STAccount::getText() const return toBase58(value()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index 8b714193cc..824453a4d3 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -47,7 +47,7 @@ #include #include -namespace ripple { +namespace xrpl { static std::uint64_t const tenTo14 = 100000000000000ull; static std::uint64_t const tenTo14m1 = tenTo14 - 1; @@ -60,13 +60,13 @@ getInt64Value(STAmount const& amount, bool valid, char const* error) if (!valid) Throw(error); XRPL_ASSERT( - amount.exponent() == 0, "ripple::getInt64Value : exponent is zero"); + amount.exponent() == 0, "xrpl::getInt64Value : exponent is zero"); auto ret = static_cast(amount.mantissa()); XRPL_ASSERT( static_cast(ret) == amount.mantissa(), - "ripple::getInt64Value : mantissa must roundtrip"); + "xrpl::getInt64Value : mantissa must roundtrip"); if (amount.negative()) ret = -ret; @@ -195,7 +195,7 @@ STAmount::STAmount(SField const& name, std::uint64_t mantissa, bool negative) { XRPL_ASSERT( mValue <= std::numeric_limits::max(), - "ripple::STAmount::STAmount(SField, std::uint64_t, bool) : maximum " + "xrpl::STAmount::STAmount(SField, std::uint64_t, bool) : maximum " "mantissa input"); } @@ -208,7 +208,7 @@ STAmount::STAmount(SField const& name, STAmount const& from) { XRPL_ASSERT( mValue <= std::numeric_limits::max(), - "ripple::STAmount::STAmount(SField, STAmount) : maximum input"); + "xrpl::STAmount::STAmount(SField, STAmount) : maximum input"); canonicalize(); } @@ -222,7 +222,7 @@ STAmount::STAmount(std::uint64_t mantissa, bool negative) { XRPL_ASSERT( mValue <= std::numeric_limits::max(), - "ripple::STAmount::STAmount(std::uint64_t, bool) : maximum mantissa " + "xrpl::STAmount::STAmount(std::uint64_t, bool) : maximum mantissa " "input"); } @@ -268,7 +268,7 @@ STAmount::xrp() const "Cannot return non-native STAmount as XRPAmount"); auto drops = static_cast(mValue); - XRPL_ASSERT(mOffset == 0, "ripple::STAmount::xrp : amount is canonical"); + XRPL_ASSERT(mOffset == 0, "xrpl::STAmount::xrp : amount is canonical"); if (mIsNegative) drops = -drops; @@ -298,7 +298,7 @@ STAmount::mpt() const Throw("Cannot return STAmount as MPTAmount"); auto value = static_cast(mValue); - XRPL_ASSERT(mOffset == 0, "ripple::STAmount::mpt : amount is canonical"); + XRPL_ASSERT(mOffset == 0, "xrpl::STAmount::mpt : amount is canonical"); if (mIsNegative) value = -value; @@ -310,8 +310,7 @@ STAmount& STAmount::operator=(IOUAmount const& iou) { XRPL_ASSERT( - native() == false, - "ripple::STAmount::operator=(IOUAmount) : is not XRP"); + native() == false, "xrpl::STAmount::operator=(IOUAmount) : is not XRP"); mOffset = iou.exponent(); mIsNegative = iou < beast::zero; if (mIsNegative) @@ -452,7 +451,7 @@ getRate(STAmount const& offerOut, STAmount const& offerIn) return 0; XRPL_ASSERT( (r.exponent() >= -100) && (r.exponent() <= 155), - "ripple::getRate : exponent inside range"); + "xrpl::getRate : exponent inside range"); std::uint64_t ret = r.exponent() + 100; return (ret << (64 - 8)) | r.mantissa(); } @@ -689,7 +688,7 @@ STAmount::getText() const return ret; } - XRPL_ASSERT(mOffset + 43 > 0, "ripple::STAmount::getText : minimum offset"); + XRPL_ASSERT(mOffset + 43 > 0, "xrpl::STAmount::getText : minimum offset"); size_t const pad_prefix = 27; size_t const pad_suffix = 23; @@ -714,8 +713,7 @@ STAmount::getText() const pre_from += pad_prefix; XRPL_ASSERT( - post_to >= post_from, - "ripple::STAmount::getText : first distance check"); + post_to >= post_from, "xrpl::STAmount::getText : first distance check"); pre_from = std::find_if(pre_from, pre_to, [](char c) { return c != '0'; }); @@ -726,7 +724,7 @@ STAmount::getText() const XRPL_ASSERT( post_to >= post_from, - "ripple::STAmount::getText : second distance check"); + "xrpl::STAmount::getText : second distance check"); post_to = std::find_if( std::make_reverse_iterator(post_to), @@ -762,7 +760,7 @@ STAmount::add(Serializer& s) const { if (native()) { - XRPL_ASSERT(mOffset == 0, "ripple::STAmount::add : zero offset"); + XRPL_ASSERT(mOffset == 0, "xrpl::STAmount::add : zero offset"); if (!mIsNegative) s.add64(mValue | cPositive); @@ -937,13 +935,13 @@ STAmount::canonicalize() XRPL_ASSERT( (mValue == 0) || ((mValue >= cMinValue) && (mValue <= cMaxValue)), - "ripple::STAmount::canonicalize : value inside range"); + "xrpl::STAmount::canonicalize : value inside range"); XRPL_ASSERT( (mValue == 0) || ((mOffset >= cMinOffset) && (mOffset <= cMaxOffset)), - "ripple::STAmount::canonicalize : offset inside range"); + "xrpl::STAmount::canonicalize : offset inside range"); XRPL_ASSERT( (mValue != 0) || (mOffset != -100), - "ripple::STAmount::canonicalize : value or offset set"); + "xrpl::STAmount::canonicalize : value or offset set"); } void @@ -1748,4 +1746,4 @@ divRoundStrict( return divRoundImpl(num, den, asset, roundUp); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STArray.cpp b/src/libxrpl/protocol/STArray.cpp index 4d60e6f5ce..de1e6905c6 100644 --- a/src/libxrpl/protocol/STArray.cpp +++ b/src/libxrpl/protocol/STArray.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { STArray::STArray(STArray&& other) : STBase(other.getFName()), v_(std::move(other.v_)) @@ -180,4 +180,4 @@ STArray::sort(bool (*compare)(STObject const&, STObject const&)) std::sort(v_.begin(), v_.end(), compare); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STBase.cpp b/src/libxrpl/protocol/STBase.cpp index 0cbe575a2a..d3faf090eb 100644 --- a/src/libxrpl/protocol/STBase.cpp +++ b/src/libxrpl/protocol/STBase.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { STBase::STBase() : fName(&sfGeneric) { @@ -17,7 +17,7 @@ STBase::STBase() : fName(&sfGeneric) STBase::STBase(SField const& n) : fName(&n) { - XRPL_ASSERT(fName, "ripple::STBase::STBase : field is set"); + XRPL_ASSERT(fName, "xrpl::STBase::STBase : field is set"); } STBase& @@ -94,7 +94,7 @@ STBase::add(Serializer& s) const { // Should never be called // LCOV_EXCL_START - UNREACHABLE("ripple::STBase::add : not implemented"); + UNREACHABLE("xrpl::STBase::add : not implemented"); // LCOV_EXCL_STOP } @@ -103,7 +103,7 @@ STBase::isEquivalent(STBase const& t) const { XRPL_ASSERT( getSType() == STI_NOTPRESENT, - "ripple::STBase::isEquivalent : type not present"); + "xrpl::STBase::isEquivalent : type not present"); return t.getSType() == STI_NOTPRESENT; } @@ -117,7 +117,7 @@ void STBase::setFName(SField const& n) { fName = &n; - XRPL_ASSERT(fName, "ripple::STBase::setFName : field is set"); + XRPL_ASSERT(fName, "xrpl::STBase::setFName : field is set"); } SField const& @@ -130,7 +130,7 @@ void STBase::addFieldID(Serializer& s) const { XRPL_ASSERT( - fName->isBinary(), "ripple::STBase::addFieldID : field is binary"); + fName->isBinary(), "xrpl::STBase::addFieldID : field is binary"); s.addFieldID(fName->fieldType, fName->fieldValue); } @@ -142,4 +142,4 @@ operator<<(std::ostream& out, STBase const& t) return out << t.getFullText(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STBlob.cpp b/src/libxrpl/protocol/STBlob.cpp index 5b46f941de..65670a6a9f 100644 --- a/src/libxrpl/protocol/STBlob.cpp +++ b/src/libxrpl/protocol/STBlob.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { STBlob::STBlob(SerialIter& st, SField const& name) : STBase(name), value_(st.getVLBuffer()) @@ -43,11 +43,11 @@ STBlob::getText() const void STBlob::add(Serializer& s) const { - XRPL_ASSERT(getFName().isBinary(), "ripple::STBlob::add : field is binary"); + XRPL_ASSERT(getFName().isBinary(), "xrpl::STBlob::add : field is binary"); XRPL_ASSERT( (getFName().fieldType == STI_VL) || (getFName().fieldType == STI_ACCOUNT), - "ripple::STBlob::add : valid field type"); + "xrpl::STBlob::add : valid field type"); s.addVL(value_.data(), value_.size()); } @@ -64,4 +64,4 @@ STBlob::isDefault() const return value_.empty(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STCurrency.cpp b/src/libxrpl/protocol/STCurrency.cpp index 3b30e1b757..d4c10b48d3 100644 --- a/src/libxrpl/protocol/STCurrency.cpp +++ b/src/libxrpl/protocol/STCurrency.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { STCurrency::STCurrency(SField const& name) : STBase{name} { @@ -102,4 +102,4 @@ currencyFromJson(SField const& name, Json::Value const& v) return STCurrency{name, currency}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STInteger.cpp b/src/libxrpl/protocol/STInteger.cpp index c71e70e1b2..e701fc4203 100644 --- a/src/libxrpl/protocol/STInteger.cpp +++ b/src/libxrpl/protocol/STInteger.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { template <> STInteger::STInteger(SerialIter& sit, SField const& name) @@ -210,14 +210,14 @@ STUInt64::getJson(JsonOptions) const auto convertToString = [](uint64_t const value, int const base) { XRPL_ASSERT( base == 10 || base == 16, - "ripple::STUInt64::getJson : base 10 or 16"); + "xrpl::STUInt64::getJson : base 10 or 16"); std::string str( base == 10 ? 20 : 16, 0); // Allocate space depending on base auto ret = std::to_chars(str.data(), str.data() + str.size(), value, base); XRPL_ASSERT( ret.ec == std::errc(), - "ripple::STUInt64::getJson : to_chars succeeded"); + "xrpl::STUInt64::getJson : to_chars succeeded"); str.resize(std::distance(str.data(), ret.ptr)); return str; }; @@ -259,4 +259,4 @@ STInt32::getJson(JsonOptions) const return value_; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STIssue.cpp b/src/libxrpl/protocol/STIssue.cpp index 346f73d5ae..213c8b7962 100644 --- a/src/libxrpl/protocol/STIssue.cpp +++ b/src/libxrpl/protocol/STIssue.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { STIssue::STIssue(SField const& name) : STBase{name} { @@ -139,4 +139,4 @@ issueFromJson(SField const& name, Json::Value const& v) return STIssue{name, assetFromJson(v)}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STLedgerEntry.cpp b/src/libxrpl/protocol/STLedgerEntry.cpp index 5665bc1508..8ee3669a24 100644 --- a/src/libxrpl/protocol/STLedgerEntry.cpp +++ b/src/libxrpl/protocol/STLedgerEntry.cpp @@ -26,7 +26,7 @@ #include #include -namespace ripple { +namespace xrpl { STLedgerEntry::STLedgerEntry(Keylet const& k) : STObject(sfLedgerEntry), key_(k.key), type_(k.type) @@ -157,7 +157,7 @@ STLedgerEntry::thread( // this transaction is already threaded XRPL_ASSERT( getFieldU32(sfPreviousTxnLgrSeq) == ledgerSeq, - "ripple::STLedgerEntry::thread : ledger sequence match"); + "xrpl::STLedgerEntry::thread : ledger sequence match"); return false; } @@ -168,4 +168,4 @@ STLedgerEntry::thread( return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STNumber.cpp b/src/libxrpl/protocol/STNumber.cpp index c353f6b795..f85bb48e0a 100644 --- a/src/libxrpl/protocol/STNumber.cpp +++ b/src/libxrpl/protocol/STNumber.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { STNumber::STNumber(SField const& field, Number const& value) : STBase(field), value_(value) @@ -45,11 +45,10 @@ STNumber::getText() const void STNumber::add(Serializer& s) const { - XRPL_ASSERT( - getFName().isBinary(), "ripple::STNumber::add : field is binary"); + XRPL_ASSERT(getFName().isBinary(), "xrpl::STNumber::add : field is binary"); XRPL_ASSERT( getFName().fieldType == getSType(), - "ripple::STNumber::add : field type match"); + "xrpl::STNumber::add : field type match"); s.add64(value_.mantissa()); s.add32(value_.exponent()); } @@ -83,7 +82,7 @@ STNumber::isEquivalent(STBase const& t) const { XRPL_ASSERT( t.getSType() == this->getSType(), - "ripple::STNumber::isEquivalent : field type match"); + "xrpl::STNumber::isEquivalent : field type match"); STNumber const& v = dynamic_cast(t); return value_ == v; } @@ -196,4 +195,4 @@ numberFromJson(SField const& field, Json::Value const& value) return STNumber{field, Number{mantissa, parts.exponent}}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STObject.cpp b/src/libxrpl/protocol/STObject.cpp index 1c39eb9108..6007753ed1 100644 --- a/src/libxrpl/protocol/STObject.cpp +++ b/src/libxrpl/protocol/STObject.cpp @@ -39,7 +39,7 @@ #include #include -namespace ripple { +namespace xrpl { STObject::STObject(STObject&& other) : STBase(other.getFName()), v_(std::move(other.v_)), mType(other.mType) @@ -904,7 +904,7 @@ STObject::add(Serializer& s, WhichFields whichFields) const XRPL_ASSERT( (sType != STI_OBJECT) || (field->getFName().fieldType == STI_OBJECT), - "ripple::STObject::add : valid field type"); + "xrpl::STObject::add : valid field type"); field->addFieldID(s); field->add(s); if (sType == STI_ARRAY || sType == STI_OBJECT) @@ -937,4 +937,4 @@ STObject::getSortedFields(STObject const& objToSort, WhichFields whichFields) return sf; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STParsedJSON.cpp b/src/libxrpl/protocol/STParsedJSON.cpp index 8443f92f75..34c8b70e45 100644 --- a/src/libxrpl/protocol/STParsedJSON.cpp +++ b/src/libxrpl/protocol/STParsedJSON.cpp @@ -41,7 +41,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace STParsedJSONDetail { template @@ -1190,4 +1190,4 @@ STParsedJSONObject::STParsedJSONObject( object = parseObject(name, json, sfGeneric, 0, error); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STPathSet.cpp b/src/libxrpl/protocol/STPathSet.cpp index 3132c81cc6..631fd51d8a 100644 --- a/src/libxrpl/protocol/STPathSet.cpp +++ b/src/libxrpl/protocol/STPathSet.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { std::size_t STPathElement::get_hash(STPathElement const& element) @@ -201,10 +201,10 @@ void STPathSet::add(Serializer& s) const { XRPL_ASSERT( - getFName().isBinary(), "ripple::STPathSet::add : field is binary"); + getFName().isBinary(), "xrpl::STPathSet::add : field is binary"); XRPL_ASSERT( getFName().fieldType == STI_PATHSET, - "ripple::STPathSet::add : valid field type"); + "xrpl::STPathSet::add : valid field type"); bool first = true; for (auto const& spPath : value) @@ -234,4 +234,4 @@ STPathSet::add(Serializer& s) const s.add8(STPathElement::typeNone); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STTx.cpp b/src/libxrpl/protocol/STTx.cpp index d3b3ab4a88..6640468bd4 100644 --- a/src/libxrpl/protocol/STTx.cpp +++ b/src/libxrpl/protocol/STTx.cpp @@ -51,7 +51,7 @@ #include #include -namespace ripple { +namespace xrpl { static auto getTxFormat(TxType type) @@ -150,7 +150,7 @@ STTx::getMentionedAccounts() const { XRPL_ASSERT( !sacc->isDefault(), - "ripple::STTx::getMentionedAccounts : account is set"); + "xrpl::STTx::getMentionedAccounts : account is set"); if (!sacc->isDefault()) list.insert(sacc->value()); } @@ -222,7 +222,7 @@ STTx::sign( { auto const data = getSigningData(*this); - auto const sig = ripple::sign(publicKey, secretKey, makeSlice(data)); + auto const sig = xrpl::sign(publicKey, secretKey, makeSlice(data)); if (signatureTarget) { @@ -375,7 +375,7 @@ STTx::getMetaSQL( std::string rTxn = sqlBlobLiteral(rawTxn.peekData()); auto format = TxFormats::getInstance().findByType(tx_type_); - XRPL_ASSERT(format, "ripple::STTx::getMetaSQL : non-null type format"); + XRPL_ASSERT(format, "xrpl::STTx::getMetaSQL : non-null type format"); return str( boost::format(bfTrans) % to_string(getTransactionID()) % @@ -819,4 +819,4 @@ isPseudoTx(STObject const& tx) return tt == ttAMENDMENT || tt == ttFEE || tt == ttUNL_MODIFY; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STValidation.cpp b/src/libxrpl/protocol/STValidation.cpp index 3c89f31896..f6f89d43e9 100644 --- a/src/libxrpl/protocol/STValidation.cpp +++ b/src/libxrpl/protocol/STValidation.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { STBase* STValidation::copy(std::size_t n, void* buf) const @@ -101,7 +101,7 @@ STValidation::isValid() const noexcept { XRPL_ASSERT( publicKeyType(getSignerPublic()) == KeyType::secp256k1, - "ripple::STValidation::isValid : valid key type"); + "xrpl::STValidation::isValid : valid key type"); valid_ = verifyDigest( getSignerPublic(), @@ -133,4 +133,4 @@ STValidation::getSerialized() const return s.peekData(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STVar.cpp b/src/libxrpl/protocol/STVar.cpp index 2b0e59b4c3..e0df5d51a9 100644 --- a/src/libxrpl/protocol/STVar.cpp +++ b/src/libxrpl/protocol/STVar.cpp @@ -22,7 +22,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { defaultObject_t defaultObject; @@ -109,7 +109,7 @@ STVar::STVar(SerializedTypeID id, SField const& name) { XRPL_ASSERT( (id == STI_NOTPRESENT) || (id == name.fieldType), - "ripple::detail::STVar::STVar(SerializedTypeID) : valid type input"); + "xrpl::detail::STVar::STVar(SerializedTypeID) : valid type input"); constructST(id, 0, name); } @@ -225,4 +225,4 @@ STVar::constructST(SerializedTypeID id, int depth, Args&&... args) } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STVector256.cpp b/src/libxrpl/protocol/STVector256.cpp index ba7cf3252c..17b4895b62 100644 --- a/src/libxrpl/protocol/STVector256.cpp +++ b/src/libxrpl/protocol/STVector256.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { STVector256::STVector256(SerialIter& sit, SField const& name) : STBase(name) { @@ -59,10 +59,10 @@ void STVector256::add(Serializer& s) const { XRPL_ASSERT( - getFName().isBinary(), "ripple::STVector256::add : field is binary"); + getFName().isBinary(), "xrpl::STVector256::add : field is binary"); XRPL_ASSERT( getFName().fieldType == STI_VECTOR256, - "ripple::STVector256::add : valid field type"); + "xrpl::STVector256::add : valid field type"); s.addVL(mValue.begin(), mValue.end(), mValue.size() * (256 / 8)); } @@ -84,4 +84,4 @@ STVector256::getJson(JsonOptions) const return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/STXChainBridge.cpp b/src/libxrpl/protocol/STXChainBridge.cpp index aa10a87bbc..065b87558f 100644 --- a/src/libxrpl/protocol/STXChainBridge.cpp +++ b/src/libxrpl/protocol/STXChainBridge.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { STXChainBridge::STXChainBridge() : STBase{sfXChainBridge} { @@ -66,7 +66,7 @@ STXChainBridge::STXChainBridge(SField const& name, Json::Value const& v) auto checkExtra = [](Json::Value const& v) { static auto const jbridge = - ripple::STXChainBridge().getJson(ripple::JsonOptions::none); + xrpl::STXChainBridge().getJson(xrpl::JsonOptions::none); for (auto it = v.begin(); it != v.end(); ++it) { std::string const name = it.memberName(); @@ -207,4 +207,4 @@ STXChainBridge::move(std::size_t n, void* buf) { return emplace(n, buf, std::move(*this)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/SecretKey.cpp b/src/libxrpl/protocol/SecretKey.cpp index d4a958c600..88404a88a5 100644 --- a/src/libxrpl/protocol/SecretKey.cpp +++ b/src/libxrpl/protocol/SecretKey.cpp @@ -26,7 +26,7 @@ #include #include -namespace ripple { +namespace xrpl { SecretKey::~SecretKey() { @@ -381,4 +381,4 @@ parseBase58(TokenType type, std::string const& s) return SecretKey(makeSlice(result)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Seed.cpp b/src/libxrpl/protocol/Seed.cpp index 9c41a534b9..18e89ef6ca 100644 --- a/src/libxrpl/protocol/Seed.cpp +++ b/src/libxrpl/protocol/Seed.cpp @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { Seed::~Seed() { @@ -124,4 +124,4 @@ seedAs1751(Seed const& seed) return encodedKey; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Serializer.cpp b/src/libxrpl/protocol/Serializer.cpp index 7fbec19bd2..e6c1e6967f 100644 --- a/src/libxrpl/protocol/Serializer.cpp +++ b/src/libxrpl/protocol/Serializer.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { int Serializer::add16(std::uint16_t i) @@ -109,7 +109,7 @@ Serializer::addFieldID(int type, int name) int ret = mData.size(); XRPL_ASSERT( (type > 0) && (type < 256) && (name > 0) && (name < 256), - "ripple::Serializer::addFieldID : inputs inside range"); + "xrpl::Serializer::addFieldID : inputs inside range"); if (type < 16) { @@ -181,7 +181,7 @@ Serializer::addVL(Blob const& vector) XRPL_ASSERT( mData.size() == (ret + vector.size() + encodeLengthLength(vector.size())), - "ripple::Serializer::addVL : size matches expected"); + "xrpl::Serializer::addVL : size matches expected"); return ret; } @@ -486,7 +486,7 @@ SerialIter::getVLDataLength() else { XRPL_ASSERT( - lenLen == 3, "ripple::SerialIter::getVLDataLength : lenLen is 3"); + lenLen == 3, "xrpl::SerialIter::getVLDataLength : lenLen is 3"); int b2 = get8(); int b3 = get8(); datLen = Serializer::decodeVLLength(b1, b2, b3); @@ -519,4 +519,4 @@ SerialIter::getVLBuffer() return getRawHelper(getVLDataLength()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/Sign.cpp b/src/libxrpl/protocol/Sign.cpp index 3a6b52ac84..9edd2bbfa4 100644 --- a/src/libxrpl/protocol/Sign.cpp +++ b/src/libxrpl/protocol/Sign.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { void sign( @@ -90,4 +90,4 @@ startMultiSigningData(STObject const& obj) return s; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/TER.cpp b/src/libxrpl/protocol/TER.cpp index 8cdcced347..6871cf5700 100644 --- a/src/libxrpl/protocol/TER.cpp +++ b/src/libxrpl/protocol/TER.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { std::unordered_map< TERUnderlyingType, @@ -281,4 +281,4 @@ transCode(std::string const& token) return TER::fromInt(r->second); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/TxFormats.cpp b/src/libxrpl/protocol/TxFormats.cpp index 0b42f8cefb..12f92615cd 100644 --- a/src/libxrpl/protocol/TxFormats.cpp +++ b/src/libxrpl/protocol/TxFormats.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { TxFormats::TxFormats() { @@ -55,4 +55,4 @@ TxFormats::getInstance() return instance; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/TxMeta.cpp b/src/libxrpl/protocol/TxMeta.cpp index ebc1d87b14..f0077c7f92 100644 --- a/src/libxrpl/protocol/TxMeta.cpp +++ b/src/libxrpl/protocol/TxMeta.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj) : transactionID_(txid) @@ -31,8 +31,7 @@ TxMeta::TxMeta(uint256 const& txid, std::uint32_t ledger, STObject const& obj) auto affectedNodes = dynamic_cast(obj.peekAtPField(sfAffectedNodes)); XRPL_ASSERT( - affectedNodes, - "ripple::TxMeta::TxMeta(STObject) : type cast succeeded"); + affectedNodes, "xrpl::TxMeta::TxMeta(STObject) : type cast succeeded"); if (affectedNodes) nodes_ = *affectedNodes; @@ -84,7 +83,7 @@ TxMeta::setAffectedNode( XRPL_ASSERT( obj.getFName() == type, - "ripple::TxMeta::setAffectedNode : field type match"); + "xrpl::TxMeta::setAffectedNode : field type match"); obj.setFieldH256(sfLedgerIndex, node); obj.setFieldU16(sfLedgerEntryType, nodeType); } @@ -108,7 +107,7 @@ TxMeta::getAffectedAccounts() const dynamic_cast(&node.peekAtIndex(index)); XRPL_ASSERT( inner, - "ripple::getAffectedAccounts : STObject type cast succeeded"); + "xrpl::getAffectedAccounts : STObject type cast succeeded"); if (inner) { for (auto const& field : *inner) @@ -117,7 +116,7 @@ TxMeta::getAffectedAccounts() const { XRPL_ASSERT( !sa->isDefault(), - "ripple::getAffectedAccounts : account is set"); + "xrpl::getAffectedAccounts : account is set"); if (!sa->isDefault()) list.insert(sa->value()); } @@ -130,7 +129,7 @@ TxMeta::getAffectedAccounts() const auto lim = dynamic_cast(&field); XRPL_ASSERT( lim, - "ripple::getAffectedAccounts : STAmount type cast " + "xrpl::getAffectedAccounts : STAmount type cast " "succeeded"); if (lim != nullptr) @@ -175,7 +174,7 @@ TxMeta::getAffectedNode(SLE::ref node, SField const& type) XRPL_ASSERT( obj.getFName() == type, - "ripple::TxMeta::getAffectedNode(SLE::ref) : field type match"); + "xrpl::TxMeta::getAffectedNode(SLE::ref) : field type match"); obj.setFieldH256(sfLedgerIndex, index); obj.setFieldU16(sfLedgerEntryType, node->getFieldU16(sfLedgerEntryType)); @@ -191,7 +190,7 @@ TxMeta::getAffectedNode(uint256 const& node) return n; } // LCOV_EXCL_START - UNREACHABLE("ripple::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 @@ -201,7 +200,7 @@ STObject TxMeta::getAsObject() const { STObject metaData(sfTransactionMetaData); - XRPL_ASSERT(result_ != 255, "ripple::TxMeta::getAsObject : result_ is set"); + XRPL_ASSERT(result_ != 255, "xrpl::TxMeta::getAsObject : result_ is set"); metaData.setFieldU8(sfTransactionResult, result_); metaData.setFieldU32(sfTransactionIndex, index_); metaData.emplace_back(nodes_); @@ -221,7 +220,7 @@ TxMeta::addRaw(Serializer& s, TER result, std::uint32_t index) index_ = index; XRPL_ASSERT( (result_ == 0) || ((result_ > 100) && (result_ <= 255)), - "ripple::TxMeta::addRaw : valid TER input"); + "xrpl::TxMeta::addRaw : valid TER input"); nodes_.sort([](STObject const& o1, STObject const& o2) { return o1.getFieldH256(sfLedgerIndex) < o2.getFieldH256(sfLedgerIndex); @@ -230,4 +229,4 @@ TxMeta::addRaw(Serializer& s, TER result, std::uint32_t index) getAsObject().add(s); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/UintTypes.cpp b/src/libxrpl/protocol/UintTypes.cpp index ca7f09b5f5..6c799397ee 100644 --- a/src/libxrpl/protocol/UintTypes.cpp +++ b/src/libxrpl/protocol/UintTypes.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { // For details on the protocol-level serialization please visit // https://xrpl.org/serialization.html#currency-codes @@ -117,4 +117,4 @@ badCurrency() return currency; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/XChainAttestations.cpp b/src/libxrpl/protocol/XChainAttestations.cpp index da5f2d4ccb..89771b63b0 100644 --- a/src/libxrpl/protocol/XChainAttestations.cpp +++ b/src/libxrpl/protocol/XChainAttestations.cpp @@ -22,7 +22,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Attestations { AttestationBase::AttestationBase( @@ -83,7 +83,7 @@ bool AttestationBase::verify(STXChainBridge const& bridge) const { std::vector msg = message(bridge); - return ripple::verify(publicKey, makeSlice(msg), signature); + return xrpl::verify(publicKey, makeSlice(msg), signature); } AttestationBase::AttestationBase(STObject const& o) @@ -742,4 +742,4 @@ XChainAttestationsBase::toSTArray() const template class XChainAttestationsBase; template class XChainAttestationsBase; -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/digest.cpp b/src/libxrpl/protocol/digest.cpp index ca7bab7372..dd4ecd7688 100644 --- a/src/libxrpl/protocol/digest.cpp +++ b/src/libxrpl/protocol/digest.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { openssl_ripemd160_hasher::openssl_ripemd160_hasher() { @@ -86,4 +86,4 @@ openssl_sha256_hasher::operator result_type() noexcept return digest; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/protocol/tokens.cpp b/src/libxrpl/protocol/tokens.cpp index a9a9ddb110..d4253a2df1 100644 --- a/src/libxrpl/protocol/tokens.cpp +++ b/src/libxrpl/protocol/tokens.cpp @@ -119,7 +119,7 @@ of another base), and doing the multi-precision computations with larger coefficients sizes greatly speeds up the multi-precision computations. */ -namespace ripple { +namespace xrpl { static constexpr char const* alphabetForward = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"; @@ -235,7 +235,7 @@ encodeBase58( carry /= 58; } XRPL_ASSERT( - carry == 0, "ripple::b58_ref::detail::encodeBase58 : zero carry"); + carry == 0, "xrpl::b58_ref::detail::encodeBase58 : zero carry"); pbegin++; } @@ -286,7 +286,7 @@ decodeBase58(std::string const& s) carry /= 256; } XRPL_ASSERT( - carry == 0, "ripple::b58_ref::detail::decodeBase58 : zero carry"); + carry == 0, "xrpl::b58_ref::detail::decodeBase58 : zero carry"); ++psz; --remain; } @@ -430,7 +430,7 @@ b256_to_b58_be(std::span input, std::span out) while (cur_2_64_end > 0) { base_58_10_coeff[num_58_10_coeffs] = - ripple::b58_fast::detail::inplace_bigint_div_rem( + xrpl::b58_fast::detail::inplace_bigint_div_rem( base_2_64_coeff.subspan(0, cur_2_64_end), B_58_10); num_58_10_coeffs += 1; if (base_2_64_coeff[cur_2_64_end - 1] == 0) @@ -442,7 +442,7 @@ b256_to_b58_be(std::span input, std::span out) // Translate the result into the alphabet // Put all the zeros at the beginning, then all the values from the output std::fill( - out.begin(), out.begin() + input_zeros, ::ripple::alphabetForward[0]); + out.begin(), out.begin() + input_zeros, ::xrpl::alphabetForward[0]); // iterate through the base 58^10 coeff // convert to base 58 big endian then @@ -461,7 +461,7 @@ b256_to_b58_be(std::span input, std::span out) return Unexpected(TokenCodecErrc::inputTooLarge); } std::array const b58_be = - ripple::b58_fast::detail::b58_10_to_b58_be(base_58_10_coeff[i]); + xrpl::b58_fast::detail::b58_10_to_b58_be(base_58_10_coeff[i]); std::size_t to_skip = 0; std::span b58_be_s{b58_be.data(), b58_be.size()}; if (skip_zeros) @@ -475,7 +475,7 @@ b256_to_b58_be(std::span input, std::span out) } for (auto b58_coeff : b58_be_s.subspan(to_skip)) { - out[out_index] = ::ripple::alphabetForward[b58_coeff]; + out[out_index] = ::xrpl::alphabetForward[b58_coeff]; out_index += 1; } } @@ -504,7 +504,7 @@ b58_to_b256_be(std::string_view input, std::span out) std::size_t count = 0; for (auto const& c : col) { - if (c != ::ripple::alphabetForward[0]) + if (c != ::xrpl::alphabetForward[0]) { return count; } @@ -520,15 +520,15 @@ b58_to_b256_be(std::string_view input, std::span out) // log(2^(38*8),58^10)) ~= 5.18. So 6 coeff are enough std::array b_58_10_coeff{}; auto [num_full_coeffs, partial_coeff_len] = - ripple::b58_fast::detail::div_rem(input.size(), 10); + xrpl::b58_fast::detail::div_rem(input.size(), 10); auto const num_partial_coeffs = partial_coeff_len ? 1 : 0; auto const num_b_58_10_coeffs = num_full_coeffs + num_partial_coeffs; XRPL_ASSERT( num_b_58_10_coeffs <= b_58_10_coeff.size(), - "ripple::b58_fast::detail::b58_to_b256_be : maximum coeff"); + "xrpl::b58_fast::detail::b58_to_b256_be : maximum coeff"); for (unsigned char c : input.substr(0, partial_coeff_len)) { - auto cur_val = ::ripple::alphabetReverse[c]; + auto cur_val = ::xrpl::alphabetReverse[c]; if (cur_val < 0) { return Unexpected(TokenCodecErrc::invalidEncodingChar); @@ -541,7 +541,7 @@ b58_to_b256_be(std::string_view input, std::span out) for (int j = 0; j < num_full_coeffs; ++j) { unsigned char c = input[partial_coeff_len + j * 10 + i]; - auto cur_val = ::ripple::alphabetReverse[c]; + auto cur_val = ::xrpl::alphabetReverse[c]; if (cur_val < 0) { return Unexpected(TokenCodecErrc::invalidEncodingChar); @@ -562,7 +562,7 @@ b58_to_b256_be(std::string_view input, std::span out) std::uint64_t const c = b_58_10_coeff[i]; { - auto code = ripple::b58_fast::detail::inplace_bigint_mul( + auto code = xrpl::b58_fast::detail::inplace_bigint_mul( std::span(&result[0], cur_result_size + 1), B_58_10); if (code != TokenCodecErrc::success) { @@ -570,7 +570,7 @@ b58_to_b256_be(std::string_view input, std::span out) } } { - auto code = ripple::b58_fast::detail::inplace_bigint_add( + auto code = xrpl::b58_fast::detail::inplace_bigint_add( std::span(&result[0], cur_result_size + 1), c); if (code != TokenCodecErrc::success) { @@ -732,4 +732,4 @@ decodeBase58Token(std::string const& s, TokenType type) } // namespace b58_fast #endif // _MSC_VER -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/resource/Charge.cpp b/src/libxrpl/resource/Charge.cpp index 43901d8985..1d88526b65 100644 --- a/src/libxrpl/resource/Charge.cpp +++ b/src/libxrpl/resource/Charge.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { Charge::Charge(value_type cost, std::string const& label) @@ -59,4 +59,4 @@ Charge::operator*(value_type m) const } } // namespace Resource -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/resource/Consumer.cpp b/src/libxrpl/resource/Consumer.cpp index 8f396c5012..c9d8ea6125 100644 --- a/src/libxrpl/resource/Consumer.cpp +++ b/src/libxrpl/resource/Consumer.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { Consumer::Consumer(Logic& logic, Entry& entry) @@ -97,7 +97,7 @@ Consumer::charge(Charge const& what, std::string const& context) bool Consumer::warn() { - XRPL_ASSERT(m_entry, "ripple::Resource::Consumer::warn : non-null entry"); + XRPL_ASSERT(m_entry, "xrpl::Resource::Consumer::warn : non-null entry"); return m_logic->warn(*m_entry); } @@ -105,7 +105,7 @@ bool Consumer::disconnect(beast::Journal const& j) { XRPL_ASSERT( - m_entry, "ripple::Resource::Consumer::disconnect : non-null entry"); + m_entry, "xrpl::Resource::Consumer::disconnect : non-null entry"); bool const d = m_logic->disconnect(*m_entry); if (d) { @@ -117,15 +117,14 @@ Consumer::disconnect(beast::Journal const& j) int Consumer::balance() { - XRPL_ASSERT( - m_entry, "ripple::Resource::Consumer::balance : non-null entry"); + XRPL_ASSERT(m_entry, "xrpl::Resource::Consumer::balance : non-null entry"); return m_logic->balance(*m_entry); } Entry& Consumer::entry() { - XRPL_ASSERT(m_entry, "ripple::Resource::Consumer::entry : non-null entry"); + XRPL_ASSERT(m_entry, "xrpl::Resource::Consumer::entry : non-null entry"); return *m_entry; } @@ -143,4 +142,4 @@ operator<<(std::ostream& os, Consumer const& v) } } // namespace Resource -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/resource/Fees.cpp b/src/libxrpl/resource/Fees.cpp index f300a70d7c..d5999458b7 100644 --- a/src/libxrpl/resource/Fees.cpp +++ b/src/libxrpl/resource/Fees.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { Charge const feeMalformedRequest(200, "malformed request"); @@ -26,4 +26,4 @@ Charge const feeDrop(6000, "dropped"); // See also Resource::Logic::charge for log level cutoff values } // namespace Resource -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/resource/ResourceManager.cpp b/src/libxrpl/resource/ResourceManager.cpp index 5e647cfce9..8582836611 100644 --- a/src/libxrpl/resource/ResourceManager.cpp +++ b/src/libxrpl/resource/ResourceManager.cpp @@ -22,7 +22,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { class ManagerImp : public Manager @@ -171,4 +171,4 @@ make_Manager( } } // namespace Resource -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/server/JSONRPCUtil.cpp b/src/libxrpl/server/JSONRPCUtil.cpp index 1a804677bd..845781374d 100644 --- a/src/libxrpl/server/JSONRPCUtil.cpp +++ b/src/libxrpl/server/JSONRPCUtil.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string getHTTPHeaderTimestamp() @@ -139,4 +139,4 @@ HTTPReply( output("\r\n"); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/server/Port.cpp b/src/libxrpl/server/Port.cpp index 6c7ec04f6f..03a503e940 100644 --- a/src/libxrpl/server/Port.cpp +++ b/src/libxrpl/server/Port.cpp @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { bool Port::secure() const @@ -320,4 +320,4 @@ parse_Port(ParsedPort& port, Section const& section, std::ostream& log) port.pmd_options.memLevel = section.value_or("memory_level", 4); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMap.cpp b/src/libxrpl/shamap/SHAMap.cpp index ef27d37ed3..7cfa66b1ac 100644 --- a/src/libxrpl/shamap/SHAMap.cpp +++ b/src/libxrpl/shamap/SHAMap.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { [[nodiscard]] intr_ptr::SharedPtr makeTypedLeaf( @@ -85,10 +85,10 @@ SHAMap::dirtyUp( XRPL_ASSERT( (state_ != SHAMapState::Synching) && (state_ != SHAMapState::Immutable), - "ripple::SHAMap::dirtyUp : valid state"); + "xrpl::SHAMap::dirtyUp : valid state"); XRPL_ASSERT( child && (child->cowid() == cowid_), - "ripple::SHAMap::dirtyUp : valid child input"); + "xrpl::SHAMap::dirtyUp : valid child input"); while (!stack.empty()) { @@ -96,10 +96,10 @@ SHAMap::dirtyUp( intr_ptr::dynamic_pointer_cast(stack.top().first); SHAMapNodeID nodeID = stack.top().second; stack.pop(); - XRPL_ASSERT(node, "ripple::SHAMap::dirtyUp : non-null node"); + XRPL_ASSERT(node, "xrpl::SHAMap::dirtyUp : non-null node"); int branch = selectBranch(nodeID, target); - XRPL_ASSERT(branch >= 0, "ripple::SHAMap::dirtyUp : valid branch"); + XRPL_ASSERT(branch >= 0, "xrpl::SHAMap::dirtyUp : valid branch"); node = unshareNode(std::move(node), nodeID); node->setChild(branch, std::move(child)); @@ -113,7 +113,7 @@ SHAMap::walkTowardsKey(uint256 const& id, SharedPtrNodeStack* stack) const { XRPL_ASSERT( stack == nullptr || stack->empty(), - "ripple::SHAMap::walkTowardsKey : empty stack input"); + "xrpl::SHAMap::walkTowardsKey : empty stack input"); auto inNode = root_; SHAMapNodeID nodeID; @@ -149,7 +149,7 @@ SHAMap::findKey(uint256 const& id) const intr_ptr::SharedPtr SHAMap::fetchNodeFromDB(SHAMapHash const& hash) const { - XRPL_ASSERT(backed_, "ripple::SHAMap::fetchNodeFromDB : is backed"); + XRPL_ASSERT(backed_, "xrpl::SHAMap::fetchNodeFromDB : is backed"); auto obj = f_.db().fetchNodeObject(hash.as_uint256(), ledgerSeq_); return finishFetch(hash, obj); } @@ -159,7 +159,7 @@ SHAMap::finishFetch( SHAMapHash const& hash, std::shared_ptr const& object) const { - XRPL_ASSERT(backed_, "ripple::SHAMap::finishFetch : is backed"); + XRPL_ASSERT(backed_, "xrpl::SHAMap::finishFetch : is backed"); try { @@ -344,13 +344,13 @@ SHAMap::descend( SHAMapSyncFilter* filter) const { XRPL_ASSERT( - parent->isInner(), "ripple::SHAMap::descend : valid parent input"); + parent->isInner(), "xrpl::SHAMap::descend : valid parent input"); XRPL_ASSERT( (branch >= 0) && (branch < branchFactor), - "ripple::SHAMap::descend : valid branch input"); + "xrpl::SHAMap::descend : valid branch input"); XRPL_ASSERT( !parent->isEmptyBranch(branch), - "ripple::SHAMap::descend : parent branch is non-empty"); + "xrpl::SHAMap::descend : parent branch is non-empty"); SHAMapTreeNode* child = parent->getChildPointer(branch); @@ -420,13 +420,13 @@ SHAMap::unshareNode(intr_ptr::SharedPtr node, SHAMapNodeID const& nodeID) // make sure the node is suitable for the intended operation (copy on write) XRPL_ASSERT( node->cowid() <= cowid_, - "ripple::SHAMap::unshareNode : node valid for cowid"); + "xrpl::SHAMap::unshareNode : node valid for cowid"); if (node->cowid() != cowid_) { // have a CoW XRPL_ASSERT( state_ != SHAMapState::Immutable, - "ripple::SHAMap::unshareNode : not immutable"); + "xrpl::SHAMap::unshareNode : not immutable"); node = intr_ptr::static_pointer_cast(node->clone(cowid_)); if (nodeID.isRoot()) root_ = node; @@ -460,8 +460,7 @@ SHAMap::belowHelper( { node.adopt(descendThrow(inner.get(), i)); XRPL_ASSERT( - !stack.empty(), - "ripple::SHAMap::belowHelper : non-empty stack"); + !stack.empty(), "xrpl::SHAMap::belowHelper : non-empty stack"); if (node->isLeaf()) { auto n = intr_ptr::static_pointer_cast(node); @@ -526,7 +525,7 @@ SHAMap::onlyBelow(SHAMapTreeNode* node) const if (!nextNode) { // LCOV_EXCL_START - UNREACHABLE("ripple::SHAMap::onlyBelow : no next node"); + UNREACHABLE("xrpl::SHAMap::onlyBelow : no next node"); return no_item; // LCOV_EXCL_STOP } @@ -539,7 +538,7 @@ SHAMap::onlyBelow(SHAMapTreeNode* node) const auto const leaf = static_cast(node); XRPL_ASSERT( leaf->peekItem() || (leaf == root_.get()), - "ripple::SHAMap::onlyBelow : valid inner node"); + "xrpl::SHAMap::onlyBelow : valid inner node"); return leaf->peekItem(); } @@ -547,7 +546,7 @@ SHAMapLeafNode const* SHAMap::peekFirstItem(SharedPtrNodeStack& stack) const { XRPL_ASSERT( - stack.empty(), "ripple::SHAMap::peekFirstItem : empty stack input"); + stack.empty(), "xrpl::SHAMap::peekFirstItem : empty stack input"); SHAMapLeafNode* node = firstBelow(root_, stack); if (!node) { @@ -562,17 +561,17 @@ SHAMapLeafNode const* SHAMap::peekNextItem(uint256 const& id, SharedPtrNodeStack& stack) const { XRPL_ASSERT( - !stack.empty(), "ripple::SHAMap::peekNextItem : non-empty stack input"); + !stack.empty(), "xrpl::SHAMap::peekNextItem : non-empty stack input"); XRPL_ASSERT( stack.top().first->isLeaf(), - "ripple::SHAMap::peekNextItem : stack starts with leaf"); + "xrpl::SHAMap::peekNextItem : stack starts with leaf"); stack.pop(); while (!stack.empty()) { auto [node, nodeID] = stack.top(); XRPL_ASSERT( !node->isLeaf(), - "ripple::SHAMap::peekNextItem : another node is not leaf"); + "xrpl::SHAMap::peekNextItem : another node is not leaf"); auto inner = intr_ptr::static_pointer_cast(node); for (auto i = selectBranch(nodeID, id) + 1; i < branchFactor; ++i) { @@ -584,7 +583,7 @@ SHAMap::peekNextItem(uint256 const& id, SharedPtrNodeStack& stack) const Throw(type_, id); XRPL_ASSERT( leaf->isLeaf(), - "ripple::SHAMap::peekNextItem : leaf is valid"); + "xrpl::SHAMap::peekNextItem : leaf is valid"); return leaf; } } @@ -704,7 +703,7 @@ SHAMap::delItem(uint256 const& id) // delete the item with this ID XRPL_ASSERT( state_ != SHAMapState::Immutable, - "ripple::SHAMap::delItem : not immutable"); + "xrpl::SHAMap::delItem : not immutable"); SharedPtrNodeStack stack; walkTowardsKey(id, &stack); @@ -787,10 +786,10 @@ SHAMap::addGiveItem( { XRPL_ASSERT( state_ != SHAMapState::Immutable, - "ripple::SHAMap::addGiveItem : not immutable"); + "xrpl::SHAMap::addGiveItem : not immutable"); XRPL_ASSERT( type != SHAMapNodeType::tnINNER, - "ripple::SHAMap::addGiveItem : valid type input"); + "xrpl::SHAMap::addGiveItem : valid type input"); // add the specified item, does not update uint256 tag = item->key(); @@ -818,7 +817,7 @@ SHAMap::addGiveItem( int branch = selectBranch(nodeID, tag); XRPL_ASSERT( inner->isEmptyBranch(branch), - "ripple::SHAMap::addGiveItem : inner branch is empty"); + "xrpl::SHAMap::addGiveItem : inner branch is empty"); inner->setChild(branch, makeTypedLeaf(type, std::move(item), cowid_)); } else @@ -829,7 +828,7 @@ SHAMap::addGiveItem( auto otherItem = leaf->peekItem(); XRPL_ASSERT( otherItem && (tag != otherItem->key()), - "ripple::SHAMap::addGiveItem : non-null item"); + "xrpl::SHAMap::addGiveItem : non-null item"); node = intr_ptr::make_shared(node->cowid()); @@ -848,7 +847,7 @@ SHAMap::addGiveItem( // we can add the two leaf nodes here XRPL_ASSERT( - node->isInner(), "ripple::SHAMap::addGiveItem : node is inner"); + node->isInner(), "xrpl::SHAMap::addGiveItem : node is inner"); auto inner = static_cast(node.get()); inner->setChild(b1, makeTypedLeaf(type, std::move(item), cowid_)); @@ -889,7 +888,7 @@ SHAMap::updateGiveItem( XRPL_ASSERT( state_ != SHAMapState::Immutable, - "ripple::SHAMap::updateGiveItem : not immutable"); + "xrpl::SHAMap::updateGiveItem : not immutable"); SharedPtrNodeStack stack; walkTowardsKey(tag, &stack); @@ -905,7 +904,7 @@ SHAMap::updateGiveItem( if (!node || (node->peekItem()->key() != tag)) { // LCOV_EXCL_START - UNREACHABLE("ripple::SHAMap::updateGiveItem : invalid node"); + UNREACHABLE("xrpl::SHAMap::updateGiveItem : invalid node"); return false; // LCOV_EXCL_STOP } @@ -953,7 +952,7 @@ SHAMap::fetchRoot(SHAMapHash const& hash, SHAMapSyncFilter* filter) root_ = newRoot; XRPL_ASSERT( root_->getHash() == hash, - "ripple::SHAMap::fetchRoot : root hash do match"); + "xrpl::SHAMap::fetchRoot : root hash do match"); return true; } @@ -977,8 +976,8 @@ SHAMap::writeNode(NodeObjectType t, intr_ptr::SharedPtr node) const { XRPL_ASSERT( - node->cowid() == 0, "ripple::SHAMap::writeNode : valid input node"); - XRPL_ASSERT(backed_, "ripple::SHAMap::writeNode : is backed"); + node->cowid() == 0, "xrpl::SHAMap::writeNode : valid input node"); + XRPL_ASSERT(backed_, "xrpl::SHAMap::writeNode : is backed"); canonicalize(node->getHash(), node); @@ -998,8 +997,7 @@ SHAMap::preFlushNode(intr_ptr::SharedPtr node) const { // A shared node should never need to be flushed // because that would imply someone modified it - XRPL_ASSERT( - node->cowid(), "ripple::SHAMap::preFlushNode : valid input node"); + XRPL_ASSERT(node->cowid(), "xrpl::SHAMap::preFlushNode : valid input node"); if (node->cowid() != cowid_) { @@ -1027,8 +1025,7 @@ SHAMap::flushDirty(NodeObjectType t) int SHAMap::walkSubTree(bool doWrite, NodeObjectType t) { - XRPL_ASSERT( - !doWrite || backed_, "ripple::SHAMap::walkSubTree : valid input"); + XRPL_ASSERT(!doWrite || backed_, "xrpl::SHAMap::walkSubTree : valid input"); int flushed = 0; @@ -1105,7 +1102,7 @@ SHAMap::walkSubTree(bool doWrite, NodeObjectType t) XRPL_ASSERT( node->cowid() == cowid_, - "ripple::SHAMap::walkSubTree : node cowid do " + "xrpl::SHAMap::walkSubTree : node cowid do " "match"); child->updateHash(); child->unshare(); @@ -1141,7 +1138,7 @@ SHAMap::walkSubTree(bool doWrite, NodeObjectType t) // Hook this inner node to its parent XRPL_ASSERT( parent->cowid() == cowid_, - "ripple::SHAMap::walkSubTree : parent cowid do match"); + "xrpl::SHAMap::walkSubTree : parent cowid do match"); parent->shareChild(pos, node); // Continue with parent's next child, if any @@ -1187,7 +1184,7 @@ SHAMap::dump(bool hash) const { XRPL_ASSERT( child->getHash() == inner->getChildHash(i), - "ripple::SHAMap::dump : child hash do match"); + "xrpl::SHAMap::dump : child hash do match"); stack.push({child, nodeID.getChildNodeID(i)}); } } @@ -1206,7 +1203,7 @@ SHAMap::cacheLookup(SHAMapHash const& hash) const auto ret = f_.getTreeNodeCache()->fetch(hash.as_uint256()); XRPL_ASSERT( !ret || !ret->cowid(), - "ripple::SHAMap::cacheLookup : not found or zero cowid"); + "xrpl::SHAMap::cacheLookup : not found or zero cowid"); return ret; } @@ -1215,12 +1212,12 @@ SHAMap::canonicalize( SHAMapHash const& hash, intr_ptr::SharedPtr& node) const { - XRPL_ASSERT(backed_, "ripple::SHAMap::canonicalize : is backed"); + XRPL_ASSERT(backed_, "xrpl::SHAMap::canonicalize : is backed"); XRPL_ASSERT( - node->cowid() == 0, "ripple::SHAMap::canonicalize : valid node input"); + node->cowid() == 0, "xrpl::SHAMap::canonicalize : valid node input"); XRPL_ASSERT( node->getHash() == hash, - "ripple::SHAMap::canonicalize : node hash do match"); + "xrpl::SHAMap::canonicalize : node hash do match"); f_.getTreeNodeCache()->canonicalize_replace_client(hash.as_uint256(), node); } @@ -1230,9 +1227,9 @@ SHAMap::invariants() const { (void)getHash(); // update node hashes auto node = root_.get(); - XRPL_ASSERT(node, "ripple::SHAMap::invariants : non-null root node"); + XRPL_ASSERT(node, "xrpl::SHAMap::invariants : non-null root node"); XRPL_ASSERT( - !node->isLeaf(), "ripple::SHAMap::invariants : root node is not leaf"); + !node->isLeaf(), "xrpl::SHAMap::invariants : root node is not leaf"); SharedPtrNodeStack stack; for (auto leaf = peekFirstItem(stack); leaf != nullptr; leaf = peekNextItem(leaf->peekItem()->key(), stack)) @@ -1240,4 +1237,4 @@ SHAMap::invariants() const node->invariants(true); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapDelta.cpp b/src/libxrpl/shamap/SHAMapDelta.cpp index 063c41993d..d7234bcbab 100644 --- a/src/libxrpl/shamap/SHAMapDelta.cpp +++ b/src/libxrpl/shamap/SHAMapDelta.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // This code is used to compare another node's transaction tree // to our own. It returns a map containing all items that are different @@ -112,7 +112,7 @@ SHAMap::compare(SHAMap const& otherMap, Delta& differences, int maxCount) const XRPL_ASSERT( isValid() && otherMap.isValid(), - "ripple::SHAMap::compare : valid state and valid input"); + "xrpl::SHAMap::compare : valid state and valid input"); if (getHash() == otherMap.getHash()) return true; @@ -130,7 +130,7 @@ SHAMap::compare(SHAMap const& otherMap, Delta& differences, int maxCount) const if (!ourNode || !otherNode) { // LCOV_EXCL_START - UNREACHABLE("ripple::SHAMap::compare : missing a node"); + UNREACHABLE("xrpl::SHAMap::compare : missing a node"); Throw(type_, uint256()); // LCOV_EXCL_STOP } @@ -214,7 +214,7 @@ SHAMap::compare(SHAMap const& otherMap, Delta& differences, int maxCount) const else { // LCOV_EXCL_START - UNREACHABLE("ripple::SHAMap::compare : invalid node"); + UNREACHABLE("xrpl::SHAMap::compare : invalid node"); // LCOV_EXCL_STOP } } @@ -315,7 +315,7 @@ SHAMap::walkMapParallel( std::move(nodeStack.top()); XRPL_ASSERT( node, - "ripple::SHAMap::walkMapParallel : non-null node"); + "xrpl::SHAMap::walkMapParallel : non-null node"); nodeStack.pop(); for (int i = 0; i < 16; ++i) @@ -366,4 +366,4 @@ SHAMap::walkMapParallel( return false; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapInnerNode.cpp b/src/libxrpl/shamap/SHAMapInnerNode.cpp index f17f86bcb1..5d4a0fd27f 100644 --- a/src/libxrpl/shamap/SHAMapInnerNode.cpp +++ b/src/libxrpl/shamap/SHAMapInnerNode.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { SHAMapInnerNode::SHAMapInnerNode( std::uint32_t cowid, @@ -212,7 +212,7 @@ void SHAMapInnerNode::serializeForWire(Serializer& s) const { XRPL_ASSERT( - !isEmpty(), "ripple::SHAMapInnerNode::serializeForWire : is non-empty"); + !isEmpty(), "xrpl::SHAMapInnerNode::serializeForWire : is non-empty"); // If the node is sparse, then only send non-empty branches: if (getBranchCount() < 12) @@ -238,7 +238,7 @@ SHAMapInnerNode::serializeWithPrefix(Serializer& s) const { XRPL_ASSERT( !isEmpty(), - "ripple::SHAMapInnerNode::serializeWithPrefix : is non-empty"); + "xrpl::SHAMapInnerNode::serializeWithPrefix : is non-empty"); s.add32(HashPrefix::innerNode); iterChildren( @@ -265,11 +265,11 @@ SHAMapInnerNode::setChild(int m, intr_ptr::SharedPtr child) { XRPL_ASSERT( (m >= 0) && (m < branchFactor), - "ripple::SHAMapInnerNode::setChild : valid branch input"); - XRPL_ASSERT(cowid_, "ripple::SHAMapInnerNode::setChild : nonzero cowid"); + "xrpl::SHAMapInnerNode::setChild : valid branch input"); + XRPL_ASSERT(cowid_, "xrpl::SHAMapInnerNode::setChild : nonzero cowid"); XRPL_ASSERT( child.get() != this, - "ripple::SHAMapInnerNode::setChild : valid child input"); + "xrpl::SHAMapInnerNode::setChild : valid child input"); auto const dstIsBranch = [&] { if (child) @@ -298,7 +298,7 @@ SHAMapInnerNode::setChild(int m, intr_ptr::SharedPtr child) XRPL_ASSERT( getBranchCount() <= hashesAndChildren_.capacity(), - "ripple::SHAMapInnerNode::setChild : maximum branch count"); + "xrpl::SHAMapInnerNode::setChild : maximum branch count"); } // finished modifying, now make shareable @@ -309,17 +309,17 @@ SHAMapInnerNode::shareChild( { XRPL_ASSERT( (m >= 0) && (m < branchFactor), - "ripple::SHAMapInnerNode::shareChild : valid branch input"); - XRPL_ASSERT(cowid_, "ripple::SHAMapInnerNode::shareChild : nonzero cowid"); + "xrpl::SHAMapInnerNode::shareChild : valid branch input"); + XRPL_ASSERT(cowid_, "xrpl::SHAMapInnerNode::shareChild : nonzero cowid"); XRPL_ASSERT( - child, "ripple::SHAMapInnerNode::shareChild : non-null child input"); + child, "xrpl::SHAMapInnerNode::shareChild : non-null child input"); XRPL_ASSERT( child.get() != this, - "ripple::SHAMapInnerNode::shareChild : valid child input"); + "xrpl::SHAMapInnerNode::shareChild : valid child input"); XRPL_ASSERT( !isEmptyBranch(m), - "ripple::SHAMapInnerNode::shareChild : non-empty branch input"); + "xrpl::SHAMapInnerNode::shareChild : non-empty branch input"); hashesAndChildren_.getChildren()[*getChildIndex(m)] = child; } @@ -328,10 +328,10 @@ SHAMapInnerNode::getChildPointer(int branch) { XRPL_ASSERT( branch >= 0 && branch < branchFactor, - "ripple::SHAMapInnerNode::getChildPointer : valid branch input"); + "xrpl::SHAMapInnerNode::getChildPointer : valid branch input"); XRPL_ASSERT( !isEmptyBranch(branch), - "ripple::SHAMapInnerNode::getChildPointer : non-empty branch input"); + "xrpl::SHAMapInnerNode::getChildPointer : non-empty branch input"); auto const index = *getChildIndex(branch); @@ -345,10 +345,10 @@ SHAMapInnerNode::getChild(int branch) { XRPL_ASSERT( branch >= 0 && branch < branchFactor, - "ripple::SHAMapInnerNode::getChild : valid branch input"); + "xrpl::SHAMapInnerNode::getChild : valid branch input"); XRPL_ASSERT( !isEmptyBranch(branch), - "ripple::SHAMapInnerNode::getChild : non-empty branch input"); + "xrpl::SHAMapInnerNode::getChild : non-empty branch input"); auto const index = *getChildIndex(branch); @@ -362,7 +362,7 @@ SHAMapInnerNode::getChildHash(int m) const { XRPL_ASSERT( (m >= 0) && (m < branchFactor), - "ripple::SHAMapInnerNode::getChildHash : valid branch input"); + "xrpl::SHAMapInnerNode::getChildHash : valid branch input"); if (auto const i = getChildIndex(m)) return hashesAndChildren_.getHashes()[*i]; @@ -376,18 +376,18 @@ SHAMapInnerNode::canonicalizeChild( { XRPL_ASSERT( branch >= 0 && branch < branchFactor, - "ripple::SHAMapInnerNode::canonicalizeChild : valid branch input"); + "xrpl::SHAMapInnerNode::canonicalizeChild : valid branch input"); XRPL_ASSERT( node != nullptr, - "ripple::SHAMapInnerNode::canonicalizeChild : valid node input"); + "xrpl::SHAMapInnerNode::canonicalizeChild : valid node input"); XRPL_ASSERT( !isEmptyBranch(branch), - "ripple::SHAMapInnerNode::canonicalizeChild : non-empty branch input"); + "xrpl::SHAMapInnerNode::canonicalizeChild : non-empty branch input"); auto const childIndex = *getChildIndex(branch); auto [_, hashes, children] = hashesAndChildren_.getHashesAndChildren(); XRPL_ASSERT( node->getHash() == hashes[childIndex], - "ripple::SHAMapInnerNode::canonicalizeChild : node and branch inputs " + "xrpl::SHAMapInnerNode::canonicalizeChild : node and branch inputs " "hash do match"); packed_spinlock sl(lock_, childIndex); @@ -420,7 +420,7 @@ SHAMapInnerNode::invariants(bool is_root) const { XRPL_ASSERT( hashes[i].isNonZero(), - "ripple::SHAMapInnerNode::invariants : nonzero hash in branch"); + "xrpl::SHAMapInnerNode::invariants : nonzero hash in branch"); if (children[i] != nullptr) children[i]->invariants(); ++count; @@ -434,7 +434,7 @@ SHAMapInnerNode::invariants(bool is_root) const { XRPL_ASSERT( (isBranch_ & (1 << i)), - "ripple::SHAMapInnerNode::invariants : valid branch when " + "xrpl::SHAMapInnerNode::invariants : valid branch when " "nonzero hash"); if (children[i] != nullptr) children[i]->invariants(); @@ -444,7 +444,7 @@ SHAMapInnerNode::invariants(bool is_root) const { XRPL_ASSERT( (isBranch_ & (1 << i)) == 0, - "ripple::SHAMapInnerNode::invariants : valid branch when " + "xrpl::SHAMapInnerNode::invariants : valid branch when " "zero hash"); } } @@ -454,13 +454,13 @@ SHAMapInnerNode::invariants(bool is_root) const { XRPL_ASSERT( hash_.isNonZero(), - "ripple::SHAMapInnerNode::invariants : nonzero hash"); + "xrpl::SHAMapInnerNode::invariants : nonzero hash"); XRPL_ASSERT( - count >= 1, "ripple::SHAMapInnerNode::invariants : minimum count"); + count >= 1, "xrpl::SHAMapInnerNode::invariants : minimum count"); } XRPL_ASSERT( (count == 0) ? hash_.isZero() : hash_.isNonZero(), - "ripple::SHAMapInnerNode::invariants : hash and count do match"); + "xrpl::SHAMapInnerNode::invariants : hash and count do match"); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapLeafNode.cpp b/src/libxrpl/shamap/SHAMapLeafNode.cpp index d2fd88ba5a..72e57cd737 100644 --- a/src/libxrpl/shamap/SHAMapLeafNode.cpp +++ b/src/libxrpl/shamap/SHAMapLeafNode.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { SHAMapLeafNode::SHAMapLeafNode( boost::intrusive_ptr item, @@ -9,7 +9,7 @@ SHAMapLeafNode::SHAMapLeafNode( { XRPL_ASSERT( item_->size() >= 12, - "ripple::SHAMapLeafNode::SHAMapLeafNode(boost::intrusive_ptr<" + "xrpl::SHAMapLeafNode::SHAMapLeafNode(boost::intrusive_ptr<" "SHAMapItem const>, std::uint32_t) : minimum input size"); } @@ -21,7 +21,7 @@ SHAMapLeafNode::SHAMapLeafNode( { XRPL_ASSERT( item_->size() >= 12, - "ripple::SHAMapLeafNode::SHAMapLeafNode(boost::intrusive_ptr<" + "xrpl::SHAMapLeafNode::SHAMapLeafNode(boost::intrusive_ptr<" "SHAMapItem const>, std::uint32_t, SHAMapHash const&) : minimum input " "size"); } @@ -35,7 +35,7 @@ SHAMapLeafNode::peekItem() const bool SHAMapLeafNode::setItem(boost::intrusive_ptr item) { - XRPL_ASSERT(cowid_, "ripple::SHAMapLeafNode::setItem : nonzero cowid"); + XRPL_ASSERT(cowid_, "xrpl::SHAMapLeafNode::setItem : nonzero cowid"); item_ = std::move(item); auto const oldHash = hash_; @@ -74,8 +74,8 @@ void SHAMapLeafNode::invariants(bool) const { XRPL_ASSERT( - hash_.isNonZero(), "ripple::SHAMapLeafNode::invariants : nonzero hash"); - XRPL_ASSERT(item_, "ripple::SHAMapLeafNode::invariants : non-null item"); + hash_.isNonZero(), "xrpl::SHAMapLeafNode::invariants : nonzero hash"); + XRPL_ASSERT(item_, "xrpl::SHAMapLeafNode::invariants : non-null item"); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapNodeID.cpp b/src/libxrpl/shamap/SHAMapNodeID.cpp index 33d38ebb03..a32ff5c28e 100644 --- a/src/libxrpl/shamap/SHAMapNodeID.cpp +++ b/src/libxrpl/shamap/SHAMapNodeID.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { static uint256 const& depthMask(unsigned int depth) @@ -39,10 +39,10 @@ SHAMapNodeID::SHAMapNodeID(unsigned int depth, uint256 const& hash) { XRPL_ASSERT( depth <= SHAMap::leafDepth, - "ripple::SHAMapNodeID::SHAMapNodeID : maximum depth input"); + "xrpl::SHAMapNodeID::SHAMapNodeID : maximum depth input"); XRPL_ASSERT( id_ == (id_ & depthMask(depth)), - "ripple::SHAMapNodeID::SHAMapNodeID : hash and depth inputs do match"); + "xrpl::SHAMapNodeID::SHAMapNodeID : hash and depth inputs do match"); } std::string @@ -59,7 +59,7 @@ SHAMapNodeID::getChildNodeID(unsigned int m) const { XRPL_ASSERT( m < SHAMap::branchFactor, - "ripple::SHAMapNodeID::getChildNodeID : valid branch input"); + "xrpl::SHAMapNodeID::getChildNodeID : valid branch input"); // A SHAMap has exactly 65 levels, so nodes must not exceed that // depth; if they do, this breaks the invariant of never allowing @@ -71,7 +71,7 @@ SHAMapNodeID::getChildNodeID(unsigned int m) const // constructing a child node from them would break the above invariant. XRPL_ASSERT( depth_ <= SHAMap::leafDepth, - "ripple::SHAMapNodeID::getChildNodeID : maximum leaf depth"); + "xrpl::SHAMapNodeID::getChildNodeID : maximum leaf depth"); if (depth_ >= SHAMap::leafDepth) Throw( @@ -117,7 +117,7 @@ selectBranch(SHAMapNodeID const& id, uint256 const& hash) branch >>= 4; XRPL_ASSERT( - branch < SHAMap::branchFactor, "ripple::selectBranch : maximum result"); + branch < SHAMap::branchFactor, "xrpl::selectBranch : maximum result"); return branch; } @@ -126,8 +126,8 @@ SHAMapNodeID::createID(int depth, uint256 const& key) { XRPL_ASSERT( (depth >= 0) && (depth < 65), - "ripple::SHAMapNodeID::createID : valid branch input"); + "xrpl::SHAMapNodeID::createID : valid branch input"); return SHAMapNodeID(depth, key & depthMask(depth)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapSync.cpp b/src/libxrpl/shamap/SHAMapSync.cpp index 3bc2d5561e..d9c0846fbf 100644 --- a/src/libxrpl/shamap/SHAMapSync.cpp +++ b/src/libxrpl/shamap/SHAMapSync.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { void SHAMap::visitLeaves( @@ -300,8 +300,8 @@ SHAMap::getMissingNodes(int max, SHAMapSyncFilter* filter) { XRPL_ASSERT( root_->getHash().isNonZero(), - "ripple::SHAMap::getMissingNodes : nonzero root hash"); - XRPL_ASSERT(max > 0, "ripple::SHAMap::getMissingNodes : valid max input"); + "xrpl::SHAMap::getMissingNodes : nonzero root hash"); + XRPL_ASSERT(max > 0, "xrpl::SHAMap::getMissingNodes : valid max input"); MissingNodes mn( max, @@ -362,7 +362,7 @@ SHAMap::getMissingNodes(int max, SHAMapSyncFilter* filter) } XRPL_ASSERT( node, - "ripple::SHAMap::getMissingNodes : first non-null node"); + "xrpl::SHAMap::getMissingNodes : first non-null node"); } } @@ -395,7 +395,7 @@ SHAMap::getMissingNodes(int max, SHAMapSyncFilter* filter) mn.stack_.pop(); XRPL_ASSERT( node, - "ripple::SHAMap::getMissingNodes : second non-null node"); + "xrpl::SHAMap::getMissingNodes : second non-null node"); } } @@ -524,11 +524,11 @@ SHAMap::addRootNode( JLOG(journal_.trace()) << "got root node, already have one"; XRPL_ASSERT( root_->getHash() == hash, - "ripple::SHAMap::addRootNode : valid hash input"); + "xrpl::SHAMap::addRootNode : valid hash input"); return SHAMapAddNode::duplicate(); } - XRPL_ASSERT(cowid_ >= 1, "ripple::SHAMap::addRootNode : valid cowid"); + XRPL_ASSERT(cowid_ >= 1, "xrpl::SHAMap::addRootNode : valid cowid"); auto node = SHAMapTreeNode::makeFromWire(rootNode); if (!node || node->getHash() != hash) return SHAMapAddNode::invalid(); @@ -563,7 +563,7 @@ SHAMap::addKnownNode( SHAMapSyncFilter* filter) { XRPL_ASSERT( - !node.isRoot(), "ripple::SHAMap::addKnownNode : valid node input"); + !node.isRoot(), "xrpl::SHAMap::addKnownNode : valid node input"); if (!isSynching()) { @@ -580,7 +580,7 @@ SHAMap::addKnownNode( (currNodeID.getDepth() < node.getDepth())) { int const branch = selectBranch(currNodeID, node.getNodeID()); - XRPL_ASSERT(branch >= 0, "ripple::SHAMap::addKnownNode : valid branch"); + XRPL_ASSERT(branch >= 0, "xrpl::SHAMap::addKnownNode : valid branch"); auto inner = static_cast(currNode); if (inner->isEmptyBranch(branch)) { @@ -884,4 +884,4 @@ SHAMap::verifyProofPath( return false; } -} // namespace ripple +} // namespace xrpl diff --git a/src/libxrpl/shamap/SHAMapTreeNode.cpp b/src/libxrpl/shamap/SHAMapTreeNode.cpp index 453be08756..854b4c1097 100644 --- a/src/libxrpl/shamap/SHAMapTreeNode.cpp +++ b/src/libxrpl/shamap/SHAMapTreeNode.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { intr_ptr::SharedPtr SHAMapTreeNode::makeTransaction( @@ -164,4 +164,4 @@ SHAMapTreeNode::getString(SHAMapNodeID const& id) const return to_string(id); } -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AMMCalc_test.cpp b/src/test/app/AMMCalc_test.cpp index 998642afb7..abfb548b64 100644 --- a/src/test/app/AMMCalc_test.cpp +++ b/src/test/app/AMMCalc_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { /** AMM Calculator. Uses AMM formulas to simulate the payment engine @@ -439,7 +439,7 @@ class AMMCalc_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE_MANUAL(AMMCalc, app, ripple); +BEAST_DEFINE_TESTSUITE_MANUAL(AMMCalc, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AMMClawback_test.cpp b/src/test/app/AMMClawback_test.cpp index 003bffae8f..e9882ef174 100644 --- a/src/test/app/AMMClawback_test.cpp +++ b/src/test/app/AMMClawback_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class AMMClawback_test : public beast::unit_test::suite { @@ -2447,6 +2447,6 @@ class AMMClawback_test : public beast::unit_test::suite } } }; -BEAST_DEFINE_TESTSUITE(AMMClawback, app, ripple); +BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 080b392ebe..c3bfb46043 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { /** @@ -3822,7 +3822,7 @@ private: } }; -BEAST_DEFINE_TESTSUITE_PRIO(AMMExtended, app, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(AMMExtended, app, xrpl, 1); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 611932e825..8d64dfed2a 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { /** @@ -7481,7 +7481,7 @@ private: for (int i = 0; i < 256; ++i) { AccountID const accountId = - ripple::pseudoAccountAddress(*env.current(), keylet.key); + xrpl::pseudoAccountAddress(*env.current(), keylet.key); env(pay(env.master.id(), accountId, XRP(1000)), seq(autofill), @@ -7952,7 +7952,7 @@ private: } }; -BEAST_DEFINE_TESTSUITE_PRIO(AMM, app, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(AMM, app, xrpl, 1); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index 91164d3e4e..749ed33e28 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class AccountDelete_test : public beast::unit_test::suite @@ -1104,7 +1104,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(AccountDelete, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(AccountDelete, app, xrpl, 2); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AccountTxPaging_test.cpp b/src/test/app/AccountTxPaging_test.cpp index fe72f1fe1f..5efe307812 100644 --- a/src/test/app/AccountTxPaging_test.cpp +++ b/src/test/app/AccountTxPaging_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { class AccountTxPaging_test : public beast::unit_test::suite { @@ -251,6 +251,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, ripple); +BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index 6aad3fa05f..9add892073 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { class AmendmentTable_test final : public beast::unit_test::suite { @@ -534,7 +534,7 @@ public: } auto v = std::make_shared( - ripple::NetClock::time_point{}, + xrpl::NetClock::time_point{}, pub, sec, calcNodeID(pub), @@ -1271,6 +1271,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AmendmentTable, app, ripple); +BEAST_DEFINE_TESTSUITE(AmendmentTable, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index f2fae58a9b..06cf5dee0c 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Batch_test : public beast::unit_test::suite @@ -547,7 +547,7 @@ class Batch_test : public beast::unit_test::suite Serializer msg; serializeBatch( msg, tfAllOrNothing, jt.stx->getBatchTransactionIDs()); - auto const sig = ripple::sign(bob.pk(), bob.sk(), msg.slice()); + auto const sig = xrpl::sign(bob.pk(), bob.sk(), msg.slice()); jt.jv[sfBatchSigners.jsonName][0u][sfBatchSigner.jsonName] [sfAccount.jsonName] = bob.human(); jt.jv[sfBatchSigners.jsonName][0u][sfBatchSigner.jsonName] @@ -1378,7 +1378,7 @@ class Batch_test : public beast::unit_test::suite env.app().openLedger().modify( [&](OpenView& view, beast::Journal j) { auto const result = - ripple::apply(env.app(), view, *jt.stx, tapNONE, j); + xrpl::apply(env.app(), view, *jt.stx, tapNONE, j); BEAST_EXPECT( !result.applied && result.ter == temARRAY_TOO_LARGE); return result.applied; @@ -1424,7 +1424,7 @@ class Batch_test : public beast::unit_test::suite env.app().openLedger().modify( [&](OpenView& view, beast::Journal j) { auto const result = - ripple::apply(env.app(), view, *jt.stx, tapNONE, j); + xrpl::apply(env.app(), view, *jt.stx, tapNONE, j); BEAST_EXPECT( !result.applied && result.ter == temARRAY_TOO_LARGE); return result.applied; @@ -3592,7 +3592,7 @@ class Batch_test : public beast::unit_test::suite BEAST_EXPECT(!passesLocalChecks(stx, reason)); BEAST_EXPECT(reason == "Cannot submit pseudo transactions."); env.app().openLedger().modify([&](OpenView& view, beast::Journal j) { - auto const result = ripple::apply(env.app(), view, stx, tapNONE, j); + auto const result = xrpl::apply(env.app(), view, stx, tapNONE, j); BEAST_EXPECT(!result.applied && result.ter == temINVALID_FLAG); return result.applied; }); @@ -4356,7 +4356,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Batch, app, ripple); +BEAST_DEFINE_TESTSUITE(Batch, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index b7d158041b..b3d8249dd0 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -1911,7 +1911,7 @@ class Check_test : public beast::unit_test::suite return acct; } - operator ripple::AccountID() const + operator xrpl::AccountID() const { return acct.id(); } @@ -2585,6 +2585,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Check, app, ripple); +BEAST_DEFINE_TESTSUITE(Check, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Clawback_test.cpp b/src/test/app/Clawback_test.cpp index 933e9678aa..c8c4aea757 100644 --- a/src/test/app/Clawback_test.cpp +++ b/src/test/app/Clawback_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Clawback_test : public beast::unit_test::suite { @@ -937,5 +937,5 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Clawback, app, ripple); -} // namespace ripple +BEAST_DEFINE_TESTSUITE(Clawback, app, xrpl); +} // namespace xrpl diff --git a/src/test/app/Credentials_test.cpp b/src/test/app/Credentials_test.cpp index c4a5ee1c7c..7de34e05a1 100644 --- a/src/test/app/Credentials_test.cpp +++ b/src/test/app/Credentials_test.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct Credentials_test : public beast::unit_test::suite @@ -926,8 +926,7 @@ struct Credentials_test : public beast::unit_test::suite testcase("deleteSLE fail, bad SLE."); auto view = std::make_shared( env.current().get(), ApplyFlags::tapNONE); - auto ter = - ripple::credentials::deleteSLE(*view, {}, env.journal); + auto ter = xrpl::credentials::deleteSLE(*view, {}, env.journal); BEAST_EXPECT(ter == tecNO_ENTRY); } } @@ -1108,7 +1107,7 @@ struct Credentials_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Credentials, app, ripple); +BEAST_DEFINE_TESTSUITE(Credentials, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/CrossingLimits_test.cpp b/src/test/app/CrossingLimits_test.cpp index 13d7aef505..9e9b1a3d45 100644 --- a/src/test/app/CrossingLimits_test.cpp +++ b/src/test/app/CrossingLimits_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class CrossingLimits_test : public beast::unit_test::suite @@ -492,7 +492,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, app, ripple, 10); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(CrossingLimits, app, xrpl, 10); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/DID_test.cpp b/src/test/app/DID_test.cpp index 20d4e3d34d..e7adfee178 100644 --- a/src/test/app/DID_test.cpp +++ b/src/test/app/DID_test.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct DID_test : public beast::unit_test::suite @@ -379,7 +379,7 @@ struct DID_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(DID, app, ripple); +BEAST_DEFINE_TESTSUITE(DID, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/DNS_test.cpp b/src/test/app/DNS_test.cpp index cf5bfb31f7..fc6917e15c 100644 --- a/src/test/app/DNS_test.cpp +++ b/src/test/app/DNS_test.cpp @@ -7,14 +7,14 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class DNS_test : public beast::unit_test::suite { using endpoint_type = boost::asio::ip::tcp::endpoint; using error_code = boost::system::error_code; - std::weak_ptr work_; + std::weak_ptr work_; endpoint_type lastEndpoint_{}; parsedURL pUrl_; std::string port_; @@ -33,14 +33,14 @@ public: { auto onFetch = [&](error_code const& errorCode, endpoint_type const& endpoint, - ripple::detail::response_type&& resp) { + xrpl::detail::response_type&& resp) { BEAST_EXPECT(!errorCode); lastEndpoint_ = endpoint; resolved_[endpoint.address().to_string()]++; cv_.notify_all(); }; - auto sp = std::make_shared( + auto sp = std::make_shared( pUrl_.domain, pUrl_.path, port_, @@ -110,7 +110,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(DNS, app, ripple, 20); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(DNS, app, xrpl, 20); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Delegate_test.cpp b/src/test/app/Delegate_test.cpp index e36ad9a550..7d58093e43 100644 --- a/src/test/app/Delegate_test.cpp +++ b/src/test/app/Delegate_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Delegate_test : public beast::unit_test::suite { @@ -1806,6 +1806,6 @@ class Delegate_test : public beast::unit_test::suite testTxReqireFeatures(all); } }; -BEAST_DEFINE_TESTSUITE(Delegate, app, ripple); +BEAST_DEFINE_TESTSUITE(Delegate, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/DeliverMin_test.cpp b/src/test/app/DeliverMin_test.cpp index 9a2bc9372e..4d643dfae1 100644 --- a/src/test/app/DeliverMin_test.cpp +++ b/src/test/app/DeliverMin_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class DeliverMin_test : public beast::unit_test::suite @@ -129,7 +129,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(DeliverMin, app, ripple); +BEAST_DEFINE_TESTSUITE(DeliverMin, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index ed727c2fa0..4235c8c9ca 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { // Helper function that returns the reserve on an account based on @@ -1462,8 +1462,8 @@ struct DepositPreauth_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(DepositAuth, app, ripple); -BEAST_DEFINE_TESTSUITE(DepositPreauth, app, ripple); +BEAST_DEFINE_TESTSUITE(DepositAuth, app, xrpl); +BEAST_DEFINE_TESTSUITE(DepositPreauth, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Discrepancy_test.cpp b/src/test/app/Discrepancy_test.cpp index b7ac66e1df..0e96f3aa1a 100644 --- a/src/test/app/Discrepancy_test.cpp +++ b/src/test/app/Discrepancy_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class Discrepancy_test : public beast::unit_test::suite { @@ -133,6 +133,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Discrepancy, app, ripple); +BEAST_DEFINE_TESTSUITE(Discrepancy, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index f1dc6155f4..ff8b2cfb49 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct EscrowToken_test : public beast::unit_test::suite @@ -1000,14 +1000,14 @@ struct EscrowToken_test : public beast::unit_test::suite auto const aa = env.le(keylet::escrow(alice.id(), aseq)); BEAST_EXPECT(aa); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 2); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) != aod.end()); } { - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 4); BEAST_EXPECT( std::find(iod.begin(), iod.end(), aa) != iod.end()); @@ -1024,14 +1024,14 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(bb); { - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); } { - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 5); BEAST_EXPECT( std::find(iod.begin(), iod.end(), bb) != iod.end()); @@ -1045,17 +1045,17 @@ struct EscrowToken_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 4); BEAST_EXPECT( std::find(iod.begin(), iod.end(), bb) != iod.end()); @@ -1069,12 +1069,12 @@ struct EscrowToken_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) == bod.end()); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 3); BEAST_EXPECT( std::find(iod.begin(), iod.end(), bb) == iod.end()); @@ -1117,24 +1117,24 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(bc); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 2); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) != aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 3); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) != bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 2); BEAST_EXPECT( std::find(cod.begin(), cod.end(), bc) != cod.end()); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 5); BEAST_EXPECT( std::find(iod.begin(), iod.end(), ab) != iod.end()); @@ -1148,22 +1148,22 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(env.le(keylet::escrow(bob.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 2); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 4); BEAST_EXPECT( std::find(iod.begin(), iod.end(), ab) == iod.end()); @@ -1177,22 +1177,22 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(!env.le(keylet::escrow(bob.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) == bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 3); BEAST_EXPECT( std::find(iod.begin(), iod.end(), ab) == iod.end()); @@ -1232,15 +1232,15 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(ag); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 2); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ag) != aod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 3); BEAST_EXPECT( std::find(iod.begin(), iod.end(), ag) != iod.end()); @@ -1251,15 +1251,15 @@ struct EscrowToken_test : public beast::unit_test::suite { BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ag) == aod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 2); BEAST_EXPECT( std::find(iod.begin(), iod.end(), ag) == iod.end()); @@ -2265,7 +2265,7 @@ struct EscrowToken_test : public beast::unit_test::suite env.fund(XRP(10'000), alice, bob, gw); env.close(); - auto const mpt = ripple::test::jtx::MPT( + auto const mpt = xrpl::test::jtx::MPT( alice.name(), makeMptID(env.seq(alice), alice)); Json::Value jv = escrow::create(alice, bob, mpt(2)); jv[jss::Amount][jss::mpt_issuance_id] = @@ -3209,14 +3209,14 @@ struct EscrowToken_test : public beast::unit_test::suite auto const aa = env.le(keylet::escrow(alice.id(), aseq)); BEAST_EXPECT(aa); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 2); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) != aod.end()); } { - ripple::Dir iod(*env.current(), keylet::ownerDir(gw.id())); + xrpl::Dir iod(*env.current(), keylet::ownerDir(gw.id())); BEAST_EXPECT(std::distance(iod.begin(), iod.end()) == 1); BEAST_EXPECT( std::find(iod.begin(), iod.end(), aa) == iod.end()); @@ -3233,7 +3233,7 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(bb); { - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); @@ -3247,12 +3247,12 @@ struct EscrowToken_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); @@ -3266,7 +3266,7 @@ struct EscrowToken_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) == bod.end()); @@ -3314,19 +3314,19 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(bc); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 2); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) != aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 3); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) != bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 2); BEAST_EXPECT( std::find(cod.begin(), cod.end(), bc) != cod.end()); @@ -3338,19 +3338,19 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(env.le(keylet::escrow(bob.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 2); } @@ -3360,19 +3360,19 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(!env.le(keylet::escrow(bob.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bob.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bob.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) == bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); } } @@ -3930,7 +3930,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(EscrowToken, app, ripple); +BEAST_DEFINE_TESTSUITE(EscrowToken, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index e3b2340022..d4a9fc5b9d 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct Escrow_test : public beast::unit_test::suite @@ -1144,7 +1144,7 @@ struct Escrow_test : public beast::unit_test::suite BEAST_EXPECT(aa); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) != aod.end()); @@ -1161,7 +1161,7 @@ struct Escrow_test : public beast::unit_test::suite BEAST_EXPECT(bb); { - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); @@ -1175,12 +1175,12 @@ struct Escrow_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 0); BEAST_EXPECT( std::find(aod.begin(), aod.end(), aa) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) != bod.end()); @@ -1194,7 +1194,7 @@ struct Escrow_test : public beast::unit_test::suite (*env.meta())[sfTransactionResult] == static_cast(tesSUCCESS)); - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 0); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bb) == bod.end()); @@ -1229,19 +1229,19 @@ struct Escrow_test : public beast::unit_test::suite BEAST_EXPECT(bc); { - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 1); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) != aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 2); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) != bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); BEAST_EXPECT( std::find(cod.begin(), cod.end(), bc) != cod.end()); @@ -1253,19 +1253,19 @@ struct Escrow_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(env.le(keylet::escrow(bruce.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 0); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 1); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) != bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 1); } @@ -1275,19 +1275,19 @@ struct Escrow_test : public beast::unit_test::suite BEAST_EXPECT(!env.le(keylet::escrow(alice.id(), aseq))); BEAST_EXPECT(!env.le(keylet::escrow(bruce.id(), bseq))); - ripple::Dir aod(*env.current(), keylet::ownerDir(alice.id())); + xrpl::Dir aod(*env.current(), keylet::ownerDir(alice.id())); BEAST_EXPECT(std::distance(aod.begin(), aod.end()) == 0); BEAST_EXPECT( std::find(aod.begin(), aod.end(), ab) == aod.end()); - ripple::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); + xrpl::Dir bod(*env.current(), keylet::ownerDir(bruce.id())); BEAST_EXPECT(std::distance(bod.begin(), bod.end()) == 0); BEAST_EXPECT( std::find(bod.begin(), bod.end(), ab) == bod.end()); BEAST_EXPECT( std::find(bod.begin(), bod.end(), bc) == bod.end()); - ripple::Dir cod(*env.current(), keylet::ownerDir(carol.id())); + xrpl::Dir cod(*env.current(), keylet::ownerDir(carol.id())); BEAST_EXPECT(std::distance(cod.begin(), cod.end()) == 0); } } @@ -1678,7 +1678,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Escrow, app, ripple); +BEAST_DEFINE_TESTSUITE(Escrow, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index 94f753d8f3..c7f33544f9 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct FeeSettingsFields @@ -780,7 +780,7 @@ class FeeVote_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(FeeVote, app, ripple); +BEAST_DEFINE_TESTSUITE(FeeVote, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index 32d444eea2..baa33b2dc5 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class FixNFTokenPageLinks_test : public beast::unit_test::suite { @@ -642,6 +642,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(FixNFTokenPageLinks, app, ripple); +BEAST_DEFINE_TESTSUITE(FixNFTokenPageLinks, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 12dcc91b98..e16a48e02f 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { bool @@ -1329,8 +1329,8 @@ struct Flow_manual_test : public Flow_test } }; -BEAST_DEFINE_TESTSUITE_PRIO(Flow, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Flow_manual, app, ripple, 4); +BEAST_DEFINE_TESTSUITE_PRIO(Flow, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Flow_manual, app, xrpl, 4); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Freeze_test.cpp b/src/test/app/Freeze_test.cpp index 43d7c6d1e4..85c2b5a924 100644 --- a/src/test/app/Freeze_test.cpp +++ b/src/test/app/Freeze_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class Freeze_test : public beast::unit_test::suite { @@ -2088,5 +2088,5 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Freeze, app, ripple); -} // namespace ripple +BEAST_DEFINE_TESTSUITE(Freeze, app, xrpl); +} // namespace xrpl diff --git a/src/test/app/HashRouter_test.cpp b/src/test/app/HashRouter_test.cpp index b3f692c2b0..c428917fdc 100644 --- a/src/test/app/HashRouter_test.cpp +++ b/src/test/app/HashRouter_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class HashRouter_test : public beast::unit_test::suite @@ -404,7 +404,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(HashRouter, app, ripple); +BEAST_DEFINE_TESTSUITE(HashRouter, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 4e4632e49b..8eb3047dc8 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -20,7 +20,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class Invariants_test : public beast::unit_test::suite @@ -1991,7 +1991,7 @@ class Invariants_test : public beast::unit_test::suite { // Create the directory BEAST_EXPECT( - ::ripple::directory::createRoot( + ::xrpl::directory::createRoot( ac.view(), dirKeylet, loanBrokerKeylet.key, @@ -2018,7 +2018,7 @@ class Invariants_test : public beast::unit_test::suite describeOwnerDir(slePseudo->at(sfAccount)); BEAST_EXPECT( - ::ripple::directory::insertPage( + ::xrpl::directory::insertPage( ac.view(), 0, sleDir, @@ -2051,7 +2051,7 @@ class Invariants_test : public beast::unit_test::suite // Put some extra garbage into the directory for (auto const& key : {slePseudo->key(), sleDir->key()}) { - ::ripple::directory::insertKey( + ::xrpl::directory::insertKey( ac.view(), sleDir, 0, false, indexes, key); } @@ -2082,7 +2082,7 @@ class Invariants_test : public beast::unit_test::suite // Put one meaningless key into the directory auto const key = keylet::account(Account("random").id()).key; - ::ripple::directory::insertKey( + ::xrpl::directory::insertKey( ac.view(), sleDir, 0, false, indexes, key); return true; @@ -2108,7 +2108,7 @@ class Invariants_test : public beast::unit_test::suite // failure. STVector256 indexes; - ::ripple::directory::insertKey( + ::xrpl::directory::insertKey( ac.view(), sleDir, 0, false, indexes, slePseudo->key()); return true; @@ -2165,7 +2165,7 @@ class Invariants_test : public beast::unit_test::suite std::optional accountShares = {}; }; auto constexpr adjust = [&](ApplyView& ac, - ripple::Keylet keylet, + xrpl::Keylet keylet, Adjustments args) { auto sleVault = ac.peek(keylet); if (!sleVault) @@ -3914,7 +3914,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Invariants, app, ripple); +BEAST_DEFINE_TESTSUITE(Invariants, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LPTokenTransfer_test.cpp b/src/test/app/LPTokenTransfer_test.cpp index acce2312ac..b2a6f39ddf 100644 --- a/src/test/app/LPTokenTransfer_test.cpp +++ b/src/test/app/LPTokenTransfer_test.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class LPTokenTransfer_test : public jtx::AMMTest @@ -462,6 +462,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LPTokenTransfer, app, ripple); +BEAST_DEFINE_TESTSUITE(LPTokenTransfer, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LedgerHistory_test.cpp b/src/test/app/LedgerHistory_test.cpp index 3223e9e1d8..b69203f1e0 100644 --- a/src/test/app/LedgerHistory_test.cpp +++ b/src/test/app/LedgerHistory_test.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class LedgerHistory_test : public beast::unit_test::suite @@ -182,7 +182,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerHistory, app, ripple); +BEAST_DEFINE_TESTSUITE(LedgerHistory, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index ac0fcdba35..d5c37d0404 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -13,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { class LedgerLoad_test : public beast::unit_test::suite { @@ -370,6 +370,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerLoad, app, ripple); +BEAST_DEFINE_TESTSUITE(LedgerLoad, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LedgerMaster_test.cpp b/src/test/app/LedgerMaster_test.cpp index 451e4f9068..59e02cbabb 100644 --- a/src/test/app/LedgerMaster_test.cpp +++ b/src/test/app/LedgerMaster_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class LedgerMaster_test : public beast::unit_test::suite @@ -116,7 +116,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerMaster, app, ripple); +BEAST_DEFINE_TESTSUITE(LedgerMaster, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index a468629de9..beb27817a1 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct LedgerReplay_test : public beast::unit_test::suite @@ -1084,8 +1084,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite { testcase("handshake test"); auto handshake = [&](bool client, bool server, bool expecting) -> bool { - auto request = - ripple::makeRequest(true, false, client, false, false); + auto request = xrpl::makeRequest(true, false, client, false, false); http_request_type http_request; http_request.version(request.version()); http_request.base() = request.base(); @@ -1098,7 +1097,7 @@ struct LedgerReplayer_test : public beast::unit_test::suite boost::asio::ip::make_address("172.1.1.100"); jtx::Env serverEnv(*this); serverEnv.app().config().LEDGER_REPLAY = server; - auto http_resp = ripple::makeResponse( + auto http_resp = xrpl::makeResponse( true, http_request, addr, @@ -1596,10 +1595,10 @@ struct LedgerReplayerLong_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(LedgerReplay, app, ripple); -BEAST_DEFINE_TESTSUITE_PRIO(LedgerReplayer, app, ripple, 1); -BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app, ripple); -BEAST_DEFINE_TESTSUITE_MANUAL(LedgerReplayerLong, app, ripple); +BEAST_DEFINE_TESTSUITE(LedgerReplay, app, xrpl); +BEAST_DEFINE_TESTSUITE_PRIO(LedgerReplayer, app, xrpl, 1); +BEAST_DEFINE_TESTSUITE(LedgerReplayerTimeout, app, xrpl); +BEAST_DEFINE_TESTSUITE_MANUAL(LedgerReplayerLong, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LoadFeeTrack_test.cpp b/src/test/app/LoadFeeTrack_test.cpp index 10b51b5c0b..e0638b64bc 100644 --- a/src/test/app/LoadFeeTrack_test.cpp +++ b/src/test/app/LoadFeeTrack_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class LoadFeeTrack_test : public beast::unit_test::suite { @@ -68,6 +68,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LoadFeeTrack, app, ripple); +BEAST_DEFINE_TESTSUITE(LoadFeeTrack, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 597e2ea75b..72a732d043 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class LoanBroker_test : public beast::unit_test::suite @@ -638,7 +638,7 @@ class LoanBroker_test : public beast::unit_test::suite } using namespace loanBroker; - using namespace ripple::Lending; + using namespace xrpl::Lending; TenthBips32 const tenthBipsZero{0}; @@ -1456,7 +1456,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LoanBroker, tx, ripple); +BEAST_DEFINE_TESTSUITE(LoanBroker, tx, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index f7672fd380..22159ba4bb 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Loan_test : public beast::unit_test::suite @@ -964,7 +964,7 @@ protected: Number totalFeesPaid = 0; std::size_t totalPaymentsMade = 0; - ripple::LoanState currentTrueState = computeRawLoanState( + xrpl::LoanState currentTrueState = computeRawLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -1019,7 +1019,7 @@ protected: paymentComponents.trackedInterestPart() + paymentComponents.trackedManagementFeeDelta); - ripple::LoanState const nextTrueState = computeRawLoanState( + xrpl::LoanState const nextTrueState = computeRawLoanState( state.periodicPayment, periodicRate, state.paymentRemaining - 1, @@ -2705,7 +2705,7 @@ protected: Number totalInterestPaid = 0; std::size_t totalPaymentsMade = 0; - ripple::LoanState currentTrueState = computeRawLoanState( + xrpl::LoanState currentTrueState = computeRawLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -2730,7 +2730,7 @@ protected: paymentComponents.trackedValueDelta <= roundedPeriodicPayment); - ripple::LoanState const nextTrueState = computeRawLoanState( + xrpl::LoanState const nextTrueState = computeRawLoanState( state.periodicPayment, periodicRate, state.paymentRemaining - 1, @@ -3873,7 +3873,7 @@ protected: Serializer ss; ss.add32(HashPrefix::txSign); parse(randomData).addWithoutSigningFields(ss); - auto const sig = ripple::sign(borrower.pk(), borrower.sk(), ss.slice()); + auto const sig = xrpl::sign(borrower.pk(), borrower.sk(), ss.slice()); sigObject[jss::TxnSignature] = strHex(Slice{sig.data(), sig.size()}); forgedLoanSet[Json::StaticString{"CounterpartySignature"}] = sigObject; @@ -3957,7 +3957,7 @@ protected: testLoanPayComputePeriodicPaymentValidRateInvariant() { // From FIND-012 - testcase << "LoanPay ripple::detail::computePeriodicPayment : " + testcase << "LoanPay xrpl::detail::computePeriodicPayment : " "valid rate"; using namespace jtx; @@ -4773,7 +4773,7 @@ protected: testAccountSendMptMinAmountInvariant() { // (From FIND-006) - testcase << "LoanSet trigger ripple::accountSendMPT : minimum amount " + testcase << "LoanSet trigger xrpl::accountSendMPT : minimum amount " "and MPT"; using namespace jtx; @@ -4835,7 +4835,7 @@ protected: testLoanPayDebtDecreaseInvariant() { // From FIND-007 - testcase << "LoanPay ripple::LoanPay::doApply : debtDecrease " + testcase << "LoanPay xrpl::LoanPay::doApply : debtDecrease " "rounding good"; using namespace jtx; @@ -4940,7 +4940,7 @@ protected: testLoanPayComputePeriodicPaymentValidTotalInterestInvariant() { // From FIND-010 - testcase << "ripple::loanComputePaymentParts : valid total interest"; + testcase << "xrpl::loanComputePaymentParts : valid total interest"; using namespace jtx; using namespace std::chrono_literals; @@ -5093,7 +5093,7 @@ protected: testLoanPayComputePeriodicPaymentValidTotalPrincipalPaidInvariant() { // From FIND-009 - testcase << "ripple::loanComputePaymentParts : totalPrincipalPaid " + testcase << "xrpl::loanComputePaymentParts : totalPrincipalPaid " "rounded"; using namespace jtx; @@ -5207,7 +5207,7 @@ protected: testLoanPayComputePeriodicPaymentValidTotalInterestPaidInvariant() { // From FIND-008 - testcase << "ripple::loanComputePaymentParts : loanValueChange rounded"; + testcase << "xrpl::loanComputePaymentParts : loanValueChange rounded"; using namespace jtx; using namespace std::chrono_literals; @@ -7207,9 +7207,9 @@ class LoanArbitrary_test : public LoanBatch_test } }; -BEAST_DEFINE_TESTSUITE(Loan, tx, ripple); -BEAST_DEFINE_TESTSUITE_MANUAL(LoanBatch, tx, ripple); -BEAST_DEFINE_TESTSUITE_MANUAL(LoanArbitrary, tx, ripple); +BEAST_DEFINE_TESTSUITE(Loan, tx, xrpl); +BEAST_DEFINE_TESTSUITE_MANUAL(LoanBatch, tx, xrpl); +BEAST_DEFINE_TESTSUITE_MANUAL(LoanArbitrary, tx, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 7d0126bd65..1de142c2ab 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class MPToken_test : public beast::unit_test::suite @@ -2349,7 +2349,7 @@ class MPToken_test : public beast::unit_test::suite env.close(); auto const USD = alice["USD"]; - auto const mpt = ripple::test::jtx::MPT( + auto const mpt = xrpl::test::jtx::MPT( alice.name(), makeMptID(env.seq(alice), alice)); env(claw(alice, bob["USD"](5), bob), ter(temMALFORMED)); @@ -2372,7 +2372,7 @@ class MPToken_test : public beast::unit_test::suite env.close(); auto const USD = alice["USD"]; - auto const mpt = ripple::test::jtx::MPT( + auto const mpt = xrpl::test::jtx::MPT( alice.name(), makeMptID(env.seq(alice), alice)); // clawing back IOU from a MPT holder fails @@ -2431,7 +2431,7 @@ class MPToken_test : public beast::unit_test::suite env.close(); MPTTester mptAlice(env, alice, {.holders = {bob}}); - auto const fakeMpt = ripple::test::jtx::MPT( + auto const fakeMpt = xrpl::test::jtx::MPT( alice.name(), makeMptID(env.seq(alice), alice)); // issuer tries to clawback MPT where issuance doesn't exist @@ -2470,7 +2470,7 @@ class MPToken_test : public beast::unit_test::suite env.fund(XRP(1000), alice, bob); env.close(); - auto const mpt = ripple::test::jtx::MPT( + auto const mpt = xrpl::test::jtx::MPT( alice.name(), makeMptID(env.seq(alice), alice)); Json::Value jv = claw(alice, mpt(1), bob); @@ -3675,7 +3675,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(MPToken, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(MPToken, app, xrpl, 2); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index b2c8c859fd..09054658c9 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Manifest_test : public beast::unit_test::suite @@ -1066,7 +1066,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Manifest, app, ripple); +BEAST_DEFINE_TESTSUITE(Manifest, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 126413d8d0..6e30ed9c13 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class MultiSign_test : public beast::unit_test::suite @@ -1481,8 +1481,8 @@ public: uint8_t tag2[] = "hello world some ascii 32b long"; // including 1 byte for NUL - uint256 bogie_tag = ripple::base_uint<256>::fromVoid(tag1); - uint256 demon_tag = ripple::base_uint<256>::fromVoid(tag2); + uint256 bogie_tag = xrpl::base_uint<256>::fromVoid(tag1); + uint256 demon_tag = xrpl::base_uint<256>::fromVoid(tag2); // Attach phantom signers to alice and use them for a transaction. env(signers(alice, 1, {{bogie, 1, bogie_tag}, {demon, 1, demon_tag}})); @@ -1632,7 +1632,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(MultiSign, app, ripple); +BEAST_DEFINE_TESTSUITE(MultiSign, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/NFTokenAuth_test.cpp b/src/test/app/NFTokenAuth_test.cpp index b22a99ce73..dce8da0042 100644 --- a/src/test/app/NFTokenAuth_test.cpp +++ b/src/test/app/NFTokenAuth_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenAuth_test : public beast::unit_test::suite { @@ -600,6 +600,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenAuth, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenAuth, app, xrpl, 2); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index 319cdba564..828539f4b1 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenBurn_test : public beast::unit_test::suite { @@ -1259,6 +1259,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn, app, ripple, 3); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBurn, app, xrpl, 3); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/NFTokenDir_test.cpp b/src/test/app/NFTokenDir_test.cpp index fdc488d5da..9718a5d073 100644 --- a/src/test/app/NFTokenDir_test.cpp +++ b/src/test/app/NFTokenDir_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenDir_test : public beast::unit_test::suite { @@ -1060,9 +1060,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenDir, app, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenDir, app, xrpl, 1); -} // namespace ripple +} // namespace xrpl // Seed that produces an account with the low-32 bits == 0xFFFFFFFF in // case it is needed for future testing: diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 5ff0ac17ae..75bf59e70d 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenBaseUtil_test : public beast::unit_test::suite { @@ -7639,10 +7639,10 @@ class NFTokenAllFeatures_test : public NFTokenBaseUtil_test } }; -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBaseUtil, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenDisallowIncoming, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenWOMintOffer, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenWOModify, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(NFTokenAllFeatures, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenBaseUtil, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenDisallowIncoming, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenWOMintOffer, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenWOModify, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(NFTokenAllFeatures, app, xrpl, 2); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index 49ca453ebb..d924710cb3 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class NetworkID_test : public beast::unit_test::suite @@ -142,7 +142,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NetworkID, app, ripple); +BEAST_DEFINE_TESTSUITE(NetworkID, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/NetworkOPs_test.cpp b/src/test/app/NetworkOPs_test.cpp index 3965778221..d5616009fa 100644 --- a/src/test/app/NetworkOPs_test.cpp +++ b/src/test/app/NetworkOPs_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class NetworkOPs_test : public beast::unit_test::suite @@ -55,7 +55,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NetworkOPs, app, ripple); +BEAST_DEFINE_TESTSUITE(NetworkOPs, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/OfferStream_test.cpp b/src/test/app/OfferStream_test.cpp index fac5ab18ab..218653a5d4 100644 --- a/src/test/app/OfferStream_test.cpp +++ b/src/test/app/OfferStream_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class OfferStream_test : public beast::unit_test::suite { @@ -20,6 +20,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(OfferStream, app, ripple); +BEAST_DEFINE_TESTSUITE(OfferStream, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 9cf8a7b1f2..1117510a45 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class OfferBaseUtil_test : public beast::unit_test::suite @@ -5300,10 +5300,10 @@ class Offer_manual_test : public OfferBaseUtil_test } }; -BEAST_DEFINE_TESTSUITE_PRIO(OfferBaseUtil, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(OfferWOSmallQOffers, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_PRIO(OfferAllFeatures, app, ripple, 2); -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Offer_manual, app, ripple, 20); +BEAST_DEFINE_TESTSUITE_PRIO(OfferBaseUtil, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(OfferWOSmallQOffers, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_PRIO(OfferAllFeatures, app, xrpl, 2); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Offer_manual, app, xrpl, 20); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Oracle_test.cpp b/src/test/app/Oracle_test.cpp index 470bcd7950..6708f56275 100644 --- a/src/test/app/Oracle_test.cpp +++ b/src/test/app/Oracle_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace oracle { @@ -865,7 +865,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Oracle, app, ripple); +BEAST_DEFINE_TESTSUITE(Oracle, app, xrpl); } // namespace oracle @@ -873,4 +873,4 @@ BEAST_DEFINE_TESTSUITE(Oracle, app, ripple); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/OversizeMeta_test.cpp b/src/test/app/OversizeMeta_test.cpp index dbb5310e01..2eb300b095 100644 --- a/src/test/app/OversizeMeta_test.cpp +++ b/src/test/app/OversizeMeta_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { // Make sure "plump" order books don't have problems @@ -42,7 +42,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(PlumpBook, app, ripple, 5); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(PlumpBook, app, xrpl, 5); //------------------------------------------------------------------------------ @@ -57,7 +57,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ThinBook, app, ripple); +BEAST_DEFINE_TESTSUITE(ThinBook, app, xrpl); //------------------------------------------------------------------------------ @@ -100,7 +100,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(OversizeMeta, app, ripple, 3); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(OversizeMeta, app, xrpl, 3); //------------------------------------------------------------------------------ @@ -166,7 +166,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(FindOversizeCross, app, ripple, 50); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(FindOversizeCross, app, xrpl, 50); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index e481bd673b..8a80ecd6d8 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -23,7 +23,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { //------------------------------------------------------------------------------ @@ -2114,7 +2114,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Path, app, ripple); +BEAST_DEFINE_TESTSUITE(Path, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index 3f350626ea..20a433b5dd 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { using namespace jtx::paychan; @@ -1772,14 +1772,14 @@ struct PayChan_test : public beast::unit_test::suite auto inOwnerDir = [](ReadView const& view, Account const& acc, std::shared_ptr const& chan) -> bool { - ripple::Dir const ownerDir(view, keylet::ownerDir(acc.id())); + xrpl::Dir const ownerDir(view, keylet::ownerDir(acc.id())); return std::find(ownerDir.begin(), ownerDir.end(), chan) != ownerDir.end(); }; auto ownerDirCount = [](ReadView const& view, Account const& acc) -> std::size_t { - ripple::Dir const ownerDir(view, keylet::ownerDir(acc.id())); + xrpl::Dir const ownerDir(view, keylet::ownerDir(acc.id())); return std::distance(ownerDir.begin(), ownerDir.end()); }; @@ -2119,6 +2119,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PayChan, app, ripple); +BEAST_DEFINE_TESTSUITE(PayChan, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 7f8f49ec07..8e0ff337b4 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct DirectStepInfo @@ -86,7 +86,7 @@ equal(std::unique_ptr const& s1, XRPEndpointStepInfo const& xrpsi) } bool -equal(std::unique_ptr const& s1, ripple::Book const& bsi) +equal(std::unique_ptr const& s1, xrpl::Book const& bsi) { if (!s1) return false; @@ -300,7 +300,7 @@ public: struct ExistingElementPool { std::vector accounts; - std::vector currencies; + std::vector currencies; std::vector currencyNames; jtx::Account @@ -310,7 +310,7 @@ struct ExistingElementPool return accounts[id]; } - ripple::Currency + xrpl::Currency getCurrency(size_t id) { assert(id < currencies.size()); @@ -484,13 +484,13 @@ struct ExistingElementPool { std::vector> diffs; - auto xrpBalance = [](ReadView const& v, ripple::Keylet const& k) { + auto xrpBalance = [](ReadView const& v, xrpl::Keylet const& k) { auto const sle = v.read(k); if (!sle) return STAmount{}; return (*sle)[sfBalance]; }; - auto lineBalance = [](ReadView const& v, ripple::Keylet const& k) { + auto lineBalance = [](ReadView const& v, xrpl::Keylet const& k) { auto const sle = v.read(k); if (!sle) return STAmount{}; @@ -534,7 +534,7 @@ struct ExistingElementPool return getAccount(nextAvailAccount++); } - ripple::Currency + xrpl::Currency getAvailCurrency() { return getCurrency(nextAvailCurrency++); @@ -619,7 +619,7 @@ struct PayStrand_test : public beast::unit_test::suite auto const usdC = USD.currency; using D = DirectStepInfo; - using B = ripple::Book; + using B = xrpl::Book; using XRPS = XRPEndpointStepInfo; AMMContext ammContext(alice, false); @@ -1182,13 +1182,13 @@ struct PayStrand_test : public beast::unit_test::suite AccountID const srcAcc = alice.id(); AccountID dstAcc = bob.id(); STPathSet pathSet; - ::ripple::path::RippleCalc::Input inputs; + ::xrpl::path::RippleCalc::Input inputs; inputs.defaultPathsAllowed = true; try { PaymentSandbox sb{env.current().get(), tapNONE}; { - auto const r = ::ripple::path::RippleCalc::rippleCalculate( + auto const r = ::xrpl::path::RippleCalc::rippleCalculate( sb, sendMax, deliver, @@ -1201,7 +1201,7 @@ struct PayStrand_test : public beast::unit_test::suite BEAST_EXPECT(r.result() == temBAD_PATH); } { - auto const r = ::ripple::path::RippleCalc::rippleCalculate( + auto const r = ::xrpl::path::RippleCalc::rippleCalculate( sb, sendMax, deliver, @@ -1214,7 +1214,7 @@ struct PayStrand_test : public beast::unit_test::suite BEAST_EXPECT(r.result() == temBAD_PATH); } { - auto const r = ::ripple::path::RippleCalc::rippleCalculate( + auto const r = ::xrpl::path::RippleCalc::rippleCalculate( sb, noAccountAmount, deliver, @@ -1227,7 +1227,7 @@ struct PayStrand_test : public beast::unit_test::suite BEAST_EXPECT(r.result() == temBAD_PATH); } { - auto const r = ::ripple::path::RippleCalc::rippleCalculate( + auto const r = ::xrpl::path::RippleCalc::rippleCalculate( sb, sendMax, noAccountAmount, @@ -1264,7 +1264,7 @@ struct PayStrand_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(PayStrand, app, ripple); +BEAST_DEFINE_TESTSUITE(PayStrand, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index 4b7a1db1be..b5db131db6 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -28,7 +28,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { using namespace jtx; @@ -1552,7 +1552,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PermissionedDEX, app, ripple); +BEAST_DEFINE_TESTSUITE(PermissionedDEX, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index ba1946ee66..a7dff84cff 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { using namespace jtx; @@ -560,7 +560,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PermissionedDomains, app, ripple); +BEAST_DEFINE_TESTSUITE(PermissionedDomains, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/PseudoTx_test.cpp b/src/test/app/PseudoTx_test.cpp index ea53b0bee5..f01ba616c8 100644 --- a/src/test/app/PseudoTx_test.cpp +++ b/src/test/app/PseudoTx_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct PseudoTx_test : public beast::unit_test::suite @@ -76,7 +76,7 @@ struct PseudoTx_test : public beast::unit_test::suite env.app().openLedger().modify( [&](OpenView& view, beast::Journal j) { auto const result = - ripple::apply(env.app(), view, stx, tapNONE, j); + xrpl::apply(env.app(), view, stx, tapNONE, j); BEAST_EXPECT(!result.applied && result.ter == temINVALID); return result.applied; }); @@ -107,7 +107,7 @@ struct PseudoTx_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(PseudoTx, app, ripple); +BEAST_DEFINE_TESTSUITE(PseudoTx, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/RCLValidations_test.cpp b/src/test/app/RCLValidations_test.cpp index 2d3c4f2af5..a4f0d6a7cb 100644 --- a/src/test/app/RCLValidations_test.cpp +++ b/src/test/app/RCLValidations_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class RCLValidations_test : public beast::unit_test::suite @@ -17,7 +17,7 @@ class RCLValidations_test : public beast::unit_test::suite testcase("Change validation trusted status"); auto keys = randomKeyPair(KeyType::secp256k1); auto v = std::make_shared( - ripple::NetClock::time_point{}, + xrpl::NetClock::time_point{}, keys.first, keys.second, calcNodeID(keys.first), @@ -308,7 +308,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RCLValidations, app, ripple); +BEAST_DEFINE_TESTSUITE(RCLValidations, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/ReducedOffer_test.cpp b/src/test/app/ReducedOffer_test.cpp index f511721dda..8a395913b2 100644 --- a/src/test/app/ReducedOffer_test.cpp +++ b/src/test/app/ReducedOffer_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ReducedOffer_test : public beast::unit_test::suite @@ -719,7 +719,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(ReducedOffer, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(ReducedOffer, app, xrpl, 2); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index be51d9c96e..56f0de9e07 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct Regression_test : public beast::unit_test::suite @@ -63,7 +63,7 @@ struct Regression_test : public beast::unit_test::suite OpenView accum(&*next); auto const result = - ripple::apply(env.app(), accum, *jt.stx, tapNONE, env.journal); + xrpl::apply(env.app(), accum, *jt.stx, tapNONE, env.journal); BEAST_EXPECT(result.ter == tesSUCCESS); BEAST_EXPECT(result.applied); @@ -87,7 +87,7 @@ struct Regression_test : public beast::unit_test::suite OpenView accum(&*next); auto const result = - ripple::apply(env.app(), accum, *jt.stx, tapNONE, env.journal); + xrpl::apply(env.app(), accum, *jt.stx, tapNONE, env.journal); BEAST_EXPECT(result.ter == tecINSUFF_FEE); BEAST_EXPECT(result.applied); @@ -323,7 +323,7 @@ struct Regression_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Regression, app, ripple); +BEAST_DEFINE_TESTSUITE(Regression, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index 8ec5a6fd23..d9689dc977 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class SHAMapStore_test : public beast::unit_test::suite @@ -637,7 +637,7 @@ public: }; // VFALCO This test fails because of thread asynchronous issues -BEAST_DEFINE_TESTSUITE(SHAMapStore, app, ripple); +BEAST_DEFINE_TESTSUITE(SHAMapStore, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/SetAuth_test.cpp b/src/test/app/SetAuth_test.cpp index 42766c87ff..29f1e46ca4 100644 --- a/src/test/app/SetAuth_test.cpp +++ b/src/test/app/SetAuth_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct SetAuth_test : public beast::unit_test::suite @@ -61,7 +61,7 @@ struct SetAuth_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(SetAuth, app, ripple); +BEAST_DEFINE_TESTSUITE(SetAuth, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/SetRegularKey_test.cpp b/src/test/app/SetRegularKey_test.cpp index 2065066ec3..308e5527f7 100644 --- a/src/test/app/SetRegularKey_test.cpp +++ b/src/test/app/SetRegularKey_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class SetRegularKey_test : public beast::unit_test::suite { @@ -169,6 +169,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(SetRegularKey, app, ripple); +BEAST_DEFINE_TESTSUITE(SetRegularKey, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/SetTrust_test.cpp b/src/test/app/SetTrust_test.cpp index 07573cf13f..f8309c4271 100644 --- a/src/test/app/SetTrust_test.cpp +++ b/src/test/app/SetTrust_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -618,6 +618,6 @@ public: testWithFeats(sa); } }; -BEAST_DEFINE_TESTSUITE(SetTrust, app, ripple); +BEAST_DEFINE_TESTSUITE(SetTrust, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/TheoreticalQuality_test.cpp b/src/test/app/TheoreticalQuality_test.cpp index fe59ac6b1a..5cc03247ae 100644 --- a/src/test/app/TheoreticalQuality_test.cpp +++ b/src/test/app/TheoreticalQuality_test.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct RippleCalcTestParams @@ -533,7 +533,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(TheoreticalQuality, app, ripple, 3); +BEAST_DEFINE_TESTSUITE_PRIO(TheoreticalQuality, app, xrpl, 3); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Ticket_test.cpp b/src/test/app/Ticket_test.cpp index 4c3208af02..3136699103 100644 --- a/src/test/app/Ticket_test.cpp +++ b/src/test/app/Ticket_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class Ticket_test : public beast::unit_test::suite { @@ -908,6 +908,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Ticket, app, ripple); +BEAST_DEFINE_TESTSUITE(Ticket, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Transaction_ordering_test.cpp b/src/test/app/Transaction_ordering_test.cpp index 2f67d8b414..81c9ae196c 100644 --- a/src/test/app/Transaction_ordering_test.cpp +++ b/src/test/app/Transaction_ordering_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct Transaction_ordering_test : public beast::unit_test::suite @@ -143,7 +143,7 @@ struct Transaction_ordering_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Transaction_ordering, app, ripple); +BEAST_DEFINE_TESTSUITE(Transaction_ordering, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/TrustAndBalance_test.cpp b/src/test/app/TrustAndBalance_test.cpp index 6cad68d584..25c22b823b 100644 --- a/src/test/app/TrustAndBalance_test.cpp +++ b/src/test/app/TrustAndBalance_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class TrustAndBalance_test : public beast::unit_test::suite { @@ -467,6 +467,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(TrustAndBalance, app, ripple); +BEAST_DEFINE_TESTSUITE(TrustAndBalance, app, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 0af91f25a6..3e19fc2842 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -99,7 +99,7 @@ class TxQPosNegFlows_test : public beast::unit_test::suite // fee (1) and amendment (numUpVotedAmendments()) // pseudotransactions. The queue treats the fees on these // transactions as though they are ordinary transactions. - auto const flagPerLedger = 1 + ripple::detail::numUpVotedAmendments(); + auto const flagPerLedger = 1 + xrpl::detail::numUpVotedAmendments(); auto const flagMaxQueue = ledgersInQueue * flagPerLedger; checkMetrics(*this, env, 0, flagMaxQueue, 0, flagPerLedger); @@ -977,13 +977,13 @@ public: Env::ParsedResult parsed; - env.app().openLedger().modify( - [&](OpenView& view, beast::Journal j) { - auto const result = ripple::apply( - env.app(), view, *jt.stx, tapNONE, env.journal); - parsed.ter = result.ter; - return result.applied; - }); + env.app().openLedger().modify([&](OpenView& view, + beast::Journal j) { + auto const result = + xrpl::apply(env.app(), view, *jt.stx, tapNONE, env.journal); + parsed.ter = result.ter; + return result.applied; + }); env.postconditions(jt, parsed); } checkMetrics(*this, env, 1, std::nullopt, 4, 2); @@ -4191,7 +4191,7 @@ public: auto const tx = env.jt(noop(alice), seq(aliceSeq), fee(openLedgerCost(env))); auto const result = - ripple::apply(env.app(), view, *tx.stx, tapUNLIMITED, j); + xrpl::apply(env.app(), view, *tx.stx, tapUNLIMITED, j); BEAST_EXPECT(result.ter == tesSUCCESS && result.applied); return result.applied; }); @@ -4263,7 +4263,7 @@ public: ticket::use(tktSeq0 + 1), fee(openLedgerCost(env))); auto const result = - ripple::apply(env.app(), view, *tx.stx, tapUNLIMITED, j); + xrpl::apply(env.app(), view, *tx.stx, tapUNLIMITED, j); BEAST_EXPECT(result.ter == tesSUCCESS && result.applied); return result.applied; }); @@ -4371,7 +4371,7 @@ public: if (!getMajorityAmendments(*env.closed()).empty()) break; } - auto expectedPerLedger = ripple::detail::numUpVotedAmendments() + 1; + auto expectedPerLedger = xrpl::detail::numUpVotedAmendments() + 1; checkMetrics( *this, env, @@ -5052,8 +5052,8 @@ class TxQMetaInfo_test : public TxQPosNegFlows_test } }; -BEAST_DEFINE_TESTSUITE_PRIO(TxQPosNegFlows, app, ripple, 1); -BEAST_DEFINE_TESTSUITE_PRIO(TxQMetaInfo, app, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(TxQPosNegFlows, app, xrpl, 1); +BEAST_DEFINE_TESTSUITE_PRIO(TxQMetaInfo, app, xrpl, 1); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/ValidatorKeys_test.cpp b/src/test/app/ValidatorKeys_test.cpp index 9770d6a0ff..943bf5231f 100644 --- a/src/test/app/ValidatorKeys_test.cpp +++ b/src/test/app/ValidatorKeys_test.cpp @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ValidatorKeys_test : public beast::unit_test::suite @@ -171,7 +171,7 @@ public: } }; // namespace test -BEAST_DEFINE_TESTSUITE(ValidatorKeys, app, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorKeys, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index 2f88f0ea1e..163e4f632c 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -16,7 +16,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ValidatorList_test : public beast::unit_test::suite @@ -2294,7 +2294,7 @@ private: { testcase("Sha512 hashing"); // Tests that ValidatorList hash_append helpers with a single blob - // returns the same result as ripple::Sha512Half used by the + // returns the same result as xrpl::Sha512Half used by the // TMValidatorList protocol message handler std::string const manifest = "This is not really a manifest"; std::string const blob = "This is not really a blob"; @@ -4145,7 +4145,7 @@ public: } }; // namespace test -BEAST_DEFINE_TESTSUITE(ValidatorList, app, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorList, app, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index be8ae8013f..71a5b7fa73 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -17,7 +17,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { constexpr char const* realValidatorContents() @@ -688,7 +688,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(ValidatorSite, app, ripple, 2); +BEAST_DEFINE_TESTSUITE_PRIO(ValidatorSite, app, xrpl, 2); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index a07045743e..fbe87ccb5d 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -29,12 +29,12 @@ #include -namespace ripple { +namespace xrpl { class Vault_test : public beast::unit_test::suite { - using PrettyAsset = ripple::test::jtx::PrettyAsset; - using PrettyAmount = ripple::test::jtx::PrettyAmount; + using PrettyAsset = xrpl::test::jtx::PrettyAsset; + using PrettyAmount = xrpl::test::jtx::PrettyAmount; static auto constexpr negativeAmount = [](PrettyAsset const& asset) -> PrettyAmount { @@ -2223,7 +2223,7 @@ class Vault_test : public beast::unit_test::suite env(tx); env.close(); - auto const issuanceId = [&env](ripple::Keylet keylet) -> MPTID { + auto const issuanceId = [&env](xrpl::Keylet keylet) -> MPTID { auto const vault = env.le(keylet); return vault->at(sfShareMPTID); }(keylet); @@ -2555,10 +2555,10 @@ class Vault_test : public beast::unit_test::suite Account const& owner, Account const& issuer, Account const& charlie, - std::function vaultAccount, + std::function vaultAccount, Vault& vault, PrettyAsset const& asset, - std::function issuanceId)> test, + std::function issuanceId)> test, CaseArgs args = {}) { Env env{*this, testable_amendments() | featureSingleAssetVault}; Account const owner{"owner"}; @@ -2590,10 +2590,10 @@ class Vault_test : public beast::unit_test::suite env.close(); auto const vaultAccount = - [&env](ripple::Keylet keylet) -> Account { + [&env](xrpl::Keylet keylet) -> Account { return Account("vault", env.le(keylet)->at(sfAccount)); }; - auto const issuanceId = [&env](ripple::Keylet keylet) -> MPTID { + auto const issuanceId = [&env](xrpl::Keylet keylet) -> MPTID { return env.le(keylet)->at(sfShareMPTID); }; @@ -2843,7 +2843,7 @@ class Vault_test : public beast::unit_test::suite env.close(); // Withdraw to 3rd party works - auto const withdrawToCharlie = [&](ripple::Keylet keylet) { + auto const withdrawToCharlie = [&](xrpl::Keylet keylet) { auto tx = vault.withdraw( {.depositor = owner, .id = keylet.key, @@ -2914,7 +2914,7 @@ class Vault_test : public beast::unit_test::suite env.close(); // Withdraw to 3rd party without trust line - auto const tx1 = [&](ripple::Keylet keylet) { + auto const tx1 = [&](xrpl::Keylet keylet) { auto tx = vault.withdraw( {.depositor = owner, .id = keylet.key, @@ -2953,7 +2953,7 @@ class Vault_test : public beast::unit_test::suite BEAST_EXPECT(trustline == nullptr); // Withdraw without trust line, will succeed - auto const tx1 = [&](ripple::Keylet keylet) { + auto const tx1 = [&](xrpl::Keylet keylet) { auto tx = vault.withdraw( {.depositor = owner, .id = keylet.key, @@ -2972,7 +2972,7 @@ class Vault_test : public beast::unit_test::suite auto vaultAccount, Vault& vault, PrettyAsset const& asset, - std::function issuanceId) { + std::function issuanceId) { testcase("IOU non-transferable"); auto [tx, keylet] = @@ -3250,7 +3250,7 @@ class Vault_test : public beast::unit_test::suite env.close(); // Withdraw to 3rd party works - auto const withdrawToCharlie = [&](ripple::Keylet keylet) { + auto const withdrawToCharlie = [&](xrpl::Keylet keylet) { auto tx = vault.withdraw( {.depositor = owner, .id = keylet.key, @@ -3755,7 +3755,7 @@ class Vault_test : public beast::unit_test::suite for (int i = 0; i < 256; ++i) { AccountID const accountId = - ripple::pseudoAccountAddress(*env.current(), keylet.key); + xrpl::pseudoAccountAddress(*env.current(), keylet.key); env(pay(env.master.id(), accountId, XRP(1000)), seq(autofill), @@ -3783,7 +3783,7 @@ class Vault_test : public beast::unit_test::suite MPTIssue shares; PrettyAsset const& share; Vault& vault; - ripple::Keylet keylet; + xrpl::Keylet keylet; Issue assets; PrettyAsset const& asset; std::function)> peek; @@ -3813,7 +3813,7 @@ class Vault_test : public beast::unit_test::suite env(tx); auto const [vaultAccount, issuanceId] = - [&env](ripple::Keylet keylet) -> std::tuple { + [&env](xrpl::Keylet keylet) -> std::tuple { auto const vault = env.le(keylet); return { Account("vault", vault->at(sfAccount)), @@ -5264,6 +5264,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(Vault, app, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(Vault, app, xrpl, 1); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/app/XChain_test.cpp b/src/test/app/XChain_test.cpp index 158d913f46..619054b078 100644 --- a/src/test/app/XChain_test.cpp +++ b/src/test/app/XChain_test.cpp @@ -23,7 +23,7 @@ #include #include -namespace ripple::test { +namespace xrpl::test { // SEnv class - encapsulate jtx::Env to make it more user-friendly, // for example having APIs that return a *this reference so that calls can be @@ -5171,7 +5171,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(XChain, app, ripple); -BEAST_DEFINE_TESTSUITE(XChainSim, app, ripple); +BEAST_DEFINE_TESTSUITE(XChain, app, xrpl); +BEAST_DEFINE_TESTSUITE(XChainSim, app, xrpl); -} // namespace ripple::test +} // namespace xrpl::test diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index 308ad3d3b8..0b198dcd22 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class Apply_test : public beast::unit_test::suite { @@ -53,6 +53,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Apply, tx, ripple); +BEAST_DEFINE_TESTSUITE(Apply, tx, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/Buffer_test.cpp b/src/test/basics/Buffer_test.cpp index f734741e0f..cb3c48484b 100644 --- a/src/test/basics/Buffer_test.cpp +++ b/src/test/basics/Buffer_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct Buffer_test : beast::unit_test::suite @@ -261,7 +261,7 @@ struct Buffer_test : beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Buffer, basics, ripple); +BEAST_DEFINE_TESTSUITE(Buffer, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/DetectCrash_test.cpp b/src/test/basics/DetectCrash_test.cpp index e2f7d39921..0dd2787dff 100644 --- a/src/test/basics/DetectCrash_test.cpp +++ b/src/test/basics/DetectCrash_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct DetectCrash_test : public beast::unit_test::suite @@ -25,4 +25,4 @@ struct DetectCrash_test : public beast::unit_test::suite BEAST_DEFINE_TESTSUITE_MANUAL(DetectCrash, basics, beast); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/Expected_test.cpp b/src/test/basics/Expected_test.cpp index 173e8302aa..010a6fbb8e 100644 --- a/src/test/basics/Expected_test.cpp +++ b/src/test/basics/Expected_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct Expected_test : beast::unit_test::suite @@ -224,7 +224,7 @@ struct Expected_test : beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Expected, basics, ripple); +BEAST_DEFINE_TESTSUITE(Expected, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/FileUtilities_test.cpp b/src/test/basics/FileUtilities_test.cpp index d3e70911b8..c655e4d1bc 100644 --- a/src/test/basics/FileUtilities_test.cpp +++ b/src/test/basics/FileUtilities_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class FileUtilities_test : public beast::unit_test::suite { @@ -12,7 +12,7 @@ public: void testGetFileContents() { - using namespace ripple::detail; + using namespace xrpl::detail; using namespace boost::system; constexpr char const* expectedContents = @@ -60,6 +60,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(FileUtilities, basics, ripple); +BEAST_DEFINE_TESTSUITE(FileUtilities, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/IOUAmount_test.cpp b/src/test/basics/IOUAmount_test.cpp index dd6389ed81..305f2c83a1 100644 --- a/src/test/basics/IOUAmount_test.cpp +++ b/src/test/basics/IOUAmount_test.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { class IOUAmount_test : public beast::unit_test::suite { @@ -239,7 +239,7 @@ public: IOUAmount big(maxMantissa, maxExponent); except([&] { mulRatio(big, 2, 0, true); }); } - } // namespace ripple + } // namespace xrpl //-------------------------------------------------------------------------- @@ -255,6 +255,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(IOUAmount, basics, ripple); +BEAST_DEFINE_TESTSUITE(IOUAmount, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/IntrusiveShared_test.cpp b/src/test/basics/IntrusiveShared_test.cpp index a3acc54d45..d5d5d75048 100644 --- a/src/test/basics/IntrusiveShared_test.cpp +++ b/src/test/basics/IntrusiveShared_test.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { /** @@ -887,6 +887,6 @@ public: } }; // namespace tests -BEAST_DEFINE_TESTSUITE(IntrusiveShared, basics, ripple); +BEAST_DEFINE_TESTSUITE(IntrusiveShared, basics, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/KeyCache_test.cpp b/src/test/basics/KeyCache_test.cpp index 3ba642682a..55b275ae09 100644 --- a/src/test/basics/KeyCache_test.cpp +++ b/src/test/basics/KeyCache_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class KeyCache_test : public beast::unit_test::suite { @@ -74,6 +74,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(KeyCache, basics, ripple); +BEAST_DEFINE_TESTSUITE(KeyCache, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/Number_test.cpp b/src/test/basics/Number_test.cpp index bb5262d028..b7c5ee45b7 100644 --- a/src/test/basics/Number_test.cpp +++ b/src/test/basics/Number_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Number_test : public beast::unit_test::suite { @@ -859,6 +859,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Number, basics, ripple); +BEAST_DEFINE_TESTSUITE(Number, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index dcb91d0fd3..06944bb5ce 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -18,7 +18,7 @@ //------------------------------------------------------------------------------ -namespace ripple { +namespace xrpl { class PerfLog_test : public beast::unit_test::suite { @@ -293,7 +293,7 @@ public: // Get the all the labels we can use for RPC interfaces without // causing an assert. std::vector labels = - test::jtx::make_vector(ripple::RPC::getHandlerNames()); + test::jtx::make_vector(xrpl::RPC::getHandlerNames()); std::shuffle(labels.begin(), labels.end(), default_prng()); // Get two IDs to associate with each label. Errors tend to happen at @@ -1042,6 +1042,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PerfLog, basics, ripple); +BEAST_DEFINE_TESTSUITE(PerfLog, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/StringUtilities_test.cpp b/src/test/basics/StringUtilities_test.cpp index 319eafe920..ec993b20c3 100644 --- a/src/test/basics/StringUtilities_test.cpp +++ b/src/test/basics/StringUtilities_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { class StringUtilities_test : public beast::unit_test::suite { @@ -303,6 +303,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(StringUtilities, basics, ripple); +BEAST_DEFINE_TESTSUITE(StringUtilities, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/TaggedCache_test.cpp b/src/test/basics/TaggedCache_test.cpp index be0eb5d77b..78dc25380b 100644 --- a/src/test/basics/TaggedCache_test.cpp +++ b/src/test/basics/TaggedCache_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /* I guess you can put some items in, make sure they're still there. Let some @@ -132,6 +132,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(TaggedCache, basics, ripple); +BEAST_DEFINE_TESTSUITE(TaggedCache, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/Units_test.cpp b/src/test/basics/Units_test.cpp index 7838926c87..d0193320bf 100644 --- a/src/test/basics/Units_test.cpp +++ b/src/test/basics/Units_test.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class units_test : public beast::unit_test::suite @@ -353,7 +353,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(units, basics, ripple); +BEAST_DEFINE_TESTSUITE(units, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/XRPAmount_test.cpp b/src/test/basics/XRPAmount_test.cpp index a63f3bfd43..da03a3533f 100644 --- a/src/test/basics/XRPAmount_test.cpp +++ b/src/test/basics/XRPAmount_test.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { class XRPAmount_test : public beast::unit_test::suite { @@ -308,7 +308,7 @@ public: XRPAmount bigNegative(minXRP + 10); BEAST_EXPECT(mulRatio(bigNegative, 2, 1, true) == minXRP); } - } // namespace ripple + } // namespace xrpl //-------------------------------------------------------------------------- @@ -325,6 +325,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(XRPAmount, basics, ripple); +BEAST_DEFINE_TESTSUITE(XRPAmount, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/base58_test.cpp b/src/test/basics/base58_test.cpp index 1700255df6..16307bdb0f 100644 --- a/src/test/basics/base58_test.cpp +++ b/src/test/basics/base58_test.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace { @@ -30,13 +30,13 @@ randEngine() -> std::mt19937& constexpr int numTokenTypeIndexes = 9; [[nodiscard]] inline auto -tokenTypeAndSize(int i) -> std::tuple +tokenTypeAndSize(int i) -> std::tuple { assert(i < numTokenTypeIndexes); switch (i) { - using enum ripple::TokenType; + using enum xrpl::TokenType; case 0: return {None, 20}; case 1: @@ -63,9 +63,9 @@ tokenTypeAndSize(int i) -> std::tuple } [[nodiscard]] inline auto -randomTokenTypeAndSize() -> std::tuple +randomTokenTypeAndSize() -> std::tuple { - using namespace ripple; + using namespace xrpl; auto& rng = randEngine(); std::uniform_int_distribution<> d(0, 8); return tokenTypeAndSize(d(rng)); @@ -74,7 +74,7 @@ randomTokenTypeAndSize() -> std::tuple // Return the token type and subspan of `d` to use as test data. [[nodiscard]] inline auto randomB256TestData(std::span d) - -> std::tuple> + -> std::tuple> { auto& rng = randEngine(); std::uniform_int_distribution dist(0, 255); @@ -267,7 +267,7 @@ class base58_test : public beast::unit_test::suite std::span const outBuf{b58ResultBuf[i]}; if (i == 0) { - auto const r = ripple::b58_fast::detail::b256_to_b58_be( + auto const r = xrpl::b58_fast::detail::b256_to_b58_be( b256Data, outBuf); BEAST_EXPECT(r); b58Result[i] = r.value(); @@ -275,7 +275,7 @@ class base58_test : public beast::unit_test::suite else { std::array tmpBuf; - std::string const s = ripple::b58_ref::detail::encodeBase58( + std::string const s = xrpl::b58_ref::detail::encodeBase58( b256Data.data(), b256Data.size(), tmpBuf.data(), @@ -307,7 +307,7 @@ class base58_test : public beast::unit_test::suite b58Result[i].data(), b58Result[i].data() + b58Result[i].size()); auto const r = - ripple::b58_fast::detail::b58_to_b256_be(in, outBuf); + xrpl::b58_fast::detail::b58_to_b256_be(in, outBuf); BEAST_EXPECT(r); b256Result[i] = r.value(); } @@ -316,7 +316,7 @@ class base58_test : public beast::unit_test::suite std::string const st( b58Result[i].begin(), b58Result[i].end()); std::string const s = - ripple::b58_ref::detail::decodeBase58(st); + xrpl::b58_ref::detail::decodeBase58(st); BEAST_EXPECT(s.size()); b256Result[i] = outBuf.subspan(0, s.size()); std::copy(s.begin(), s.end(), b256Result[i].begin()); @@ -336,7 +336,7 @@ class base58_test : public beast::unit_test::suite } }; - auto testTokenEncode = [&](ripple::TokenType const tokType, + auto testTokenEncode = [&](xrpl::TokenType const tokType, std::span const& b256Data) { std::array b58ResultBuf[2]; std::array, 2> b58Result; @@ -349,14 +349,14 @@ class base58_test : public beast::unit_test::suite b58ResultBuf[i].data(), b58ResultBuf[i].size()}; if (i == 0) { - auto const r = ripple::b58_fast::encodeBase58Token( + auto const r = xrpl::b58_fast::encodeBase58Token( tokType, b256Data, outBuf); BEAST_EXPECT(r); b58Result[i] = r.value(); } else { - std::string const s = ripple::b58_ref::encodeBase58Token( + std::string const s = xrpl::b58_ref::encodeBase58Token( tokType, b256Data.data(), b256Data.size()); BEAST_EXPECT(s.size()); b58Result[i] = outBuf.subspan(0, s.size()); @@ -384,8 +384,8 @@ class base58_test : public beast::unit_test::suite std::string const in( b58Result[i].data(), b58Result[i].data() + b58Result[i].size()); - auto const r = ripple::b58_fast::decodeBase58Token( - tokType, in, outBuf); + auto const r = + xrpl::b58_fast::decodeBase58Token(tokType, in, outBuf); BEAST_EXPECT(r); b256Result[i] = r.value(); } @@ -394,7 +394,7 @@ class base58_test : public beast::unit_test::suite std::string const st( b58Result[i].begin(), b58Result[i].end()); std::string const s = - ripple::b58_ref::decodeBase58Token(st, tokType); + xrpl::b58_ref::decodeBase58Token(st, tokType); BEAST_EXPECT(s.size()); b256Result[i] = outBuf.subspan(0, s.size()); std::copy(s.begin(), s.end(), b256Result[i].begin()); @@ -414,7 +414,7 @@ class base58_test : public beast::unit_test::suite } }; - auto testIt = [&](ripple::TokenType const tokType, + auto testIt = [&](xrpl::TokenType const tokType, std::span const& b256Data) { testRawEncode(b256Data); testTokenEncode(tokType, b256Data); @@ -451,8 +451,8 @@ class base58_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(base58, basics, ripple); +BEAST_DEFINE_TESTSUITE(base58, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl #endif // _MSC_VER diff --git a/src/test/basics/base_uint_test.cpp b/src/test/basics/base_uint_test.cpp index 0308fb4466..8f764fd58b 100644 --- a/src/test/basics/base_uint_test.cpp +++ b/src/test/basics/base_uint_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { // a non-hashing Hasher that just copies the bytes. @@ -59,7 +59,7 @@ struct base_uint_test : beast::unit_test::suite for (auto const& arg : test_args) { - ripple::base_uint<64> const u{arg.first}, v{arg.second}; + xrpl::base_uint<64> const u{arg.first}, v{arg.second}; BEAST_EXPECT(u < v); BEAST_EXPECT(u <= v); BEAST_EXPECT(u != v); @@ -92,7 +92,7 @@ struct base_uint_test : beast::unit_test::suite for (auto const& arg : test_args) { - ripple::base_uint<96> const u{arg.first}, v{arg.second}; + xrpl::base_uint<96> const u{arg.first}, v{arg.second}; BEAST_EXPECT(u < v); BEAST_EXPECT(u <= v); BEAST_EXPECT(u != v); @@ -352,7 +352,7 @@ struct base_uint_test : beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(base_uint, basics, ripple); +BEAST_DEFINE_TESTSUITE(base_uint, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/hardened_hash_test.cpp b/src/test/basics/hardened_hash_test.cpp index 9cd40d6a60..f7eb78ce31 100644 --- a/src/test/basics/hardened_hash_test.cpp +++ b/src/test/basics/hardened_hash_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { template @@ -51,11 +51,11 @@ public: }; } // namespace detail -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ -namespace ripple { +namespace xrpl { namespace detail { @@ -148,11 +148,11 @@ using sha256_t = unsigned_integer<256, std::size_t>; static_assert(sha256_t::bits == 256, "sha256_t must have 256 bits"); #endif -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ -namespace ripple { +namespace xrpl { class hardened_hash_test : public beast::unit_test::suite { @@ -234,6 +234,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(hardened_hash, basics, ripple); +BEAST_DEFINE_TESTSUITE(hardened_hash, basics, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/basics/join_test.cpp b/src/test/basics/join_test.cpp index 751f0290f8..5354f2ab60 100644 --- a/src/test/basics/join_test.cpp +++ b/src/test/basics/join_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct join_test : beast::unit_test::suite @@ -80,7 +80,7 @@ struct join_test : beast::unit_test::suite } }; // namespace test -BEAST_DEFINE_TESTSUITE(join, basics, ripple); +BEAST_DEFINE_TESTSUITE(join, basics, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/beast/IPEndpointCommon.h b/src/test/beast/IPEndpointCommon.h index 83175834af..73cbe7d95b 100644 --- a/src/test/beast/IPEndpointCommon.h +++ b/src/test/beast/IPEndpointCommon.h @@ -7,7 +7,7 @@ namespace IP { inline Endpoint randomEP(bool v4 = true) { - using namespace ripple; + using namespace xrpl; auto dv4 = []() -> AddressV4::bytes_type { return { {static_cast(rand_int(1, UINT8_MAX)), diff --git a/src/test/beast/IPEndpoint_test.cpp b/src/test/beast/IPEndpoint_test.cpp index 3d4f2e7f02..1d451e94a2 100644 --- a/src/test/beast/IPEndpoint_test.cpp +++ b/src/test/beast/IPEndpoint_test.cpp @@ -380,7 +380,7 @@ public: float max_lf{0}; for (auto i = 0; i < items; ++i) { - eps.insert(randomEP(ripple::rand_int(0, 1) == 1)); + eps.insert(randomEP(xrpl::rand_int(0, 1) == 1)); max_lf = std::max(max_lf, eps.load_factor()); } BEAST_EXPECT(eps.bucket_count() >= items); diff --git a/src/test/beast/beast_CurrentThreadName_test.cpp b/src/test/beast/beast_CurrentThreadName_test.cpp index 9863c1bb3c..3d33ecb602 100644 --- a/src/test/beast/beast_CurrentThreadName_test.cpp +++ b/src/test/beast/beast_CurrentThreadName_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class CurrentThreadName_test : public beast::unit_test::suite @@ -70,4 +70,4 @@ public: BEAST_DEFINE_TESTSUITE(CurrentThreadName, beast, beast); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/conditions/PreimageSha256_test.cpp b/src/test/conditions/PreimageSha256_test.cpp index 08f9e5fb5b..71ba526be3 100644 --- a/src/test/conditions/PreimageSha256_test.cpp +++ b/src/test/conditions/PreimageSha256_test.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { class PreimageSha256_test : public beast::unit_test::suite @@ -167,8 +167,8 @@ class PreimageSha256_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(PreimageSha256, conditions, ripple); +BEAST_DEFINE_TESTSUITE(PreimageSha256, conditions, xrpl); } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/ByzantineFailureSim_test.cpp b/src/test/consensus/ByzantineFailureSim_test.cpp index f2a9a7d5c6..0a988f0473 100644 --- a/src/test/consensus/ByzantineFailureSim_test.cpp +++ b/src/test/consensus/ByzantineFailureSim_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ByzantineFailureSim_test : public beast::unit_test::suite @@ -79,7 +79,7 @@ class ByzantineFailureSim_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE_MANUAL(ByzantineFailureSim, consensus, ripple); +BEAST_DEFINE_TESTSUITE_MANUAL(ByzantineFailureSim, consensus, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/Consensus_test.cpp b/src/test/consensus/Consensus_test.cpp index 6318c86a12..85dd5e3957 100644 --- a/src/test/consensus/Consensus_test.cpp +++ b/src/test/consensus/Consensus_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Consensus_test : public beast::unit_test::suite @@ -1518,6 +1518,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Consensus, consensus, ripple); +BEAST_DEFINE_TESTSUITE(Consensus, consensus, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/DistributedValidatorsSim_test.cpp b/src/test/consensus/DistributedValidatorsSim_test.cpp index 6e093a91c5..006c1aab4e 100644 --- a/src/test/consensus/DistributedValidatorsSim_test.cpp +++ b/src/test/consensus/DistributedValidatorsSim_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { /** In progress simulations for diversifying and distributing validators @@ -254,7 +254,7 @@ class DistributedValidators_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(DistributedValidators, consensus, ripple, 2); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(DistributedValidators, consensus, xrpl, 2); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/LedgerTiming_test.cpp b/src/test/consensus/LedgerTiming_test.cpp index c3ce86b4b3..0ec3563c79 100644 --- a/src/test/consensus/LedgerTiming_test.cpp +++ b/src/test/consensus/LedgerTiming_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class LedgerTiming_test : public beast::unit_test::suite @@ -105,6 +105,6 @@ class LedgerTiming_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(LedgerTiming, consensus, ripple); +BEAST_DEFINE_TESTSUITE(LedgerTiming, consensus, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/LedgerTrie_test.cpp b/src/test/consensus/LedgerTrie_test.cpp index 5ad725fa73..586b9231f6 100644 --- a/src/test/consensus/LedgerTrie_test.cpp +++ b/src/test/consensus/LedgerTrie_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class LedgerTrie_test : public beast::unit_test::suite @@ -659,6 +659,6 @@ class LedgerTrie_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(LedgerTrie, consensus, ripple); +BEAST_DEFINE_TESTSUITE(LedgerTrie, consensus, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index a1000c0d49..e10d6cbdd0 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { /* @@ -1826,20 +1826,20 @@ class NegativeUNLVoteFilterValidations_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(NegativeUNL, consensus, ripple); +BEAST_DEFINE_TESTSUITE(NegativeUNL, consensus, xrpl); -BEAST_DEFINE_TESTSUITE(NegativeUNLVoteInternal, consensus, ripple); -BEAST_DEFINE_TESTSUITE_MANUAL(NegativeUNLVoteScoreTable, consensus, ripple); -BEAST_DEFINE_TESTSUITE_PRIO(NegativeUNLVoteGoodScore, consensus, ripple, 1); -BEAST_DEFINE_TESTSUITE(NegativeUNLVoteOffline, consensus, ripple); -BEAST_DEFINE_TESTSUITE(NegativeUNLVoteMaxListed, consensus, ripple); +BEAST_DEFINE_TESTSUITE(NegativeUNLVoteInternal, consensus, xrpl); +BEAST_DEFINE_TESTSUITE_MANUAL(NegativeUNLVoteScoreTable, consensus, xrpl); +BEAST_DEFINE_TESTSUITE_PRIO(NegativeUNLVoteGoodScore, consensus, xrpl, 1); +BEAST_DEFINE_TESTSUITE(NegativeUNLVoteOffline, consensus, xrpl); +BEAST_DEFINE_TESTSUITE(NegativeUNLVoteMaxListed, consensus, xrpl); BEAST_DEFINE_TESTSUITE_PRIO( NegativeUNLVoteRetiredValidator, consensus, ripple, 1); -BEAST_DEFINE_TESTSUITE(NegativeUNLVoteNewValidator, consensus, ripple); -BEAST_DEFINE_TESTSUITE(NegativeUNLVoteFilterValidations, consensus, ripple); +BEAST_DEFINE_TESTSUITE(NegativeUNLVoteNewValidator, consensus, xrpl); +BEAST_DEFINE_TESTSUITE(NegativeUNLVoteFilterValidations, consensus, xrpl); /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// @@ -1947,4 +1947,4 @@ createTx(bool disabling, LedgerIndex seq, PublicKey const& txKey) } } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/RCLCensorshipDetector_test.cpp b/src/test/consensus/RCLCensorshipDetector_test.cpp index 9be73735f9..4093ffe900 100644 --- a/src/test/consensus/RCLCensorshipDetector_test.cpp +++ b/src/test/consensus/RCLCensorshipDetector_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class RCLCensorshipDetector_test : public beast::unit_test::suite @@ -79,6 +79,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RCLCensorshipDetector, consensus, ripple); +BEAST_DEFINE_TESTSUITE(RCLCensorshipDetector, consensus, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/ScaleFreeSim_test.cpp b/src/test/consensus/ScaleFreeSim_test.cpp index 51b9ee542a..53c5030f29 100644 --- a/src/test/consensus/ScaleFreeSim_test.cpp +++ b/src/test/consensus/ScaleFreeSim_test.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ScaleFreeSim_test : public beast::unit_test::suite @@ -100,7 +100,7 @@ class ScaleFreeSim_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(ScaleFreeSim, consensus, ripple, 80); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(ScaleFreeSim, consensus, xrpl, 80); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/consensus/Validations_test.cpp b/src/test/consensus/Validations_test.cpp index b1b5a46f38..906817add0 100644 --- a/src/test/consensus/Validations_test.cpp +++ b/src/test/consensus/Validations_test.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { class Validations_test : public beast::unit_test::suite @@ -1125,7 +1125,7 @@ class Validations_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Validations, consensus, ripple); +BEAST_DEFINE_TESTSUITE(Validations, consensus, xrpl); } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/ClosureCounter_test.cpp b/src/test/core/ClosureCounter_test.cpp index 23359596fd..47f9d9a5d1 100644 --- a/src/test/core/ClosureCounter_test.cpp +++ b/src/test/core/ClosureCounter_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { //------------------------------------------------------------------------------ @@ -318,7 +318,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ClosureCounter, core, ripple); +BEAST_DEFINE_TESTSUITE(ClosureCounter, core, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 6f11877202..86f09e6c02 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { std::string configContents(std::string const& dbPath, std::string const& validatorsFile) @@ -109,7 +109,7 @@ backend=sqlite /** Write a rippled config file and remove when done. */ -class RippledCfgGuard : public ripple::detail::FileDirGuard +class RippledCfgGuard : public xrpl::detail::FileDirGuard { private: path dataDir_; @@ -326,7 +326,7 @@ port_wss_admin { // read from file absolute path auto const cwd = current_path(); - ripple::detail::DirGuard const g0(*this, "test_db"); + xrpl::detail::DirGuard const g0(*this, "test_db"); path const dataDirRel("test_data_dir"); path const dataDirAbs(cwd / g0.subdir() / dataDirRel); detail::RippledCfgGuard const g( @@ -1497,6 +1497,6 @@ r.ripple.com:51235 } }; -BEAST_DEFINE_TESTSUITE(Config, core, ripple); +BEAST_DEFINE_TESTSUITE(Config, core, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/Coroutine_test.cpp b/src/test/core/Coroutine_test.cpp index 47bd74a4a6..72a4c02434 100644 --- a/src/test/core/Coroutine_test.cpp +++ b/src/test/core/Coroutine_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Coroutine_test : public beast::unit_test::suite @@ -165,7 +165,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Coroutine, core, ripple); +BEAST_DEFINE_TESTSUITE(Coroutine, core, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/JobQueue_test.cpp b/src/test/core/JobQueue_test.cpp index 2451827bda..641a5fa317 100644 --- a/src/test/core/JobQueue_test.cpp +++ b/src/test/core/JobQueue_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { //------------------------------------------------------------------------------ @@ -140,7 +140,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(JobQueue, core, ripple); +BEAST_DEFINE_TESTSUITE(JobQueue, core, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index 2d38ac4697..fc3c86a994 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class SociDB_test final : public TestSuite { private: @@ -351,6 +351,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(SociDB, core, ripple); +BEAST_DEFINE_TESTSUITE(SociDB, core, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/core/Workers_test.cpp b/src/test/core/Workers_test.cpp index 2ba8c2a0e0..0a552e9d61 100644 --- a/src/test/core/Workers_test.cpp +++ b/src/test/core/Workers_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * Dummy class for unit tests. @@ -154,6 +154,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Workers, core, ripple); +BEAST_DEFINE_TESTSUITE(Workers, core, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/BasicNetwork.h b/src/test/csf/BasicNetwork.h index 7fce2e5f0e..cb4e691317 100644 --- a/src/test/csf/BasicNetwork.h +++ b/src/test/csf/BasicNetwork.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { /** Peer to peer network simulator. @@ -234,6 +234,6 @@ BasicNetwork::send(Peer const& from, Peer const& to, Function&& f) } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/BasicNetwork_test.cpp b/src/test/csf/BasicNetwork_test.cpp index e5a8c545e5..0b29f90ad3 100644 --- a/src/test/csf/BasicNetwork_test.cpp +++ b/src/test/csf/BasicNetwork_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class BasicNetwork_test : public beast::unit_test::suite @@ -127,7 +127,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(BasicNetwork, csf, ripple); +BEAST_DEFINE_TESTSUITE(BasicNetwork, csf, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/CollectorRef.h b/src/test/csf/CollectorRef.h index 81aa048249..3aa2c6495f 100644 --- a/src/test/csf/CollectorRef.h +++ b/src/test/csf/CollectorRef.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -327,6 +327,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Digraph.h b/src/test/csf/Digraph.h index 24ff820e1d..688d0528d3 100644 --- a/src/test/csf/Digraph.h +++ b/src/test/csf/Digraph.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { // Dummy class when no edge data needed for graph struct NoEdgeData @@ -231,5 +231,5 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Digraph_test.cpp b/src/test/csf/Digraph_test.cpp index bd37fef80c..a0cb35323d 100644 --- a/src/test/csf/Digraph_test.cpp +++ b/src/test/csf/Digraph_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Digraph_test : public beast::unit_test::suite @@ -73,7 +73,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Digraph, csf, ripple); +BEAST_DEFINE_TESTSUITE(Digraph, csf, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/Histogram.h b/src/test/csf/Histogram.h index 3a504557f2..b55af34846 100644 --- a/src/test/csf/Histogram.h +++ b/src/test/csf/Histogram.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -111,6 +111,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Histogram_test.cpp b/src/test/csf/Histogram_test.cpp index 964c065bfc..b0a8d8490d 100644 --- a/src/test/csf/Histogram_test.cpp +++ b/src/test/csf/Histogram_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class Histogram_test : public beast::unit_test::suite @@ -62,7 +62,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Histogram, csf, ripple); +BEAST_DEFINE_TESTSUITE(Histogram, csf, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index 5f6f006b0f..b2a0c3b3ed 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -20,7 +20,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -983,5 +983,5 @@ struct Peer } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/PeerGroup.h b/src/test/csf/PeerGroup.h index 8186b877c8..e674581546 100644 --- a/src/test/csf/PeerGroup.h +++ b/src/test/csf/PeerGroup.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -351,5 +351,5 @@ randomRankedConnect( } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Proposal.h b/src/test/csf/Proposal.h index bb09bbdde1..0bcf838080 100644 --- a/src/test/csf/Proposal.h +++ b/src/test/csf/Proposal.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { /** Proposal is a position taken in the consensus process and is represented @@ -17,6 +17,6 @@ using Proposal = ConsensusProposal; } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Scheduler.h b/src/test/csf/Scheduler.h index 7a44dda5da..2c250e6def 100644 --- a/src/test/csf/Scheduler.h +++ b/src/test/csf/Scheduler.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -434,6 +434,6 @@ Scheduler::step_for(std::chrono::duration const& amount) } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Scheduler_test.cpp b/src/test/csf/Scheduler_test.cpp index 0975cc09d0..a0b57dd87f 100644 --- a/src/test/csf/Scheduler_test.cpp +++ b/src/test/csf/Scheduler_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class Scheduler_test : public beast::unit_test::suite @@ -64,7 +64,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Scheduler, csf, ripple); +BEAST_DEFINE_TESTSUITE(Scheduler, csf, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/Sim.h b/src/test/csf/Sim.h index 53c3875624..ad0927e87e 100644 --- a/src/test/csf/Sim.h +++ b/src/test/csf/Sim.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -157,6 +157,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/SimTime.h b/src/test/csf/SimTime.h index d4ab34fe55..5d8c67b8f8 100644 --- a/src/test/csf/SimTime.h +++ b/src/test/csf/SimTime.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -19,6 +19,6 @@ using SimTime = typename SimClock::time_point; } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/TrustGraph.h b/src/test/csf/TrustGraph.h index 936e13b963..f5b8a9e755 100644 --- a/src/test/csf/TrustGraph.h +++ b/src/test/csf/TrustGraph.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -154,6 +154,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Tx.h b/src/test/csf/Tx.h index e24c09be2f..cf3ee85940 100644 --- a/src/test/csf/Tx.h +++ b/src/test/csf/Tx.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -210,6 +210,6 @@ hash_append(Hasher& h, Tx const& tx) } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/Validation.h b/src/test/csf/Validation.h index 77ba81681d..907eca79d0 100644 --- a/src/test/csf/Validation.h +++ b/src/test/csf/Validation.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -183,6 +183,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/collectors.h b/src/test/csf/collectors.h index 53494dad44..3b6bc0e0f3 100644 --- a/src/test/csf/collectors.h +++ b/src/test/csf/collectors.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -699,6 +699,6 @@ struct JumpCollector } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/events.h b/src/test/csf/events.h index b25dc4b339..29f434f4ad 100644 --- a/src/test/csf/events.h +++ b/src/test/csf/events.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -129,6 +129,6 @@ struct FullyValidateLedger } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/impl/Sim.cpp b/src/test/csf/impl/Sim.cpp index c17ea26939..4fbee56f0f 100644 --- a/src/test/csf/impl/Sim.cpp +++ b/src/test/csf/impl/Sim.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -63,4 +63,4 @@ Sim::branches(PeerGroup const& g) const } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/impl/ledgers.cpp b/src/test/csf/impl/ledgers.cpp index 681020c12e..09a098f2d6 100644 --- a/src/test/csf/impl/ledgers.cpp +++ b/src/test/csf/impl/ledgers.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -152,4 +152,4 @@ LedgerOracle::branches(std::set const& ledgers) const } } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/csf/ledgers.h b/src/test/csf/ledgers.h index 80e431c1e2..7614482635 100644 --- a/src/test/csf/ledgers.h +++ b/src/test/csf/ledgers.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -230,8 +230,8 @@ private: class LedgerOracle { using InstanceMap = boost::bimaps::bimap< - boost::bimaps::set_of>, - boost::bimaps::set_of>>; + boost::bimaps::set_of>, + boost::bimaps::set_of>>; using InstanceEntry = InstanceMap::value_type; // Set of all known ledgers; note this is never pruned @@ -341,6 +341,6 @@ struct LedgerHistoryHelper } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/random.h b/src/test/csf/random.h index c3ad9564ba..8b3ac7e971 100644 --- a/src/test/csf/random.h +++ b/src/test/csf/random.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -156,6 +156,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/submitters.h b/src/test/csf/submitters.h index 3cca62c10d..8a3632eb97 100644 --- a/src/test/csf/submitters.h +++ b/src/test/csf/submitters.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -109,6 +109,6 @@ makeSubmitter( } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/csf/timers.h b/src/test/csf/timers.h index c16beec885..b5902393c7 100644 --- a/src/test/csf/timers.h +++ b/src/test/csf/timers.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace csf { @@ -65,6 +65,6 @@ public: } // namespace csf } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/json/Object_test.cpp b/src/test/json/Object_test.cpp index 9d4f65492a..b74754db33 100644 --- a/src/test/json/Object_test.cpp +++ b/src/test/json/Object_test.cpp @@ -5,7 +5,7 @@ namespace Json { -class JsonObject_test : public ripple::test::TestOutputSuite +class JsonObject_test : public xrpl::test::TestOutputSuite { void setup(std::string const& testName) @@ -234,6 +234,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(JsonObject, json, ripple); +BEAST_DEFINE_TESTSUITE(JsonObject, json, xrpl); } // namespace Json diff --git a/src/test/json/TestOutputSuite.h b/src/test/json/TestOutputSuite.h index 0c1810bd39..934fe1de81 100644 --- a/src/test/json/TestOutputSuite.h +++ b/src/test/json/TestOutputSuite.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class TestOutputSuite : public TestSuite @@ -34,6 +34,6 @@ protected: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/AMM.h b/src/test/jtx/AMM.h index 646d663f99..65c16ec627 100644 --- a/src/test/jtx/AMM.h +++ b/src/test/jtx/AMM.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -442,6 +442,6 @@ ammClawback( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_TEST_JTX_AMM_H_INCLUDED diff --git a/src/test/jtx/AMMTest.h b/src/test/jtx/AMMTest.h index 91a18bec2c..83366d61e2 100644 --- a/src/test/jtx/AMMTest.h +++ b/src/test/jtx/AMMTest.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -148,6 +148,6 @@ protected: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_TEST_JTX_AMMTEST_H_INCLUDED diff --git a/src/test/jtx/AbstractClient.h b/src/test/jtx/AbstractClient.h index 383586ce02..0bdfbd67de 100644 --- a/src/test/jtx/AbstractClient.h +++ b/src/test/jtx/AbstractClient.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { /* Abstract Ripple Client interface. @@ -40,6 +40,6 @@ public: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/Account.h b/src/test/jtx/Account.h index 7545b620ee..af8870f22a 100644 --- a/src/test/jtx/Account.h +++ b/src/test/jtx/Account.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -152,6 +152,6 @@ operator<=>(Account const& lhs, Account const& rhs) noexcept } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/CaptureLogs.h b/src/test/jtx/CaptureLogs.h index 86f160c318..0ac855e402 100644 --- a/src/test/jtx/CaptureLogs.h +++ b/src/test/jtx/CaptureLogs.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { /** @@ -75,6 +75,6 @@ public: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/CheckMessageLogs.h b/src/test/jtx/CheckMessageLogs.h index d71b09673e..b0e5f4c82e 100644 --- a/src/test/jtx/CheckMessageLogs.h +++ b/src/test/jtx/CheckMessageLogs.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { /** Log manager that searches for a specific message substring @@ -63,6 +63,6 @@ public: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 9858e17078..26a664efbd 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -39,7 +39,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -819,6 +819,6 @@ Env::rpc(std::string const& cmd, Args&&... args) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/Env_ss.h b/src/test/jtx/Env_ss.h index 726fbb4fe0..734eca5819 100644 --- a/src/test/jtx/Env_ss.h +++ b/src/test/jtx/Env_ss.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -59,6 +59,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index fbc4bd37a2..ba5a2ee8c5 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Env_test : public beast::unit_test::suite @@ -928,7 +928,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Env, jtx, ripple); +BEAST_DEFINE_TESTSUITE(Env, jtx, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/JSONRPCClient.h b/src/test/jtx/JSONRPCClient.h index a351694c3b..0513b43a93 100644 --- a/src/test/jtx/JSONRPCClient.h +++ b/src/test/jtx/JSONRPCClient.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { /** Returns a client using JSON-RPC over HTTP/S. */ @@ -15,6 +15,6 @@ std::unique_ptr makeJSONRPCClient(Config const& cfg, unsigned rpc_version = 2); } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/JTx.h b/src/test/jtx/JTx.h index 2baaf8cd10..aa87ce333d 100644 --- a/src/test/jtx/JTx.h +++ b/src/test/jtx/JTx.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -159,6 +159,6 @@ private: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/ManualTimeKeeper.h b/src/test/jtx/ManualTimeKeeper.h index 251877986f..df3c7ff89a 100644 --- a/src/test/jtx/ManualTimeKeeper.h +++ b/src/test/jtx/ManualTimeKeeper.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ManualTimeKeeper : public TimeKeeper @@ -30,6 +30,6 @@ public: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/Oracle.h b/src/test/jtx/Oracle.h index cbf3975771..fc7dc89cd1 100644 --- a/src/test/jtx/Oracle.h +++ b/src/test/jtx/Oracle.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace oracle { @@ -185,6 +185,6 @@ public: } // namespace oracle } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_TEST_JTX_ORACLE_H_INCLUDED diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index 25f58150bb..0c54b6fb77 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { /** Count offer @@ -182,6 +182,6 @@ private: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/SignerUtils.h b/src/test/jtx/SignerUtils.h index 07d12d8cea..272909c887 100644 --- a/src/test/jtx/SignerUtils.h +++ b/src/test/jtx/SignerUtils.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -51,6 +51,6 @@ sortSigners(std::vector& signers) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 5ae44acaac..f00b929967 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -25,7 +25,7 @@ using source_location = std::experimental::source_location; using std::source_location; #endif -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -828,6 +828,6 @@ pay(AccountID const& account, } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED diff --git a/src/test/jtx/TestSuite.h b/src/test/jtx/TestSuite.h index 69ac910c54..69cbd2a210 100644 --- a/src/test/jtx/TestSuite.h +++ b/src/test/jtx/TestSuite.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class TestSuite : public beast::unit_test::suite { @@ -119,6 +119,6 @@ private: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 0f88e42f3d..e7ddef7ac9 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -23,7 +23,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class TrustedPublisherServer @@ -164,8 +164,7 @@ public: bool immediateStart = true, int sequence = 1) : sock_{ioc} - , ep_{boost::asio::ip::make_address( - ripple::test::getEnvLocalhostAddr()), + , ep_{boost::asio::ip::make_address(xrpl::test::getEnvLocalhostAddr()), // 0 means let OS pick the port based on what's available 0} , acceptor_{ioc} @@ -715,5 +714,5 @@ make_TrustedPublisherServer( } } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/WSClient.h b/src/test/jtx/WSClient.h index 9e7370a0fd..2365e8ce40 100644 --- a/src/test/jtx/WSClient.h +++ b/src/test/jtx/WSClient.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class WSClient : public AbstractClient @@ -37,6 +37,6 @@ makeWSClient( std::unordered_map const& headers = {}); } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/WSClient_test.cpp b/src/test/jtx/WSClient_test.cpp index 27285b2021..206b550b87 100644 --- a/src/test/jtx/WSClient_test.cpp +++ b/src/test/jtx/WSClient_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class WSClient_test : public beast::unit_test::suite @@ -27,7 +27,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(WSClient, jtx, ripple); +BEAST_DEFINE_TESTSUITE(WSClient, jtx, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/account_txn_id.h b/src/test/jtx/account_txn_id.h index bec9a195d3..fb48941925 100644 --- a/src/test/jtx/account_txn_id.h +++ b/src/test/jtx/account_txn_id.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -22,5 +22,5 @@ public: }; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/acctdelete.h b/src/test/jtx/acctdelete.h index 73e7cb6e8d..71b8597db9 100644 --- a/src/test/jtx/acctdelete.h +++ b/src/test/jtx/acctdelete.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -26,6 +26,6 @@ incLgrSeqForAccDel( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index ed0fa57cbf..faf70921be 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { struct epsilon_multiple @@ -239,9 +239,9 @@ public: struct BookSpec { AccountID account; - ripple::Currency currency; + xrpl::Currency currency; - BookSpec(AccountID const& account_, ripple::Currency const& currency_) + BookSpec(AccountID const& account_, xrpl::Currency const& currency_) : account(account_), currency(currency_) { } @@ -383,9 +383,9 @@ class IOU { public: Account account; - ripple::Currency currency; + xrpl::Currency currency; - IOU(Account const& account_, ripple::Currency const& currency_) + IOU(Account const& account_, xrpl::Currency const& currency_) : account(account_), currency(currency_) { } @@ -465,14 +465,14 @@ class MPT { public: std::string name; - ripple::MPTID issuanceID; + xrpl::MPTID issuanceID; - MPT(std::string const& n, ripple::MPTID const& issuanceID_) + MPT(std::string const& n, xrpl::MPTID const& issuanceID_) : name(n), issuanceID(issuanceID_) { } - ripple::MPTID const& + xrpl::MPTID const& mpt() const { return issuanceID; @@ -480,7 +480,7 @@ public: /** Explicit conversion to MPTIssue or asset. */ - ripple::MPTIssue + xrpl::MPTIssue mptIssue() const { return MPTIssue{issuanceID}; @@ -496,7 +496,7 @@ public: This allows passing an MPT value where an MPTIssue is expected. */ - operator ripple::MPTIssue() const + operator xrpl::MPTIssue() const { return mptIssue(); } @@ -589,6 +589,6 @@ extern any_t const any; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/attester.h b/src/test/jtx/attester.h index 6aa69e23b5..345002f90a 100644 --- a/src/test/jtx/attester.h +++ b/src/test/jtx/attester.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class PublicKey; class SecretKey; @@ -43,6 +43,6 @@ sign_create_account_attestation( AccountID const& dst); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/balance.h b/src/test/jtx/balance.h index 8ca0f2fd47..999f6b7b0c 100644 --- a/src/test/jtx/balance.h +++ b/src/test/jtx/balance.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -45,6 +45,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/basic_prop.h b/src/test/jtx/basic_prop.h index 1ee7c04e08..32655e9f52 100644 --- a/src/test/jtx/basic_prop.h +++ b/src/test/jtx/basic_prop.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -41,6 +41,6 @@ struct prop_type : basic_prop } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/batch.h b/src/test/jtx/batch.h index 14122e3c01..dc9d30a420 100644 --- a/src/test/jtx/batch.h +++ b/src/test/jtx/batch.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -144,6 +144,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/check.h b/src/test/jtx/check.h index 863fce6f75..6152195f1f 100644 --- a/src/test/jtx/check.h +++ b/src/test/jtx/check.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -44,6 +44,6 @@ using checks = owner_count; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/credentials.h b/src/test/jtx/credentials.h index 2ae0d1737e..2b41b5e7ef 100644 --- a/src/test/jtx/credentials.h +++ b/src/test/jtx/credentials.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -91,6 +91,6 @@ ledgerEntry(jtx::Env& env, std::string const& credIdx); } // namespace credentials } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/delegate.h b/src/test/jtx/delegate.h index 11b13cb9be..19707584ad 100644 --- a/src/test/jtx/delegate.h +++ b/src/test/jtx/delegate.h @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -40,4 +40,4 @@ public: } // namespace delegate } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/delivermin.h b/src/test/jtx/delivermin.h index 9d7ca4eaa2..70f092c9dc 100644 --- a/src/test/jtx/delivermin.h +++ b/src/test/jtx/delivermin.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -26,6 +26,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/deposit.h b/src/test/jtx/deposit.h index 91897038b6..5ea1e5bf06 100644 --- a/src/test/jtx/deposit.h +++ b/src/test/jtx/deposit.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -62,6 +62,6 @@ unauthCredentials( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/did.h b/src/test/jtx/did.h index 883f1abe35..65407028eb 100644 --- a/src/test/jtx/did.h +++ b/src/test/jtx/did.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -80,6 +80,6 @@ del(jtx::Account const& account); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/directory.h b/src/test/jtx/directory.h index 3abcc0562d..6129b79d1c 100644 --- a/src/test/jtx/directory.h +++ b/src/test/jtx/directory.h @@ -10,7 +10,7 @@ #include #include -namespace ripple::test::jtx { +namespace xrpl::test::jtx { /** Directory operations. */ namespace directory { @@ -57,6 +57,6 @@ maximumPageIndex(Env const& env) -> std::uint64_t } // namespace directory -} // namespace ripple::test::jtx +} // namespace xrpl::test::jtx #endif diff --git a/src/test/jtx/domain.h b/src/test/jtx/domain.h index b7199a843c..cb67ce3622 100644 --- a/src/test/jtx/domain.h +++ b/src/test/jtx/domain.h @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -23,4 +23,4 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/envconfig.h b/src/test/jtx/envconfig.h index 4c8476d95f..d6276f2fba 100644 --- a/src/test/jtx/envconfig.h +++ b/src/test/jtx/envconfig.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { // frequently used macros defined here for convenience. @@ -44,7 +44,7 @@ envconfig() /// /// @param modfunc callable function or lambda to modify the default config. /// The first argument to the function must be std::unique_ptr to -/// ripple::Config. The function takes ownership of the unique_ptr and +/// xrpl::Config. The function takes ownership of the unique_ptr and /// relinquishes ownership by returning a unique_ptr. /// /// @param args additional arguments that will be passed to @@ -115,6 +115,6 @@ makeConfig( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/escrow.h b/src/test/jtx/escrow.h index d0d066c2d4..b8490d9534 100644 --- a/src/test/jtx/escrow.h +++ b/src/test/jtx/escrow.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -90,6 +90,6 @@ auto const fulfillment = JTxFieldWrapper(sfFulfillment); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/fee.h b/src/test/jtx/fee.h index 17269b1a38..1b3a6ac49c 100644 --- a/src/test/jtx/fee.h +++ b/src/test/jtx/fee.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -51,6 +51,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/flags.h b/src/test/jtx/flags.h index 7b6be9fe22..6b8c230a79 100644 --- a/src/test/jtx/flags.h +++ b/src/test/jtx/flags.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { class flags_helper @@ -140,6 +140,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index 0fe9bd25df..b620126b0f 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -59,7 +59,7 @@ AMM::AMM( , msig_(ms) , fee_(fee) , ammAccount_(create(tfee, flags, seq, ter)) - , lptIssue_(ripple::ammLPTIssue( + , lptIssue_(xrpl::ammLPTIssue( asset1_.issue().currency, asset2_.issue().currency, ammAccount_)) @@ -832,4 +832,4 @@ ammClawback( } // namespace amm } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/AMMTest.cpp b/src/test/jtx/impl/AMMTest.cpp index 3bdc8e041a..790762d3df 100644 --- a/src/test/jtx/impl/AMMTest.cpp +++ b/src/test/jtx/impl/AMMTest.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -280,4 +280,4 @@ AMMTest::find_paths( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/Account.cpp b/src/test/jtx/impl/Account.cpp index 6cab28245d..232c9d4e6c 100644 --- a/src/test/jtx/impl/Account.cpp +++ b/src/test/jtx/impl/Account.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -85,4 +85,4 @@ Account::operator[](std::string const& s) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 311a5dde3a..ccef0f0398 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -28,7 +28,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -673,4 +673,4 @@ Env::disableFeature(uint256 const feature) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/JSONRPCClient.cpp b/src/test/jtx/impl/JSONRPCClient.cpp index 7374128e02..df41ed39be 100644 --- a/src/test/jtx/impl/JSONRPCClient.cpp +++ b/src/test/jtx/impl/JSONRPCClient.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class JSONRPCClient : public AbstractClient @@ -147,4 +147,4 @@ makeJSONRPCClient(Config const& cfg, unsigned rpc_version) } } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/Oracle.cpp b/src/test/jtx/impl/Oracle.cpp index e3396f3ebc..03271cc9ad 100644 --- a/src/test/jtx/impl/Oracle.cpp +++ b/src/test/jtx/impl/Oracle.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace oracle { @@ -358,4 +358,4 @@ validDocumentID(AnyValue const& v) } // namespace oracle } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/TestHelpers.cpp b/src/test/jtx/impl/TestHelpers.cpp index 4dfc5fb7b1..4a9d425f01 100644 --- a/src/test/jtx/impl/TestHelpers.cpp +++ b/src/test/jtx/impl/TestHelpers.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -486,4 +486,4 @@ pay(AccountID const& account, } // namespace loan } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/WSClient.cpp b/src/test/jtx/impl/WSClient.cpp index 5f9f123f81..878846b41d 100644 --- a/src/test/jtx/impl/WSClient.cpp +++ b/src/test/jtx/impl/WSClient.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class WSClientImpl : public WSClient @@ -311,4 +311,4 @@ makeWSClient( } } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/account_txn_id.cpp b/src/test/jtx/impl/account_txn_id.cpp index e2c05b4bc7..ceda6e7b50 100644 --- a/src/test/jtx/impl/account_txn_id.cpp +++ b/src/test/jtx/impl/account_txn_id.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -13,4 +13,4 @@ account_txn_id::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/acctdelete.cpp b/src/test/jtx/impl/acctdelete.cpp index ab613671da..47ee1c39a6 100644 --- a/src/test/jtx/impl/acctdelete.cpp +++ b/src/test/jtx/impl/acctdelete.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -42,4 +42,4 @@ incLgrSeqForAccDel(jtx::Env& env, jtx::Account const& acc, std::uint32_t margin) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 08836e4aa3..2548a4423b 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -115,4 +115,4 @@ any_t const any{}; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/attester.cpp b/src/test/jtx/impl/attester.cpp index 2937aca785..1d00767f0c 100644 --- a/src/test/jtx/impl/attester.cpp +++ b/src/test/jtx/impl/attester.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -59,4 +59,4 @@ sign_create_account_attestation( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/balance.cpp b/src/test/jtx/impl/balance.cpp index e3ab97950b..4449be223c 100644 --- a/src/test/jtx/impl/balance.cpp +++ b/src/test/jtx/impl/balance.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -74,4 +74,4 @@ balance::operator()(Env& env) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/batch.cpp b/src/test/jtx/impl/batch.cpp index b728ff391b..e0a52d0218 100644 --- a/src/test/jtx/impl/batch.cpp +++ b/src/test/jtx/impl/batch.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -81,7 +81,7 @@ sig::operator()(Env& env, JTx& jt) const Serializer msg; serializeBatch(msg, stx.getFlags(), stx.getBatchTransactionIDs()); - auto const sig = ripple::sign( + auto const sig = xrpl::sign( *publicKeyType(e.sig.pk().slice()), e.sig.sk(), msg.slice()); jo[sfTxnSignature.getJsonName()] = strHex(Slice{sig.data(), sig.size()}); @@ -121,7 +121,7 @@ msig::operator()(Env& env, JTx& jt) const Serializer msg; serializeBatch(msg, stx.getFlags(), stx.getBatchTransactionIDs()); finishMultiSigningData(e.acct.id(), msg); - auto const sig = ripple::sign( + auto const sig = xrpl::sign( *publicKeyType(e.sig.pk().slice()), e.sig.sk(), msg.slice()); iso[sfTxnSignature.getJsonName()] = strHex(Slice{sig.data(), sig.size()}); @@ -132,4 +132,4 @@ msig::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/check.cpp b/src/test/jtx/impl/check.cpp index f9de30a8ed..769771861d 100644 --- a/src/test/jtx/impl/check.cpp +++ b/src/test/jtx/impl/check.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -51,4 +51,4 @@ cancel(jtx::Account const& dest, uint256 const& checkId) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/creds.cpp b/src/test/jtx/impl/creds.cpp index b5b65c4445..f93d951e48 100644 --- a/src/test/jtx/impl/creds.cpp +++ b/src/test/jtx/impl/creds.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -84,4 +84,4 @@ ledgerEntry(jtx::Env& env, std::string const& credIdx) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/delegate.cpp b/src/test/jtx/impl/delegate.cpp index 62407776c4..7cca9aa738 100644 --- a/src/test/jtx/impl/delegate.cpp +++ b/src/test/jtx/impl/delegate.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -45,4 +45,4 @@ entry(jtx::Env& env, jtx::Account const& account, jtx::Account const& authorize) } // namespace delegate } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/delivermin.cpp b/src/test/jtx/impl/delivermin.cpp index 7ddccc9c91..5ad98edd09 100644 --- a/src/test/jtx/impl/delivermin.cpp +++ b/src/test/jtx/impl/delivermin.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -14,4 +14,4 @@ delivermin::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/deposit.cpp b/src/test/jtx/impl/deposit.cpp index ba947f48fb..7a49bee06a 100644 --- a/src/test/jtx/impl/deposit.cpp +++ b/src/test/jtx/impl/deposit.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -74,4 +74,4 @@ unauthCredentials( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/dids.cpp b/src/test/jtx/impl/dids.cpp index 6257a0cddb..bb782bcd43 100644 --- a/src/test/jtx/impl/dids.cpp +++ b/src/test/jtx/impl/dids.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -43,4 +43,4 @@ del(jtx::Account const& account) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/directory.cpp b/src/test/jtx/impl/directory.cpp index 275ce2c7b3..bb44b8d782 100644 --- a/src/test/jtx/impl/directory.cpp +++ b/src/test/jtx/impl/directory.cpp @@ -2,7 +2,7 @@ #include -namespace ripple::test::jtx { +namespace xrpl::test::jtx { /** Directory operations. */ namespace directory { @@ -123,4 +123,4 @@ adjustOwnerNode(ApplyView& view, uint256 key, std::uint64_t page) } // namespace directory -} // namespace ripple::test::jtx +} // namespace xrpl::test::jtx diff --git a/src/test/jtx/impl/domain.cpp b/src/test/jtx/impl/domain.cpp index d186fb950c..91568783d2 100644 --- a/src/test/jtx/impl/domain.cpp +++ b/src/test/jtx/impl/domain.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -14,4 +14,4 @@ domain::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/envconfig.cpp b/src/test/jtx/impl/envconfig.cpp index 8cf416a4c5..67bbe3b457 100644 --- a/src/test/jtx/impl/envconfig.cpp +++ b/src/test/jtx/impl/envconfig.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { std::atomic envUseIPv4{false}; @@ -156,4 +156,4 @@ makeConfig( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/escrow.cpp b/src/test/jtx/impl/escrow.cpp index 742bea6afa..067c304178 100644 --- a/src/test/jtx/impl/escrow.cpp +++ b/src/test/jtx/impl/escrow.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -51,7 +51,7 @@ rate(Env& env, Account const& account, std::uint32_t const& seq) { auto const sle = env.le(keylet::escrow(account.id(), seq)); if (sle->isFieldPresent(sfTransferRate)) - return ripple::Rate((*sle)[sfTransferRate]); + return xrpl::Rate((*sle)[sfTransferRate]); return Rate{0}; } @@ -60,4 +60,4 @@ rate(Env& env, Account const& account, std::uint32_t const& seq) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/fee.cpp b/src/test/jtx/impl/fee.cpp index 8ce1dda6af..2b1ac6c398 100644 --- a/src/test/jtx/impl/fee.cpp +++ b/src/test/jtx/impl/fee.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -21,4 +21,4 @@ fee::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/flags.cpp b/src/test/jtx/impl/flags.cpp index 8ee7e4cffa..11e7831f55 100644 --- a/src/test/jtx/impl/flags.cpp +++ b/src/test/jtx/impl/flags.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -45,4 +45,4 @@ nflags::operator()(Env& env) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/invoice_id.cpp b/src/test/jtx/impl/invoice_id.cpp index 47eff96cb2..6d6dae0fbf 100644 --- a/src/test/jtx/impl/invoice_id.cpp +++ b/src/test/jtx/impl/invoice_id.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -13,4 +13,4 @@ invoice_id::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/jtx_json.cpp b/src/test/jtx/impl/jtx_json.cpp index 1e39ec2dda..c39503d038 100644 --- a/src/test/jtx/impl/jtx_json.cpp +++ b/src/test/jtx/impl/jtx_json.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -32,4 +32,4 @@ json::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/last_ledger_sequence.cpp b/src/test/jtx/impl/last_ledger_sequence.cpp index 1a00f7d4d9..5f29282ad6 100644 --- a/src/test/jtx/impl/last_ledger_sequence.cpp +++ b/src/test/jtx/impl/last_ledger_sequence.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -12,4 +12,4 @@ last_ledger_seq::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/ledgerStateFixes.cpp b/src/test/jtx/impl/ledgerStateFixes.cpp index 704da218e8..f1e6b6eda1 100644 --- a/src/test/jtx/impl/ledgerStateFixes.cpp +++ b/src/test/jtx/impl/ledgerStateFixes.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -27,4 +27,4 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/memo.cpp b/src/test/jtx/impl/memo.cpp index 10bcede507..c815b916d7 100644 --- a/src/test/jtx/impl/memo.cpp +++ b/src/test/jtx/impl/memo.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -81,4 +81,4 @@ memontype::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index fc831790f1..adffa8548a 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -595,7 +595,7 @@ MPTTester::mpt(std::int64_t amount) const { if (!id_) Throw("MPT has not been created"); - return ripple::test::jtx::MPT(issuer_.name(), *id_)(amount); + return xrpl::test::jtx::MPT(issuer_.name(), *id_)(amount); } MPTTester::operator Asset() const @@ -651,4 +651,4 @@ MPTTester::operator()(std::uint64_t amount) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/multisign.cpp b/src/test/jtx/impl/multisign.cpp index 68662b114b..61af11fb3a 100644 --- a/src/test/jtx/impl/multisign.cpp +++ b/src/test/jtx/impl/multisign.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -78,7 +78,7 @@ msig::operator()(Env& env, JTx& jt) const jo[jss::SigningPubKey] = strHex(e.sig.pk().slice()); Serializer ss{buildMultiSigningData(*st, e.acct.id())}; - auto const sig = ripple::sign( + auto const sig = xrpl::sign( *publicKeyType(e.sig.pk().slice()), e.sig.sk(), ss.slice()); jo[sfTxnSignature.getJsonName()] = strHex(Slice{sig.data(), sig.size()}); @@ -92,4 +92,4 @@ msig::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/offer.cpp b/src/test/jtx/impl/offer.cpp index 69ee933049..251b659f3b 100644 --- a/src/test/jtx/impl/offer.cpp +++ b/src/test/jtx/impl/offer.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -35,4 +35,4 @@ offer_cancel(Account const& account, std::uint32_t offerSeq) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/owners.cpp b/src/test/jtx/impl/owners.cpp index b3690563d2..ad449dab93 100644 --- a/src/test/jtx/impl/owners.cpp +++ b/src/test/jtx/impl/owners.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace detail { std::uint32_t @@ -38,4 +38,4 @@ owners::operator()(Env& env) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/paths.cpp b/src/test/jtx/impl/paths.cpp index 37b59773c0..fd93ebd841 100644 --- a/src/test/jtx/impl/paths.cpp +++ b/src/test/jtx/impl/paths.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -98,4 +98,4 @@ path::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/pay.cpp b/src/test/jtx/impl/pay.cpp index 750a3f2abf..9e927c6270 100644 --- a/src/test/jtx/impl/pay.cpp +++ b/src/test/jtx/impl/pay.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -27,4 +27,4 @@ pay(Account const& account, Account const& to, AnyAmount amount) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/permissioned_dex.cpp b/src/test/jtx/impl/permissioned_dex.cpp index 46c7a58689..87b7896663 100644 --- a/src/test/jtx/impl/permissioned_dex.cpp +++ b/src/test/jtx/impl/permissioned_dex.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -63,4 +63,4 @@ PermissionedDEX::PermissionedDEX(Env& env) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/permissioned_domains.cpp b/src/test/jtx/impl/permissioned_domains.cpp index c57bde620e..aac9dcc05f 100644 --- a/src/test/jtx/impl/permissioned_domains.cpp +++ b/src/test/jtx/impl/permissioned_domains.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace pdomain { @@ -158,4 +158,4 @@ getNewDomain(std::shared_ptr const& meta) } // namespace pdomain } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/quality2.cpp b/src/test/jtx/impl/quality2.cpp index dd2c900389..c202592b9d 100644 --- a/src/test/jtx/impl/quality2.cpp +++ b/src/test/jtx/impl/quality2.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -51,4 +51,4 @@ qualityOutPercent::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/rate.cpp b/src/test/jtx/impl/rate.cpp index 14901e37e4..b4e9b2cb60 100644 --- a/src/test/jtx/impl/rate.cpp +++ b/src/test/jtx/impl/rate.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -23,4 +23,4 @@ rate(Account const& account, double multiplier) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/regkey.cpp b/src/test/jtx/impl/regkey.cpp index 72d7331ce6..a2e2198eee 100644 --- a/src/test/jtx/impl/regkey.cpp +++ b/src/test/jtx/impl/regkey.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -27,4 +27,4 @@ regkey(Account const& account, Account const& signer) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/sendmax.cpp b/src/test/jtx/impl/sendmax.cpp index 4a920f5be0..f117458cfa 100644 --- a/src/test/jtx/impl/sendmax.cpp +++ b/src/test/jtx/impl/sendmax.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -14,4 +14,4 @@ sendmax::operator()(Env& env, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/seq.cpp b/src/test/jtx/impl/seq.cpp index c127029def..99c6ddbf0d 100644 --- a/src/test/jtx/impl/seq.cpp +++ b/src/test/jtx/impl/seq.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -18,4 +18,4 @@ seq::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/sig.cpp b/src/test/jtx/impl/sig.cpp index 6d8a0b42c7..3ea7f669a7 100644 --- a/src/test/jtx/impl/sig.cpp +++ b/src/test/jtx/impl/sig.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -31,4 +31,4 @@ sig::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/tag.cpp b/src/test/jtx/impl/tag.cpp index f9a6128c54..8321322f75 100644 --- a/src/test/jtx/impl/tag.cpp +++ b/src/test/jtx/impl/tag.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -18,4 +18,4 @@ stag::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/testline.cpp b/src/test/jtx/impl/testline.cpp index 722dc33bff..fbcb1d2de7 100644 --- a/src/test/jtx/impl/testline.cpp +++ b/src/test/jtx/impl/testline.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -12,4 +12,4 @@ testline::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/ticket.cpp b/src/test/jtx/impl/ticket.cpp index 60318469fb..2cb1826bbb 100644 --- a/src/test/jtx/impl/ticket.cpp +++ b/src/test/jtx/impl/ticket.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -30,4 +30,4 @@ use::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/token.cpp b/src/test/jtx/impl/token.cpp index 281d8543b9..f74b66f9ae 100644 --- a/src/test/jtx/impl/token.cpp +++ b/src/test/jtx/impl/token.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace token { @@ -72,7 +72,7 @@ getID( // sequence number. nftSeq += env.le(issuer)->at(~sfFirstNFTokenSequence).value_or(env.seq(issuer)); - return ripple::NFTokenMint::createNFTokenID( + return xrpl::NFTokenMint::createNFTokenID( flags, xferFee, issuer, nft::toTaxon(nfTokenTaxon), nftSeq); } @@ -223,4 +223,4 @@ modify(jtx::Account const& account, uint256 const& nftokenID) } // namespace token } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/trust.cpp b/src/test/jtx/impl/trust.cpp index d53f87773c..a553efa7f2 100644 --- a/src/test/jtx/impl/trust.cpp +++ b/src/test/jtx/impl/trust.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -65,4 +65,4 @@ claw( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/txflags.cpp b/src/test/jtx/impl/txflags.cpp index a7f69116d5..7b49f9380b 100644 --- a/src/test/jtx/impl/txflags.cpp +++ b/src/test/jtx/impl/txflags.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -14,4 +14,4 @@ txflags::operator()(Env&, JTx& jt) const } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/utility.cpp b/src/test/jtx/impl/utility.cpp index 92f7b16c8d..81bce576ce 100644 --- a/src/test/jtx/impl/utility.cpp +++ b/src/test/jtx/impl/utility.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -31,7 +31,7 @@ sign(Json::Value& jv, Account const& account, Json::Value& sigObject) Serializer ss; ss.add32(HashPrefix::txSign); parse(jv).addWithoutSigningFields(ss); - auto const sig = ripple::sign(account.pk(), account.sk(), ss.slice()); + auto const sig = xrpl::sign(account.pk(), account.sk(), ss.slice()); sigObject[jss::TxnSignature] = strHex(Slice{sig.data(), sig.size()}); } @@ -97,4 +97,4 @@ cmdToJSONRPC( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/vault.cpp b/src/test/jtx/impl/vault.cpp index a1295ba887..90250aece0 100644 --- a/src/test/jtx/impl/vault.cpp +++ b/src/test/jtx/impl/vault.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -81,4 +81,4 @@ Vault::clawback(ClawbackArgs const& args) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/impl/xchain_bridge.cpp b/src/test/jtx/impl/xchain_bridge.cpp index 5cfb6e4a11..cc6be6c737 100644 --- a/src/test/jtx/impl/xchain_bridge.cpp +++ b/src/test/jtx/impl/xchain_bridge.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -486,4 +486,4 @@ XChainBridgeObjects::createBridgeObjects(Env& mcEnv, Env& scEnv) } } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/invoice_id.h b/src/test/jtx/invoice_id.h index 492bb4a500..bdf1aa4250 100644 --- a/src/test/jtx/invoice_id.h +++ b/src/test/jtx/invoice_id.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -22,5 +22,5 @@ public: }; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/jtx_json.h b/src/test/jtx/jtx_json.h index 4334db58f8..32fd3c8d30 100644 --- a/src/test/jtx/jtx_json.h +++ b/src/test/jtx/jtx_json.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -40,6 +40,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/last_ledger_sequence.h b/src/test/jtx/last_ledger_sequence.h index 59e4b9f401..6544294bd6 100644 --- a/src/test/jtx/last_ledger_sequence.h +++ b/src/test/jtx/last_ledger_sequence.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -23,6 +23,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/ledgerStateFix.h b/src/test/jtx/ledgerStateFix.h index c1ab04f249..f93c1bc3d8 100644 --- a/src/test/jtx/ledgerStateFix.h +++ b/src/test/jtx/ledgerStateFix.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -20,6 +20,6 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/memo.h b/src/test/jtx/memo.h index 4a1990e079..377dcbec4e 100644 --- a/src/test/jtx/memo.h +++ b/src/test/jtx/memo.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -124,6 +124,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/mpt.h b/src/test/jtx/mpt.h index f9c58ebc9e..2f6bbb9ea8 100644 --- a/src/test/jtx/mpt.h +++ b/src/test/jtx/mpt.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -313,6 +313,6 @@ private: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index 68dc35442b..8582b27a77 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -118,6 +118,6 @@ using siglists = owner_count; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/noop.h b/src/test/jtx/noop.h index 70be63052a..3ef3a57c4b 100644 --- a/src/test/jtx/noop.h +++ b/src/test/jtx/noop.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -16,6 +16,6 @@ noop(Account const& account) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/offer.h b/src/test/jtx/offer.h index 45dd358375..8b01a9381b 100644 --- a/src/test/jtx/offer.h +++ b/src/test/jtx/offer.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -24,6 +24,6 @@ offer_cancel(Account const& account, std::uint32_t offerSeq); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/owners.h b/src/test/jtx/owners.h index 326835d507..fabaa148e4 100644 --- a/src/test/jtx/owners.h +++ b/src/test/jtx/owners.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -74,6 +74,6 @@ using offers = owner_count; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/paths.h b/src/test/jtx/paths.h index 2ea4b623fc..b603db3f7b 100644 --- a/src/test/jtx/paths.h +++ b/src/test/jtx/paths.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -94,6 +94,6 @@ path::append(T const& t, Args const&... args) } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/pay.h b/src/test/jtx/pay.h index 6ebcd25b0c..4ef13d72a3 100644 --- a/src/test/jtx/pay.h +++ b/src/test/jtx/pay.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -18,6 +18,6 @@ pay(Account const& account, Account const& to, AnyAmount amount); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/permissioned_dex.h b/src/test/jtx/permissioned_dex.h index b5c81a83ea..2023342ded 100644 --- a/src/test/jtx/permissioned_dex.h +++ b/src/test/jtx/permissioned_dex.h @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -31,4 +31,4 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/jtx/permissioned_domains.h b/src/test/jtx/permissioned_domains.h index 1cb81005c1..c0adacd0c5 100644 --- a/src/test/jtx/permissioned_domains.h +++ b/src/test/jtx/permissioned_domains.h @@ -5,13 +5,13 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace pdomain { // Helpers for PermissionedDomains testing -using Credential = ripple::test::jtx::deposit::AuthorizeCredentials; +using Credential = xrpl::test::jtx::deposit::AuthorizeCredentials; using Credentials = std::vector; // helpers @@ -51,6 +51,6 @@ getNewDomain(std::shared_ptr const& meta); } // namespace pdomain } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/prop.h b/src/test/jtx/prop.h index 67a8e3f45c..3478e23d9b 100644 --- a/src/test/jtx/prop.h +++ b/src/test/jtx/prop.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -30,6 +30,6 @@ struct prop } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/quality.h b/src/test/jtx/quality.h index c05ccb0404..c112ad9934 100644 --- a/src/test/jtx/quality.h +++ b/src/test/jtx/quality.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -65,6 +65,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/rate.h b/src/test/jtx/rate.h index 1f0abd3e46..2ed8cec6f2 100644 --- a/src/test/jtx/rate.h +++ b/src/test/jtx/rate.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -15,6 +15,6 @@ rate(Account const& account, double multiplier); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/regkey.h b/src/test/jtx/regkey.h index 3f9d10596c..b3ab9a0ed9 100644 --- a/src/test/jtx/regkey.h +++ b/src/test/jtx/regkey.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -20,6 +20,6 @@ regkey(Account const& account, Account const& signer); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/require.h b/src/test/jtx/require.h index 3538df2cbc..21ff8a29ec 100644 --- a/src/test/jtx/require.h +++ b/src/test/jtx/require.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -63,6 +63,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/requires.h b/src/test/jtx/requires.h index 4e330c63cc..379c5ad67d 100644 --- a/src/test/jtx/requires.h +++ b/src/test/jtx/requires.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -15,6 +15,6 @@ using requires_t = std::vector; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/rpc.h b/src/test/jtx/rpc.h index a525b04e6b..5a7c205aac 100644 --- a/src/test/jtx/rpc.h +++ b/src/test/jtx/rpc.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -63,6 +63,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/sendmax.h b/src/test/jtx/sendmax.h index f1cc0b2d8c..9082ef9ddd 100644 --- a/src/test/jtx/sendmax.h +++ b/src/test/jtx/sendmax.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -26,6 +26,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/seq.h b/src/test/jtx/seq.h index 6e174b5f97..102961db0e 100644 --- a/src/test/jtx/seq.h +++ b/src/test/jtx/seq.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -36,6 +36,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/sig.h b/src/test/jtx/sig.h index 1b21607d4d..27d18b322e 100644 --- a/src/test/jtx/sig.h +++ b/src/test/jtx/sig.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -60,6 +60,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/tag.h b/src/test/jtx/tag.h index 586eae1f27..688d2e92c1 100644 --- a/src/test/jtx/tag.h +++ b/src/test/jtx/tag.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -41,6 +41,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/tags.h b/src/test/jtx/tags.h index 631d40bb89..445bdebcb4 100644 --- a/src/test/jtx/tags.h +++ b/src/test/jtx/tags.h @@ -1,7 +1,7 @@ #ifndef XRPL_TEST_JTX_TAGS_H_INCLUDED #define XRPL_TEST_JTX_TAGS_H_INCLUDED -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -43,6 +43,6 @@ static increment_t const increment; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/ter.h b/src/test/jtx/ter.h index 9200b2a265..f13c2a90e6 100644 --- a/src/test/jtx/ter.h +++ b/src/test/jtx/ter.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -35,6 +35,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/testline.h b/src/test/jtx/testline.h index 65dd3b7d92..beda870345 100644 --- a/src/test/jtx/testline.h +++ b/src/test/jtx/testline.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -29,6 +29,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/ticket.h b/src/test/jtx/ticket.h index 881757df5c..10cb772bbd 100644 --- a/src/test/jtx/ticket.h +++ b/src/test/jtx/ticket.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -47,6 +47,6 @@ using tickets = owner_count; } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/token.h b/src/test/jtx/token.h index 0f5921d080..5280799582 100644 --- a/src/test/jtx/token.h +++ b/src/test/jtx/token.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -227,6 +227,6 @@ modify(jtx::Account const& account, uint256 const& nftokenID); } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_TEST_JTX_NFT_H_INCLUDED diff --git a/src/test/jtx/trust.h b/src/test/jtx/trust.h index 667ecc9c2e..69a3e7ba53 100644 --- a/src/test/jtx/trust.h +++ b/src/test/jtx/trust.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -30,6 +30,6 @@ claw( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/txflags.h b/src/test/jtx/txflags.h index 26a89c0f76..75a0d2740b 100644 --- a/src/test/jtx/txflags.h +++ b/src/test/jtx/txflags.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -24,6 +24,6 @@ public: } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/utility.h b/src/test/jtx/utility.h index 25708d8bb3..a824f86c1a 100644 --- a/src/test/jtx/utility.h +++ b/src/test/jtx/utility.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -60,6 +60,6 @@ cmdToJSONRPC( } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/vault.h b/src/test/jtx/vault.h index 5ffcd620c1..485940f9f4 100644 --- a/src/test/jtx/vault.h +++ b/src/test/jtx/vault.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -85,6 +85,6 @@ struct Vault } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/jtx/xchain_bridge.h b/src/test/jtx/xchain_bridge.h index be5e4b4a5f..dfd6073ca4 100644 --- a/src/test/jtx/xchain_bridge.h +++ b/src/test/jtx/xchain_bridge.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { @@ -237,6 +237,6 @@ struct XChainBridgeObjects } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/ledger/BookDirs_test.cpp b/src/test/ledger/BookDirs_test.cpp index 7157d17301..4f5cf5cca2 100644 --- a/src/test/ledger/BookDirs_test.cpp +++ b/src/test/ledger/BookDirs_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct BookDirs_test : public beast::unit_test::suite @@ -91,7 +91,7 @@ struct BookDirs_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(BookDirs, ledger, ripple); +BEAST_DEFINE_TESTSUITE(BookDirs, ledger, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ledger/Directory_test.cpp b/src/test/ledger/Directory_test.cpp index 68c3286660..721b919238 100644 --- a/src/test/ledger/Directory_test.cpp +++ b/src/test/ledger/Directory_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct Directory_test : public beast::unit_test::suite @@ -571,7 +571,7 @@ struct Directory_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE_PRIO(Directory, ledger, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(Directory, ledger, xrpl, 1); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ledger/PaymentSandbox_test.cpp b/src/test/ledger/PaymentSandbox_test.cpp index 200aac76e2..b5acb38156 100644 --- a/src/test/ledger/PaymentSandbox_test.cpp +++ b/src/test/ledger/PaymentSandbox_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class PaymentSandbox_test : public beast::unit_test::suite @@ -406,7 +406,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PaymentSandbox, ledger, ripple); +BEAST_DEFINE_TESTSUITE(PaymentSandbox, ledger, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ledger/PendingSaves_test.cpp b/src/test/ledger/PendingSaves_test.cpp index 95b1cc8ab7..ddf371e913 100644 --- a/src/test/ledger/PendingSaves_test.cpp +++ b/src/test/ledger/PendingSaves_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct PendingSaves_test : public beast::unit_test::suite @@ -40,7 +40,7 @@ struct PendingSaves_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(PendingSaves, ledger, ripple); +BEAST_DEFINE_TESTSUITE(PendingSaves, ledger, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ledger/SkipList_test.cpp b/src/test/ledger/SkipList_test.cpp index 4869036014..12fedea5c1 100644 --- a/src/test/ledger/SkipList_test.cpp +++ b/src/test/ledger/SkipList_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class SkipList_test : public beast::unit_test::suite @@ -87,7 +87,7 @@ class SkipList_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(SkipList, ledger, ripple); +BEAST_DEFINE_TESTSUITE(SkipList, ledger, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ledger/View_test.cpp b/src/test/ledger/View_test.cpp index a8f3f7fc3b..a486792209 100644 --- a/src/test/ledger/View_test.cpp +++ b/src/test/ledger/View_test.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class View_test : public beast::unit_test::suite @@ -1145,8 +1145,8 @@ class GetAmendments_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(View, ledger, ripple); -BEAST_DEFINE_TESTSUITE(GetAmendments, ledger, ripple); +BEAST_DEFINE_TESTSUITE(View, ledger, xrpl); +BEAST_DEFINE_TESTSUITE(GetAmendments, ledger, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/Backend_test.cpp b/src/test/nodestore/Backend_test.cpp index b65c138305..07b35ed9fc 100644 --- a/src/test/nodestore/Backend_test.cpp +++ b/src/test/nodestore/Backend_test.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -101,7 +101,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Backend, nodestore, ripple); +BEAST_DEFINE_TESTSUITE(Backend, nodestore, xrpl); } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/Basics_test.cpp b/src/test/nodestore/Basics_test.cpp index 350c44ec5d..3a7c6a1fdd 100644 --- a/src/test/nodestore/Basics_test.cpp +++ b/src/test/nodestore/Basics_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { // Tests predictable batches, and NodeObject blob encoding @@ -66,7 +66,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NodeStoreBasic, nodestore, ripple); +BEAST_DEFINE_TESTSUITE(NodeStoreBasic, nodestore, xrpl); } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/Database_test.cpp b/src/test/nodestore/Database_test.cpp index 0efb1e7ba1..e5446374ec 100644 --- a/src/test/nodestore/Database_test.cpp +++ b/src/test/nodestore/Database_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { @@ -28,8 +28,8 @@ public: { testcase("Config"); - using namespace ripple::test; - using namespace ripple::test::jtx; + using namespace xrpl::test; + using namespace xrpl::test::jtx; auto const integrityWarning = "reducing the data integrity guarantees from the " @@ -746,7 +746,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Database, nodestore, ripple); +BEAST_DEFINE_TESTSUITE(Database, nodestore, xrpl); } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/NuDBFactory_test.cpp b/src/test/nodestore/NuDBFactory_test.cpp index 951af7dd5b..b91425259c 100644 --- a/src/test/nodestore/NuDBFactory_test.cpp +++ b/src/test/nodestore/NuDBFactory_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { class NuDBFactory_test : public TestBase @@ -452,7 +452,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NuDBFactory, ripple_core, ripple); +BEAST_DEFINE_TESTSUITE(NuDBFactory, xrpl_core, xrpl); } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/TestBase.h b/src/test/nodestore/TestBase.h index 0675ad85d4..83db83b1df 100644 --- a/src/test/nodestore/TestBase.h +++ b/src/test/nodestore/TestBase.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace NodeStore { /** Binary function that satisfies the strict-weak-ordering requirement. @@ -209,6 +209,6 @@ public: }; } // namespace NodeStore -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/nodestore/Timing_test.cpp b/src/test/nodestore/Timing_test.cpp index e6238925bb..9c91311416 100644 --- a/src/test/nodestore/Timing_test.cpp +++ b/src/test/nodestore/Timing_test.cpp @@ -27,7 +27,7 @@ #define NODESTORE_TIMING_DO_VERIFY 0 #endif -namespace ripple { +namespace xrpl { namespace NodeStore { std::unique_ptr @@ -759,7 +759,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Timing, nodestore, ripple, 1); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(Timing, nodestore, xrpl, 1); } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/import_test.cpp b/src/test/nodestore/import_test.cpp index 30aaaa2ea9..9a786801cb 100644 --- a/src/test/nodestore/import_test.cpp +++ b/src/test/nodestore/import_test.cpp @@ -40,7 +40,7 @@ multi(32gb): */ -namespace ripple { +namespace xrpl { namespace detail { @@ -530,11 +530,11 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(import, nodestore, ripple); +BEAST_DEFINE_TESTSUITE_MANUAL(import, nodestore, xrpl); #endif //------------------------------------------------------------------------------ } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/nodestore/varint_test.cpp b/src/test/nodestore/varint_test.cpp index 148d593aae..7ef624e777 100644 --- a/src/test/nodestore/varint_test.cpp +++ b/src/test/nodestore/varint_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace NodeStore { namespace tests { @@ -52,8 +52,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(varint, nodestore, ripple); +BEAST_DEFINE_TESTSUITE(varint, nodestore, xrpl); } // namespace tests } // namespace NodeStore -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/ProtocolVersion_test.cpp b/src/test/overlay/ProtocolVersion_test.cpp index d6bbe6282a..507a42eca0 100644 --- a/src/test/overlay/ProtocolVersion_test.cpp +++ b/src/test/overlay/ProtocolVersion_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class ProtocolVersion_test : public beast::unit_test::suite { @@ -79,6 +79,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ProtocolVersion, overlay, ripple); +BEAST_DEFINE_TESTSUITE(ProtocolVersion, overlay, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/cluster_test.cpp b/src/test/overlay/cluster_test.cpp index d29e143cff..4638434233 100644 --- a/src/test/overlay/cluster_test.cpp +++ b/src/test/overlay/cluster_test.cpp @@ -6,10 +6,10 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { -class cluster_test : public ripple::TestSuite +class cluster_test : public xrpl::TestSuite { test::SuiteJournal journal_; @@ -248,7 +248,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(cluster, overlay, ripple); +BEAST_DEFINE_TESTSUITE(cluster, overlay, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 4e001115d1..2be69a74c9 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -30,17 +30,17 @@ #include -namespace ripple { +namespace xrpl { namespace test { -using namespace ripple::test; -using namespace ripple::test::jtx; +using namespace xrpl::test; +using namespace xrpl::test::jtx; static uint256 ledgerHash(LedgerHeader const& info) { - return ripple::sha512Half( + return xrpl::sha512Half( HashPrefix::ledgerMaster, std::uint32_t(info.seq), std::uint64_t(info.drops.drops()), @@ -92,8 +92,8 @@ public: } boost::system::error_code ec; - auto header = ripple::detail::parseMessageHeader( - ec, buffers.data(), buffer.size()); + auto header = + xrpl::detail::parseMessageHeader(ec, buffers.data(), buffer.size()); BEAST_EXPECT(header); @@ -109,7 +109,7 @@ public: ZeroCopyInputStream stream(buffers.data()); stream.Skip(header->header_size); - auto decompressedSize = ripple::compression::decompress( + auto decompressedSize = xrpl::compression::decompress( stream, header->payload_wire_size, decompressed.data(), @@ -121,7 +121,7 @@ public: proto1->ParseFromArray(decompressed.data(), decompressedSize)); auto uncompressed = m.getBuffer(Compressed::Off); BEAST_EXPECT(std::equal( - uncompressed.begin() + ripple::compression::headerBytes, + uncompressed.begin() + xrpl::compression::headerBytes, uncompressed.end(), decompressed.begin())); } @@ -223,10 +223,10 @@ public: auto getLedger = std::make_shared(); getLedger->set_itype(protocol::liTS_CANDIDATE); getLedger->set_ltype(protocol::TMLedgerType::ltACCEPTED); - uint256 const hash(ripple::sha512Half(123456789)); + uint256 const hash(xrpl::sha512Half(123456789)); getLedger->set_ledgerhash(hash.begin(), hash.size()); getLedger->set_ledgerseq(123456789); - ripple::SHAMapNodeID sha(64, hash); + xrpl::SHAMapNodeID sha(64, hash); getLedger->add_nodeids(sha.getRawString()); getLedger->set_requestcookie(123456789); getLedger->set_querytype(protocol::qtINDIRECT); @@ -238,7 +238,7 @@ public: buildLedgerData(uint32_t n, Logs& logs) { auto ledgerData = std::make_shared(); - uint256 const hash(ripple::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); @@ -255,9 +255,9 @@ public: LedgerHeader info; info.seq = i; info.parentCloseTime = ct; - info.hash = ripple::sha512Half(i); - info.txHash = ripple::sha512Half(i + 1); - info.accountHash = ripple::sha512Half(i + 2); + info.hash = xrpl::sha512Half(i); + info.txHash = xrpl::sha512Half(i + 1); + info.accountHash = xrpl::sha512Half(i + 2); info.parentHash = parentHash; info.drops = XRPAmount(10); info.closeTimeResolution = resolution; @@ -265,7 +265,7 @@ public: ct += resolution; parentHash = ledgerHash(info); Serializer nData; - ripple::addRaw(info, nData); + xrpl::addRaw(info, nData); ledgerData->add_nodes()->set_nodedata( nData.getDataPtr(), nData.getLength()); } @@ -282,15 +282,15 @@ public: TMGetObjectByHash_ObjectType_otTRANSACTION); getObject->set_query(true); getObject->set_seq(123456789); - uint256 hash(ripple::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(ripple::sha512Half(i)); + uint256 hash(xrpl::sha512Half(i)); auto object = getObject->add_objects(); object->set_hash(hash.data(), hash.size()); - ripple::SHAMapNodeID sha(64, hash); + xrpl::SHAMapNodeID sha(64, hash); object->set_nodeid(sha.getRawString()); object->set_index(""); object->set_data(""); @@ -323,7 +323,7 @@ public: list->set_manifest(s.data(), s.size()); list->set_version(3); STObject signature(sfSignature); - ripple::sign( + xrpl::sign( st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing)); Serializer s1; st.add(s1); @@ -356,7 +356,7 @@ public: list->set_manifest(s.data(), s.size()); list->set_version(4); STObject signature(sfSignature); - ripple::sign( + xrpl::sign( st, HashPrefix::manifest, KeyType::ed25519, std::get<1>(signing)); Serializer s1; st.add(s1); @@ -469,7 +469,7 @@ public: boost::asio::ip::make_address("172.1.1.100"); auto env = getEnv(outboundEnable); - auto request = ripple::makeRequest( + auto request = xrpl::makeRequest( true, env->app().config().COMPRESSION, false, @@ -489,7 +489,7 @@ public: env.reset(); env = getEnv(inboundEnable); - auto http_resp = ripple::makeResponse( + auto http_resp = xrpl::makeResponse( true, http_request, addr, @@ -518,7 +518,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(compression, overlay, ripple); +BEAST_DEFINE_TESTSUITE_MANUAL(compression, overlay, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/handshake_test.cpp b/src/test/overlay/handshake_test.cpp index b3b7c261a7..8e2d5d5ec1 100644 --- a/src/test/overlay/handshake_test.cpp +++ b/src/test/overlay/handshake_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { @@ -40,7 +40,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(handshake, overlay, ripple); +BEAST_DEFINE_TESTSUITE(handshake, overlay, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/reduce_relay_test.cpp b/src/test/overlay/reduce_relay_test.cpp index 8447a9fc9f..6af27ea8f1 100644 --- a/src/test/overlay/reduce_relay_test.cpp +++ b/src/test/overlay/reduce_relay_test.cpp @@ -19,7 +19,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -1646,7 +1646,7 @@ vp_base_squelch_max_selected_peers=2 boost::asio::ip::make_address("172.1.1.100"); setEnv(outboundEnable); - auto request = ripple::makeRequest( + auto request = xrpl::makeRequest( true, env_.app().config().COMPRESSION, false, @@ -1665,7 +1665,7 @@ vp_base_squelch_max_selected_peers=2 BEAST_EXPECT(!(peerEnabled ^ inboundEnabled)); setEnv(inboundEnable); - auto http_resp = ripple::makeResponse( + auto http_resp = xrpl::makeResponse( true, http_request, addr, @@ -1736,9 +1736,9 @@ class reduce_relay_simulate_test : public reduce_relay_test } }; -BEAST_DEFINE_TESTSUITE(reduce_relay, overlay, ripple); -BEAST_DEFINE_TESTSUITE_MANUAL(reduce_relay_simulate, overlay, ripple); +BEAST_DEFINE_TESTSUITE(reduce_relay, overlay, xrpl); +BEAST_DEFINE_TESTSUITE_MANUAL(reduce_relay_simulate, overlay, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/short_read_test.cpp b/src/test/overlay/short_read_test.cpp index 05193e525c..2db35dd93e 100644 --- a/src/test/overlay/short_read_test.cpp +++ b/src/test/overlay/short_read_test.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { /* Findings from the test: @@ -638,6 +638,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(short_read, overlay, ripple); +BEAST_DEFINE_TESTSUITE(short_read, overlay, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/traffic_count_test.cpp b/src/test/overlay/traffic_count_test.cpp index d8c5636b59..a8948879d9 100644 --- a/src/test/overlay/traffic_count_test.cpp +++ b/src/test/overlay/traffic_count_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -132,7 +132,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(traffic_count, overlay, ripple); +BEAST_DEFINE_TESTSUITE(traffic_count, overlay, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/overlay/tx_reduce_relay_test.cpp b/src/test/overlay/tx_reduce_relay_test.cpp index 1ca9e7aac6..7286b3fd90 100644 --- a/src/test/overlay/tx_reduce_relay_test.cpp +++ b/src/test/overlay/tx_reduce_relay_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -265,6 +265,6 @@ private: } }; -BEAST_DEFINE_TESTSUITE(tx_reduce_relay, overlay, ripple); +BEAST_DEFINE_TESTSUITE(tx_reduce_relay, overlay, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/peerfinder/Livecache_test.cpp b/src/test/peerfinder/Livecache_test.cpp index 2218191b56..b9487d8ce7 100644 --- a/src/test/peerfinder/Livecache_test.cpp +++ b/src/test/peerfinder/Livecache_test.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { bool @@ -120,9 +120,7 @@ public: constexpr auto num_eps = 40; Livecache<> c(clock_, journal_); for (auto i = 0; i < num_eps; ++i) - add(beast::IP::randomEP(true), - c, - ripple::rand_int()); + add(beast::IP::randomEP(true), c, xrpl::rand_int()); auto h = c.hops.histogram(); if (!BEAST_EXPECT(!h.empty())) return; @@ -146,9 +144,9 @@ public: for (auto i = 0; i < 100; ++i) add(beast::IP::randomEP(true), c, - ripple::rand_int(Tuning::maxHops + 1)); + xrpl::rand_int(Tuning::maxHops + 1)); - using at_hop = std::vector; + using at_hop = std::vector; using all_hops = std::array; auto cmp_EP = [](Endpoint const& a, Endpoint const& b) { @@ -220,7 +218,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Livecache, peerfinder, ripple); +BEAST_DEFINE_TESTSUITE(Livecache, peerfinder, xrpl); } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/test/peerfinder/PeerFinder_test.cpp b/src/test/peerfinder/PeerFinder_test.cpp index 96052bdb1a..7ff1b9de01 100644 --- a/src/test/peerfinder/PeerFinder_test.cpp +++ b/src/test/peerfinder/PeerFinder_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { class PeerFinder_test : public beast::unit_test::suite @@ -395,7 +395,7 @@ public: std::uint16_t expectOut, std::uint16_t expectIn, std::uint16_t expectIpLimit) { - ripple::Config c; + xrpl::Config c; testcase(test); @@ -468,7 +468,7 @@ public: testcase("invalid config"); auto run = [&](std::string const& toLoad) { - ripple::Config c; + xrpl::Config c; try { c.loadFromString(toLoad); @@ -524,7 +524,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PeerFinder, peerfinder, ripple); +BEAST_DEFINE_TESTSUITE(PeerFinder, peerfinder, xrpl); } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/ApiVersion_test.cpp b/src/test/protocol/ApiVersion_test.cpp index f9e897ad74..1dc8ef93f7 100644 --- a/src/test/protocol/ApiVersion_test.cpp +++ b/src/test/protocol/ApiVersion_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct ApiVersion_test : beast::unit_test::suite { @@ -49,7 +49,7 @@ struct ApiVersion_test : beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(ApiVersion, protocol, ripple); +BEAST_DEFINE_TESTSUITE(ApiVersion, protocol, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/BuildInfo_test.cpp b/src/test/protocol/BuildInfo_test.cpp index b153e03608..ae06511e85 100644 --- a/src/test/protocol/BuildInfo_test.cpp +++ b/src/test/protocol/BuildInfo_test.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { class BuildInfo_test : public beast::unit_test::suite { @@ -95,5 +95,5 @@ public: } }; -BEAST_DEFINE_TESTSUITE(BuildInfo, protocol, ripple); -} // namespace ripple +BEAST_DEFINE_TESTSUITE(BuildInfo, protocol, xrpl); +} // namespace xrpl diff --git a/src/test/protocol/Hooks_test.cpp b/src/test/protocol/Hooks_test.cpp index 9bbfc4850c..27f455f202 100644 --- a/src/test/protocol/Hooks_test.cpp +++ b/src/test/protocol/Hooks_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class Hooks_test : public beast::unit_test::suite { @@ -174,6 +174,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Hooks, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Hooks, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/InnerObjectFormats_test.cpp b/src/test/protocol/InnerObjectFormats_test.cpp index 5593d4644d..c06524b90e 100644 --- a/src/test/protocol/InnerObjectFormats_test.cpp +++ b/src/test/protocol/InnerObjectFormats_test.cpp @@ -6,7 +6,7 @@ #include // RPC::containsError #include // STParsedJSONObject -namespace ripple { +namespace xrpl { namespace InnerObjectFormatsUnitTestDetail { @@ -182,6 +182,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(InnerObjectFormatsParsedJSON, protocol, ripple); +BEAST_DEFINE_TESTSUITE(InnerObjectFormatsParsedJSON, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/Issue_test.cpp b/src/test/protocol/Issue_test.cpp index cf0b6ff861..eec164f5b6 100644 --- a/src/test/protocol/Issue_test.cpp +++ b/src/test/protocol/Issue_test.cpp @@ -25,7 +25,7 @@ #endif #endif -namespace ripple { +namespace xrpl { class Issue_test : public beast::unit_test::suite { @@ -959,6 +959,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Issue, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Issue, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/Memo_test.cpp b/src/test/protocol/Memo_test.cpp index 415d23190a..706ef79fe2 100644 --- a/src/test/protocol/Memo_test.cpp +++ b/src/test/protocol/Memo_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class Memo_test : public beast::unit_test::suite { @@ -116,6 +116,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Memo, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Memo, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/MultiApiJson_test.cpp b/src/test/protocol/MultiApiJson_test.cpp index fb1549f5fd..52daa0e0a6 100644 --- a/src/test/protocol/MultiApiJson_test.cpp +++ b/src/test/protocol/MultiApiJson_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { namespace { @@ -36,7 +36,7 @@ struct MultiApiJson_test : beast::unit_test::suite void run() override { - using ripple::detail::MultiApiJson; + using xrpl::detail::MultiApiJson; Json::Value const obj1 = makeJson("value", 1); Json::Value const obj2 = makeJson("value", 2); @@ -1049,7 +1049,7 @@ struct MultiApiJson_test : beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(MultiApiJson, protocol, ripple); +BEAST_DEFINE_TESTSUITE(MultiApiJson, protocol, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/PublicKey_test.cpp b/src/test/protocol/PublicKey_test.cpp index 3bc50f2d95..4af21cd037 100644 --- a/src/test/protocol/PublicKey_test.cpp +++ b/src/test/protocol/PublicKey_test.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { class PublicKey_test : public beast::unit_test::suite { @@ -450,6 +450,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(PublicKey, protocol, ripple); +BEAST_DEFINE_TESTSUITE(PublicKey, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/Quality_test.cpp b/src/test/protocol/Quality_test.cpp index 5c6af14312..840e903ed5 100644 --- a/src/test/protocol/Quality_test.cpp +++ b/src/test/protocol/Quality_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Quality_test : public beast::unit_test::suite { @@ -396,6 +396,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Quality, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Quality, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STAccount_test.cpp b/src/test/protocol/STAccount_test.cpp index 397b150a6c..d469627d51 100644 --- a/src/test/protocol/STAccount_test.cpp +++ b/src/test/protocol/STAccount_test.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { struct STAccount_test : public beast::unit_test::suite { @@ -127,6 +127,6 @@ struct STAccount_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(STAccount, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STAccount, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STAmount_test.cpp b/src/test/protocol/STAmount_test.cpp index 694e351303..796ac91de1 100644 --- a/src/test/protocol/STAmount_test.cpp +++ b/src/test/protocol/STAmount_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class STAmount_test : public beast::unit_test::suite { @@ -1245,6 +1245,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(STAmount, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STAmount, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STInteger_test.cpp b/src/test/protocol/STInteger_test.cpp index 5852fc873c..73b4ca39ef 100644 --- a/src/test/protocol/STInteger_test.cpp +++ b/src/test/protocol/STInteger_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { struct STInteger_test : public beast::unit_test::suite { @@ -139,6 +139,6 @@ struct STInteger_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(STInteger, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STInteger, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STIssue_test.cpp b/src/test/protocol/STIssue_test.cpp index 110c544ec4..d64722712b 100644 --- a/src/test/protocol/STIssue_test.cpp +++ b/src/test/protocol/STIssue_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class STIssue_test : public beast::unit_test::suite @@ -140,7 +140,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(STIssue, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STIssue, protocol, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STNumber_test.cpp b/src/test/protocol/STNumber_test.cpp index af455c6592..1275c756cf 100644 --- a/src/test/protocol/STNumber_test.cpp +++ b/src/test/protocol/STNumber_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { struct STNumber_test : public beast::unit_test::suite { @@ -281,7 +281,7 @@ struct STNumber_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(STNumber, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STNumber, protocol, xrpl); void testCompile(std::ostream& out) @@ -290,4 +290,4 @@ testCompile(std::ostream& out) out << number; } -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STObject_test.cpp b/src/test/protocol/STObject_test.cpp index c0d0297e37..c01297b4e1 100644 --- a/src/test/protocol/STObject_test.cpp +++ b/src/test/protocol/STObject_test.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { class STObject_test : public beast::unit_test::suite { @@ -458,7 +458,7 @@ public: st[sf3] = std::vector{}; BEAST_EXPECT(cst[sf3].size() == 0); } - } // namespace ripple + } // namespace xrpl void testMalformed() @@ -503,6 +503,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(STObject, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STObject, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STParsedJSON_test.cpp b/src/test/protocol/STParsedJSON_test.cpp index 13983444da..9c3a08243b 100644 --- a/src/test/protocol/STParsedJSON_test.cpp +++ b/src/test/protocol/STParsedJSON_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class STParsedJSON_test : public beast::unit_test::suite { @@ -2332,6 +2332,6 @@ class STParsedJSON_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(STParsedJSON, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STParsedJSON, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STTx_test.cpp b/src/test/protocol/STTx_test.cpp index 50cd8c511f..1899b786f9 100644 --- a/src/test/protocol/STTx_test.cpp +++ b/src/test/protocol/STTx_test.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { /** * Return true if the string loosely matches the regex. @@ -1398,7 +1398,7 @@ public: SerialIter tenSit{tenDeep.slice()}; try { - auto stx = std::make_shared(tenSit); + auto stx = std::make_shared(tenSit); fail("STTx construction should have thrown."); } catch (std::runtime_error const& ex) @@ -1417,7 +1417,7 @@ public: SerialIter tooDeepSit{tooDeep.slice()}; try { - auto stx = std::make_shared(tooDeepSit); + auto stx = std::make_shared(tooDeepSit); fail("STTx construction should have thrown."); } catch (std::runtime_error const& ex) @@ -1463,7 +1463,7 @@ public: SerialIter nineSit{nineDeep.slice()}; try { - auto stx = std::make_shared(nineSit); + auto stx = std::make_shared(nineSit); fail("STTx construction should have thrown."); } catch (std::runtime_error const& ex) @@ -1483,7 +1483,7 @@ public: SerialIter tooDeepSit{tooDeep.slice()}; try { - auto stx = std::make_shared(tooDeepSit); + auto stx = std::make_shared(tooDeepSit); fail("STTx construction should have thrown."); } catch (std::runtime_error const& ex) @@ -1512,7 +1512,7 @@ public: { // Verify we have a valid transaction. SerialIter sit{serialized.slice()}; - auto stx = std::make_shared(sit); + auto stx = std::make_shared(sit); } // Tweak the serialized data to change the ClearFlag to @@ -1524,7 +1524,7 @@ public: SerialIter sit{serialized.slice()}; try { - auto stx = std::make_shared(sit); + auto stx = std::make_shared(sit); fail("An exception should have been thrown"); } catch (std::exception const& ex) @@ -1551,9 +1551,9 @@ public: // vary. BEAST_EXPECT(!tx2.ParseFromArray(payload1, sizeof(payload1))); - ripple::SerialIter sit(ripple::makeSlice(tx2.rawtransaction())); + xrpl::SerialIter sit(xrpl::makeSlice(tx2.rawtransaction())); - auto stx = std::make_shared(sit); + auto stx = std::make_shared(sit); fail("An exception should have been thrown"); } catch (std::exception const&) @@ -1563,8 +1563,8 @@ public: try { - ripple::SerialIter sit{payload2}; - auto stx = std::make_shared(sit); + xrpl::SerialIter sit{payload2}; + auto stx = std::make_shared(sit); fail("An exception should have been thrown"); } catch (std::exception const& ex) @@ -1574,8 +1574,8 @@ public: try { - ripple::SerialIter sit{payload3}; - auto stx = std::make_shared(sit); + xrpl::SerialIter sit{payload3}; + auto stx = std::make_shared(sit); fail("An exception should have been thrown"); } catch (std::exception const& ex) @@ -1586,8 +1586,8 @@ public: try { - ripple::SerialIter sit{payload4}; - auto stx = std::make_shared(sit); + xrpl::SerialIter sit{payload4}; + auto stx = std::make_shared(sit); fail("An exception should have been thrown"); } catch (std::exception const& ex) @@ -1837,7 +1837,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(STTx, protocol, ripple); -BEAST_DEFINE_TESTSUITE(InnerObjectFormatsSerializer, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STTx, protocol, xrpl); +BEAST_DEFINE_TESTSUITE(InnerObjectFormatsSerializer, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/STValidation_test.cpp b/src/test/protocol/STValidation_test.cpp index 88956ef2f6..3530d2f34a 100644 --- a/src/test/protocol/STValidation_test.cpp +++ b/src/test/protocol/STValidation_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class STValidation_test : public beast::unit_test::suite { @@ -187,7 +187,7 @@ public: try { SerialIter sit{payload1}; - auto val = std::make_shared( + auto val = std::make_shared( sit, [](PublicKey const& pk) { return calcNodeID(pk); }, false); fail("An exception should have been thrown"); } @@ -202,7 +202,7 @@ public: try { SerialIter sit{payload2}; - auto val = std::make_shared( + auto val = std::make_shared( sit, [](PublicKey const& pk) { return calcNodeID(pk); }, false); fail("An exception should have been thrown"); } @@ -215,7 +215,7 @@ public: try { SerialIter sit{payload3}; - auto val = std::make_shared( + auto val = std::make_shared( sit, [](PublicKey const& pk) { return calcNodeID(pk); }, false); fail("An exception should have been thrown"); } @@ -228,7 +228,7 @@ public: try { SerialIter sit{payload4}; - auto val = std::make_shared( + auto val = std::make_shared( sit, [](PublicKey const& pk) { return calcNodeID(pk); }, false); fail("An exception should have been thrown"); } @@ -330,6 +330,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(STValidation, protocol, ripple); +BEAST_DEFINE_TESTSUITE(STValidation, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/SecretKey_test.cpp b/src/test/protocol/SecretKey_test.cpp index 803988e9d5..e7bdcc1916 100644 --- a/src/test/protocol/SecretKey_test.cpp +++ b/src/test/protocol/SecretKey_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { class SecretKey_test : public beast::unit_test::suite { @@ -1494,6 +1494,6 @@ inline static TestKeyData const ed25519TestVectors[] = { // clang-format on }; -BEAST_DEFINE_TESTSUITE(SecretKey, protocol, ripple); +BEAST_DEFINE_TESTSUITE(SecretKey, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/Seed_test.cpp b/src/test/protocol/Seed_test.cpp index dfac5416d9..65428295f8 100644 --- a/src/test/protocol/Seed_test.cpp +++ b/src/test/protocol/Seed_test.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class Seed_test : public beast::unit_test::suite { @@ -339,6 +339,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Seed, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Seed, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/SeqProxy_test.cpp b/src/test/protocol/SeqProxy_test.cpp index fefea5a638..d922dd1182 100644 --- a/src/test/protocol/SeqProxy_test.cpp +++ b/src/test/protocol/SeqProxy_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { struct SeqProxy_test : public beast::unit_test::suite { @@ -217,6 +217,6 @@ struct SeqProxy_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(SeqProxy, protocol, ripple); +BEAST_DEFINE_TESTSUITE(SeqProxy, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/Serializer_test.cpp b/src/test/protocol/Serializer_test.cpp index 1b99266dc4..c5b56c3029 100644 --- a/src/test/protocol/Serializer_test.cpp +++ b/src/test/protocol/Serializer_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { struct Serializer_test : public beast::unit_test::suite { @@ -45,6 +45,6 @@ struct Serializer_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(Serializer, protocol, ripple); +BEAST_DEFINE_TESTSUITE(Serializer, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/protocol/TER_test.cpp b/src/test/protocol/TER_test.cpp index 8c279a8c95..0d9c6cb96d 100644 --- a/src/test/protocol/TER_test.cpp +++ b/src/test/protocol/TER_test.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { struct TER_test : public beast::unit_test::suite { @@ -274,6 +274,6 @@ struct TER_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(TER, protocol, ripple); +BEAST_DEFINE_TESTSUITE(TER, protocol, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/resource/Logic_test.cpp b/src/test/resource/Logic_test.cpp index 2cb2625708..0e520d4983 100644 --- a/src/test/resource/Logic_test.cpp +++ b/src/test/resource/Logic_test.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace Resource { class ResourceManager_test : public beast::unit_test::suite @@ -272,7 +272,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ResourceManager, resource, ripple); +BEAST_DEFINE_TESTSUITE(ResourceManager, resource, xrpl); } // namespace Resource -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AMMInfo_test.cpp b/src/test/rpc/AMMInfo_test.cpp index 2e519d1fb2..c76fa15eb7 100644 --- a/src/test/rpc/AMMInfo_test.cpp +++ b/src/test/rpc/AMMInfo_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class AMMInfo_test : public jtx::AMMTestBase @@ -350,7 +350,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AMMInfo, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AMMInfo, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountCurrencies_test.cpp b/src/test/rpc/AccountCurrencies_test.cpp index c4833d11d4..b1417735be 100644 --- a/src/test/rpc/AccountCurrencies_test.cpp +++ b/src/test/rpc/AccountCurrencies_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { class AccountCurrencies_test : public beast::unit_test::suite { @@ -209,6 +209,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AccountCurrencies, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountCurrencies, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountInfo_test.cpp b/src/test/rpc/AccountInfo_test.cpp index 5e2fc608b3..6370884124 100644 --- a/src/test/rpc/AccountInfo_test.cpp +++ b/src/test/rpc/AccountInfo_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class AccountInfo_test : public beast::unit_test::suite @@ -693,15 +693,14 @@ public: testSignerListsApiVersion2(); testSignerListsV2(); - FeatureBitset const allFeatures{ - ripple::test::jtx::testable_amendments()}; + FeatureBitset const allFeatures{xrpl::test::jtx::testable_amendments()}; testAccountFlags(allFeatures); testAccountFlags(allFeatures - featureClawback); testAccountFlags(allFeatures - featureClawback - featureTokenEscrow); } }; -BEAST_DEFINE_TESTSUITE(AccountInfo, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountInfo, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountLines_test.cpp b/src/test/rpc/AccountLines_test.cpp index 200331b9be..6d9b75a44e 100644 --- a/src/test/rpc/AccountLines_test.cpp +++ b/src/test/rpc/AccountLines_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { class AccountLines_test : public beast::unit_test::suite @@ -1400,7 +1400,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AccountLines, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountLines, rpc, xrpl); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index 74c5a2c915..e438d50633 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { static char const* bobs_account_objects[] = { @@ -1427,7 +1427,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AccountObjects, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountObjects, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountOffers_test.cpp b/src/test/rpc/AccountOffers_test.cpp index 500828d9d7..2c03239bd8 100644 --- a/src/test/rpc/AccountOffers_test.cpp +++ b/src/test/rpc/AccountOffers_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class AccountOffers_test : public beast::unit_test::suite @@ -320,7 +320,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AccountOffers, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountOffers, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountSet_test.cpp b/src/test/rpc/AccountSet_test.cpp index 3df3606a03..40ef4acba7 100644 --- a/src/test/rpc/AccountSet_test.cpp +++ b/src/test/rpc/AccountSet_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class AccountSet_test : public beast::unit_test::suite { @@ -565,8 +565,7 @@ public: stx->at(sfSigningPubKey) = makeSlice(std::string("badkey")); env.app().openLedger().modify([&](OpenView& view, beast::Journal j) { - auto const result = - ripple::apply(env.app(), view, *stx, tapNONE, j); + auto const result = xrpl::apply(env.app(), view, *stx, tapNONE, j); BEAST_EXPECT(result.ter == temBAD_SIGNATURE); BEAST_EXPECT(!result.applied); return result.applied; @@ -593,6 +592,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(AccountSet, rpc, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(AccountSet, rpc, xrpl, 1); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AccountTx_test.cpp b/src/test/rpc/AccountTx_test.cpp index f9f21c5e87..e387e1bc4c 100644 --- a/src/test/rpc/AccountTx_test.cpp +++ b/src/test/rpc/AccountTx_test.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { @@ -938,7 +938,7 @@ public: testMPT(); } }; -BEAST_DEFINE_TESTSUITE(AccountTx, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AccountTx, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/AmendmentBlocked_test.cpp b/src/test/rpc/AmendmentBlocked_test.cpp index 05fa4908f3..2c3f631ac8 100644 --- a/src/test/rpc/AmendmentBlocked_test.cpp +++ b/src/test/rpc/AmendmentBlocked_test.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { class AmendmentBlocked_test : public beast::unit_test::suite { @@ -236,6 +236,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(AmendmentBlocked, rpc, ripple); +BEAST_DEFINE_TESTSUITE(AmendmentBlocked, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/BookChanges_test.cpp b/src/test/rpc/BookChanges_test.cpp index 5f58dfc383..216f4bd895 100644 --- a/src/test/rpc/BookChanges_test.cpp +++ b/src/test/rpc/BookChanges_test.cpp @@ -4,7 +4,7 @@ #include "xrpl/beast/unit_test/suite.h" #include "xrpl/protocol/jss.h" -namespace ripple { +namespace xrpl { namespace test { class BookChanges_test : public beast::unit_test::suite @@ -124,7 +124,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(BookChanges, rpc, ripple); +BEAST_DEFINE_TESTSUITE(BookChanges, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Book_test.cpp b/src/test/rpc/Book_test.cpp index f2798671b0..3c7477745b 100644 --- a/src/test/rpc/Book_test.cpp +++ b/src/test/rpc/Book_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class Book_test : public beast::unit_test::suite @@ -2011,7 +2011,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(Book, rpc, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(Book, rpc, xrpl, 1); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Connect_test.cpp b/src/test/rpc/Connect_test.cpp index a01ee05ff2..8d5a2ca33f 100644 --- a/src/test/rpc/Connect_test.cpp +++ b/src/test/rpc/Connect_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class Connect_test : public beast::unit_test::suite { @@ -36,6 +36,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Connect, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Connect, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/DeliveredAmount_test.cpp b/src/test/rpc/DeliveredAmount_test.cpp index 79447af780..3e256aa03b 100644 --- a/src/test/rpc/DeliveredAmount_test.cpp +++ b/src/test/rpc/DeliveredAmount_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { // Helper class to track the expected number `delivered_amount` results. @@ -403,7 +403,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(DeliveredAmount, rpc, ripple); +BEAST_DEFINE_TESTSUITE(DeliveredAmount, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/DepositAuthorized_test.cpp b/src/test/rpc/DepositAuthorized_test.cpp index 6e46b077b8..968a3fd4dc 100644 --- a/src/test/rpc/DepositAuthorized_test.cpp +++ b/src/test/rpc/DepositAuthorized_test.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class DepositAuthorized_test : public beast::unit_test::suite @@ -622,7 +622,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(DepositAuthorized, rpc, ripple); +BEAST_DEFINE_TESTSUITE(DepositAuthorized, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 058b4a9572..6b66da072e 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class Feature_test : public beast::unit_test::suite { @@ -14,13 +14,13 @@ class Feature_test : public beast::unit_test::suite { testcase("internals"); - auto const& supportedAmendments = ripple::detail::supportedAmendments(); - auto const& allAmendments = ripple::allAmendments(); + auto const& supportedAmendments = xrpl::detail::supportedAmendments(); + auto const& allAmendments = xrpl::allAmendments(); BEAST_EXPECT( supportedAmendments.size() == - ripple::detail::numDownVotedAmendments() + - ripple::detail::numUpVotedAmendments()); + xrpl::detail::numDownVotedAmendments() + + xrpl::detail::numUpVotedAmendments()); { std::size_t up = 0, down = 0, obsolete = 0; for (auto const& [name, vote] : supportedAmendments) @@ -54,8 +54,8 @@ class Feature_test : public beast::unit_test::suite } } BEAST_EXPECT( - down + obsolete == ripple::detail::numDownVotedAmendments()); - BEAST_EXPECT(up == ripple::detail::numUpVotedAmendments()); + down + obsolete == xrpl::detail::numDownVotedAmendments()); + BEAST_EXPECT(up == xrpl::detail::numUpVotedAmendments()); } { std::size_t supported = 0, unsupported = 0, retired = 0; @@ -93,7 +93,7 @@ class Feature_test : public beast::unit_test::suite // Test all the supported features. In a perfect world, this would test // FeatureCollections::featureNames, but that's private. Leave it that // way. - auto const supported = ripple::detail::supportedAmendments(); + auto const supported = xrpl::detail::supportedAmendments(); for (auto const& [feature, vote] : supported) { @@ -139,7 +139,7 @@ class Feature_test : public beast::unit_test::suite Env env{*this}; std::map const& votes = - ripple::detail::supportedAmendments(); + xrpl::detail::supportedAmendments(); auto jrr = env.rpc("feature")[jss::result]; if (!BEAST_EXPECT(jrr.isMember(jss::features))) @@ -325,7 +325,7 @@ class Feature_test : public beast::unit_test::suite Env env{*this, FeatureBitset{}}; std::map const& votes = - ripple::detail::supportedAmendments(); + xrpl::detail::supportedAmendments(); auto jrr = env.rpc("feature")[jss::result]; if (!BEAST_EXPECT(jrr.isMember(jss::features))) @@ -423,7 +423,7 @@ class Feature_test : public beast::unit_test::suite // to avoid maintenance as more amendments are added in the future. BEAST_EXPECT(majorities.size() >= 2); std::map const& votes = - ripple::detail::supportedAmendments(); + xrpl::detail::supportedAmendments(); jrr = env.rpc("feature")[jss::result]; if (!BEAST_EXPECT(jrr.isMember(jss::features))) @@ -607,6 +607,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Feature, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Feature, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/GRPCTestClientBase.h b/src/test/rpc/GRPCTestClientBase.h index b5e50b1c94..6cb806a562 100644 --- a/src/test/rpc/GRPCTestClientBase.h +++ b/src/test/rpc/GRPCTestClientBase.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { struct GRPCTestClientBase @@ -29,5 +29,5 @@ struct GRPCTestClientBase }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif // XRPL_GRPCTESTCLIENTBASE_H diff --git a/src/test/rpc/GatewayBalances_test.cpp b/src/test/rpc/GatewayBalances_test.cpp index 23ac199b4e..40f56dfc81 100644 --- a/src/test/rpc/GatewayBalances_test.cpp +++ b/src/test/rpc/GatewayBalances_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class GatewayBalances_test : public beast::unit_test::suite @@ -243,7 +243,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(GatewayBalances, rpc, ripple); +BEAST_DEFINE_TESTSUITE(GatewayBalances, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/GetAggregatePrice_test.cpp b/src/test/rpc/GetAggregatePrice_test.cpp index a1a09ab592..52f82ffc6c 100644 --- a/src/test/rpc/GetAggregatePrice_test.cpp +++ b/src/test/rpc/GetAggregatePrice_test.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { namespace jtx { namespace oracle { @@ -327,9 +327,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(GetAggregatePrice, rpc, ripple); +BEAST_DEFINE_TESTSUITE(GetAggregatePrice, rpc, xrpl); } // namespace oracle } // namespace jtx } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/GetCounts_test.cpp b/src/test/rpc/GetCounts_test.cpp index ea8d7a896a..b9ad5ec254 100644 --- a/src/test/rpc/GetCounts_test.cpp +++ b/src/test/rpc/GetCounts_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class GetCounts_test : public beast::unit_test::suite { @@ -101,6 +101,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(GetCounts, rpc, ripple); +BEAST_DEFINE_TESTSUITE(GetCounts, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Handler_test.cpp b/src/test/rpc/Handler_test.cpp index b0f386b925..9a6f1b3aa1 100644 --- a/src/test/rpc/Handler_test.cpp +++ b/src/test/rpc/Handler_test.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple::test { +namespace xrpl::test { // NOTE: there should be no need for this function; // `std::cout << some_duration` should just work if built with a compliant @@ -82,7 +82,7 @@ class Handler_test : public beast::unit_test::suite std::ranlux48 prng(dev()); std::vector names = - test::jtx::make_vector(ripple::RPC::getHandlerNames()); + test::jtx::make_vector(xrpl::RPC::getHandlerNames()); std::uniform_int_distribution distr{0, names.size() - 1}; @@ -109,6 +109,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_MANUAL(Handler, rpc, ripple); +BEAST_DEFINE_TESTSUITE_MANUAL(Handler, rpc, xrpl); -} // namespace ripple::test +} // namespace xrpl::test diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index 7bcc26e3d3..4d3f0a5098 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -2917,7 +2917,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(JSONRPC, rpc, ripple); +BEAST_DEFINE_TESTSUITE(JSONRPC, rpc, xrpl); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/KeyGeneration_test.cpp b/src/test/rpc/KeyGeneration_test.cpp index b1bbac7340..23f2723d6a 100644 --- a/src/test/rpc/KeyGeneration_test.cpp +++ b/src/test/rpc/KeyGeneration_test.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -75,7 +75,7 @@ static key_strings const strong_brain_strings = { "attacks.", }; -class WalletPropose_test : public ripple::TestSuite +class WalletPropose_test : public xrpl::TestSuite { public: void @@ -875,7 +875,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(WalletPropose, rpc, ripple); +BEAST_DEFINE_TESTSUITE(WalletPropose, rpc, xrpl); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerClosed_test.cpp b/src/test/rpc/LedgerClosed_test.cpp index ba25a115c3..2bc5c2b0c9 100644 --- a/src/test/rpc/LedgerClosed_test.cpp +++ b/src/test/rpc/LedgerClosed_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { class LedgerClosed_test : public beast::unit_test::suite { @@ -49,6 +49,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerClosed, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerClosed, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerData_test.cpp b/src/test/rpc/LedgerData_test.cpp index 9ac61c277a..66be8486b4 100644 --- a/src/test/rpc/LedgerData_test.cpp +++ b/src/test/rpc/LedgerData_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { class LedgerData_test : public beast::unit_test::suite { @@ -473,6 +473,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE_PRIO(LedgerData, rpc, ripple, 1); +BEAST_DEFINE_TESTSUITE_PRIO(LedgerData, rpc, xrpl, 1); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 8e9be02dda..ef5abdd800 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -19,7 +19,7 @@ using source_location = std::experimental::source_location; #include using std::source_location; #endif -namespace ripple { +namespace xrpl { namespace test { @@ -1775,8 +1775,8 @@ class LedgerEntry_test : public beast::unit_test::suite testInvalidOracleLedgerEntry() { testcase("Invalid Oracle Ledger Entry"); - using namespace ripple::test::jtx; - using namespace ripple::test::jtx::oracle; + using namespace xrpl::test::jtx; + using namespace xrpl::test::jtx::oracle; Env env(*this); Account const owner("owner"); @@ -1802,8 +1802,8 @@ class LedgerEntry_test : public beast::unit_test::suite testOracleLedgerEntry() { testcase("Oracle Ledger Entry"); - using namespace ripple::test::jtx; - using namespace ripple::test::jtx::oracle; + using namespace xrpl::test::jtx; + using namespace xrpl::test::jtx::oracle; Env env(*this); auto const baseFee = @@ -2368,8 +2368,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerEntry, rpc, ripple); -BEAST_DEFINE_TESTSUITE(LedgerEntry_XChain, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerEntry, rpc, xrpl); +BEAST_DEFINE_TESTSUITE(LedgerEntry_XChain, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerHeader_test.cpp b/src/test/rpc/LedgerHeader_test.cpp index 7ebf7a8a94..3af82d683e 100644 --- a/src/test/rpc/LedgerHeader_test.cpp +++ b/src/test/rpc/LedgerHeader_test.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LedgerHeader_test : public beast::unit_test::suite { @@ -68,6 +68,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerHeader, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerHeader, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerRPC_test.cpp b/src/test/rpc/LedgerRPC_test.cpp index 7728973045..583ff0a531 100644 --- a/src/test/rpc/LedgerRPC_test.cpp +++ b/src/test/rpc/LedgerRPC_test.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -738,7 +738,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerRPC, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerRPC, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/LedgerRequest_test.cpp b/src/test/rpc/LedgerRequest_test.cpp index 013d4cbe0f..153c6ad508 100644 --- a/src/test/rpc/LedgerRequest_test.cpp +++ b/src/test/rpc/LedgerRequest_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -377,7 +377,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(LedgerRequest, rpc, ripple); +BEAST_DEFINE_TESTSUITE(LedgerRequest, rpc, xrpl); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/ManifestRPC_test.cpp b/src/test/rpc/ManifestRPC_test.cpp index a875ecb479..5d4f4900eb 100644 --- a/src/test/rpc/ManifestRPC_test.cpp +++ b/src/test/rpc/ManifestRPC_test.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class ManifestRPC_test : public beast::unit_test::suite @@ -73,6 +73,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ManifestRPC, rpc, ripple); +BEAST_DEFINE_TESTSUITE(ManifestRPC, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/NoRippleCheck_test.cpp b/src/test/rpc/NoRippleCheck_test.cpp index 4d9af8524f..7ed2cd8fd1 100644 --- a/src/test/rpc/NoRippleCheck_test.cpp +++ b/src/test/rpc/NoRippleCheck_test.cpp @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { class NoRippleCheck_test : public beast::unit_test::suite { @@ -289,7 +289,7 @@ class NoRippleCheckLimits_test : public beast::unit_test::suite // be better if we could add this functionality to Env somehow // or otherwise disable endpoint charging for certain test // cases. - using namespace ripple::Resource; + using namespace xrpl::Resource; using namespace std::chrono; using namespace beast::IP; auto c = env.app().getResourceManager().newInboundEndpoint( @@ -304,7 +304,7 @@ class NoRippleCheckLimits_test : public beast::unit_test::suite } }; - for (auto i = 0; i < ripple::RPC::Tuning::noRippleCheck.rmax + 5; ++i) + for (auto i = 0; i < xrpl::RPC::Tuning::noRippleCheck.rmax + 5; ++i) { if (!admin) checkBalance(); @@ -379,12 +379,12 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NoRippleCheck, rpc, ripple); +BEAST_DEFINE_TESTSUITE(NoRippleCheck, rpc, xrpl); // These tests that deal with limit amounts are slow because of the // offer/account setup, so making them manual -- the additional coverage // provided by them is minimal -BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(NoRippleCheckLimits, rpc, ripple, 1); +BEAST_DEFINE_TESTSUITE_MANUAL_PRIO(NoRippleCheckLimits, rpc, xrpl, 1); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/NoRipple_test.cpp b/src/test/rpc/NoRipple_test.cpp index 8e68df0e8b..040ceaaa29 100644 --- a/src/test/rpc/NoRipple_test.cpp +++ b/src/test/rpc/NoRipple_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -269,7 +269,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(NoRipple, rpc, ripple); +BEAST_DEFINE_TESTSUITE(NoRipple, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/OwnerInfo_test.cpp b/src/test/rpc/OwnerInfo_test.cpp index b3a4f6a0a4..b47b529680 100644 --- a/src/test/rpc/OwnerInfo_test.cpp +++ b/src/test/rpc/OwnerInfo_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class OwnerInfo_test : public beast::unit_test::suite { @@ -200,6 +200,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(OwnerInfo, rpc, ripple); +BEAST_DEFINE_TESTSUITE(OwnerInfo, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Peers_test.cpp b/src/test/rpc/Peers_test.cpp index a066a0a709..639f5e98cb 100644 --- a/src/test/rpc/Peers_test.cpp +++ b/src/test/rpc/Peers_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class Peers_test : public beast::unit_test::suite { @@ -73,6 +73,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Peers, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Peers, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 7647dc5f65..682584f40b 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { struct RPCCallTestData @@ -5990,7 +5990,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RPCCall, rpc, ripple); +BEAST_DEFINE_TESTSUITE(RPCCall, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/RPCHelpers_test.cpp b/src/test/rpc/RPCHelpers_test.cpp index e2e5f5fcf9..f180bd5c1a 100644 --- a/src/test/rpc/RPCHelpers_test.cpp +++ b/src/test/rpc/RPCHelpers_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class RPCHelpers_test : public beast::unit_test::suite @@ -70,7 +70,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RPCHelpers, rpc, ripple); +BEAST_DEFINE_TESTSUITE(RPCHelpers, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/RPCOverload_test.cpp b/src/test/rpc/RPCOverload_test.cpp index 3eef88ff2a..d05dba4606 100644 --- a/src/test/rpc/RPCOverload_test.cpp +++ b/src/test/rpc/RPCOverload_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class RPCOverload_test : public beast::unit_test::suite @@ -70,7 +70,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RPCOverload, rpc, ripple); +BEAST_DEFINE_TESTSUITE(RPCOverload, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/RobustTransaction_test.cpp b/src/test/rpc/RobustTransaction_test.cpp index d52e08f7ac..b0d0cdafd5 100644 --- a/src/test/rpc/RobustTransaction_test.cpp +++ b/src/test/rpc/RobustTransaction_test.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class RobustTransaction_test : public beast::unit_test::suite @@ -490,7 +490,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(RobustTransaction, rpc, ripple); +BEAST_DEFINE_TESTSUITE(RobustTransaction, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Roles_test.cpp b/src/test/rpc/Roles_test.cpp index 777cf1e2a2..4fa99b432b 100644 --- a/src/test/rpc/Roles_test.cpp +++ b/src/test/rpc/Roles_test.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -370,8 +370,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Roles, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Roles, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/ServerDefinitions_test.cpp b/src/test/rpc/ServerDefinitions_test.cpp index 051e9e00eb..ae2cccd908 100644 --- a/src/test/rpc/ServerDefinitions_test.cpp +++ b/src/test/rpc/ServerDefinitions_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -143,7 +143,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ServerDefinitions, rpc, ripple); +BEAST_DEFINE_TESTSUITE(ServerDefinitions, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/ServerInfo_test.cpp b/src/test/rpc/ServerInfo_test.cpp index d149a0899c..27b554e38b 100644 --- a/src/test/rpc/ServerInfo_test.cpp +++ b/src/test/rpc/ServerInfo_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { @@ -162,7 +162,7 @@ admin = 127.0.0.1 } }; -BEAST_DEFINE_TESTSUITE(ServerInfo, rpc, ripple); +BEAST_DEFINE_TESTSUITE(ServerInfo, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Simulate_test.cpp b/src/test/rpc/Simulate_test.cpp index 61d3f1ce6e..2a85e2a928 100644 --- a/src/test/rpc/Simulate_test.cpp +++ b/src/test/rpc/Simulate_test.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { @@ -1316,8 +1316,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Simulate, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Simulate, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Status_test.cpp b/src/test/rpc/Status_test.cpp index 5e6ac1bca4..c2e9c836df 100644 --- a/src/test/rpc/Status_test.cpp +++ b/src/test/rpc/Status_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { class codeString_test : public beast::unit_test::suite @@ -202,4 +202,4 @@ public: BEAST_DEFINE_TESTSUITE(fillJson, rpc, RPC); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index a4eea3f12c..1637554f5c 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { class Subscribe_test : public beast::unit_test::suite @@ -1591,7 +1591,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Subscribe, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Subscribe, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/TransactionEntry_test.cpp b/src/test/rpc/TransactionEntry_test.cpp index 052d45e43b..f81a04df6a 100644 --- a/src/test/rpc/TransactionEntry_test.cpp +++ b/src/test/rpc/TransactionEntry_test.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class TransactionEntry_test : public beast::unit_test::suite { @@ -375,6 +375,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(TransactionEntry, rpc, ripple); +BEAST_DEFINE_TESTSUITE(TransactionEntry, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/TransactionHistory_test.cpp b/src/test/rpc/TransactionHistory_test.cpp index ca8d128962..1dec83584d 100644 --- a/src/test/rpc/TransactionHistory_test.cpp +++ b/src/test/rpc/TransactionHistory_test.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class TransactionHistory_test : public beast::unit_test::suite { @@ -151,6 +151,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(TransactionHistory, rpc, ripple); +BEAST_DEFINE_TESTSUITE(TransactionHistory, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index b1bea237f5..6947fc91c2 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { class Transaction_test : public beast::unit_test::suite { @@ -938,6 +938,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Transaction, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Transaction, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/ValidatorInfo_test.cpp b/src/test/rpc/ValidatorInfo_test.cpp index a115044194..a8fccc724b 100644 --- a/src/test/rpc/ValidatorInfo_test.cpp +++ b/src/test/rpc/ValidatorInfo_test.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class ValidatorInfo_test : public beast::unit_test::suite @@ -104,6 +104,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ValidatorInfo, rpc, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorInfo, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/ValidatorRPC_test.cpp b/src/test/rpc/ValidatorRPC_test.cpp index df7180ed10..cf8741e507 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace test { @@ -575,7 +575,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ValidatorRPC, rpc, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorRPC, rpc, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/rpc/Version_test.cpp b/src/test/rpc/Version_test.cpp index 50004c2c54..fd4bfdd565 100644 --- a/src/test/rpc/Version_test.cpp +++ b/src/test/rpc/Version_test.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { class Version_test : public beast::unit_test::suite { @@ -277,6 +277,6 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Version, rpc, ripple); +BEAST_DEFINE_TESTSUITE(Version, rpc, xrpl); -} // namespace ripple +} // namespace xrpl diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index b93c3a30e7..9f35a9162d 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class ServerStatus_test : public beast::unit_test::suite, @@ -1226,7 +1226,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(ServerStatus, server, ripple); +BEAST_DEFINE_TESTSUITE(ServerStatus, server, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/server/Server_test.cpp b/src/test/server/Server_test.cpp index 55a9b17ea0..2a4bb49d34 100644 --- a/src/test/server/Server_test.cpp +++ b/src/test/server/Server_test.cpp @@ -22,7 +22,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { using socket_type = boost::beast::tcp_stream; @@ -517,7 +517,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(Server, server, ripple); +BEAST_DEFINE_TESTSUITE(Server, server, xrpl); } // namespace test -} // namespace ripple +} // namespace xrpl diff --git a/src/test/shamap/FetchPack_test.cpp b/src/test/shamap/FetchPack_test.cpp index 13ea267da9..dc51616015 100644 --- a/src/test/shamap/FetchPack_test.cpp +++ b/src/test/shamap/FetchPack_test.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { class FetchPack_test : public beast::unit_test::suite @@ -72,7 +72,7 @@ public: { Serializer s; for (int d = 0; d < 3; ++d) - s.add32(ripple::rand_int(r)); + s.add32(xrpl::rand_int(r)); return make_shamapitem(s.getSHA512Half(), s.slice()); } @@ -151,7 +151,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(FetchPack, shamap, ripple); +BEAST_DEFINE_TESTSUITE(FetchPack, shamap, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/shamap/SHAMapSync_test.cpp b/src/test/shamap/SHAMapSync_test.cpp index c71ad53ce8..912768e618 100644 --- a/src/test/shamap/SHAMapSync_test.cpp +++ b/src/test/shamap/SHAMapSync_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { class SHAMapSync_test : public beast::unit_test::suite @@ -168,7 +168,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(SHAMapSync, shamap, ripple); +BEAST_DEFINE_TESTSUITE(SHAMapSync, shamap, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/shamap/SHAMap_test.cpp b/src/test/shamap/SHAMap_test.cpp index e3e541019b..ade7a692f8 100644 --- a/src/test/shamap/SHAMap_test.cpp +++ b/src/test/shamap/SHAMap_test.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { #ifndef __INTELLISENSE__ @@ -382,7 +382,7 @@ class SHAMapPathProof_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(SHAMap, shamap, ripple); -BEAST_DEFINE_TESTSUITE(SHAMapPathProof, shamap, ripple); +BEAST_DEFINE_TESTSUITE(SHAMap, shamap, xrpl); +BEAST_DEFINE_TESTSUITE(SHAMapPathProof, shamap, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/shamap/common.h b/src/test/shamap/common.h index ac9a716912..add2c79243 100644 --- a/src/test/shamap/common.h +++ b/src/test/shamap/common.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { class TestNodeFamily : public Family @@ -109,6 +109,6 @@ public: }; } // namespace tests -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/unit_test/FileDirGuard.h b/src/test/unit_test/FileDirGuard.h index c5272015cc..94ca5948bd 100644 --- a/src/test/unit_test/FileDirGuard.h +++ b/src/test/unit_test/FileDirGuard.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { /** @@ -158,6 +158,6 @@ public: }; } // namespace detail -} // namespace ripple +} // namespace xrpl #endif // TEST_UNIT_TEST_DIRGUARD_H diff --git a/src/test/unit_test/SuiteJournal.h b/src/test/unit_test/SuiteJournal.h index d4883f4721..d64be9ea9b 100644 --- a/src/test/unit_test/SuiteJournal.h +++ b/src/test/unit_test/SuiteJournal.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { // A Journal::Sink intended for use with the beast unit test framework. @@ -140,6 +140,6 @@ public: }; } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/test/unit_test/multi_runner.cpp b/src/test/unit_test/multi_runner.cpp index f6f599977e..4b1a82cd3f 100644 --- a/src/test/unit_test/multi_runner.cpp +++ b/src/test/unit_test/multi_runner.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -636,4 +636,4 @@ template class multi_runner_base; template class multi_runner_base; } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/test/unit_test/multi_runner.h b/src/test/unit_test/multi_runner.h index 8c302a8007..813af61572 100644 --- a/src/test/unit_test/multi_runner.h +++ b/src/test/unit_test/multi_runner.h @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -335,6 +335,6 @@ multi_runner_child::run_multi(Pred pred) } } // namespace test -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/tests/libxrpl/basics/RangeSet.cpp b/src/tests/libxrpl/basics/RangeSet.cpp index d6f3691d4b..8c43b26758 100644 --- a/src/tests/libxrpl/basics/RangeSet.cpp +++ b/src/tests/libxrpl/basics/RangeSet.cpp @@ -5,7 +5,7 @@ #include #include -using namespace ripple; +using namespace xrpl; TEST_SUITE_BEGIN("RangeSet"); diff --git a/src/tests/libxrpl/basics/Slice.cpp b/src/tests/libxrpl/basics/Slice.cpp index d85d7c03d7..03d89ff174 100644 --- a/src/tests/libxrpl/basics/Slice.cpp +++ b/src/tests/libxrpl/basics/Slice.cpp @@ -5,7 +5,7 @@ #include #include -using namespace ripple; +using namespace xrpl; static std::uint8_t const data[] = { 0xa8, 0xa1, 0x38, 0x45, 0x23, 0xec, 0xe4, 0x23, 0x71, 0x6d, 0x2a, diff --git a/src/tests/libxrpl/basics/base64.cpp b/src/tests/libxrpl/basics/base64.cpp index 1191319145..e4581126b4 100644 --- a/src/tests/libxrpl/basics/base64.cpp +++ b/src/tests/libxrpl/basics/base64.cpp @@ -4,7 +4,7 @@ #include -using namespace ripple; +using namespace xrpl; static void check(std::string const& in, std::string const& out) diff --git a/src/tests/libxrpl/basics/contract.cpp b/src/tests/libxrpl/basics/contract.cpp index c7be5f8ede..a1f6f0b777 100644 --- a/src/tests/libxrpl/basics/contract.cpp +++ b/src/tests/libxrpl/basics/contract.cpp @@ -5,7 +5,7 @@ #include #include -using namespace ripple; +using namespace xrpl; TEST_CASE("contract") { diff --git a/src/tests/libxrpl/basics/mulDiv.cpp b/src/tests/libxrpl/basics/mulDiv.cpp index 2a59ff81c6..d3c58ea2f4 100644 --- a/src/tests/libxrpl/basics/mulDiv.cpp +++ b/src/tests/libxrpl/basics/mulDiv.cpp @@ -5,7 +5,7 @@ #include #include -using namespace ripple; +using namespace xrpl; TEST_CASE("mulDiv") { diff --git a/src/tests/libxrpl/basics/scope.cpp b/src/tests/libxrpl/basics/scope.cpp index 2f8248ef9a..b3774d54bd 100644 --- a/src/tests/libxrpl/basics/scope.cpp +++ b/src/tests/libxrpl/basics/scope.cpp @@ -2,7 +2,7 @@ #include -using namespace ripple; +using namespace xrpl; TEST_CASE("scope_exit") { diff --git a/src/tests/libxrpl/basics/tagged_integer.cpp b/src/tests/libxrpl/basics/tagged_integer.cpp index 945eaf9156..45efc579ab 100644 --- a/src/tests/libxrpl/basics/tagged_integer.cpp +++ b/src/tests/libxrpl/basics/tagged_integer.cpp @@ -4,7 +4,7 @@ #include -using namespace ripple; +using namespace xrpl; struct Tag1 { diff --git a/src/tests/libxrpl/crypto/csprng.cpp b/src/tests/libxrpl/crypto/csprng.cpp index 88c55dc4d0..e59c8a555a 100644 --- a/src/tests/libxrpl/crypto/csprng.cpp +++ b/src/tests/libxrpl/crypto/csprng.cpp @@ -2,7 +2,7 @@ #include -using namespace ripple; +using namespace xrpl; TEST_CASE("get values") { diff --git a/src/tests/libxrpl/json/Output.cpp b/src/tests/libxrpl/json/Output.cpp index 4960171e56..6e6c20a0e5 100644 --- a/src/tests/libxrpl/json/Output.cpp +++ b/src/tests/libxrpl/json/Output.cpp @@ -6,7 +6,7 @@ #include -using namespace ripple; +using namespace xrpl; using namespace Json; TEST_SUITE_BEGIN("JsonOutput"); diff --git a/src/tests/libxrpl/json/Value.cpp b/src/tests/libxrpl/json/Value.cpp index df777c98fc..25bd2f548d 100644 --- a/src/tests/libxrpl/json/Value.cpp +++ b/src/tests/libxrpl/json/Value.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { TEST_SUITE_BEGIN("json_value"); @@ -1363,4 +1363,4 @@ TEST_CASE("memory leak") TEST_SUITE_END(); -} // namespace ripple +} // namespace xrpl diff --git a/src/tests/libxrpl/json/Writer.cpp b/src/tests/libxrpl/json/Writer.cpp index 46bfd61ae2..9637184c95 100644 --- a/src/tests/libxrpl/json/Writer.cpp +++ b/src/tests/libxrpl/json/Writer.cpp @@ -6,7 +6,7 @@ #include #include -using namespace ripple; +using namespace xrpl; using namespace Json; TEST_SUITE_BEGIN("JsonWriter"); diff --git a/src/tests/libxrpl/net/HTTPClient.cpp b/src/tests/libxrpl/net/HTTPClient.cpp index 5d46f68f0c..5a484c1f56 100644 --- a/src/tests/libxrpl/net/HTTPClient.cpp +++ b/src/tests/libxrpl/net/HTTPClient.cpp @@ -13,7 +13,7 @@ #include #include -using namespace ripple; +using namespace xrpl; namespace { diff --git a/src/xrpld/app/consensus/RCLCensorshipDetector.h b/src/xrpld/app/consensus/RCLCensorshipDetector.h index d53d1197db..97d2743dc1 100644 --- a/src/xrpld/app/consensus/RCLCensorshipDetector.h +++ b/src/xrpld/app/consensus/RCLCensorshipDetector.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { template class RCLCensorshipDetector @@ -122,6 +122,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 4c2ecbac10..99cc140056 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -30,7 +30,7 @@ #include #include -namespace ripple { +namespace xrpl { RCLConsensus::RCLConsensus( Application& app, @@ -77,7 +77,7 @@ RCLConsensus::Adaptor::Adaptor( , nUnlVote_(validatorKeys_.nodeID, j_) { XRPL_ASSERT( - valCookie_, "ripple::RCLConsensus::Adaptor::Adaptor : nonzero cookie"); + valCookie_, "xrpl::RCLConsensus::Adaptor::Adaptor : nonzero cookie"); JLOG(j_.info()) << "Consensus engine started (cookie: " + std::to_string(valCookie_) + ")"; @@ -133,10 +133,10 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& hash) XRPL_ASSERT( !built->open() && built->isImmutable(), - "ripple::RCLConsensus::Adaptor::acquireLedger : valid ledger state"); + "xrpl::RCLConsensus::Adaptor::acquireLedger : valid ledger state"); XRPL_ASSERT( built->header().hash == hash, - "ripple::RCLConsensus::Adaptor::acquireLedger : ledger hash match"); + "xrpl::RCLConsensus::Adaptor::acquireLedger : ledger hash match"); // Notify inbound transactions of the new ledger sequence number inboundTransactions_.newRound(built->header().seq); @@ -193,8 +193,8 @@ void RCLConsensus::Adaptor::propose(RCLCxPeerPos::Proposal const& proposal) { JLOG(j_.trace()) << (proposal.isBowOut() ? "We bow out: " : "We propose: ") - << ripple::to_string(proposal.prevLedger()) << " -> " - << ripple::to_string(proposal.position()); + << xrpl::to_string(proposal.prevLedger()) << " -> " + << xrpl::to_string(proposal.position()); protocol::TMProposeSet prop; @@ -664,10 +664,10 @@ RCLConsensus::Adaptor::doAccept( // Do these need to exist? XRPL_ASSERT( ledgerMaster_.getClosedLedger()->header().hash == built.id(), - "ripple::RCLConsensus::Adaptor::doAccept : ledger hash match"); + "xrpl::RCLConsensus::Adaptor::doAccept : ledger hash match"); XRPL_ASSERT( app_.openLedger().current()->header().parentHash == built.id(), - "ripple::RCLConsensus::Adaptor::doAccept : parent hash match"); + "xrpl::RCLConsensus::Adaptor::doAccept : parent hash match"); } //------------------------------------------------------------------------- @@ -765,7 +765,7 @@ RCLConsensus::Adaptor::buildLCL( { XRPL_ASSERT( replayData->parent()->header().hash == previousLedger.id(), - "ripple::RCLConsensus::Adaptor::buildLCL : parent hash match"); + "xrpl::RCLConsensus::Adaptor::buildLCL : parent hash match"); return buildLedger(*replayData, tapNONE, app_, j_); } return buildLedger( @@ -1106,4 +1106,4 @@ RclConsensusLogger::~RclConsensusLogger() j_.sink().writeAlways(beast::severities::kInfo, outSs.str()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index a6a15395a3..e26cde9801 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { class InboundTransactions; class LocalTxs; @@ -548,6 +548,6 @@ public: return ss_; } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/consensus/RCLCxLedger.h b/src/xrpld/app/consensus/RCLCxLedger.h index 5671fa988d..4413fee7fc 100644 --- a/src/xrpld/app/consensus/RCLCxLedger.h +++ b/src/xrpld/app/consensus/RCLCxLedger.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents a ledger in RCLConsensus. @@ -69,7 +69,7 @@ public: bool closeAgree() const { - return ripple::getCloseAgree(ledger_->header()); + return xrpl::getCloseAgree(ledger_->header()); } //! The close time of this ledger @@ -90,7 +90,7 @@ public: Json::Value getJson() const { - return ripple::getJson({*ledger_, {}}); + return xrpl::getJson({*ledger_, {}}); } /** The ledger instance. @@ -100,5 +100,5 @@ public: */ std::shared_ptr ledger_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.cpp b/src/xrpld/app/consensus/RCLCxPeerPos.cpp index c1ebfc20e2..5f227b00a9 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.cpp +++ b/src/xrpld/app/consensus/RCLCxPeerPos.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { // Used to construct received proposals RCLCxPeerPos::RCLCxPeerPos( @@ -19,7 +19,7 @@ RCLCxPeerPos::RCLCxPeerPos( // this elsewhere, but we want to be extra careful here: XRPL_ASSERT( signature.size() != 0 && signature.size() <= signature_.capacity(), - "ripple::RCLCxPeerPos::RCLCxPeerPos : valid signature size"); + "xrpl::RCLCxPeerPos::RCLCxPeerPos : valid signature size"); if (signature.size() != 0 && signature.size() <= signature_.capacity()) signature_.assign(signature.begin(), signature.end()); @@ -63,4 +63,4 @@ proposalUniqueId( return s.getSHA512Half(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/consensus/RCLCxPeerPos.h b/src/xrpld/app/consensus/RCLCxPeerPos.h index 7202503e76..08b93d4ba9 100644 --- a/src/xrpld/app/consensus/RCLCxPeerPos.h +++ b/src/xrpld/app/consensus/RCLCxPeerPos.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A peer's signed, proposed position for use in RCLConsensus. @@ -128,6 +128,6 @@ proposalUniqueId( Slice const& publicKey, Slice const& signature); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/consensus/RCLCxTx.h b/src/xrpld/app/consensus/RCLCxTx.h index 0a2f25dbd2..5e92aea8a6 100644 --- a/src/xrpld/app/consensus/RCLCxTx.h +++ b/src/xrpld/app/consensus/RCLCxTx.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Represents a transaction in RCLConsensus. @@ -90,7 +90,7 @@ public: RCLTxSet(std::shared_ptr m) : map_{std::move(m)} { XRPL_ASSERT( - map_, "ripple::RCLTxSet::MutableTxSet::RCLTxSet : non-null input"); + map_, "xrpl::RCLTxSet::MutableTxSet::RCLTxSet : non-null input"); } /** Constructor from a previously created MutableTxSet @@ -158,7 +158,7 @@ public: { XRPL_ASSERT( (v.first && !v.second) || (v.second && !v.first), - "ripple::RCLTxSet::compare : either side is set"); + "xrpl::RCLTxSet::compare : either side is set"); ret[k] = static_cast(v.first); } @@ -168,5 +168,5 @@ public: //! The SHAMap representing the transactions. std::shared_ptr map_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/consensus/RCLValidations.cpp b/src/xrpld/app/consensus/RCLValidations.cpp index 827c417ba8..eb10765ba3 100644 --- a/src/xrpld/app/consensus/RCLValidations.cpp +++ b/src/xrpld/app/consensus/RCLValidations.cpp @@ -13,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { RCLValidatedLedger::RCLValidatedLedger(MakeGenesis) : ledgerID_{0}, ledgerSeq_{0}, j_{beast::Journal::getNullSink()} @@ -30,7 +30,7 @@ RCLValidatedLedger::RCLValidatedLedger( { XRPL_ASSERT( hashIndex->getFieldU32(sfLastLedgerSequence) == (seq() - 1), - "ripple::RCLValidatedLedger::RCLValidatedLedger(Ledger) : valid " + "xrpl::RCLValidatedLedger::RCLValidatedLedger(Ledger) : valid " "last ledger sequence"); ancestors_ = hashIndex->getFieldV256(sfHashes).value(); } @@ -134,10 +134,10 @@ RCLValidationsAdaptor::acquire(LedgerHash const& hash) XRPL_ASSERT( !ledger->open() && ledger->isImmutable(), - "ripple::RCLValidationsAdaptor::acquire : valid ledger state"); + "xrpl::RCLValidationsAdaptor::acquire : valid ledger state"); XRPL_ASSERT( ledger->header().hash == hash, - "ripple::RCLValidationsAdaptor::acquire : ledger hash match"); + "xrpl::RCLValidationsAdaptor::acquire : ledger hash match"); return RCLValidatedLedger(std::move(ledger), j_); } @@ -177,7 +177,7 @@ handleNewValidation( if (bypassAccept == BypassAccept::yes) { XRPL_ASSERT( - j, "ripple::handleNewValidation : journal is available"); + j, "xrpl::handleNewValidation : journal is available"); if (j.has_value()) { JLOG(j->trace()) << "Bypassing checkAccept for validation " @@ -228,4 +228,4 @@ handleNewValidation( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/consensus/RCLValidations.h b/src/xrpld/app/consensus/RCLValidations.h index ef6d8e9423..62dd52b1dd 100644 --- a/src/xrpld/app/consensus/RCLValidations.h +++ b/src/xrpld/app/consensus/RCLValidations.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; @@ -26,8 +26,8 @@ class RCLValidation std::shared_ptr val_; public: - using NodeKey = ripple::PublicKey; - using NodeID = ripple::NodeID; + using NodeKey = xrpl::PublicKey; + using NodeID = xrpl::NodeID; /** Constructor @@ -238,6 +238,6 @@ handleNewValidation( BypassAccept const bypassAccept = BypassAccept::no, std::optional j = std::nullopt); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/AbstractFetchPackContainer.h b/src/xrpld/app/ledger/AbstractFetchPackContainer.h index d8826a14e3..85efe09e29 100644 --- a/src/xrpld/app/ledger/AbstractFetchPackContainer.h +++ b/src/xrpld/app/ledger/AbstractFetchPackContainer.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { /** An interface facilitating retrieval of fetch packs without an application or ledgermaster object. @@ -26,6 +26,6 @@ public: getFetchPack(uint256 const& nodeHash) = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/AcceptedLedger.cpp b/src/xrpld/app/ledger/AcceptedLedger.cpp index 85fc1dcb37..76099ff864 100644 --- a/src/xrpld/app/ledger/AcceptedLedger.cpp +++ b/src/xrpld/app/ledger/AcceptedLedger.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { AcceptedLedger::AcceptedLedger( std::shared_ptr const& ledger, @@ -28,4 +28,4 @@ AcceptedLedger::AcceptedLedger( }); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/AcceptedLedger.h b/src/xrpld/app/ledger/AcceptedLedger.h index 0d0fe19f10..41177e7078 100644 --- a/src/xrpld/app/ledger/AcceptedLedger.h +++ b/src/xrpld/app/ledger/AcceptedLedger.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** A ledger that has become irrevocable. @@ -57,6 +57,6 @@ private: std::vector> transactions_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/AcceptedLedgerTx.cpp b/src/xrpld/app/ledger/AcceptedLedgerTx.cpp index 18de7b5d06..d57246444f 100644 --- a/src/xrpld/app/ledger/AcceptedLedgerTx.cpp +++ b/src/xrpld/app/ledger/AcceptedLedgerTx.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { AcceptedLedgerTx::AcceptedLedgerTx( std::shared_ptr const& ledger, @@ -17,7 +17,7 @@ AcceptedLedgerTx::AcceptedLedgerTx( { XRPL_ASSERT( !ledger->open(), - "ripple::AcceptedLedgerTx::AcceptedLedgerTx : valid ledger state"); + "xrpl::AcceptedLedgerTx::AcceptedLedgerTx : valid ledger state"); Serializer s; met->add(s); @@ -62,8 +62,8 @@ AcceptedLedgerTx::getEscMeta() const { XRPL_ASSERT( !mRawMeta.empty(), - "ripple::AcceptedLedgerTx::getEscMeta : metadata is set"); + "xrpl::AcceptedLedgerTx::getEscMeta : metadata is set"); return sqlBlobLiteral(mRawMeta); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/AcceptedLedgerTx.h b/src/xrpld/app/ledger/AcceptedLedgerTx.h index aeac800c5c..efea5b9162 100644 --- a/src/xrpld/app/ledger/AcceptedLedgerTx.h +++ b/src/xrpld/app/ledger/AcceptedLedgerTx.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class Logs; @@ -85,6 +85,6 @@ private: Json::Value mJson; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/AccountStateSF.cpp b/src/xrpld/app/ledger/AccountStateSF.cpp index 052f9f9a69..44f18b5cd3 100644 --- a/src/xrpld/app/ledger/AccountStateSF.cpp +++ b/src/xrpld/app/ledger/AccountStateSF.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { void AccountStateSF::gotNode( @@ -20,4 +20,4 @@ AccountStateSF::getNode(SHAMapHash const& nodeHash) const return fp_.getFetchPack(nodeHash.as_uint256()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/AccountStateSF.h b/src/xrpld/app/ledger/AccountStateSF.h index 13844e2417..84738f6e1f 100644 --- a/src/xrpld/app/ledger/AccountStateSF.h +++ b/src/xrpld/app/ledger/AccountStateSF.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // This class is only needed on add functions // sync filter for account state nodes during ledger sync @@ -34,6 +34,6 @@ private: AbstractFetchPackContainer& fp_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/BookListeners.cpp b/src/xrpld/app/ledger/BookListeners.cpp index 31b5d102ca..69d03058a9 100644 --- a/src/xrpld/app/ledger/BookListeners.cpp +++ b/src/xrpld/app/ledger/BookListeners.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { void BookListeners::addSubscriber(InfoSub::ref sub) @@ -44,4 +44,4 @@ BookListeners::publish( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/BookListeners.h b/src/xrpld/app/ledger/BookListeners.h index ad9e0fe0c7..784172974e 100644 --- a/src/xrpld/app/ledger/BookListeners.h +++ b/src/xrpld/app/ledger/BookListeners.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Listen to public/subscribe messages from a book. */ class BookListeners @@ -50,6 +50,6 @@ private: hash_map mListeners; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/BuildLedger.h b/src/xrpld/app/ledger/BuildLedger.h index 8c127fb365..ad6aba3288 100644 --- a/src/xrpld/app/ledger/BuildLedger.h +++ b/src/xrpld/app/ledger/BuildLedger.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class CanonicalTXSet; @@ -57,5 +57,5 @@ buildLedger( Application& app, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index d248a36987..b52cee2927 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { ConsensusTransSetSF::ConsensusTransSetSF(Application& app, NodeCache& nodeCache) : app_(app), m_nodeCache(nodeCache), j_(app.journal("TransactionAcquire")) @@ -43,7 +43,7 @@ ConsensusTransSetSF::gotNode( auto stx = std::make_shared(std::ref(sit)); XRPL_ASSERT( stx->getTransactionID() == nodeHash.as_uint256(), - "ripple::ConsensusTransSetSF::gotNode : transaction hash " + "xrpl::ConsensusTransSetSF::gotNode : transaction hash " "match"); auto const pap = &app_; app_.getJobQueue().addJob(jtTRANSACTION, "TXS->TXN", [pap, stx]() { @@ -78,7 +78,7 @@ ConsensusTransSetSF::getNode(SHAMapHash const& nodeHash) const txn->getSTransaction()->add(s); XRPL_ASSERT( sha512Half(s.slice()) == nodeHash.as_uint256(), - "ripple::ConsensusTransSetSF::getNode : transaction hash match"); + "xrpl::ConsensusTransSetSF::getNode : transaction hash match"); nodeData = s.peekData(); return nodeData; } @@ -86,4 +86,4 @@ ConsensusTransSetSF::getNode(SHAMapHash const& nodeHash) const return std::nullopt; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.h b/src/xrpld/app/ledger/ConsensusTransSetSF.h index 23ee6b9fac..cdb1c47183 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.h +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // Sync filters allow low-level SHAMapSync code to interact correctly with // higher-level structures such as caches and transaction stores @@ -38,6 +38,6 @@ private: beast::Journal const j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/InboundLedger.h b/src/xrpld/app/ledger/InboundLedger.h index 0d5639909b..1b4353b260 100644 --- a/src/xrpld/app/ledger/InboundLedger.h +++ b/src/xrpld/app/ledger/InboundLedger.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { // A ledger we are trying to acquire class InboundLedger final : public TimeoutCounter, @@ -179,6 +179,6 @@ private: std::unique_ptr mPeerSet; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/InboundLedgers.h b/src/xrpld/app/ledger/InboundLedgers.h index 6eba2eec87..0e4d9996bb 100644 --- a/src/xrpld/app/ledger/InboundLedgers.h +++ b/src/xrpld/app/ledger/InboundLedgers.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Manages the lifetime of inbound ledgers. @@ -84,6 +84,6 @@ make_InboundLedgers( InboundLedgers::clock_type& clock, beast::insight::Collector::ptr const& collector); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/InboundTransactions.h b/src/xrpld/app/ledger/InboundTransactions.h index 41dab5307e..6c0281e26f 100644 --- a/src/xrpld/app/ledger/InboundTransactions.h +++ b/src/xrpld/app/ledger/InboundTransactions.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class Application; @@ -78,6 +78,6 @@ make_InboundTransactions( beast::insight::Collector::ptr const& collector, std::function const&, bool)> gotSet); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index bf5f442eee..e21cbb6d54 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -27,7 +27,7 @@ #include #include -namespace ripple { +namespace xrpl { create_genesis_t const create_genesis{}; @@ -344,7 +344,7 @@ Ledger::setAccepted( bool correctCloseTime) { // Used when we witnessed the consensus. - XRPL_ASSERT(!open(), "ripple::Ledger::setAccepted : valid ledger state"); + XRPL_ASSERT(!open(), "xrpl::Ledger::setAccepted : valid ledger state"); header_.closeTime = closeTime; header_.closeTimeResolution = closeResolution; @@ -418,7 +418,7 @@ Ledger::read(Keylet const& k) const if (k.key == beast::zero) { // LCOV_EXCL_START - UNREACHABLE("ripple::Ledger::read : zero key"); + UNREACHABLE("xrpl::Ledger::read : zero key"); return nullptr; // LCOV_EXCL_STOP } @@ -540,7 +540,7 @@ Ledger::rawTxInsert( std::shared_ptr const& metaData) { XRPL_ASSERT( - metaData, "ripple::Ledger::rawTxInsert : non-null metadata input"); + metaData, "xrpl::Ledger::rawTxInsert : non-null metadata input"); // low-level - just add to table Serializer s(txn->getDataLength() + metaData->getDataLength() + 16); @@ -559,7 +559,7 @@ Ledger::rawTxInsertWithHash( { XRPL_ASSERT( metaData, - "ripple::Ledger::rawTxInsertWithHash : non-null metadata input"); + "xrpl::Ledger::rawTxInsertWithHash : non-null metadata input"); // low-level - just add to table Serializer s(txn->getDataLength() + metaData->getDataLength() + 16); @@ -657,7 +657,7 @@ Ledger::defaultFees(Config const& config) { XRPL_ASSERT( fees_.base == 0 && fees_.reserve == 0 && fees_.increment == 0, - "ripple::Ledger::defaultFees : zero fees"); + "xrpl::Ledger::defaultFees : zero fees"); if (fees_.base == 0) fees_.base = config.FEES.reference_fee; if (fees_.reserve == 0) @@ -854,7 +854,7 @@ Ledger::assertSensible(beast::Journal ledgerJ) const JLOG(ledgerJ.fatal()) << "ledger is not sensible" << j; - UNREACHABLE("ripple::Ledger::assertSensible : ledger is not sensible"); + UNREACHABLE("xrpl::Ledger::assertSensible : ledger is not sensible"); return false; // LCOV_EXCL_STOP @@ -891,7 +891,7 @@ Ledger::updateSkipList() XRPL_ASSERT( hashes.size() <= 256, - "ripple::Ledger::updateSkipList : first maximum hashes size"); + "xrpl::Ledger::updateSkipList : first maximum hashes size"); hashes.push_back(header_.parentHash); sle->setFieldV256(sfHashes, STVector256(hashes)); sle->setFieldU32(sfLastLedgerSequence, prevIndex); @@ -918,7 +918,7 @@ Ledger::updateSkipList() } XRPL_ASSERT( hashes.size() <= 256, - "ripple::Ledger::updateSkipList : second maximum hashes size"); + "xrpl::Ledger::updateSkipList : second maximum hashes size"); if (hashes.size() == 256) hashes.erase(hashes.begin()); hashes.push_back(header_.parentHash); @@ -1000,7 +1000,7 @@ pendSaveValidated( } XRPL_ASSERT( - ledger->isImmutable(), "ripple::pendSaveValidated : immutable ledger"); + ledger->isImmutable(), "xrpl::pendSaveValidated : immutable ledger"); if (!app.pendingSaves().shouldWork(ledger->header().seq, isSynchronous)) { @@ -1080,7 +1080,7 @@ finishLoadByIndexOrHash( XRPL_ASSERT( ledger->header().seq < XRP_LEDGER_EARLIEST_FEES || ledger->read(keylet::fees()), - "ripple::finishLoadByIndexOrHash : valid ledger fees"); + "xrpl::finishLoadByIndexOrHash : valid ledger fees"); ledger->setImmutable(); JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->header().hash); @@ -1121,10 +1121,10 @@ loadByHash(uint256 const& ledgerHash, Application& app, bool acquire) finishLoadByIndexOrHash(ledger, app.config(), app.journal("Ledger")); XRPL_ASSERT( !ledger || ledger->header().hash == ledgerHash, - "ripple::loadByHash : ledger hash match if loaded"); + "xrpl::loadByHash : ledger hash match if loaded"); return ledger; } return {}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index 0e849389fd..a17281f2c7 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class Job; @@ -459,6 +459,6 @@ deserializeTxPlusMeta(SHAMapItem const& item); uint256 calculateLedgerHash(LedgerHeader const& info); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerCleaner.h b/src/xrpld/app/ledger/LedgerCleaner.h index 66c8c070c9..2377485f22 100644 --- a/src/xrpld/app/ledger/LedgerCleaner.h +++ b/src/xrpld/app/ledger/LedgerCleaner.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Check the ledger/transaction databases to make sure they have continuity */ class LedgerCleaner : public beast::PropertyStream::Source @@ -43,6 +43,6 @@ public: std::unique_ptr make_LedgerCleaner(Application& app, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerHistory.cpp b/src/xrpld/app/ledger/LedgerHistory.cpp index c084297641..2654e25d7b 100644 --- a/src/xrpld/app/ledger/LedgerHistory.cpp +++ b/src/xrpld/app/ledger/LedgerHistory.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // FIXME: Need to clean up ledgers by index at some point @@ -42,7 +42,7 @@ LedgerHistory::insert( XRPL_ASSERT( ledger->stateMap().getHash().isNonZero(), - "ripple::LedgerHistory::insert : nonzero hash"); + "xrpl::LedgerHistory::insert : nonzero hash"); std::unique_lock sl(m_ledgers_by_hash.peekMutex()); @@ -85,7 +85,7 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index) XRPL_ASSERT( ret->header().seq == index, - "ripple::LedgerHistory::getLedgerBySeq : result sequence match"); + "xrpl::LedgerHistory::getLedgerBySeq : result sequence match"); { // Add this ledger to the local tracking by index @@ -93,7 +93,7 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index) XRPL_ASSERT( ret->isImmutable(), - "ripple::LedgerHistory::getLedgerBySeq : immutable result ledger"); + "xrpl::LedgerHistory::getLedgerBySeq : immutable result ledger"); m_ledgers_by_hash.canonicalize_replace_client(ret->header().hash, ret); mLedgersByIndex[ret->header().seq] = ret->header().hash; return (ret->header().seq == index) ? ret : nullptr; @@ -109,11 +109,11 @@ LedgerHistory::getLedgerByHash(LedgerHash const& hash) { XRPL_ASSERT( ret->isImmutable(), - "ripple::LedgerHistory::getLedgerByHash : immutable fetched " + "xrpl::LedgerHistory::getLedgerByHash : immutable fetched " "ledger"); XRPL_ASSERT( ret->header().hash == hash, - "ripple::LedgerHistory::getLedgerByHash : fetched ledger hash " + "xrpl::LedgerHistory::getLedgerByHash : fetched ledger hash " "match"); return ret; } @@ -125,14 +125,14 @@ LedgerHistory::getLedgerByHash(LedgerHash const& hash) XRPL_ASSERT( ret->isImmutable(), - "ripple::LedgerHistory::getLedgerByHash : immutable loaded ledger"); + "xrpl::LedgerHistory::getLedgerByHash : immutable loaded ledger"); XRPL_ASSERT( ret->header().hash == hash, - "ripple::LedgerHistory::getLedgerByHash : loaded ledger hash match"); + "xrpl::LedgerHistory::getLedgerByHash : loaded ledger hash match"); m_ledgers_by_hash.canonicalize_replace_client(ret->header().hash, ret); XRPL_ASSERT( ret->header().hash == hash, - "ripple::LedgerHistory::getLedgerByHash : result hash match"); + "xrpl::LedgerHistory::getLedgerByHash : result hash match"); return ret; } @@ -178,7 +178,7 @@ log_metadata_difference( XRPL_ASSERT( validMetaData || builtMetaData, - "ripple::log_metadata_difference : some metadata present"); + "xrpl::log_metadata_difference : some metadata present"); if (validMetaData && builtMetaData) { @@ -325,8 +325,7 @@ LedgerHistory::handleMismatch( Json::Value const& consensus) { XRPL_ASSERT( - built != valid, - "ripple::LedgerHistory::handleMismatch : unequal hashes"); + built != valid, "xrpl::LedgerHistory::handleMismatch : unequal hashes"); ++mismatch_counter_; auto builtLedger = getLedgerByHash(built); @@ -343,7 +342,7 @@ LedgerHistory::handleMismatch( XRPL_ASSERT( builtLedger->header().seq == validLedger->header().seq, - "ripple::LedgerHistory::handleMismatch : sequence match"); + "xrpl::LedgerHistory::handleMismatch : sequence match"); if (auto stream = j_.debug()) { @@ -437,7 +436,7 @@ LedgerHistory::builtLedger( LedgerIndex index = ledger->header().seq; LedgerHash hash = ledger->header().hash; XRPL_ASSERT( - !hash.isZero(), "ripple::LedgerHistory::builtLedger : nonzero hash"); + !hash.isZero(), "xrpl::LedgerHistory::builtLedger : nonzero hash"); std::unique_lock sl(m_consensus_validated.peekMutex()); @@ -478,8 +477,7 @@ LedgerHistory::validatedLedger( LedgerIndex index = ledger->header().seq; LedgerHash hash = ledger->header().hash; XRPL_ASSERT( - !hash.isZero(), - "ripple::LedgerHistory::validatedLedger : nonzero hash"); + !hash.isZero(), "xrpl::LedgerHistory::validatedLedger : nonzero hash"); std::unique_lock sl(m_consensus_validated.peekMutex()); @@ -538,4 +536,4 @@ LedgerHistory::clearLedgerCachePrior(LedgerIndex seq) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/LedgerHistory.h b/src/xrpld/app/ledger/LedgerHistory.h index 02346265bd..279d009429 100644 --- a/src/xrpld/app/ledger/LedgerHistory.h +++ b/src/xrpld/app/ledger/LedgerHistory.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { // VFALCO TODO Rename to OldLedgers ? @@ -135,6 +135,6 @@ private: beast::Journal j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerHolder.h b/src/xrpld/app/ledger/LedgerHolder.h index 8925d688ac..c0a81778ae 100644 --- a/src/xrpld/app/ledger/LedgerHolder.h +++ b/src/xrpld/app/ledger/LedgerHolder.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { // Can std::atomic> make this lock free? @@ -53,6 +53,6 @@ private: std::shared_ptr m_heldLedger; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerMaster.h b/src/xrpld/app/ledger/LedgerMaster.h index eba57894be..38dff835b7 100644 --- a/src/xrpld/app/ledger/LedgerMaster.h +++ b/src/xrpld/app/ledger/LedgerMaster.h @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { class Peer; class Transaction; @@ -401,6 +401,6 @@ private: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerReplay.h b/src/xrpld/app/ledger/LedgerReplay.h index 5d26d36e99..29e8a835fe 100644 --- a/src/xrpld/app/ledger/LedgerReplay.h +++ b/src/xrpld/app/ledger/LedgerReplay.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Ledger; class STTx; @@ -52,6 +52,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerReplayTask.h b/src/xrpld/app/ledger/LedgerReplayTask.h index d7d24f86f2..623a193d93 100644 --- a/src/xrpld/app/ledger/LedgerReplayTask.h +++ b/src/xrpld/app/ledger/LedgerReplayTask.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class InboundLedgers; class Ledger; class LedgerDeltaAcquire; @@ -161,6 +161,6 @@ private: friend class test::LedgerReplayClient; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerReplayer.h b/src/xrpld/app/ledger/LedgerReplayer.h index 68a1c0da1d..b0e0692019 100644 --- a/src/xrpld/app/ledger/LedgerReplayer.h +++ b/src/xrpld/app/ledger/LedgerReplayer.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace test { class LedgerReplayClient; @@ -141,6 +141,6 @@ private: friend class test::LedgerReplayClient; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LedgerToJson.h b/src/xrpld/app/ledger/LedgerToJson.h index cd3dcc9255..7ebbfc655e 100644 --- a/src/xrpld/app/ledger/LedgerToJson.h +++ b/src/xrpld/app/ledger/LedgerToJson.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { struct LedgerFill { @@ -53,6 +53,6 @@ addJson(Json::Value&, LedgerFill const&); Json::Value getJson(LedgerFill const&); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/LocalTxs.h b/src/xrpld/app/ledger/LocalTxs.h index c60d3bce1a..d02e1027a0 100644 --- a/src/xrpld/app/ledger/LocalTxs.h +++ b/src/xrpld/app/ledger/LocalTxs.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { // Track transactions issued by local clients // Ensure we always apply them to our open ledger @@ -42,6 +42,6 @@ public: std::unique_ptr make_LocalTxs(); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/OpenLedger.h b/src/xrpld/app/ledger/OpenLedger.h index c21e858f44..45a3517168 100644 --- a/src/xrpld/app/ledger/OpenLedger.h +++ b/src/xrpld/app/ledger/OpenLedger.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { // How many total extra passes we make // We must ensure we make at least one non-retriable pass @@ -247,7 +247,7 @@ OpenLedger::apply( // If there are any transactions left, we must have // tried them in at least one final pass XRPL_ASSERT( - retries.empty() || !retry, "ripple::OpenLedger::apply : valid retries"); + retries.empty() || !retry, "xrpl::OpenLedger::apply : valid retries"); } //------------------------------------------------------------------------------ @@ -266,6 +266,6 @@ debugTostr(SHAMap const& set); std::string debugTostr(std::shared_ptr const& view); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 00907ee2ce..47b04f3d2c 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { OrderBookDB::OrderBookDB(Application& app) : app_(app), seq_(0), j_(app.journal("OrderBookDB")) @@ -249,7 +249,7 @@ OrderBookDB::makeBookListeners(Book const& book) mListeners[book] = ret; XRPL_ASSERT( getBookListeners(book) == ret, - "ripple::OrderBookDB::makeBookListeners : result roundtrip " + "xrpl::OrderBookDB::makeBookListeners : result roundtrip " "lookup"); } @@ -325,4 +325,4 @@ OrderBookDB::processTxn( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/OrderBookDB.h b/src/xrpld/app/ledger/OrderBookDB.h index 9a1528c794..68bdf294a9 100644 --- a/src/xrpld/app/ledger/OrderBookDB.h +++ b/src/xrpld/app/ledger/OrderBookDB.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { class OrderBookDB { @@ -81,6 +81,6 @@ private: beast::Journal const j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/PendingSaves.h b/src/xrpld/app/ledger/PendingSaves.h index 5082936ec8..24eb50e568 100644 --- a/src/xrpld/app/ledger/PendingSaves.h +++ b/src/xrpld/app/ledger/PendingSaves.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Keeps track of which ledgers haven't been fully saved. @@ -124,6 +124,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/TransactionMaster.h b/src/xrpld/app/ledger/TransactionMaster.h index 5fbf00a0d5..a9bf05065d 100644 --- a/src/xrpld/app/ledger/TransactionMaster.h +++ b/src/xrpld/app/ledger/TransactionMaster.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class STTx; @@ -77,6 +77,6 @@ private: TaggedCache mCache; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/TransactionStateSF.cpp b/src/xrpld/app/ledger/TransactionStateSF.cpp index e861cbd2cc..af7dd8640a 100644 --- a/src/xrpld/app/ledger/TransactionStateSF.cpp +++ b/src/xrpld/app/ledger/TransactionStateSF.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { void TransactionStateSF::gotNode( @@ -13,7 +13,7 @@ TransactionStateSF::gotNode( { XRPL_ASSERT( type != SHAMapNodeType::tnTRANSACTION_NM, - "ripple::TransactionStateSF::gotNode : valid input"); + "xrpl::TransactionStateSF::gotNode : valid input"); db_.store( hotTRANSACTION_NODE, std::move(nodeData), @@ -27,4 +27,4 @@ TransactionStateSF::getNode(SHAMapHash const& nodeHash) const return fp_.getFetchPack(nodeHash.as_uint256()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/TransactionStateSF.h b/src/xrpld/app/ledger/TransactionStateSF.h index 50a77edc56..9950134e4b 100644 --- a/src/xrpld/app/ledger/TransactionStateSF.h +++ b/src/xrpld/app/ledger/TransactionStateSF.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // This class is only needed on add functions // sync filter for transactions tree during ledger sync @@ -34,6 +34,6 @@ private: AbstractFetchPackContainer& fp_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index d7153c0fe9..a716375f6b 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /* Generic buildLedgerImpl that dispatches to ApplyTxs invocable with signature void(OpenView&, std::shared_ptr const&) @@ -39,7 +39,7 @@ buildLedgerImpl( { OpenView accum(&*built); XRPL_ASSERT( - !accum.open(), "ripple::buildLedgerImpl : valid ledger state"); + !accum.open(), "xrpl::buildLedgerImpl : valid ledger state"); applyTxs(accum, built); accum.apply(*built); } @@ -60,7 +60,7 @@ buildLedgerImpl( XRPL_ASSERT( built->header().seq < XRP_LEDGER_EARLIEST_FEES || built->read(keylet::fees()), - "ripple::buildLedgerImpl : valid ledger fees"); + "xrpl::buildLedgerImpl : valid ledger fees"); built->setAccepted(closeTime, closeResolution, closeTimeCorrect); return built; @@ -154,7 +154,7 @@ applyTransactions( // tried them in at least one final pass XRPL_ASSERT( txns.empty() || !certainRetry, - "ripple::applyTransactions : retry transactions"); + "xrpl::applyTransactions : retry transactions"); return count; } @@ -228,4 +228,4 @@ buildLedger( }); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index cd42b4fe82..1f5e5cc7b6 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { using namespace std::chrono_literals; @@ -104,7 +104,7 @@ InboundLedger::init(ScopedLockType& collectionLock) XRPL_ASSERT( mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), - "ripple::InboundLedger::init : valid ledger fees"); + "xrpl::InboundLedger::init : valid ledger fees"); mLedger->setImmutable(); if (mReason == Reason::HISTORY) @@ -337,7 +337,7 @@ InboundLedger::tryDB(NodeStore::Database& srcDB) XRPL_ASSERT( mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), - "ripple::InboundLedger::tryDB : valid ledger fees"); + "xrpl::InboundLedger::tryDB : valid ledger fees"); mLedger->setImmutable(); } } @@ -432,15 +432,14 @@ InboundLedger::done() << mStats.get(); XRPL_ASSERT( - complete_ || failed_, - "ripple::InboundLedger::done : complete or failed"); + complete_ || failed_, "xrpl::InboundLedger::done : complete or failed"); if (complete_ && !failed_ && mLedger) { XRPL_ASSERT( mLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || mLedger->read(keylet::fees()), - "ripple::InboundLedger::done : valid ledger fees"); + "xrpl::InboundLedger::done : valid ledger fees"); mLedger->setImmutable(); switch (mReason) { @@ -604,7 +603,7 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) { XRPL_ASSERT( mLedger, - "ripple::InboundLedger::trigger : non-null ledger to read state " + "xrpl::InboundLedger::trigger : non-null ledger to read state " "from"); if (!mLedger->stateMap().isValid()) @@ -679,7 +678,7 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) { XRPL_ASSERT( mLedger, - "ripple::InboundLedger::trigger : non-null ledger to read " + "xrpl::InboundLedger::trigger : non-null ledger to read " "transactions from"); if (!mLedger->txMap().isValid()) @@ -946,7 +945,7 @@ InboundLedger::takeAsRootNode(Slice const& data, SHAMapAddNode& san) if (!mHaveHeader) { // LCOV_EXCL_START - UNREACHABLE("ripple::InboundLedger::takeAsRootNode : no ledger header"); + UNREACHABLE("xrpl::InboundLedger::takeAsRootNode : no ledger header"); return false; // LCOV_EXCL_STOP } @@ -973,7 +972,7 @@ InboundLedger::takeTxRootNode(Slice const& data, SHAMapAddNode& san) if (!mHaveHeader) { // LCOV_EXCL_START - UNREACHABLE("ripple::InboundLedger::takeTxRootNode : no ledger header"); + UNREACHABLE("xrpl::InboundLedger::takeTxRootNode : no ledger header"); return false; // LCOV_EXCL_STOP } @@ -1335,4 +1334,4 @@ InboundLedger::getJson(int) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index fafcdb9161..445786eb63 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { class InboundLedgersImp : public InboundLedgers { @@ -56,7 +56,7 @@ public: auto doAcquire = [&, seq, reason]() -> std::shared_ptr { XRPL_ASSERT( hash.isNonZero(), - "ripple::InboundLedgersImp::acquire::doAcquire : nonzero hash"); + "xrpl::InboundLedgersImp::acquire::doAcquire : nonzero hash"); // probably not the right rule if (app_.getOPs().isNeedNetworkLedger() && @@ -146,8 +146,7 @@ public: find(uint256 const& hash) override { XRPL_ASSERT( - hash.isNonZero(), - "ripple::InboundLedgersImp::find : nonzero input"); + hash.isNonZero(), "xrpl::InboundLedgersImp::find : nonzero input"); std::shared_ptr ret; @@ -311,7 +310,7 @@ public: { XRPL_ASSERT( it.second, - "ripple::InboundLedgersImp::getInfo : non-null ledger"); + "xrpl::InboundLedgersImp::getInfo : non-null ledger"); acqs.push_back(it); } for (auto const& it : mRecentFailures) @@ -348,7 +347,7 @@ public: { XRPL_ASSERT( it.second, - "ripple::InboundLedgersImp::gotFetchPack : non-null " + "xrpl::InboundLedgersImp::gotFetchPack : non-null " "ledger"); acquires.push_back(it.second); } @@ -458,4 +457,4 @@ make_InboundLedgers( app, clock, collector, make_PeerSetBuilder(app)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/InboundTransactions.cpp b/src/xrpld/app/ledger/detail/InboundTransactions.cpp index b84a03e7bb..80906c45e7 100644 --- a/src/xrpld/app/ledger/detail/InboundTransactions.cpp +++ b/src/xrpld/app/ledger/detail/InboundTransactions.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { enum { // Ideal number of peers to start with @@ -258,4 +258,4 @@ make_InboundTransactions( app, collector, std::move(gotSet), make_PeerSetBuilder(app)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp index 639d8250ac..1eec2efc80 100644 --- a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp +++ b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /* @@ -215,7 +215,7 @@ private: break; XRPL_ASSERT( state_ == State::cleaning, - "ripple::LedgerCleanerImp::run : is cleaning"); + "xrpl::LedgerCleanerImp::run : is cleaning"); } doLedgerCleaner(); } @@ -338,8 +338,7 @@ private: bool const nonzero(refHash.isNonZero()); XRPL_ASSERT( - nonzero, - "ripple::LedgerCleanerImp::getHash : nonzero hash"); + nonzero, "xrpl::LedgerCleanerImp::getHash : nonzero hash"); if (nonzero) { // We found the hash and sequence of a better reference @@ -443,4 +442,4 @@ make_LedgerCleaner(Application& app, beast::Journal journal) return std::make_unique(app, journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index 9c190ee376..5b642ba3db 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { LedgerDeltaAcquire::LedgerDeltaAcquire( Application& app, @@ -183,10 +183,10 @@ LedgerDeltaAcquire::tryBuild(std::shared_ptr const& parent) XRPL_ASSERT( parent->seq() + 1 == replayTemp_->seq(), - "ripple::LedgerDeltaAcquire::tryBuild : parent sequence match"); + "xrpl::LedgerDeltaAcquire::tryBuild : parent sequence match"); XRPL_ASSERT( parent->header().hash == replayTemp_->header().parentHash, - "ripple::LedgerDeltaAcquire::tryBuild : parent hash match"); + "xrpl::LedgerDeltaAcquire::tryBuild : parent hash match"); // build ledger LedgerReplay replayData(parent, replayTemp_, std::move(orderedTxns_)); fullLedger_ = buildLedger(replayData, tapNONE, app_, journal_); @@ -248,7 +248,7 @@ LedgerDeltaAcquire::onLedgerBuilt( void LedgerDeltaAcquire::notify(ScopedLockType& sl) { - XRPL_ASSERT(isDone(), "ripple::LedgerDeltaAcquire::notify : is done"); + XRPL_ASSERT(isDone(), "xrpl::LedgerDeltaAcquire::notify : is done"); std::vector toCall; std::swap(toCall, dataReadyCallbacks_); auto const good = !failed_; @@ -262,4 +262,4 @@ LedgerDeltaAcquire::notify(ScopedLockType& sl) sl.lock(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h index a2c300c546..779bbfa85e 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { class InboundLedgers; class PeerSet; namespace test { @@ -142,6 +142,6 @@ private: friend class test::LedgerReplayClient; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 3e75a28abd..2a2424995e 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -37,7 +37,7 @@ #include #include -namespace ripple { +namespace xrpl { // Don't catch up more than 100 ledgers (cannot exceed 256) static constexpr int MAX_LEDGER_GAP{100}; @@ -257,7 +257,7 @@ LedgerMaster::setValidLedger(std::shared_ptr const& l) mValidLedgerSeq || !app_.getMaxDisallowedLedger() || l->header().seq + max_ledger_difference_ > app_.getMaxDisallowedLedger(), - "ripple::LedgerMaster::setValidLedger : valid ledger sequence"); + "xrpl::LedgerMaster::setValidLedger : valid ledger sequence"); (void)max_ledger_difference_; mValidLedgerSeq = l->header().seq; @@ -322,7 +322,7 @@ LedgerMaster::addHeldTransaction( bool LedgerMaster::canBeCurrent(std::shared_ptr const& ledger) { - XRPL_ASSERT(ledger, "ripple::LedgerMaster::canBeCurrent : non-null input"); + XRPL_ASSERT(ledger, "xrpl::LedgerMaster::canBeCurrent : non-null input"); // Never jump to a candidate ledger that precedes our // last validated ledger @@ -390,7 +390,7 @@ LedgerMaster::canBeCurrent(std::shared_ptr const& ledger) void LedgerMaster::switchLCL(std::shared_ptr const& lastClosed) { - XRPL_ASSERT(lastClosed, "ripple::LedgerMaster::switchLCL : non-null input"); + XRPL_ASSERT(lastClosed, "xrpl::LedgerMaster::switchLCL : non-null input"); if (!lastClosed->isImmutable()) LogicError("mutable ledger in switchLCL"); @@ -500,7 +500,7 @@ LedgerMaster::isValidated(ReadView const& ledger) { XRPL_ASSERT( hash->isNonZero(), - "ripple::LedgerMaster::isValidated : nonzero hash"); + "xrpl::LedgerMaster::isValidated : nonzero hash"); uint256 valHash = app_.getRelationalDatabase().getHashByIndex(seq); if (valHash == ledger.header().hash) @@ -792,7 +792,7 @@ LedgerMaster::setFullLedger( << " accepted :" << ledger->header().hash; XRPL_ASSERT( ledger->stateMap().getHash().isNonZero(), - "ripple::LedgerMaster::setFullLedger : nonzero ledger state hash"); + "xrpl::LedgerMaster::setFullLedger : nonzero ledger state hash"); ledger->setValidated(); ledger->setFull(); @@ -1258,7 +1258,7 @@ LedgerMaster::findNewLedgersToPublish( JLOG(m_journal.fatal()) << "Ledger: " << valSeq << " does not have hash for " << seq; UNREACHABLE( - "ripple::LedgerMaster::findNewLedgersToPublish : ledger " + "xrpl::LedgerMaster::findNewLedgersToPublish : ledger " "not found"); // LCOV_EXCL_STOP } @@ -1349,7 +1349,7 @@ LedgerMaster::tryAdvance() XRPL_ASSERT( !mValidLedger.empty() && mAdvanceThread, - "ripple::LedgerMaster::tryAdvance : has valid ledger"); + "xrpl::LedgerMaster::tryAdvance : has valid ledger"); JLOG(m_journal.trace()) << "advanceThread<"; @@ -1651,7 +1651,7 @@ LedgerMaster::walkHashBySeq( // be located easily and should contain the hash. LedgerIndex refIndex = getCandidateLedger(index); auto const refHash = hashOfSeq(*referenceLedger, refIndex, m_journal); - XRPL_ASSERT(refHash, "ripple::LedgerMaster::walkHashBySeq : found ledger"); + XRPL_ASSERT(refHash, "xrpl::LedgerMaster::walkHashBySeq : found ledger"); if (refHash) { // Try the hash and sequence of a better reference ledger just found @@ -1678,7 +1678,7 @@ LedgerMaster::walkHashBySeq( ledgerHash = hashOfSeq(*l, index, m_journal); XRPL_ASSERT( ledgerHash, - "ripple::LedgerMaster::walkHashBySeq : has complete " + "xrpl::LedgerMaster::walkHashBySeq : has complete " "ledger"); } } @@ -1793,7 +1793,7 @@ LedgerMaster::fetchForHistory( { XRPL_ASSERT( hash->isNonZero(), - "ripple::LedgerMaster::fetchForHistory : found ledger"); + "xrpl::LedgerMaster::fetchForHistory : found ledger"); auto ledger = getLedgerByHash(*hash); if (!ledger) { @@ -1822,7 +1822,7 @@ LedgerMaster::fetchForHistory( auto seq = ledger->header().seq; XRPL_ASSERT( seq == missing, - "ripple::LedgerMaster::fetchForHistory : sequence match"); + "xrpl::LedgerMaster::fetchForHistory : sequence match"); JLOG(m_journal.trace()) << "fetchForHistory acquired " << seq; setFullLedger(ledger, false, false); int fillInProgress; @@ -1865,7 +1865,7 @@ LedgerMaster::fetchForHistory( { XRPL_ASSERT( h->isNonZero(), - "ripple::LedgerMaster::fetchForHistory : " + "xrpl::LedgerMaster::fetchForHistory : " "prefetched ledger"); app_.getInboundLedgers().acquire(*h, seq, reason); } @@ -2052,7 +2052,7 @@ populateFetchPack( std::uint32_t seq, bool withLeaves = true) { - XRPL_ASSERT(cnt, "ripple::populateFetchPack : nonzero count input"); + XRPL_ASSERT(cnt, "xrpl::populateFetchPack : nonzero count input"); Serializer s(1024); @@ -2242,4 +2242,4 @@ LedgerMaster::txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex) return {}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerReplay.cpp b/src/xrpld/app/ledger/detail/LedgerReplay.cpp index 85ec420bbf..5d7ce0e69f 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplay.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplay.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { LedgerReplay::LedgerReplay( std::shared_ptr parent, @@ -26,4 +26,4 @@ LedgerReplay::LedgerReplay( { } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp index 0a070fdeb0..e1eb51fda7 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { LedgerReplayMsgHandler::LedgerReplayMsgHandler( Application& app, LedgerReplayer& replayer) @@ -273,4 +273,4 @@ LedgerReplayMsgHandler::processReplayDeltaResponse( return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h index 276bf316e1..fff3e75460 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class LedgerReplayer; @@ -54,6 +54,6 @@ private: beast::Journal journal_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index 4e73b54d53..cd174b098f 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { LedgerReplayTask::TaskParameter::TaskParameter( InboundLedger::Reason r, @@ -14,7 +14,7 @@ LedgerReplayTask::TaskParameter::TaskParameter( { XRPL_ASSERT( finishLedgerHash.isNonZero() && totalNumLedgers > 0, - "ripple::LedgerReplayTask::TaskParameter::TaskParameter : valid " + "xrpl::LedgerReplayTask::TaskParameter::TaskParameter : valid " "inputs"); } @@ -33,7 +33,7 @@ LedgerReplayTask::TaskParameter::update( startHash_ = skipList_[skipList_.size() - totalLedgers_]; XRPL_ASSERT( startHash_.isNonZero(), - "ripple::LedgerReplayTask::TaskParameter::update : nonzero start hash"); + "xrpl::LedgerReplayTask::TaskParameter::update : nonzero start hash"); startSeq_ = finishSeq_ - totalLedgers_ + 1; full_ = true; return true; @@ -187,7 +187,7 @@ LedgerReplayTask::tryAdvance(ScopedLockType& sl) auto& delta = deltas_[deltaToBuild_]; XRPL_ASSERT( parent_->seq() + 1 == delta->ledgerSeq_, - "ripple::LedgerReplayTask::tryAdvance : consecutive sequence"); + "xrpl::LedgerReplayTask::tryAdvance : consecutive sequence"); if (auto l = delta->tryBuild(parent_); l) { JLOG(journal_.debug()) @@ -279,7 +279,7 @@ LedgerReplayTask::addDelta(std::shared_ptr const& delta) XRPL_ASSERT( deltas_.empty() || deltas_.back()->ledgerSeq_ + 1 == delta->ledgerSeq_, - "ripple::LedgerReplayTask::addDelta : no deltas or consecutive " + "xrpl::LedgerReplayTask::addDelta : no deltas or consecutive " "sequence"); deltas_.push_back(delta); } @@ -292,4 +292,4 @@ LedgerReplayTask::finished() const return isDone(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp index 1f89b6c044..1d1cdf3ec2 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayer.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayer.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { LedgerReplayer::LedgerReplayer( Application& app, @@ -30,7 +30,7 @@ LedgerReplayer::replay( XRPL_ASSERT( finishLedgerHash.isNonZero() && totalNumLedgers > 0 && totalNumLedgers <= LedgerReplayParameters::MAX_TASK_SIZE, - "ripple::LedgerReplayer::replay : valid inputs"); + "xrpl::LedgerReplayer::replay : valid inputs"); LedgerReplayTask::TaskParameter parameter( r, finishLedgerHash, totalNumLedgers); @@ -266,4 +266,4 @@ LedgerReplayer::stop() JLOG(j_.info()) << "Stopped"; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index f571669e5c..8c9e21acde 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace { @@ -342,4 +342,4 @@ getJson(LedgerFill const& fill) return json; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/LocalTxs.cpp b/src/xrpld/app/ledger/detail/LocalTxs.cpp index 4d26b60a6f..1e9cfe0b9b 100644 --- a/src/xrpld/app/ledger/detail/LocalTxs.cpp +++ b/src/xrpld/app/ledger/detail/LocalTxs.cpp @@ -27,7 +27,7 @@ test-applied to all new open ledgers until seen in a fully- validated ledger */ -namespace ripple { +namespace xrpl { // This class wraps a pointer to a transaction along with // its expiration ledger. It also caches the issuing account. @@ -175,4 +175,4 @@ make_LocalTxs() return std::make_unique(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/OpenLedger.cpp b/src/xrpld/app/ledger/detail/OpenLedger.cpp index 14db13aad4..35f4b75157 100644 --- a/src/xrpld/app/ledger/detail/OpenLedger.cpp +++ b/src/xrpld/app/ledger/detail/OpenLedger.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { OpenLedger::OpenLedger( std::shared_ptr const& ledger, @@ -163,7 +163,7 @@ OpenLedger::apply_one( if (retry) flags = flags | tapRETRY; // If it's in anybody's proposed set, try to keep it in the ledger - auto const result = ripple::apply(app, view, *tx, flags, j); + auto const result = xrpl::apply(app, view, *tx, flags, j); if (result.applied || result.ter == terQUEUED) return Result::success; if (isTefFailure(result.ter) || isTemMalformed(result.ter) || @@ -220,4 +220,4 @@ debugTostr(std::shared_ptr const& view) return ss.str(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp index a6dbf40d4d..5f4b0dc339 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { SkipListAcquire::SkipListAcquire( Application& app, @@ -121,7 +121,7 @@ SkipListAcquire::processData( { XRPL_ASSERT( ledgerSeq != 0 && item, - "ripple::SkipListAcquire::processData : valid inputs"); + "xrpl::SkipListAcquire::processData : valid inputs"); ScopedLockType sl(mtx_); if (isDone()) return; @@ -206,7 +206,7 @@ SkipListAcquire::onSkipListAcquired( void SkipListAcquire::notify(ScopedLockType& sl) { - XRPL_ASSERT(isDone(), "ripple::SkipListAcquire::notify : is done"); + XRPL_ASSERT(isDone(), "xrpl::SkipListAcquire::notify : is done"); std::vector toCall; std::swap(toCall, dataReadyCallbacks_); auto const good = !failed_; @@ -220,4 +220,4 @@ SkipListAcquire::notify(ScopedLockType& sl) sl.lock(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.h b/src/xrpld/app/ledger/detail/SkipListAcquire.h index 816bacc4cb..15c420a5cd 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.h +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class InboundLedgers; class PeerSet; namespace test { @@ -36,11 +36,11 @@ public: struct SkipListData { std::uint32_t const ledgerSeq; - std::vector const skipList; + std::vector const skipList; SkipListData( std::uint32_t const ledgerSeq, - std::vector const& skipList) + std::vector const& skipList) : ledgerSeq(ledgerSeq), skipList(skipList) { } @@ -144,6 +144,6 @@ private: friend class test::LedgerReplayClient; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp index d4e7e9a73c..3482725148 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.cpp +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { using namespace std::chrono_literals; @@ -25,7 +25,7 @@ TimeoutCounter::TimeoutCounter( { XRPL_ASSERT( (timerInterval_ > 10ms) && (timerInterval_ < 30s), - "ripple::TimeoutCounter::TimeoutCounter : interval input inside range"); + "xrpl::TimeoutCounter::TimeoutCounter : interval input inside range"); } void @@ -107,4 +107,4 @@ TimeoutCounter::cancel() } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/TimeoutCounter.h b/src/xrpld/app/ledger/detail/TimeoutCounter.h index 1ce4c48415..c228d50aac 100644 --- a/src/xrpld/app/ledger/detail/TimeoutCounter.h +++ b/src/xrpld/app/ledger/detail/TimeoutCounter.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { /** This class is an "active" object. It maintains its own timer @@ -102,7 +102,7 @@ protected: } // Used in this class for access to boost::asio::io_context and - // ripple::Overlay. Used in subtypes for the kitchen sink. + // xrpl::Overlay. Used in subtypes for the kitchen sink. Application& app_; beast::Journal journal_; mutable std::recursive_mutex mtx_; @@ -130,6 +130,6 @@ private: boost::asio::basic_waitable_timer timer_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp index 4c50c5087c..3cd0e84ef0 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { using namespace std::chrono_literals; @@ -244,4 +244,4 @@ TransactionAcquire::stillNeed() failed_ = false; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.h b/src/xrpld/app/ledger/detail/TransactionAcquire.h index 60afab7928..83f9b62f83 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.h +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { // VFALCO TODO rename to PeerTxRequest // A transaction set we are trying to acquire @@ -54,6 +54,6 @@ private: pmDowncast() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/TransactionMaster.cpp b/src/xrpld/app/ledger/detail/TransactionMaster.cpp index 266a067f66..e8580bcfc6 100644 --- a/src/xrpld/app/ledger/detail/TransactionMaster.cpp +++ b/src/xrpld/app/ledger/detail/TransactionMaster.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { TransactionMaster::TransactionMaster(Application& app) : mApp(app) @@ -151,4 +151,4 @@ TransactionMaster::getCache() return mCache; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index e28cd559e9..15abff9b14 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -66,7 +66,7 @@ #include #include -namespace ripple { +namespace xrpl { static void fixConfigPorts(Config& config, Endpoints const& endpoints); @@ -569,7 +569,7 @@ public: { XRPL_ASSERT( serverHandler_, - "ripple::ApplicationImp::getServerHandler : non-null server " + "xrpl::ApplicationImp::getServerHandler : non-null server " "handle"); return *serverHandler_; } @@ -777,7 +777,7 @@ public: overlay() override { XRPL_ASSERT( - overlay_, "ripple::ApplicationImp::overlay : non-null overlay"); + overlay_, "xrpl::ApplicationImp::overlay : non-null overlay"); return *overlay_; } @@ -785,8 +785,7 @@ public: getTxQ() override { XRPL_ASSERT( - txQ_, - "ripple::ApplicationImp::getTxQ : non-null transaction queue"); + txQ_, "xrpl::ApplicationImp::getTxQ : non-null transaction queue"); return *txQ_; } @@ -795,7 +794,7 @@ public: { XRPL_ASSERT( mRelationalDatabase, - "ripple::ApplicationImp::getRelationalDatabase : non-null " + "xrpl::ApplicationImp::getRelationalDatabase : non-null " "relational database"); return *mRelationalDatabase; } @@ -805,7 +804,7 @@ public: { XRPL_ASSERT( mWalletDB, - "ripple::ApplicationImp::getWalletDB : non-null wallet database"); + "xrpl::ApplicationImp::getWalletDB : non-null wallet database"); return *mWalletDB; } @@ -822,7 +821,7 @@ public: { XRPL_ASSERT( mWalletDB.get() == nullptr, - "ripple::ApplicationImp::initRelationalDatabase : null wallet " + "xrpl::ApplicationImp::initRelationalDatabase : null wallet " "database"); try @@ -1223,9 +1222,9 @@ ApplicationImp::setup(boost::program_options::variables_map const& cmdline) supported.reserve(amendments.size()); for (auto const& [a, vote] : amendments) { - auto const f = ripple::getRegisteredFeature(a); + auto const f = xrpl::getRegisteredFeature(a); XRPL_ASSERT( - f, "ripple::ApplicationImp::setup : registered feature"); + f, "xrpl::ApplicationImp::setup : registered feature"); if (f) supported.emplace_back(a, *f, vote); } @@ -1701,7 +1700,7 @@ ApplicationImp::startGenesisLedger() XRPL_ASSERT( next->header().seq < XRP_LEDGER_EARLIEST_FEES || next->read(keylet::fees()), - "ripple::ApplicationImp::startGenesisLedger : valid ledger fees"); + "xrpl::ApplicationImp::startGenesisLedger : valid ledger fees"); next->setImmutable(); openLedger_.emplace(next, cachedSLEs_, logs_->journal("OpenLedger")); m_ledgerMaster->storeLedger(next); @@ -1723,7 +1722,7 @@ ApplicationImp::getLastFullLedger() XRPL_ASSERT( ledger->header().seq < XRP_LEDGER_EARLIEST_FEES || ledger->read(keylet::fees()), - "ripple::ApplicationImp::getLastFullLedger : valid ledger fees"); + "xrpl::ApplicationImp::getLastFullLedger : valid ledger fees"); ledger->setImmutable(); if (getLedgerMaster().haveLedger(seq)) @@ -1878,7 +1877,7 @@ ApplicationImp::loadLedgerFromFile(std::string const& name) XRPL_ASSERT( loadLedger->header().seq < XRP_LEDGER_EARLIEST_FEES || loadLedger->read(keylet::fees()), - "ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees"); + "xrpl::ApplicationImp::loadLedgerFromFile : valid ledger fees"); loadLedger->setAccepted( closeTime, closeTimeResolution, !closeTimeEstimated); @@ -1978,7 +1977,7 @@ ApplicationImp::loadOldLedger( // LCOV_EXCL_START JLOG(m_journal.fatal()) << "Replay ledger missing/damaged"; UNREACHABLE( - "ripple::ApplicationImp::loadOldLedger : replay ledger " + "xrpl::ApplicationImp::loadOldLedger : replay ledger " "missing/damaged"); return false; // LCOV_EXCL_STOP @@ -2011,7 +2010,7 @@ ApplicationImp::loadOldLedger( // LCOV_EXCL_START JLOG(m_journal.fatal()) << "Ledger is empty."; UNREACHABLE( - "ripple::ApplicationImp::loadOldLedger : ledger is empty"); + "xrpl::ApplicationImp::loadOldLedger : ledger is empty"); return false; // LCOV_EXCL_STOP } @@ -2021,7 +2020,7 @@ ApplicationImp::loadOldLedger( // LCOV_EXCL_START JLOG(m_journal.fatal()) << "Ledger is missing nodes."; UNREACHABLE( - "ripple::ApplicationImp::loadOldLedger : ledger is missing " + "xrpl::ApplicationImp::loadOldLedger : ledger is missing " "nodes"); return false; // LCOV_EXCL_STOP @@ -2032,7 +2031,7 @@ ApplicationImp::loadOldLedger( // LCOV_EXCL_START JLOG(m_journal.fatal()) << "Ledger is not sensible."; UNREACHABLE( - "ripple::ApplicationImp::loadOldLedger : ledger is not " + "xrpl::ApplicationImp::loadOldLedger : ledger is not " "sensible"); return false; // LCOV_EXCL_STOP @@ -2206,4 +2205,4 @@ fixConfigPorts(Config& config, Endpoints const& endpoints) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index d8cceb687b..ffb3cd9983 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace unl { class Manager; @@ -264,6 +264,6 @@ make_Application( std::unique_ptr logs, std::unique_ptr timeKeeper); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/CollectorManager.cpp b/src/xrpld/app/main/CollectorManager.cpp index d66b08db8c..110ea564d8 100644 --- a/src/xrpld/app/main/CollectorManager.cpp +++ b/src/xrpld/app/main/CollectorManager.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { class CollectorManagerImp : public CollectorManager { @@ -56,4 +56,4 @@ make_CollectorManager(Section const& params, beast::Journal journal) return std::make_unique(params, journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/CollectorManager.h b/src/xrpld/app/main/CollectorManager.h index d0cc35f94f..d0d202625c 100644 --- a/src/xrpld/app/main/CollectorManager.h +++ b/src/xrpld/app/main/CollectorManager.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Provides the beast::insight::Collector service. */ class CollectorManager @@ -22,6 +22,6 @@ public: std::unique_ptr make_CollectorManager(Section const& params, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/DBInit.h b/src/xrpld/app/main/DBInit.h index 9219db715a..60ff4b498b 100644 --- a/src/xrpld/app/main/DBInit.h +++ b/src/xrpld/app/main/DBInit.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { //////////////////////////////////////////////////////////////////////////////// @@ -116,6 +116,6 @@ inline constexpr std::array WalletDBInit{ "END TRANSACTION;"}}; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 03aa0f6612..e415ee14cf 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace { @@ -249,7 +249,7 @@ template std::optional GRPCServerImpl::CallData::getClientEndpoint() { - return ripple::getEndpoint(ctx_.peer()); + return xrpl::getEndpoint(ctx_.peer()); } template @@ -601,7 +601,7 @@ GRPCServer::stop() GRPCServer::~GRPCServer() { - XRPL_ASSERT(!running_, "ripple::GRPCServer::~GRPCServer : is not running"); + XRPL_ASSERT(!running_, "xrpl::GRPCServer::~GRPCServer : is not running"); } boost::asio::ip::tcp::endpoint @@ -610,4 +610,4 @@ GRPCServer::getEndpoint() const return impl_.getEndpoint(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index eba666cc35..dab71303c4 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { // Interface that CallData implements class Processor @@ -305,5 +305,5 @@ private: std::thread thread_; bool running_ = false; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index 92a4c49bf2..91afb67eb7 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { LoadManager::LoadManager(Application& app, beast::Journal journal) : app_(app), journal_(journal), lastHeartbeat_(), armed_(false) @@ -56,8 +56,7 @@ LoadManager::start() { JLOG(journal_.debug()) << "Starting"; XRPL_ASSERT( - !thread_.joinable(), - "ripple::LoadManager::start : thread not joinable"); + !thread_.joinable(), "xrpl::LoadManager::start : thread not joinable"); thread_ = std::thread{&LoadManager::run, this}; } @@ -182,4 +181,4 @@ make_LoadManager(Application& app, beast::Journal journal) return std::unique_ptr{new LoadManager{app, journal}}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/LoadManager.h b/src/xrpld/app/main/LoadManager.h index bd3a72b80b..15caa9b0f0 100644 --- a/src/xrpld/app/main/LoadManager.h +++ b/src/xrpld/app/main/LoadManager.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; @@ -94,6 +94,6 @@ private: std::unique_ptr make_LoadManager(Application& app, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index 2491149160..7c138168e4 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -53,7 +53,7 @@ namespace po = boost::program_options; -namespace ripple { +namespace xrpl { bool adjustDescriptorLimit(int needed, beast::Journal j) @@ -248,9 +248,9 @@ runUnitTests( char** argv) { using namespace beast::unit_test; - using namespace ripple::test; + using namespace xrpl::test; - ripple::test::envUseIPv4 = (!ipv6); + xrpl::test::envUseIPv4 = (!ipv6); if (!child && num_jobs == 1) { @@ -829,7 +829,7 @@ run(int argc, char** argv) // LCOV_EXCL_STOP } -} // namespace ripple +} // namespace xrpl int main(int argc, char** argv) @@ -854,5 +854,5 @@ main(int argc, char** argv) atexit(&google::protobuf::ShutdownProtobufLibrary); - return ripple::run(argc, argv); + return xrpl::run(argc, argv); } diff --git a/src/xrpld/app/main/NodeIdentity.cpp b/src/xrpld/app/main/NodeIdentity.cpp index 4c7148642c..73ef3f0152 100644 --- a/src/xrpld/app/main/NodeIdentity.cpp +++ b/src/xrpld/app/main/NodeIdentity.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { std::pair getNodeIdentity( @@ -46,4 +46,4 @@ getNodeIdentity( return getNodeIdentity(*db); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/NodeIdentity.h b/src/xrpld/app/main/NodeIdentity.h index fcef1d1d03..7fdb748033 100644 --- a/src/xrpld/app/main/NodeIdentity.h +++ b/src/xrpld/app/main/NodeIdentity.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { /** The cryptographic credentials identifying this server instance. @@ -20,6 +20,6 @@ getNodeIdentity( Application& app, boost::program_options::variables_map const& cmdline); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/NodeStoreScheduler.cpp b/src/xrpld/app/main/NodeStoreScheduler.cpp index ba9c2ff281..221c1f098e 100644 --- a/src/xrpld/app/main/NodeStoreScheduler.cpp +++ b/src/xrpld/app/main/NodeStoreScheduler.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { NodeStoreScheduler::NodeStoreScheduler(JobQueue& jobQueue) : jobQueue_(jobQueue) { @@ -44,4 +44,4 @@ NodeStoreScheduler::onBatchWrite(NodeStore::BatchWriteReport const& report) jobQueue_.addLoadEvents(jtNS_WRITE, report.writeCount, report.elapsed); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/main/NodeStoreScheduler.h b/src/xrpld/app/main/NodeStoreScheduler.h index 6a5cb8e8ee..0214b76660 100644 --- a/src/xrpld/app/main/NodeStoreScheduler.h +++ b/src/xrpld/app/main/NodeStoreScheduler.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { /** A NodeStore::Scheduler which uses the JobQueue. */ class NodeStoreScheduler : public NodeStore::Scheduler @@ -23,6 +23,6 @@ private: JobQueue& jobQueue_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/main/Tuning.h b/src/xrpld/app/main/Tuning.h index 6c7db8ea72..25cc2ef75d 100644 --- a/src/xrpld/app/main/Tuning.h +++ b/src/xrpld/app/main/Tuning.h @@ -3,13 +3,13 @@ #include -namespace ripple { +namespace xrpl { constexpr std::size_t fullBelowTargetSize = 524288; constexpr std::chrono::seconds fullBelowExpiration = std::chrono::minutes{10}; constexpr std::size_t maxPoppedTransactions = 10; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/AMMHelpers.h b/src/xrpld/app/misc/AMMHelpers.h index c300774553..3a33f49ee4 100644 --- a/src/xrpld/app/misc/AMMHelpers.h +++ b/src/xrpld/app/misc/AMMHelpers.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -761,6 +761,6 @@ adjustFracByTokens( STAmount const& tokens, Number const& frac); -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_MISC_AMMHELPERS_H_INCLUDED diff --git a/src/xrpld/app/misc/AMMUtils.h b/src/xrpld/app/misc/AMMUtils.h index 7369ee4998..266f50bb87 100644 --- a/src/xrpld/app/misc/AMMUtils.h +++ b/src/xrpld/app/misc/AMMUtils.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { class ReadView; class ApplyView; @@ -116,6 +116,6 @@ verifyAndAdjustLPTokenBalance( std::shared_ptr& ammSle, AccountID const& account); -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_MISC_AMMUTILS_H_INCLUDED diff --git a/src/xrpld/app/misc/AmendmentTable.h b/src/xrpld/app/misc/AmendmentTable.h index af436205fb..0265e0127f 100644 --- a/src/xrpld/app/misc/AmendmentTable.h +++ b/src/xrpld/app/misc/AmendmentTable.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { /** The amendment table stores the list of enabled and potential amendments. Individuals amendments are voted on by validators during the consensus @@ -177,6 +177,6 @@ make_AmendmentTable( Section const& vetoed, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/CanonicalTXSet.cpp b/src/xrpld/app/misc/CanonicalTXSet.cpp index 311d120d4e..ac1b86e62f 100644 --- a/src/xrpld/app/misc/CanonicalTXSet.cpp +++ b/src/xrpld/app/misc/CanonicalTXSet.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { bool operator<(CanonicalTXSet::Key const& lhs, CanonicalTXSet::Key const& rhs) @@ -71,4 +71,4 @@ CanonicalTXSet::popAcctTransaction(std::shared_ptr const& tx) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/CanonicalTXSet.h b/src/xrpld/app/misc/CanonicalTXSet.h index 9a7d7fe171..8d0461a845 100644 --- a/src/xrpld/app/misc/CanonicalTXSet.h +++ b/src/xrpld/app/misc/CanonicalTXSet.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Holds transactions which were deferred to the next pass of consensus. @@ -156,6 +156,6 @@ private: uint256 salt_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/DelegateUtils.h b/src/xrpld/app/misc/DelegateUtils.h index 21b78ca71c..37d9195a82 100644 --- a/src/xrpld/app/misc/DelegateUtils.h +++ b/src/xrpld/app/misc/DelegateUtils.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * Check if the delegate account has permission to execute the transaction. @@ -33,6 +33,6 @@ loadGranularPermission( TxType const& type, std::unordered_set& granularPermissions); -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_MISC_DELEGATEUTILS_H_INCLUDED diff --git a/src/xrpld/app/misc/DeliverMax.h b/src/xrpld/app/misc/DeliverMax.h index 0847bf185d..e9455354f8 100644 --- a/src/xrpld/app/misc/DeliverMax.h +++ b/src/xrpld/app/misc/DeliverMax.h @@ -7,7 +7,7 @@ namespace Json { class Value; } -namespace ripple { +namespace xrpl { namespace RPC { @@ -26,6 +26,6 @@ insertDeliverMax(Json::Value& tx_json, TxType txnType, unsigned int apiVersion); /** @} */ } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/FeeVote.h b/src/xrpld/app/misc/FeeVote.h index 15fd8e39fe..aed64be2c2 100644 --- a/src/xrpld/app/misc/FeeVote.h +++ b/src/xrpld/app/misc/FeeVote.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Manager to process fee votes. */ class FeeVote @@ -44,6 +44,6 @@ struct FeeSetup; std::unique_ptr make_FeeVote(FeeSetup const& setup, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/FeeVoteImpl.cpp b/src/xrpld/app/misc/FeeVoteImpl.cpp index 88c33bd66b..a6b140f691 100644 --- a/src/xrpld/app/misc/FeeVoteImpl.cpp +++ b/src/xrpld/app/misc/FeeVoteImpl.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -182,7 +182,7 @@ FeeVoteImpl::doVoting( // LCL must be flag ledger XRPL_ASSERT( lastClosedLedger && isFlagLedger(lastClosedLedger->seq()), - "ripple::FeeVoteImpl::doVoting : has a flag ledger"); + "xrpl::FeeVoteImpl::doVoting : has a flag ledger"); detail::VotableValue baseFeeVote( lastClosedLedger->fees().base, target_.reference_fee); @@ -323,4 +323,4 @@ make_FeeVote(FeeSetup const& setup, beast::Journal journal) return std::make_unique(setup, journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/HashRouter.cpp b/src/xrpld/app/misc/HashRouter.cpp index da27158969..0cad01c27e 100644 --- a/src/xrpld/app/misc/HashRouter.cpp +++ b/src/xrpld/app/misc/HashRouter.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { auto HashRouter::emplace(uint256 const& key) -> std::pair @@ -87,7 +87,7 @@ bool HashRouter::setFlags(uint256 const& key, HashRouterFlags flags) { XRPL_ASSERT( - static_cast(flags), "ripple::HashRouter::setFlags : valid input"); + static_cast(flags), "xrpl::HashRouter::setFlags : valid input"); std::lock_guard lock(mutex_); @@ -149,4 +149,4 @@ setup_HashRouter(Config const& config) return setup; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/HashRouter.h b/src/xrpld/app/misc/HashRouter.h index f7ecb153fe..1b59797b28 100644 --- a/src/xrpld/app/misc/HashRouter.h +++ b/src/xrpld/app/misc/HashRouter.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { enum class HashRouterFlags : std::uint16_t { // Public flags @@ -270,6 +270,6 @@ private: HashRouter::Setup setup_HashRouter(Config const&); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/LendingHelpers.h b/src/xrpld/app/misc/LendingHelpers.h index 559af28a47..071466f05c 100644 --- a/src/xrpld/app/misc/LendingHelpers.h +++ b/src/xrpld/app/misc/LendingHelpers.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { struct PreflightContext; @@ -155,7 +155,7 @@ struct LoanState XRPL_ASSERT_PARTS( interestDue + managementFeeDue == valueOutstanding - principalOutstanding, - "ripple::LoanState::interestOutstanding", + "xrpl::LoanState::interestOutstanding", "other values add up correctly"); return interestDue + managementFeeDue; } @@ -439,6 +439,6 @@ loanMakePayment( LoanPaymentType const paymentType, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_MISC_LENDINGHELPERS_H_INCLUDED diff --git a/src/xrpld/app/misc/LoadFeeTrack.h b/src/xrpld/app/misc/LoadFeeTrack.h index dfae110fb4..181fb0536e 100644 --- a/src/xrpld/app/misc/LoadFeeTrack.h +++ b/src/xrpld/app/misc/LoadFeeTrack.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { struct Fees; @@ -147,6 +147,6 @@ scaleFeeLoad( Fees const& fees, bool bUnlimited); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/Manifest.h b/src/xrpld/app/misc/Manifest.h index 49b345d095..24e4f5f71f 100644 --- a/src/xrpld/app/misc/Manifest.h +++ b/src/xrpld/app/misc/Manifest.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /* Validator key manifests @@ -443,6 +443,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/NegativeUNLVote.cpp b/src/xrpld/app/misc/NegativeUNLVote.cpp index 23d3248ba6..12467697fa 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.cpp +++ b/src/xrpld/app/misc/NegativeUNLVote.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { NegativeUNLVote::NegativeUNLVote(NodeID const& myId, beast::Journal j) : myId_(myId), j_(j) @@ -73,7 +73,7 @@ NegativeUNLVote::doVoting( prevLedger->header().hash, candidates.toDisableCandidates); XRPL_ASSERT( nidToKeyMap.contains(n), - "ripple::NegativeUNLVote::doVoting : found node to disable"); + "xrpl::NegativeUNLVote::doVoting : found node to disable"); addTx(seq, nidToKeyMap.at(n), ToDisable, initialSet); } @@ -83,7 +83,7 @@ NegativeUNLVote::doVoting( prevLedger->header().hash, candidates.toReEnableCandidates); XRPL_ASSERT( nidToKeyMap.contains(n), - "ripple::NegativeUNLVote::doVoting : found node to enable"); + "xrpl::NegativeUNLVote::doVoting : found node to enable"); addTx(seq, nidToKeyMap.at(n), ToReEnable, initialSet); } } @@ -127,8 +127,7 @@ NegativeUNLVote::choose( std::vector const& candidates) { XRPL_ASSERT( - !candidates.empty(), - "ripple::NegativeUNLVote::choose : non-empty input"); + !candidates.empty(), "xrpl::NegativeUNLVote::choose : non-empty input"); static_assert(NodeID::bytes <= uint256::bytes); NodeID randomPad = NodeID::fromVoid(randomPadData.data()); NodeID txNodeID = candidates[0]; @@ -336,4 +335,4 @@ NegativeUNLVote::purgeNewValidators(LedgerIndex seq) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/NegativeUNLVote.h b/src/xrpld/app/misc/NegativeUNLVote.h index 77b4035a0d..3146294923 100644 --- a/src/xrpld/app/misc/NegativeUNLVote.h +++ b/src/xrpld/app/misc/NegativeUNLVote.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { template class Validations; @@ -194,6 +194,6 @@ private: friend class test::NegativeUNLVoteScoreTable_test; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 39ec0b78c9..084a584377 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -64,7 +64,7 @@ #include #include -namespace ripple { +namespace xrpl { class NetworkOPsImp final : public NetworkOPs { @@ -91,7 +91,7 @@ class NetworkOPsImp final : public NetworkOPs { XRPL_ASSERT( local || failType == FailHard::no, - "ripple::NetworkOPsImp::TransactionStatus::TransactionStatus : " + "xrpl::NetworkOPsImp::TransactionStatus::TransactionStatus : " "valid inputs"); } }; @@ -1267,7 +1267,7 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) checkValidity(app_.getHashRouter(), sttx, view->rules(), app_.config()); XRPL_ASSERT( validity == Validity::Valid, - "ripple::NetworkOPsImp::processTransaction : valid validity"); + "xrpl::NetworkOPsImp::processTransaction : valid validity"); // Not concerned with local checks at this point. if (validity == Validity::SigBad) @@ -1442,7 +1442,7 @@ NetworkOPsImp::processTransactionSet(CanonicalTXSet const& set) doTransactionSyncBatch(lock, [&](std::unique_lock const&) { XRPL_ASSERT( lock.owns_lock(), - "ripple::NetworkOPsImp::processTransactionSet has lock"); + "xrpl::NetworkOPsImp::processTransactionSet has lock"); return std::any_of( mTransactions.begin(), mTransactions.end(), [](auto const& t) { return t.transaction->getApplying(); @@ -1472,10 +1472,10 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) mTransactions.swap(transactions); XRPL_ASSERT( !transactions.empty(), - "ripple::NetworkOPsImp::apply : non-empty transactions"); + "xrpl::NetworkOPsImp::apply : non-empty transactions"); XRPL_ASSERT( mDispatchState != DispatchState::running, - "ripple::NetworkOPsImp::apply : is not running"); + "xrpl::NetworkOPsImp::apply : is not running"); mDispatchState = DispatchState::running; @@ -1754,7 +1754,7 @@ NetworkOPsImp::getOwnerInfo( auto sleCur = lpLedger->read(keylet::child(uDirEntry)); XRPL_ASSERT( sleCur, - "ripple::NetworkOPsImp::getOwnerInfo : non-null child SLE"); + "xrpl::NetworkOPsImp::getOwnerInfo : non-null child SLE"); switch (sleCur->getType()) { @@ -1783,7 +1783,7 @@ NetworkOPsImp::getOwnerInfo( // LCOV_EXCL_START default: UNREACHABLE( - "ripple::NetworkOPsImp::getOwnerInfo : invalid " + "xrpl::NetworkOPsImp::getOwnerInfo : invalid " "type"); break; // LCOV_EXCL_STOP @@ -1797,7 +1797,7 @@ NetworkOPsImp::getOwnerInfo( sleNode = lpLedger->read(keylet::page(root, uNodeDir)); XRPL_ASSERT( sleNode, - "ripple::NetworkOPsImp::getOwnerInfo : read next page"); + "xrpl::NetworkOPsImp::getOwnerInfo : read next page"); } } while (uNodeDir); } @@ -2034,7 +2034,7 @@ NetworkOPsImp::beginConsensus( { XRPL_ASSERT( networkClosed.isNonZero(), - "ripple::NetworkOPsImp::beginConsensus : nonzero input"); + "xrpl::NetworkOPsImp::beginConsensus : nonzero input"); auto closingInfo = m_ledgerMaster.getCurrentLedger()->header(); @@ -2059,12 +2059,12 @@ NetworkOPsImp::beginConsensus( XRPL_ASSERT( prevLedger->header().hash == closingInfo.parentHash, - "ripple::NetworkOPsImp::beginConsensus : prevLedger hash matches " + "xrpl::NetworkOPsImp::beginConsensus : prevLedger hash matches " "parent"); XRPL_ASSERT( closingInfo.parentHash == m_ledgerMaster.getClosedLedger()->header().hash, - "ripple::NetworkOPsImp::beginConsensus : closedLedger parent matches " + "xrpl::NetworkOPsImp::beginConsensus : closedLedger parent matches " "hash"); app_.validators().setNegativeUNL(prevLedger->negativeUNL()); @@ -2327,7 +2327,7 @@ NetworkOPsImp::pubServer() f.em->openLedgerFeeLevel, f.loadBaseServer, f.em->referenceFeeLevel) - .value_or(ripple::muldiv_max)); + .value_or(xrpl::muldiv_max)); jvObj[jss::load_factor] = trunc32(loadFactor); jvObj[jss::load_factor_fee_escalation] = @@ -2843,7 +2843,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters) escalationMetrics.openLedgerFeeLevel, loadBaseServer, escalationMetrics.referenceFeeLevel) - .value_or(ripple::muldiv_max); + .value_or(xrpl::muldiv_max); auto const loadFactor = std::max( safe_cast(loadFactorServer), loadFactorFeeEscalation); @@ -3097,7 +3097,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) XRPL_ASSERT( alpAccepted->getLedger().get() == lpAccepted.get(), - "ripple::NetworkOPsImp::pubLedger : accepted input"); + "xrpl::NetworkOPsImp::pubLedger : accepted input"); { JLOG(m_journal.debug()) @@ -3149,7 +3149,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) if (!mStreamMaps[sBookChanges].empty()) { - Json::Value jvObj = ripple::RPC::computeBookChanges(lpAccepted); + Json::Value jvObj = xrpl::RPC::computeBookChanges(lpAccepted); auto it = mStreamMaps[sBookChanges].begin(); while (it != mStreamMaps[sBookChanges].end()) @@ -3519,7 +3519,7 @@ NetworkOPsImp::pubAccountTransaction( XRPL_ASSERT( jvObj.isMember(jss::account_history_tx_stream) == MultiApiJson::none, - "ripple::NetworkOPsImp::pubAccountTransaction : " + "xrpl::NetworkOPsImp::pubAccountTransaction : " "account_history_tx_stream not set"); for (auto& info : accountHistoryNotify) { @@ -3596,7 +3596,7 @@ NetworkOPsImp::pubProposedAccountTransaction( XRPL_ASSERT( jvObj.isMember(jss::account_history_tx_stream) == MultiApiJson::none, - "ripple::NetworkOPs::pubProposedAccountTransaction : " + "xrpl::NetworkOPs::pubProposedAccountTransaction : " "account_history_tx_stream not set"); for (auto& info : accountHistoryNotify) { @@ -3713,8 +3713,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) if (databaseType == DatabaseType::None) { // LCOV_EXCL_START - UNREACHABLE( - "ripple::NetworkOPsImp::addAccountHistoryJob : no database"); + UNREACHABLE("xrpl::NetworkOPsImp::addAccountHistoryJob : no database"); JLOG(m_journal.error()) << "AccountHistory job for account " << toBase58(subInfo.index_->accountId_) << " no database"; @@ -3824,7 +3823,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) // LCOV_EXCL_START default: { UNREACHABLE( - "ripple::NetworkOPsImp::addAccountHistoryJob : " + "xrpl::NetworkOPsImp::addAccountHistoryJob : " "getMoreTxns : invalid database type"); return {}; } @@ -3891,7 +3890,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) { // LCOV_EXCL_START UNREACHABLE( - "ripple::NetworkOPsImp::addAccountHistoryJob : " + "xrpl::NetworkOPsImp::addAccountHistoryJob : " "getMoreTxns failed"); JLOG(m_journal.debug()) << "AccountHistory job for account " @@ -3923,7 +3922,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) { // LCOV_EXCL_START UNREACHABLE( - "ripple::NetworkOPsImp::addAccountHistoryJob : " + "xrpl::NetworkOPsImp::addAccountHistoryJob : " "getLedgerBySeq failed"); JLOG(m_journal.debug()) << "AccountHistory job for account " @@ -4039,7 +4038,7 @@ NetworkOPsImp::subAccountHistoryStart( { // LCOV_EXCL_START UNREACHABLE( - "ripple::NetworkOPsImp::subAccountHistoryStart : failed to " + "xrpl::NetworkOPsImp::subAccountHistoryStart : failed to " "access genesis account"); return; // LCOV_EXCL_STOP @@ -4151,7 +4150,7 @@ NetworkOPsImp::subBook(InfoSub::ref isrListener, Book const& book) else { // LCOV_EXCL_START - UNREACHABLE("ripple::NetworkOPsImp::subBook : null book listeners"); + UNREACHABLE("xrpl::NetworkOPsImp::subBook : null book listeners"); // LCOV_EXCL_STOP } return true; @@ -4173,7 +4172,7 @@ NetworkOPsImp::acceptLedger( // This code-path is exclusively used when the server is in standalone // mode via `ledger_accept` XRPL_ASSERT( - m_standalone, "ripple::NetworkOPsImp::acceptLedger : is standalone"); + m_standalone, "xrpl::NetworkOPsImp::acceptLedger : is standalone"); if (!m_standalone) Throw( @@ -4894,4 +4893,4 @@ make_NetworkOPs( collector); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/NetworkOPs.h b/src/xrpld/app/misc/NetworkOPs.h index 15545153c7..800f473959 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/src/xrpld/app/misc/NetworkOPs.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { // Operations that clients may wish to perform against the network // Master operational handler, server sequencer, network tracker @@ -275,6 +275,6 @@ make_NetworkOPs( beast::Journal journal, beast::insight::Collector::ptr const& collector); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp b/src/xrpld/app/misc/PermissionedDEXHelpers.cpp index bc90848428..0cf41ac6f0 100644 --- a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp +++ b/src/xrpld/app/misc/PermissionedDEXHelpers.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace permissioned_dex { bool @@ -67,4 +67,4 @@ offerInDomain( } // namespace permissioned_dex -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.h b/src/xrpld/app/misc/PermissionedDEXHelpers.h index 87c8e64bcd..9b6d23d09d 100644 --- a/src/xrpld/app/misc/PermissionedDEXHelpers.h +++ b/src/xrpld/app/misc/PermissionedDEXHelpers.h @@ -1,7 +1,7 @@ #pragma once #include -namespace ripple { +namespace xrpl { namespace permissioned_dex { // Check if an account is in a permissioned domain @@ -21,4 +21,4 @@ offerInDomain( } // namespace permissioned_dex -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/SHAMapStore.h b/src/xrpld/app/misc/SHAMapStore.h index a906966b37..26d6120f32 100644 --- a/src/xrpld/app/misc/SHAMapStore.h +++ b/src/xrpld/app/misc/SHAMapStore.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { class TransactionMaster; @@ -88,6 +88,6 @@ make_SHAMapStore( Application& app, NodeStore::Scheduler& scheduler, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 79c75ca0cf..0e33a0bc10 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { void SHAMapStoreImp::SavedStateDB::init( BasicConfig const& config, @@ -27,7 +27,7 @@ SHAMapStoreImp::SavedStateDB::getCanDelete() { std::lock_guard lock(mutex_); - return ripple::getCanDelete(sqlDb_); + return xrpl::getCanDelete(sqlDb_); } LedgerIndex @@ -35,7 +35,7 @@ SHAMapStoreImp::SavedStateDB::setCanDelete(LedgerIndex canDelete) { std::lock_guard lock(mutex_); - return ripple::setCanDelete(sqlDb_, canDelete); + return xrpl::setCanDelete(sqlDb_, canDelete); } SavedState @@ -43,21 +43,21 @@ SHAMapStoreImp::SavedStateDB::getState() { std::lock_guard lock(mutex_); - return ripple::getSavedState(sqlDb_); + return xrpl::getSavedState(sqlDb_); } void SHAMapStoreImp::SavedStateDB::setState(SavedState const& state) { std::lock_guard lock(mutex_); - ripple::setSavedState(sqlDb_, state); + xrpl::setSavedState(sqlDb_, state); } void SHAMapStoreImp::SavedStateDB::setLastRotated(LedgerIndex seq) { std::lock_guard lock(mutex_); - ripple::setLastRotated(sqlDb_, seq); + xrpl::setLastRotated(sqlDb_, seq); } //------------------------------------------------------------------------------ @@ -496,7 +496,7 @@ SHAMapStoreImp::clearSql( { XRPL_ASSERT( deleteInterval_, - "ripple::SHAMapStoreImp::clearSql : nonzero delete interval"); + "xrpl::SHAMapStoreImp::clearSql : nonzero delete interval"); LedgerIndex min = std::numeric_limits::max(); { @@ -669,4 +669,4 @@ make_SHAMapStore( return std::make_unique(app, scheduler, journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index 12079b9fec..e5a7435b0a 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { class NetworkOPs; @@ -225,6 +225,6 @@ public: stop() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index 4f59377fe0..ac801a2cd0 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { // // Transactions should be constructed in JSON with. Use STObject::parseJson to @@ -413,6 +413,6 @@ private: beast::Journal j_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index 4c4bb3c923..aff7fc89db 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -15,7 +15,7 @@ #include -namespace ripple { +namespace xrpl { class Application; class Config; @@ -854,6 +854,6 @@ toFeeLevel(XRPAmount const& drops, XRPAmount const& baseFee) .value_or(FeeLevel64(std::numeric_limits::max())); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/ValidatorKeys.h b/src/xrpld/app/misc/ValidatorKeys.h index 8c5060b488..a1511c134a 100644 --- a/src/xrpld/app/misc/ValidatorKeys.h +++ b/src/xrpld/app/misc/ValidatorKeys.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class Config; @@ -59,6 +59,6 @@ private: bool configInvalid_ = false; //< Set to true if config was invalid }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index 77793619ac..d6758f8877 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -21,7 +21,7 @@ class TMValidatorList; class TMValidatorListCollection; } // namespace protocol -namespace ripple { +namespace xrpl { class Overlay; class HashRouter; @@ -927,7 +927,7 @@ hash_append(Hasher& h, std::map const& blobs) } } -} // namespace ripple +} // namespace xrpl namespace protocol { @@ -945,10 +945,7 @@ hash_append(Hasher& h, TMValidatorListCollection const& msg) { using beast::hash_append; hash_append( - h, - msg.manifest(), - ripple::ValidatorList::parseBlobs(msg), - msg.version()); + h, msg.manifest(), xrpl::ValidatorList::parseBlobs(msg), msg.version()); } } // namespace protocol diff --git a/src/xrpld/app/misc/ValidatorSite.h b/src/xrpld/app/misc/ValidatorSite.h index 9f20bef07a..64b22f065d 100644 --- a/src/xrpld/app/misc/ValidatorSite.h +++ b/src/xrpld/app/misc/ValidatorSite.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Validator Sites @@ -242,6 +242,6 @@ private: missingSite(std::lock_guard const&); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/AMMHelpers.cpp b/src/xrpld/app/misc/detail/AMMHelpers.cpp index 2d5adc8f44..0b741c8d36 100644 --- a/src/xrpld/app/misc/detail/AMMHelpers.cpp +++ b/src/xrpld/app/misc/detail/AMMHelpers.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { STAmount ammLPTokens( @@ -236,7 +236,7 @@ adjustAmountsByLPTokens( XRPL_ASSERT( lpTokensActual == lpTokens, - "ripple::adjustAmountsByLPTokens : LP tokens match actual"); + "xrpl::adjustAmountsByLPTokens : LP tokens match actual"); return {amount, amount2, lpTokensActual}; } @@ -390,4 +390,4 @@ adjustFracByTokens( return tokens / lptAMMBalance; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/AMMUtils.cpp b/src/xrpld/app/misc/detail/AMMUtils.cpp index ab0aec41b1..c0cda2bd73 100644 --- a/src/xrpld/app/misc/detail/AMMUtils.cpp +++ b/src/xrpld/app/misc/detail/AMMUtils.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { std::pair ammPoolHolds( @@ -163,7 +163,7 @@ getTradingFee(ReadView const& view, SLE const& ammSle, AccountID const& account) XRPL_ASSERT( !view.rules().enabled(fixInnerObjTemplate) || ammSle.isFieldPresent(sfAuctionSlot), - "ripple::getTradingFee : auction present"); + "xrpl::getTradingFee : auction present"); if (ammSle.isFieldPresent(sfAuctionSlot)) { auto const& auctionSlot = @@ -475,4 +475,4 @@ verifyAndAdjustLPTokenBalance( return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.cpp b/src/xrpld/app/misc/detail/AccountTxPaging.cpp index d58dace34c..e3fc2de4f8 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.cpp +++ b/src/xrpld/app/misc/detail/AccountTxPaging.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { void convertBlobsToTxResult( @@ -44,4 +44,4 @@ saveLedgerAsync(Application& app, std::uint32_t seq) pendSaveValidated(app, l, false, false); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.h b/src/xrpld/app/misc/detail/AccountTxPaging.h index b822d7186c..cbfe8c89bb 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.h +++ b/src/xrpld/app/misc/detail/AccountTxPaging.h @@ -7,7 +7,7 @@ //------------------------------------------------------------------------------ -namespace ripple { +namespace xrpl { void convertBlobsToTxResult( @@ -21,6 +21,6 @@ convertBlobsToTxResult( void saveLedgerAsync(Application& app, std::uint32_t seq); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index b857f82213..8ed9bc12c5 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { static std::vector> parseSection(Section const& section) @@ -211,7 +211,7 @@ public: { XRPL_ASSERT( votes.second.upVotes.empty(), - "ripple::TrustedVotes::recordVotes : received no " + "xrpl::TrustedVotes::recordVotes : received no " "upvotes"); JLOG(j.debug()) << "recordVotes: Have not received any " @@ -230,7 +230,7 @@ public: { XRPL_ASSERT( votes.second.timeout < newTimeout, - "ripple::TrustedVotes::recordVotes : votes not " + "xrpl::TrustedVotes::recordVotes : votes not " "expired"); using namespace std::chrono; auto const age = duration_cast( @@ -254,7 +254,7 @@ public: XRPL_ASSERT( validatorVotes.second.timeout || validatorVotes.second.upVotes.empty(), - "ripple::TrustedVotes::getVotes : valid votes"); + "xrpl::TrustedVotes::getVotes : valid votes"); if (validatorVotes.second.timeout) ++available; for (uint256 const& amendment : validatorVotes.second.upVotes) @@ -688,7 +688,7 @@ AmendmentTableImpl::persistVote( { XRPL_ASSERT( vote != AmendmentVote::obsolete, - "ripple::AmendmentTableImpl::persistVote : valid vote input"); + "xrpl::AmendmentTableImpl::persistVote : valid vote input"); auto db = db_.checkoutDb(); voteAmendment(*db, amendment, name, vote); } @@ -1042,4 +1042,4 @@ make_AmendmentTable( app, majorityTime, supported, enabled, vetoed, journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/DelegateUtils.cpp b/src/xrpld/app/misc/detail/DelegateUtils.cpp index 04728005af..027f2f1cc6 100644 --- a/src/xrpld/app/misc/detail/DelegateUtils.cpp +++ b/src/xrpld/app/misc/detail/DelegateUtils.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { NotTEC checkTxPermission(std::shared_ptr const& delegate, STTx const& tx) { @@ -44,4 +44,4 @@ loadGranularPermission( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/DeliverMax.cpp b/src/xrpld/app/misc/detail/DeliverMax.cpp index 3d0ef901ec..44500eec7e 100644 --- a/src/xrpld/app/misc/detail/DeliverMax.cpp +++ b/src/xrpld/app/misc/detail/DeliverMax.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { void @@ -20,4 +20,4 @@ insertDeliverMax(Json::Value& tx_json, TxType txnType, unsigned int apiVersion) } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/xrpld/app/misc/detail/LendingHelpers.cpp index 8020b47ba9..51e0988bc4 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/xrpld/app/misc/detail/LendingHelpers.cpp @@ -2,7 +2,7 @@ // DO NOT REMOVE forces header file include to sort first #include -namespace ripple { +namespace xrpl { bool checkLendingProtocolDependencies(PreflightContext const& ctx) @@ -17,15 +17,15 @@ LoanPaymentParts::operator+=(LoanPaymentParts const& other) XRPL_ASSERT( other.principalPaid >= beast::zero, - "ripple::LoanPaymentParts::operator+= : other principal " + "xrpl::LoanPaymentParts::operator+= : other principal " "non-negative"); XRPL_ASSERT( other.interestPaid >= beast::zero, - "ripple::LoanPaymentParts::operator+= : other interest paid " + "xrpl::LoanPaymentParts::operator+= : other interest paid " "non-negative"); XRPL_ASSERT( other.feePaid >= beast::zero, - "ripple::LoanPaymentParts::operator+= : other fee paid " + "xrpl::LoanPaymentParts::operator+= : other fee paid " "non-negative"); principalPaid += other.principalPaid; @@ -288,23 +288,21 @@ doPayment( std::uint32_t paymentInterval) { XRPL_ASSERT_PARTS( - nextDueDateProxy, - "ripple::detail::doPayment", - "Next due date proxy set"); + nextDueDateProxy, "xrpl::detail::doPayment", "Next due date proxy set"); if (payment.specialCase == PaymentSpecialCase::final) { XRPL_ASSERT_PARTS( principalOutstandingProxy == payment.trackedPrincipalDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Full principal payment"); XRPL_ASSERT_PARTS( totalValueOutstandingProxy == payment.trackedValueDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Full value payment"); XRPL_ASSERT_PARTS( managementFeeOutstandingProxy == payment.trackedManagementFeeDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Full management fee payment"); // Mark the loan as complete @@ -336,17 +334,17 @@ doPayment( } XRPL_ASSERT_PARTS( principalOutstandingProxy > payment.trackedPrincipalDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Partial principal payment"); XRPL_ASSERT_PARTS( totalValueOutstandingProxy > payment.trackedValueDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Partial value payment"); // Management fees are expected to be relatively small, and could get to // zero before the loan is paid off XRPL_ASSERT_PARTS( managementFeeOutstandingProxy >= payment.trackedManagementFeeDelta, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "Valid management fee"); // Apply the payment deltas to reduce the outstanding balances @@ -361,14 +359,14 @@ doPayment( // ValueProxy or Number static_cast(principalOutstandingProxy) <= static_cast(totalValueOutstandingProxy), - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "principal does not exceed total"); XRPL_ASSERT_PARTS( // Use an explicit cast because the template parameter can be // ValueProxy or Number static_cast(managementFeeOutstandingProxy) >= beast::zero, - "ripple::detail::doPayment", + "xrpl::detail::doPayment", "fee outstanding stays valid"); return LoanPaymentParts{ @@ -673,13 +671,13 @@ doOverpayment( XRPL_ASSERT_PARTS( overpaymentComponents.trackedPrincipalDelta == principalOutstandingProxy - principalOutstanding, - "ripple::detail::doOverpayment", + "xrpl::detail::doOverpayment", "principal change agrees"); XRPL_ASSERT_PARTS( overpaymentComponents.trackedManagementFeeDelta == managementFeeOutstandingProxy - managementFeeOutstanding, - "ripple::detail::doOverpayment", + "xrpl::detail::doOverpayment", "no fee change"); // I'm not 100% sure the following asserts are correct. If in doubt, and @@ -703,20 +701,20 @@ doOverpayment( (totalValueOutstandingProxy - overpaymentComponents.trackedPrincipalDelta) + overpaymentComponents.trackedInterestPart(), - "ripple::detail::doOverpayment", + "xrpl::detail::doOverpayment", "interest paid agrees"); XRPL_ASSERT_PARTS( overpaymentComponents.trackedPrincipalDelta == loanPaymentParts.principalPaid, - "ripple::detail::doOverpayment", + "xrpl::detail::doOverpayment", "principal payment matches"); XRPL_ASSERT_PARTS( loanPaymentParts.feePaid == overpaymentComponents.untrackedManagementFee + overpaymentComponents.trackedManagementFeeDelta, - "ripple::detail::doOverpayment", + "xrpl::detail::doOverpayment", "fee payment matches"); // All validations passed, so update the proxy objects (which will @@ -780,10 +778,10 @@ computeLatePayment( XRPL_ASSERT( roundedLateInterest >= 0, - "ripple::detail::computeLatePayment : valid late interest"); + "xrpl::detail::computeLatePayment : valid late interest"); XRPL_ASSERT_PARTS( periodic.specialCase != PaymentSpecialCase::extra, - "ripple::detail::computeLatePayment", + "xrpl::detail::computeLatePayment", "no extra parts to this payment"); // Create the late payment components by copying the regular periodic @@ -813,7 +811,7 @@ computeLatePayment( XRPL_ASSERT_PARTS( isRounded(asset, late.totalDue, loanScale), - "ripple::detail::computeLatePayment", + "xrpl::detail::computeLatePayment", "total due is rounded"); // Check that the borrower provided enough funds to cover the late payment. @@ -939,7 +937,7 @@ computeFullPayment( XRPL_ASSERT_PARTS( isRounded(asset, full.totalDue, loanScale), - "ripple::detail::computeFullPayment", + "xrpl::detail::computeFullPayment", "total due is rounded"); JLOG(j.trace()) << "computeFullPayment result: periodicPayment: " @@ -999,11 +997,11 @@ computePaymentComponents( isRounded(asset, totalValueOutstanding, scale) && isRounded(asset, principalOutstanding, scale) && isRounded(asset, managementFeeOutstanding, scale), - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "Outstanding values are rounded"); XRPL_ASSERT_PARTS( paymentRemaining > 0, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "some payments remaining"); auto const roundedPeriodicPayment = @@ -1054,7 +1052,7 @@ computePaymentComponents( XRPL_ASSERT_PARTS( deltas.principal <= currentLedgerState.principalOutstanding, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "principal delta not greater than outstanding"); // Cap each component to never exceed what's actually outstanding @@ -1063,7 +1061,7 @@ computePaymentComponents( XRPL_ASSERT_PARTS( deltas.interest <= currentLedgerState.interestDue, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "interest due delta not greater than outstanding"); // Cap interest to both the outstanding amount AND what's left of the @@ -1075,7 +1073,7 @@ computePaymentComponents( XRPL_ASSERT_PARTS( deltas.managementFee <= currentLedgerState.managementFeeDue, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "management fee due delta not greater than outstanding"); // Cap management fee to both the outstanding amount AND what's left of the @@ -1098,7 +1096,7 @@ computePaymentComponents( } XRPL_ASSERT_PARTS( excess >= beast::zero, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "excess non-negative"); }; // Helper to reduce deltas when they collectively exceed a limit. @@ -1120,7 +1118,7 @@ computePaymentComponents( { // LCOV_EXCL_START UNREACHABLE( - "ripple::detail::computePaymentComponents : payment exceeded loan " + "xrpl::detail::computePaymentComponents : payment exceeded loan " "state"); addressExcess(deltas, totalOverpayment); // LCOV_EXCL_STOP @@ -1131,7 +1129,7 @@ computePaymentComponents( XRPL_ASSERT_PARTS( isRounded(asset, shortage, scale), - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "shortage is rounded"); if (shortage < beast::zero) @@ -1147,35 +1145,35 @@ computePaymentComponents( // shortage < 0 would mean we're trying to pay more than allowed (bug). XRPL_ASSERT_PARTS( shortage >= beast::zero, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "no shortage or excess"); // Final validation that all components are valid XRPL_ASSERT_PARTS( deltas.total() == deltas.principal + deltas.interest + deltas.managementFee, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "total value adds up"); XRPL_ASSERT_PARTS( deltas.principal >= beast::zero && deltas.principal <= currentLedgerState.principalOutstanding, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "valid principal result"); XRPL_ASSERT_PARTS( deltas.interest >= beast::zero && deltas.interest <= currentLedgerState.interestDue, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "valid interest result"); XRPL_ASSERT_PARTS( deltas.managementFee >= beast::zero && deltas.managementFee <= currentLedgerState.managementFeeDue, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "valid fee result"); XRPL_ASSERT_PARTS( deltas.principal + deltas.interest + deltas.managementFee > beast::zero, - "ripple::detail::computePaymentComponents", + "xrpl::detail::computePaymentComponents", "payment parts add to payment"); // Final safety clamp to ensure no value exceeds its outstanding balance @@ -1218,7 +1216,7 @@ computeOverpaymentComponents( { XRPL_ASSERT( overpayment > 0 && isRounded(asset, overpayment, loanScale), - "ripple::detail::computeOverpaymentComponents : valid overpayment " + "xrpl::detail::computeOverpaymentComponents : valid overpayment " "amount"); // First, deduct the fixed overpayment fee from the total amount. @@ -1267,7 +1265,7 @@ computeOverpaymentComponents( roundedOverpaymentInterest}; XRPL_ASSERT_PARTS( result.trackedInterestPart() == roundedOverpaymentInterest, - "ripple::detail::computeOverpaymentComponents", + "xrpl::detail::computeOverpaymentComponents", "valid interest computation"); return result; } @@ -1418,7 +1416,7 @@ computeFullPaymentInterest( paymentInterval); XRPL_ASSERT( accruedInterest >= 0, - "ripple::detail::computeFullPaymentInterest : valid accrued " + "xrpl::detail::computeFullPaymentInterest : valid accrued " "interest"); // Equation (28) from XLS-66 spec, Section A-2 Equation Glossary @@ -1428,7 +1426,7 @@ computeFullPaymentInterest( XRPL_ASSERT( prepaymentPenalty >= 0, - "ripple::detail::computeFullPaymentInterest : valid prepayment " + "xrpl::detail::computeFullPaymentInterest : valid prepayment " "interest"); // Part of equation (27) from XLS-66 spec, Section A-2 Equation Glossary @@ -1616,7 +1614,7 @@ computeLoanProperties( auto const periodicRate = loanPeriodicRate(interestRate, paymentInterval); XRPL_ASSERT( interestRate == 0 || periodicRate > 0, - "ripple::computeLoanProperties : valid rate"); + "xrpl::computeLoanProperties : valid rate"); auto const periodicPayment = detail::loanPeriodicPayment( principalOutstanding, periodicRate, paymentsRemaining); @@ -1638,7 +1636,7 @@ computeLoanProperties( (amount.integral() && loanScale == 0) || (!amount.integral() && loanScale >= static_cast(amount).exponent()), - "ripple::computeLoanProperties", + "xrpl::computeLoanProperties", "loanScale value fits expectations"); // We may need to truncate the total value because of the minimum @@ -1752,11 +1750,11 @@ loanMakePayment( Number const periodicRate = loanPeriodicRate(interestRate, paymentInterval); XRPL_ASSERT( interestRate == 0 || periodicRate > 0, - "ripple::loanMakePayment : valid rate"); + "xrpl::loanMakePayment : valid rate"); XRPL_ASSERT( *totalValueOutstandingProxy > 0, - "ripple::loanMakePayment : valid total value"); + "xrpl::loanMakePayment : valid total value"); view.update(loan); @@ -1826,7 +1824,7 @@ loanMakePayment( return Unexpected(fullPaymentComponents.error()); // LCOV_EXCL_START - UNREACHABLE("ripple::loanMakePayment : invalid full payment result"); + UNREACHABLE("xrpl::loanMakePayment : invalid full payment result"); JLOG(j.error()) << "Full payment computation failed unexpectedly."; return Unexpected(tecINTERNAL); // LCOV_EXCL_STOP @@ -1849,7 +1847,7 @@ loanMakePayment( serviceFee}; XRPL_ASSERT_PARTS( periodic.trackedPrincipalDelta >= 0, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "regular payment valid principal"); // ------------------------------------------------------------- @@ -1890,7 +1888,7 @@ loanMakePayment( } // LCOV_EXCL_START - UNREACHABLE("ripple::loanMakePayment : invalid late payment result"); + UNREACHABLE("xrpl::loanMakePayment : invalid late payment result"); JLOG(j.error()) << "Late payment computation failed unexpectedly."; return Unexpected(tecINTERNAL); // LCOV_EXCL_STOP @@ -1902,7 +1900,7 @@ loanMakePayment( XRPL_ASSERT_PARTS( paymentType == LoanPaymentType::regular || paymentType == LoanPaymentType::overpayment, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "regular payment type"); // Keep a running total of the actual parts paid @@ -1917,7 +1915,7 @@ loanMakePayment( // Try to make more payments XRPL_ASSERT_PARTS( periodic.trackedPrincipalDelta >= 0, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "payment pays non-negative principal"); totalPaid += periodic.totalDue; @@ -1935,7 +1933,7 @@ loanMakePayment( XRPL_ASSERT_PARTS( (periodic.specialCase == detail::PaymentSpecialCase::final) == (paymentRemainingProxy == 0), - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "final payment is the final payment"); // Don't compute the next payment if this was the last payment @@ -1967,11 +1965,11 @@ loanMakePayment( totalParts.principalPaid + totalParts.interestPaid + totalParts.feePaid == totalPaid, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "payment parts add up"); XRPL_ASSERT_PARTS( totalParts.valueChange == 0, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "no value change"); // ------------------------------------------------------------- @@ -2005,7 +2003,7 @@ loanMakePayment( { XRPL_ASSERT_PARTS( overpaymentComponents.untrackedInterest >= beast::zero, - "ripple::loanMakePayment", + "xrpl::loanMakePayment", "overpayment penalty did not reduce value of loan"); // Can't just use `periodicPayment` here, because it might // change @@ -2041,18 +2039,18 @@ loanMakePayment( XRPL_ASSERT( isRounded(asset, totalParts.principalPaid, loanScale) && totalParts.principalPaid >= beast::zero, - "ripple::loanMakePayment : total principal paid is valid"); + "xrpl::loanMakePayment : total principal paid is valid"); XRPL_ASSERT( isRounded(asset, totalParts.interestPaid, loanScale) && totalParts.interestPaid >= beast::zero, - "ripple::loanMakePayment : total interest paid is valid"); + "xrpl::loanMakePayment : total interest paid is valid"); XRPL_ASSERT( isRounded(asset, totalParts.valueChange, loanScale), - "ripple::loanMakePayment : loan value change is valid"); + "xrpl::loanMakePayment : loan value change is valid"); XRPL_ASSERT( isRounded(asset, totalParts.feePaid, loanScale) && totalParts.feePaid >= beast::zero, - "ripple::loanMakePayment : fee paid is valid"); + "xrpl::loanMakePayment : fee paid is valid"); return totalParts; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp b/src/xrpld/app/misc/detail/LoadFeeTrack.cpp index 9434ed5d02..6166656aee 100644 --- a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp +++ b/src/xrpld/app/misc/detail/LoadFeeTrack.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { bool LoadFeeTrack::raiseLocalFee() @@ -90,4 +90,4 @@ scaleFeeLoad( return *result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index 68d91599db..59a1325e32 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string to_string(Manifest const& m) @@ -187,11 +187,10 @@ Manifest::verify() const // Signing key and signature are not required for // master key revocations - if (!revoked() && !ripple::verify(st, HashPrefix::manifest, *signingKey)) + if (!revoked() && !xrpl::verify(st, HashPrefix::manifest, *signingKey)) return false; - return ripple::verify( - st, HashPrefix::manifest, masterKey, sfMasterSignature); + return xrpl::verify(st, HashPrefix::manifest, masterKey, sfMasterSignature); } uint256 @@ -374,7 +373,7 @@ ManifestCache::applyManifest(Manifest m) -> std::optional { XRPL_ASSERT( lock.owns_lock(), - "ripple::ManifestCache::applyManifest::prewriteCheck : locked"); + "xrpl::ManifestCache::applyManifest::prewriteCheck : locked"); (void)lock; // not used. parameter is present to ensure the mutex is // locked when the lambda is called. if (iter != map_.end() && m.sequence <= iter->second.sequence) @@ -525,7 +524,7 @@ void ManifestCache::load(DatabaseCon& dbCon, std::string const& dbTable) { auto db = dbCon.checkoutDb(); - ripple::getManifests(*db, dbTable, *this, j_); + xrpl::getManifests(*db, dbTable, *this, j_); } bool @@ -596,4 +595,4 @@ ManifestCache::save( saveManifests(*db, dbTable, isTrusted, map_, j_); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index 588bbc6fb7..77a8897d9c 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { Transaction::Transaction( std::shared_ptr const& stx, @@ -71,7 +71,7 @@ Transaction::sqlTransactionStatus(boost::optional const& status) XRPL_ASSERT( c == txnSqlUnknown, - "ripple::Transaction::sqlTransactionStatus : unknown transaction " + "xrpl::Transaction::sqlTransactionStatus : unknown transaction " "status"); return INVALID; } @@ -183,4 +183,4 @@ Transaction::getJson(JsonOptions options, bool binary) const return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 35ae25c82f..9f260e5f48 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { ////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ getFeeLevelPaid(ReadView const& view, STTx const& tx) return std::pair{baseFee + mod, feePaid + mod}; }(); - XRPL_ASSERT(baseFee.signum() > 0, "ripple::getFeeLevelPaid : positive fee"); + XRPL_ASSERT(baseFee.signum() > 0, "xrpl::getFeeLevelPaid : positive fee"); if (effectiveFeePaid.signum() <= 0 || baseFee.signum() <= 0) { return FeeLevel64(0); @@ -56,7 +56,7 @@ static FeeLevel64 increase(FeeLevel64 level, std::uint32_t increasePercent) { return mulDiv(level, 100 + increasePercent, 100) - .value_or(static_cast(ripple::muldiv_max)); + .value_or(static_cast(xrpl::muldiv_max)); } ////////////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ TxQ::FeeMetrics::update( std::sort(feeLevels.begin(), feeLevels.end()); XRPL_ASSERT( size == feeLevels.size(), - "ripple::TxQ::FeeMetrics::update : fee levels size"); + "xrpl::TxQ::FeeMetrics::update : fee levels size"); JLOG((timeLeap ? j_.warn() : j_.debug())) << "Ledger " << view.header().seq << " has " << size @@ -96,10 +96,10 @@ TxQ::FeeMetrics::update( // upperLimit must be >= minimumTxnCount_ or std::clamp can give // unexpected results auto const upperLimit = std::max( - mulDiv(txnsExpected_, cutPct, 100).value_or(ripple::muldiv_max), + mulDiv(txnsExpected_, cutPct, 100).value_or(xrpl::muldiv_max), minimumTxnCount_); txnsExpected_ = std::clamp( - mulDiv(size, cutPct, 100).value_or(ripple::muldiv_max), + mulDiv(size, cutPct, 100).value_or(xrpl::muldiv_max), minimumTxnCount_, upperLimit); recentTxnCounts_.clear(); @@ -108,7 +108,7 @@ TxQ::FeeMetrics::update( { recentTxnCounts_.push_back( mulDiv(size, 100 + setup.normalConsensusIncreasePercent, 100) - .value_or(ripple::muldiv_max)); + .value_or(xrpl::muldiv_max)); auto const iter = std::max_element(recentTxnCounts_.begin(), recentTxnCounts_.end()); BOOST_ASSERT(iter != recentTxnCounts_.end()); @@ -167,7 +167,7 @@ TxQ::FeeMetrics::scaleFeeLevel(Snapshot const& snapshot, OpenView const& view) // Compute escalated fee level // Don't care about the overflow flag return mulDiv(multiplier, current * current, target * target) - .value_or(static_cast(ripple::muldiv_max)); + .value_or(static_cast(xrpl::muldiv_max)); } return baseLevel; @@ -234,7 +234,7 @@ TxQ::FeeMetrics::escalatedSeriesFeeLevel( XRPL_ASSERT( current > target, - "ripple::TxQ::FeeMetrics::escalatedSeriesFeeLevel : current over " + "xrpl::TxQ::FeeMetrics::escalatedSeriesFeeLevel : current over " "target"); /* Calculate (apologies for the terrible notation) @@ -281,7 +281,7 @@ TxQ::MaybeTx::apply(Application& app, OpenView& view, beast::Journal j) { // If the rules or flags change, preflight again XRPL_ASSERT( - pfresult, "ripple::TxQ::MaybeTx::apply : preflight result is set"); + pfresult, "xrpl::TxQ::MaybeTx::apply : preflight result is set"); NumberSO stNumberSO{view.rules().enabled(fixUniversalNumber)}; if (pfresult->rules != view.rules() || pfresult->flags != flags) @@ -326,10 +326,10 @@ TxQ::TxQAccount::add(MaybeTx&& txn) auto result = transactions.emplace(seqProx, std::move(txn)); XRPL_ASSERT( - result.second, "ripple::TxQ::TxQAccount::add : emplace succeeded"); + result.second, "xrpl::TxQ::TxQAccount::add : emplace succeeded"); XRPL_ASSERT( &result.first->second != &txn, - "ripple::TxQ::TxQAccount::add : transaction moved"); + "xrpl::TxQ::TxQAccount::add : transaction moved"); return result.first->second; } @@ -438,7 +438,7 @@ TxQ::erase(TxQ::FeeMultiSet::const_iterator_type candidateIter) // intrusive list remove it from the TxQAccount // so the memory can be freed. [[maybe_unused]] auto const found = txQAccount.remove(seqProx); - XRPL_ASSERT(found, "ripple::TxQ::erase : account removed"); + XRPL_ASSERT(found, "xrpl::TxQ::erase : account removed"); return newCandidateIter; } @@ -452,7 +452,7 @@ TxQ::eraseAndAdvance(TxQ::FeeMultiSet::const_iterator_type candidateIter) txQAccount.transactions.find(candidateIter->seqProxy); XRPL_ASSERT( accountIter != txQAccount.transactions.end(), - "ripple::TxQ::eraseAndAdvance : account found"); + "xrpl::TxQ::eraseAndAdvance : account found"); // Note that sequence-based transactions must be applied in sequence order // from smallest to largest. But ticket-based transactions can be @@ -460,10 +460,10 @@ TxQ::eraseAndAdvance(TxQ::FeeMultiSet::const_iterator_type candidateIter) XRPL_ASSERT( candidateIter->seqProxy.isTicket() || accountIter == txQAccount.transactions.begin(), - "ripple::TxQ::eraseAndAdvance : ticket or sequence"); + "xrpl::TxQ::eraseAndAdvance : ticket or sequence"); XRPL_ASSERT( byFee_.iterator_to(accountIter->second) == candidateIter, - "ripple::TxQ::eraseAndAdvance : found in byFee"); + "xrpl::TxQ::eraseAndAdvance : found in byFee"); auto const accountNextIter = std::next(accountIter); // Check if the next transaction for this account is earlier in the queue, @@ -512,7 +512,7 @@ TxQ::tryClearAccountQueueUpThruTx( SeqProxy const tSeqProx{tx.getSeqProxy()}; XRPL_ASSERT( beginTxIter != accountIter->second.transactions.end(), - "ripple::TxQ::tryClearAccountQueueUpThruTx : non-empty accounts input"); + "xrpl::TxQ::tryClearAccountQueueUpThruTx : non-empty accounts input"); // This check is only concerned with the range from // [aSeqProxy, tSeqProxy) @@ -994,8 +994,7 @@ TxQ::apply( // o The current first thing in the queue has a Ticket and // * The tx has a Ticket that precedes it or // * txSeqProx == acctSeqProx. - XRPL_ASSERT( - prevIter != txIter->end, "ripple::TxQ::apply : not end"); + XRPL_ASSERT(prevIter != txIter->end, "xrpl::TxQ::apply : not end"); if (prevIter == txIter->end || txSeqProx < prevIter->first) { // The first Sequence number in the queue must be the @@ -1120,7 +1119,7 @@ TxQ::apply( potentialTotalSpend > XRPAmount{0} || (potentialTotalSpend == XRPAmount{0} && multiTxn->applyView.fees().base == 0), - "ripple::TxQ::apply : total spend check"); + "xrpl::TxQ::apply : total spend check"); sleBump->setFieldAmount(sfBalance, balance - potentialTotalSpend); // The transaction's sequence/ticket will be valid when the other // transactions in the queue have been processed. If the tx has a @@ -1150,7 +1149,7 @@ TxQ::apply( return {pcresult.ter, false}; // Too low of a fee should get caught by preclaim - XRPL_ASSERT(feeLevelPaid >= baseLevel, "ripple::TxQ::apply : minimum fee"); + XRPL_ASSERT(feeLevelPaid >= baseLevel, "xrpl::TxQ::apply : minimum fee"); JLOG(j_.trace()) << "Transaction " << transactionID << " from account " << account << " has fee level of " << feeLevelPaid @@ -1277,7 +1276,7 @@ TxQ::apply( auto dropRIter = endAccount.transactions.rbegin(); XRPL_ASSERT( dropRIter->second.account == lastRIter->account, - "ripple::TxQ::apply : cheapest transaction found"); + "xrpl::TxQ::apply : cheapest transaction found"); JLOG(j_.info()) << "Removing last item of account " << lastRIter->account << " from queue with average fee of " << endEffectiveFeeLevel @@ -1306,7 +1305,7 @@ TxQ::apply( [[maybe_unused]] bool created = false; std::tie(accountIter, created) = byAccount_.emplace(account, TxQAccount(tx)); - XRPL_ASSERT(created, "ripple::TxQ::apply : account created"); + XRPL_ASSERT(created, "xrpl::TxQ::apply : account created"); } // Modify the flags for use when coming out of the queue. // These changes _may_ cause an extra `preflight`, but as long as @@ -1521,7 +1520,7 @@ TxQ::accept(Application& app, OpenView& view) auto dropRIter = account.transactions.rbegin(); XRPL_ASSERT( dropRIter->second.account == candidateIter->account, - "ripple::TxQ::accept : account check"); + "xrpl::TxQ::accept : account check"); JLOG(j_.info()) << "Queue is nearly full, and transaction " @@ -1576,8 +1575,7 @@ TxQ::accept(Application& app, OpenView& view) } } XRPL_ASSERT( - byFee_.size() == startingSize, - "ripple::TxQ::accept : byFee size match"); + byFee_.size() == startingSize, "xrpl::TxQ::accept : byFee size match"); return ledgerChanged; } @@ -1696,7 +1694,7 @@ TxQ::tryDirectApply( << " to open ledger."; auto const [txnResult, didApply, metadata] = - ripple::apply(app, view, *tx, flags, j); + xrpl::apply(app, view, *tx, flags, j); JLOG(j_.trace()) << "New transaction " << transactionID << (didApply ? " applied successfully with " @@ -1738,16 +1736,16 @@ TxQ::removeFromByFee( auto deleteIter = byFee_.iterator_to((*replacedTxIter)->second); XRPL_ASSERT( deleteIter != byFee_.end(), - "ripple::TxQ::removeFromByFee : found in byFee"); + "xrpl::TxQ::removeFromByFee : found in byFee"); XRPL_ASSERT( &(*replacedTxIter)->second == &*deleteIter, - "ripple::TxQ::removeFromByFee : matching transaction"); + "xrpl::TxQ::removeFromByFee : matching transaction"); XRPL_ASSERT( deleteIter->seqProxy == tx->getSeqProxy(), - "ripple::TxQ::removeFromByFee : matching sequence"); + "xrpl::TxQ::removeFromByFee : matching sequence"); XRPL_ASSERT( deleteIter->account == (*tx)[sfAccount], - "ripple::TxQ::removeFromByFee : matching account"); + "xrpl::TxQ::removeFromByFee : matching account"); erase(deleteIter); } @@ -1959,4 +1957,4 @@ setup_TxQ(Config const& config) return setup; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/ValidatorKeys.cpp b/src/xrpld/app/misc/detail/ValidatorKeys.cpp index 4b1e93a444..757a18aa47 100644 --- a/src/xrpld/app/misc/detail/ValidatorKeys.cpp +++ b/src/xrpld/app/misc/detail/ValidatorKeys.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) { if (config.exists(SECTION_VALIDATOR_TOKEN) && @@ -70,4 +70,4 @@ ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) } } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 566dfc06a0..db2ee980b8 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { std::string to_string(ListDisposition disposition) @@ -181,7 +181,7 @@ ValidatorList::load( // This should be enforced by Config class XRPL_ASSERT( listThreshold_ > 0 && listThreshold_ <= publisherLists_.size(), - "ripple::ValidatorList::load : list threshold inside range"); + "xrpl::ValidatorList::load : list threshold inside range"); JLOG(j_.debug()) << "Validator list threshold set in configuration to " << listThreshold_; } @@ -293,7 +293,7 @@ ValidatorList::buildFileData( XRPL_ASSERT( pubCollection.rawVersion == 2 || pubCollection.remaining.empty(), - "ripple::ValidatorList::buildFileData : valid publisher list input"); + "xrpl::ValidatorList::buildFileData : valid publisher list input"); auto const effectiveVersion = forceVersion ? *forceVersion : pubCollection.rawVersion; @@ -395,7 +395,7 @@ ValidatorList::parseBlobs(std::uint32_t version, Json::Value const& body) info.signature = body[jss::signature].asString(); XRPL_ASSERT( result.size() == 1, - "ripple::ValidatorList::parseBlobs : single element result"); + "xrpl::ValidatorList::parseBlobs : single element result"); return result; } // Treat unknown versions as if they're the latest version. This @@ -432,7 +432,7 @@ ValidatorList::parseBlobs(std::uint32_t version, Json::Value const& body) } XRPL_ASSERT( result.size() == blobs.size(), - "ripple::ValidatorList::parseBlobs(version, Jason::Value) : " + "xrpl::ValidatorList::parseBlobs(version, Jason::Value) : " "result size matches"); return result; } @@ -466,7 +466,7 @@ ValidatorList::parseBlobs(protocol::TMValidatorListCollection const& body) } XRPL_ASSERT( result.size() == body.blobs_size(), - "ripple::ValidatorList::parseBlobs(TMValidatorList) : result size " + "xrpl::ValidatorList::parseBlobs(TMValidatorList) : result size " "match"); return result; } @@ -489,7 +489,7 @@ splitMessage( { if (begin == 0 && end == 0) end = largeMsg.blobs_size(); - XRPL_ASSERT(begin < end, "ripple::splitMessage : valid inputs"); + XRPL_ASSERT(begin < end, "xrpl::splitMessage : valid inputs"); if (end <= begin) return 0; @@ -525,7 +525,7 @@ splitMessageParts( XRPL_ASSERT( Message::totalSize(smallMsg) <= maximiumMessageSize, - "ripple::splitMessageParts : maximum message size"); + "xrpl::splitMessageParts : maximum message size"); messages.emplace_back( std::make_shared(smallMsg, protocol::mtVALIDATORLIST), @@ -575,7 +575,7 @@ buildValidatorListMessage( { XRPL_ASSERT( messages.empty(), - "ripple::buildValidatorListMessage(ValidatorBlobInfo) : empty messages " + "xrpl::buildValidatorListMessage(ValidatorBlobInfo) : empty messages " "input"); protocol::TMValidatorList msg; auto const manifest = @@ -589,7 +589,7 @@ buildValidatorListMessage( XRPL_ASSERT( Message::totalSize(msg) <= maximiumMessageSize, - "ripple::buildValidatorListMessage(ValidatorBlobInfo) : maximum " + "xrpl::buildValidatorListMessage(ValidatorBlobInfo) : maximum " "message size"); messages.emplace_back( std::make_shared(msg, protocol::mtVALIDATORLIST), @@ -611,7 +611,7 @@ buildValidatorListMessage( { XRPL_ASSERT( messages.empty(), - "ripple::buildValidatorListMessage(std::map) : empty messages input"); protocol::TMValidatorListCollection msg; auto const version = rawVersion < 2 ? 2 : rawVersion; @@ -630,7 +630,7 @@ buildValidatorListMessage( } XRPL_ASSERT( msg.blobs_size() > 0, - "ripple::buildValidatorListMessage(std::map) : minimum message blobs"); if (Message::totalSize(msg) > maxSize) { @@ -662,7 +662,7 @@ ValidatorList::buildValidatorListMessages( { XRPL_ASSERT( !blobInfos.empty(), - "ripple::ValidatorList::buildValidatorListMessages : empty messages " + "xrpl::ValidatorList::buildValidatorListMessages : empty messages " "input"); auto const& [currentSeq, currentBlob] = *blobInfos.begin(); auto numVLs = std::accumulate( @@ -748,7 +748,7 @@ ValidatorList::sendValidatorList( { XRPL_ASSERT( !messages.empty(), - "ripple::ValidatorList::sendValidatorList : non-empty messages " + "xrpl::ValidatorList::sendValidatorList : non-empty messages " "input"); // Don't send it next time. peer.setPublisherListSequence(publisherKey, newPeerSequence); @@ -767,7 +767,7 @@ ValidatorList::sendValidatorList( // thus there will only be one entry without a message XRPL_ASSERT( sent || messages.size() == 1, - "ripple::ValidatorList::sendValidatorList : sent or one message"); + "xrpl::ValidatorList::sendValidatorList : sent or one message"); if (sent) { if (messageVersion > 1) @@ -781,7 +781,7 @@ ValidatorList::sendValidatorList( { XRPL_ASSERT( numVLs == 1, - "ripple::ValidatorList::sendValidatorList : one validator " + "xrpl::ValidatorList::sendValidatorList : one validator " "list"); JLOG(j.debug()) << "Sent validator list for " << strHex(publisherKey) @@ -879,7 +879,7 @@ ValidatorList::broadcastBlobs( XRPL_ASSERT( lists.current.sequence == maxSequence || lists.remaining.count(maxSequence) == 1, - "ripple::ValidatorList::broadcastBlobs : valid sequence"); + "xrpl::ValidatorList::broadcastBlobs : valid sequence"); // Can't use overlay.foreach here because we need to modify // the peer, and foreach provides a const& for (auto& peer : overlay.getActivePeers()) @@ -1025,7 +1025,7 @@ ValidatorList::applyLists( auto next = std::next(iter); XRPL_ASSERT( next == remaining.end() || next->first > iter->first, - "ripple::ValidatorList::applyLists : next is valid"); + "xrpl::ValidatorList::applyLists : next is valid"); if (iter->first <= current.sequence || (next != remaining.end() && next->second.validFrom <= iter->second.validFrom)) @@ -1151,8 +1151,7 @@ ValidatorList::applyList( // we can only arrive here if the key used by the manifest matched one // of the loaded keys // LCOV_EXCL_START - UNREACHABLE( - "ripple::ValidatorList::applyList : invalid public key type"); + UNREACHABLE("xrpl::ValidatorList::applyList : invalid public key type"); return PublisherListStats{result}; // LCOV_EXCL_STOP } @@ -1213,7 +1212,7 @@ ValidatorList::applyList( // Done XRPL_ASSERT( publisher.sequence == sequence, - "ripple::ValidatorList::applyList : publisher sequence match"); + "xrpl::ValidatorList::applyList : publisher sequence match"); } else { @@ -1374,7 +1373,7 @@ ValidatorList::verify( auto const sig = strUnHex(signature); auto const data = base64_decode(blob); - if (!sig || !ripple::verify(*signingKey, makeSlice(data), makeSlice(*sig))) + if (!sig || !xrpl::verify(*signingKey, makeSlice(data), makeSlice(*sig))) return {ListDisposition::invalid, masterPubKey}; Json::Reader r; @@ -1508,7 +1507,7 @@ ValidatorList::removePublisherList( XRPL_ASSERT( reason != PublisherStatus::available && reason != PublisherStatus::unavailable, - "ripple::ValidatorList::removePublisherList : valid reason input"); + "xrpl::ValidatorList::removePublisherList : valid reason input"); auto const iList = publisherLists_.find(publisherKey); if (iList == publisherLists_.end()) return false; @@ -1697,7 +1696,7 @@ ValidatorList::getJson() const // Race conditions can happen, so make this check "fuzzy" XRPL_ASSERT( future.validFrom > timeKeeper_.now() + 600s, - "ripple::ValidatorList::getJson : minimum valid from"); + "xrpl::ValidatorList::getJson : minimum valid from"); } if (remaining.size()) curr[jss::remaining] = std::move(remaining); @@ -1764,7 +1763,7 @@ ValidatorList::for_each_available( continue; XRPL_ASSERT( plCollection.maxSequence != 0, - "ripple::ValidatorList::for_each_available : nonzero maxSequence"); + "xrpl::ValidatorList::for_each_available : nonzero maxSequence"); func( plCollection.rawManifest, plCollection.rawVersion, @@ -1854,7 +1853,7 @@ ValidatorList::calculateQuorum( publisherLists_.size() - listThreshold_ + 1); XRPL_ASSERT( errorThreshold > 0, - "ripple::ValidatorList::calculateQuorum : nonzero error threshold"); + "xrpl::ValidatorList::calculateQuorum : nonzero error threshold"); if (unavailable >= errorThreshold) return std::numeric_limits::max(); } @@ -1931,12 +1930,12 @@ ValidatorList::updateTrusted( { XRPL_ASSERT( std::next(iter) == next, - "ripple::ValidatorList::updateTrusted : sequential " + "xrpl::ValidatorList::updateTrusted : sequential " "remaining"); } XRPL_ASSERT( iter != remaining.end(), - "ripple::ValidatorList::updateTrusted : non-end of " + "xrpl::ValidatorList::updateTrusted : non-end of " "remaining"); // Rotate the pending list in to current @@ -1945,7 +1944,7 @@ ValidatorList::updateTrusted( auto& current = collection.current; XRPL_ASSERT( candidate.validFrom <= closeTime, - "ripple::ValidatorList::updateTrusted : maximum time"); + "xrpl::ValidatorList::updateTrusted : maximum time"); auto const oldList = current.list; current = std::move(candidate); @@ -1953,7 +1952,7 @@ ValidatorList::updateTrusted( collection.status = PublisherStatus::available; XRPL_ASSERT( current.sequence == sequence, - "ripple::ValidatorList::updateTrusted : sequence match"); + "xrpl::ValidatorList::updateTrusted : sequence match"); // If the list is expired, remove the validators so they don't // get processed in. The expiration check below will do the rest // of the work @@ -2012,7 +2011,7 @@ ValidatorList::updateTrusted( { XRPL_ASSERT( kit->second >= listThreshold_, - "ripple::ValidatorList::updateTrusted : count meets threshold"); + "xrpl::ValidatorList::updateTrusted : count meets threshold"); ++it; } } @@ -2039,7 +2038,7 @@ ValidatorList::updateTrusted( validatorManifests_.getSigningKey(k); XRPL_ASSERT( signingKey, - "ripple::ValidatorList::updateTrusted : found signing key"); + "xrpl::ValidatorList::updateTrusted : found signing key"); trustedSigningKeys_.insert(*signingKey); } } @@ -2153,4 +2152,4 @@ ValidatorList::negativeUNLFilter( return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/ValidatorSite.cpp b/src/xrpld/app/misc/detail/ValidatorSite.cpp index 74481e9a6b..a76980ac02 100644 --- a/src/xrpld/app/misc/detail/ValidatorSite.cpp +++ b/src/xrpld/app/misc/detail/ValidatorSite.cpp @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { auto constexpr default_refresh_interval = std::chrono::minutes{5}; auto constexpr error_retry_interval = std::chrono::seconds{30}; @@ -394,7 +394,7 @@ ValidatorSite::parseJsonResponse( auto const manifest = body[jss::manifest].asString(); XRPL_ASSERT( version == body[jss::version].asUInt(), - "ripple::ValidatorSite::parseJsonResponse : version match"); + "xrpl::ValidatorSite::parseJsonResponse : version match"); auto const& uri = sites_[siteIdx].activeResource->uri; auto const hash = sha512Half(manifest, blobs, version); auto const applyResult = app_.validators().applyListsAndBroadcast( @@ -571,7 +571,7 @@ ValidatorSite::onSiteFetch( processRedirect(res, siteIdx, lock_sites); XRPL_ASSERT( newLocation, - "ripple::ValidatorSite::onSiteFetch : non-null " + "xrpl::ValidatorSite::onSiteFetch : non-null " "validator"); // for perm redirects, also update our starting URI if (res.result() == status::moved_permanently || @@ -684,4 +684,4 @@ ValidatorSite::getJson() const } return jrr; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/Work.h b/src/xrpld/app/misc/detail/Work.h index 6855c68827..4d1547c4fb 100644 --- a/src/xrpld/app/misc/detail/Work.h +++ b/src/xrpld/app/misc/detail/Work.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -25,6 +25,6 @@ public: } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/WorkBase.h b/src/xrpld/app/misc/detail/WorkBase.h index 03cd2398f5..6c46749f6d 100644 --- a/src/xrpld/app/misc/detail/WorkBase.h +++ b/src/xrpld/app/misc/detail/WorkBase.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -260,7 +260,7 @@ WorkBase::onResponse(error_code const& ec) return fail(ec); close(); - XRPL_ASSERT(cb_, "ripple::detail::WorkBase::onResponse : callback is set"); + XRPL_ASSERT(cb_, "xrpl::detail::WorkBase::onResponse : callback is set"); cb_(ec, lastEndpoint_, std::move(res_)); cb_ = nullptr; } @@ -281,6 +281,6 @@ WorkBase::close() } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/WorkFile.h b/src/xrpld/app/misc/detail/WorkFile.h index 32dfca2b49..ac926ede1f 100644 --- a/src/xrpld/app/misc/detail/WorkFile.h +++ b/src/xrpld/app/misc/detail/WorkFile.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { @@ -78,7 +78,7 @@ WorkFile::run() error_code ec; auto const fileContents = getFileContents(ec, path_, megabytes(1)); - XRPL_ASSERT(cb_, "ripple::detail::WorkFile::run : callback is set"); + XRPL_ASSERT(cb_, "xrpl::detail::WorkFile::run : callback is set"); cb_(ec, fileContents); cb_ = nullptr; } @@ -91,6 +91,6 @@ WorkFile::cancel() } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/WorkPlain.h b/src/xrpld/app/misc/detail/WorkPlain.h index 13ed9c7f1d..23bae20006 100644 --- a/src/xrpld/app/misc/detail/WorkPlain.h +++ b/src/xrpld/app/misc/detail/WorkPlain.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -60,6 +60,6 @@ WorkPlain::onConnect(error_code const& ec) } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/misc/detail/WorkSSL.cpp b/src/xrpld/app/misc/detail/WorkSSL.cpp index 6bd576cb18..6ccc83f595 100644 --- a/src/xrpld/app/misc/detail/WorkSSL.cpp +++ b/src/xrpld/app/misc/detail/WorkSSL.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace detail { WorkSSL::WorkSSL( @@ -56,4 +56,4 @@ WorkSSL::onHandshake(error_code const& ec) } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/misc/detail/WorkSSL.h b/src/xrpld/app/misc/detail/WorkSSL.h index 5d17e6979f..7dd1a94c9e 100644 --- a/src/xrpld/app/misc/detail/WorkSSL.h +++ b/src/xrpld/app/misc/detail/WorkSSL.h @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -57,6 +57,6 @@ private: } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/AMMContext.h b/src/xrpld/app/paths/AMMContext.h index b84634c6dc..a272ba291e 100644 --- a/src/xrpld/app/paths/AMMContext.h +++ b/src/xrpld/app/paths/AMMContext.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** Maintains AMM info per overall payment engine execution and * individual iteration. @@ -95,6 +95,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_PATHS_AMMCONTEXT_H_INCLUDED diff --git a/src/xrpld/app/paths/AMMLiquidity.h b/src/xrpld/app/paths/AMMLiquidity.h index 48388b378e..b5b865d80e 100644 --- a/src/xrpld/app/paths/AMMLiquidity.h +++ b/src/xrpld/app/paths/AMMLiquidity.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { template class AMMOffer; @@ -131,6 +131,6 @@ private: maxOffer(TAmounts const& balances, Rules const& rules) const; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_TX_AMMLIQUIDITY_H_INCLUDED diff --git a/src/xrpld/app/paths/AMMOffer.h b/src/xrpld/app/paths/AMMOffer.h index d669e60d99..07defc16b1 100644 --- a/src/xrpld/app/paths/AMMOffer.h +++ b/src/xrpld/app/paths/AMMOffer.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { template class AMMLiquidity; @@ -127,6 +127,6 @@ public: checkInvariant(TAmounts const& consumed, beast::Journal j) const; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_APP_AMMOFFER_H_INCLUDED diff --git a/src/xrpld/app/paths/AccountCurrencies.cpp b/src/xrpld/app/paths/AccountCurrencies.cpp index 900ca04904..fbb9c63cd8 100644 --- a/src/xrpld/app/paths/AccountCurrencies.cpp +++ b/src/xrpld/app/paths/AccountCurrencies.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { hash_set accountSourceCurrencies( @@ -66,4 +66,4 @@ accountDestCurrencies( return currencies; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/AccountCurrencies.h b/src/xrpld/app/paths/AccountCurrencies.h index 39e4f8931f..de46a13808 100644 --- a/src/xrpld/app/paths/AccountCurrencies.h +++ b/src/xrpld/app/paths/AccountCurrencies.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { hash_set accountDestCurrencies( @@ -19,6 +19,6 @@ accountSourceCurrencies( std::shared_ptr const& lrLedger, bool includeXRP); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/Credit.cpp b/src/xrpld/app/paths/Credit.cpp index 8895e681dc..09798cef90 100644 --- a/src/xrpld/app/paths/Credit.cpp +++ b/src/xrpld/app/paths/Credit.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { STAmount creditLimit( @@ -25,10 +25,10 @@ creditLimit( XRPL_ASSERT( result.getIssuer() == account, - "ripple::creditLimit : result issuer match"); + "xrpl::creditLimit : result issuer match"); XRPL_ASSERT( result.getCurrency() == currency, - "ripple::creditLimit : result currency match"); + "xrpl::creditLimit : result currency match"); return result; } @@ -63,11 +63,11 @@ creditBalance( XRPL_ASSERT( result.getIssuer() == account, - "ripple::creditBalance : result issuer match"); + "xrpl::creditBalance : result issuer match"); XRPL_ASSERT( result.getCurrency() == currency, - "ripple::creditBalance : result currency match"); + "xrpl::creditBalance : result currency match"); return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/Credit.h b/src/xrpld/app/paths/Credit.h index 69594cf843..5bdcd70e74 100644 --- a/src/xrpld/app/paths/Credit.h +++ b/src/xrpld/app/paths/Credit.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Calculate the maximum amount of IOUs that an account can hold @param ledger the ledger to check against. @@ -45,6 +45,6 @@ creditBalance( Currency const& currency); /** @} */ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/Flow.cpp b/src/xrpld/app/paths/Flow.cpp index c9e16497e3..a102e44854 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/xrpld/app/paths/Flow.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { template static auto @@ -172,7 +172,7 @@ flow( flowDebugInfo)); } - XRPL_ASSERT(!srcIsXRP && !dstIsXRP, "ripple::flow : neither is XRP"); + XRPL_ASSERT(!srcIsXRP && !dstIsXRP, "xrpl::flow : neither is XRP"); return finishFlow( sb, srcIssue, @@ -190,4 +190,4 @@ flow( flowDebugInfo)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/Flow.h b/src/xrpld/app/paths/Flow.h index ca1e538e3a..5fafe294db 100644 --- a/src/xrpld/app/paths/Flow.h +++ b/src/xrpld/app/paths/Flow.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace path { namespace detail { @@ -51,6 +51,6 @@ flow( beast::Journal j, path::detail::FlowDebugInfo* flowDebugInfo = nullptr); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index 6b7b35e366..41bae4b178 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { PathRequest::PathRequest( Application& app, @@ -139,8 +139,7 @@ PathRequest::updateComplete() { std::lock_guard sl(mIndexLock); - XRPL_ASSERT( - mInProgress, "ripple::PathRequest::updateComplete : in progress"); + XRPL_ASSERT(mInProgress, "xrpl::PathRequest::updateComplete : in progress"); mInProgress = false; if (fCompletion) @@ -762,4 +761,4 @@ PathRequest::getSubscriber() const return wpSubscriber.lock(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index b71635cc7f..3d5564c069 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { // A pathfinding request submitted by a client // The request issuer must maintain a strong pointer @@ -158,6 +158,6 @@ private: static unsigned int const max_paths_ = 4; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/PathRequests.cpp b/src/xrpld/app/paths/PathRequests.cpp index 2d5b52d1f9..cfe6080eac 100644 --- a/src/xrpld/app/paths/PathRequests.cpp +++ b/src/xrpld/app/paths/PathRequests.cpp @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { /** Get the current RippleLineCache, updating it if necessary. Get the correct ledger to use. @@ -300,4 +300,4 @@ PathRequests::doLegacyPathRequest( return std::move(jvRes); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/PathRequests.h b/src/xrpld/app/paths/PathRequests.h index 544ff2fec0..5c97bafa8a 100644 --- a/src/xrpld/app/paths/PathRequests.h +++ b/src/xrpld/app/paths/PathRequests.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { class PathRequests { @@ -100,6 +100,6 @@ private: std::recursive_mutex mutable mLock; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index d3ed3fc38c..1d3be85d48 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -45,7 +45,7 @@ same path request (particularly if the search depth may change). */ -namespace ripple { +namespace xrpl { namespace { @@ -174,7 +174,7 @@ Pathfinder::Pathfinder( { XRPL_ASSERT( !uSrcIssuer || isXRP(uSrcCurrency) == isXRP(uSrcIssuer.value()), - "ripple::Pathfinder::Pathfinder : valid inputs"); + "xrpl::Pathfinder::Pathfinder : valid inputs"); } bool @@ -568,7 +568,7 @@ Pathfinder::getBestPaths( XRPL_ASSERT( fullLiquidityPath.empty(), - "ripple::Pathfinder::getBestPaths : first empty path result"); + "xrpl::Pathfinder::getBestPaths : first empty path result"); bool const issuerIsSender = isXRP(mSrcCurrency) || (srcIssuer == mSrcAccount); @@ -630,7 +630,7 @@ Pathfinder::getBestPaths( if (path.empty()) { // LCOV_EXCL_START - UNREACHABLE("ripple::Pathfinder::getBestPaths : path not found"); + UNREACHABLE("xrpl::Pathfinder::getBestPaths : path not found"); continue; // LCOV_EXCL_STOP } @@ -676,7 +676,7 @@ Pathfinder::getBestPaths( { XRPL_ASSERT( fullLiquidityPath.empty(), - "ripple::Pathfinder::getBestPaths : second empty path result"); + "xrpl::Pathfinder::getBestPaths : second empty path result"); JLOG(j_.info()) << "Paths could not send " << remaining << " of " << mDstAmount; } @@ -827,7 +827,7 @@ Pathfinder::addPathsForType( // Source must always be at the start, so pathsOut has to be empty. XRPL_ASSERT( pathsOut.empty(), - "ripple::Pathfinder::addPathsForType : empty paths"); + "xrpl::Pathfinder::addPathsForType : empty paths"); pathsOut.push_back(STPath()); break; @@ -1280,7 +1280,7 @@ void fillPaths(Pathfinder::PaymentType type, PathCostList const& costs) { auto& list = mPathTable[type]; - XRPL_ASSERT(list.empty(), "ripple::fillPaths : empty paths"); + XRPL_ASSERT(list.empty(), "xrpl::fillPaths : empty paths"); for (auto& cost : costs) list.push_back({cost.cost, makePath(cost.path)}); } @@ -1359,4 +1359,4 @@ Pathfinder::initPathTable() }); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/Pathfinder.h b/src/xrpld/app/paths/Pathfinder.h index 91c0a033f1..b269cc868b 100644 --- a/src/xrpld/app/paths/Pathfinder.h +++ b/src/xrpld/app/paths/Pathfinder.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Calculates payment paths. @@ -219,6 +219,6 @@ private: static std::uint32_t const afAC_LAST = 0x080; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/RippleCalc.cpp b/src/xrpld/app/paths/RippleCalc.cpp index a6751169d7..2b48a6ba5c 100644 --- a/src/xrpld/app/paths/RippleCalc.cpp +++ b/src/xrpld/app/paths/RippleCalc.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace path { RippleCalc::Output @@ -108,4 +108,4 @@ RippleCalc::rippleCalculate( } } // namespace path -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/RippleCalc.h b/src/xrpld/app/paths/RippleCalc.h index 1480a02bb7..0ef2641e36 100644 --- a/src/xrpld/app/paths/RippleCalc.h +++ b/src/xrpld/app/paths/RippleCalc.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class Config; namespace path { @@ -107,6 +107,6 @@ public: }; } // namespace path -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/RippleLineCache.cpp b/src/xrpld/app/paths/RippleLineCache.cpp index 498b060cb3..ece4c4149a 100644 --- a/src/xrpld/app/paths/RippleLineCache.cpp +++ b/src/xrpld/app/paths/RippleLineCache.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { RippleLineCache::RippleLineCache( std::shared_ptr const& ledger, @@ -61,7 +61,7 @@ RippleLineCache::getRippleLines( // for either value of outgoing. XRPL_ASSERT( size <= totalLineCount_, - "ripple::RippleLineCache::getRippleLines : maximum lines"); + "xrpl::RippleLineCache::getRippleLines : maximum lines"); totalLineCount_ -= size; lines_.erase(otheriter); } @@ -83,7 +83,7 @@ RippleLineCache::getRippleLines( { XRPL_ASSERT( it->second == nullptr, - "ripple::RippleLineCache::getRippleLines : null lines"); + "xrpl::RippleLineCache::getRippleLines : null lines"); auto lines = PathFindTrustLine::getItems(accountID, *ledger_, direction); if (lines.size()) @@ -96,7 +96,7 @@ RippleLineCache::getRippleLines( XRPL_ASSERT( !it->second || (it->second->size() > 0), - "ripple::RippleLineCache::getRippleLines : null or nonempty lines"); + "xrpl::RippleLineCache::getRippleLines : null or nonempty lines"); auto const size = it->second ? it->second->size() : 0; JLOG(journal_.trace()) << "getRippleLines for ledger " << ledger_->header().seq << " found " << size @@ -111,4 +111,4 @@ RippleLineCache::getRippleLines( return it->second; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/RippleLineCache.h b/src/xrpld/app/paths/RippleLineCache.h index 00614f08c2..c2763ca2b4 100644 --- a/src/xrpld/app/paths/RippleLineCache.h +++ b/src/xrpld/app/paths/RippleLineCache.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { // Used by Pathfinder class RippleLineCache final : public CountedObject @@ -46,7 +46,7 @@ public: private: std::mutex mLock; - ripple::hardened_hash<> hasher_; + xrpl::hardened_hash<> hasher_; std::shared_ptr ledger_; beast::Journal journal_; @@ -108,6 +108,6 @@ private: std::size_t totalLineCount_ = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/TrustLine.cpp b/src/xrpld/app/paths/TrustLine.cpp index 45c17bb893..b6ce9d74b0 100644 --- a/src/xrpld/app/paths/TrustLine.cpp +++ b/src/xrpld/app/paths/TrustLine.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { TrustLineBase::TrustLineBase( std::shared_ptr const& sle, @@ -103,4 +103,4 @@ RPCTrustLine::getItems(AccountID const& accountID, ReadView const& view) return detail::getTrustLineItems(accountID, view); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/TrustLine.h b/src/xrpld/app/paths/TrustLine.h index 8b944d84b1..a0a58c2bde 100644 --- a/src/xrpld/app/paths/TrustLine.h +++ b/src/xrpld/app/paths/TrustLine.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Describes how an account was found in a path, and how to find the next set of paths. "Outgoing" is defined as the source account, or an account found via a @@ -227,6 +227,6 @@ private: Rate highQualityOut_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/AMMLiquidity.cpp b/src/xrpld/app/paths/detail/AMMLiquidity.cpp index 84a039bfc6..2042467923 100644 --- a/src/xrpld/app/paths/detail/AMMLiquidity.cpp +++ b/src/xrpld/app/paths/detail/AMMLiquidity.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { template AMMLiquidity::AMMLiquidity( @@ -60,7 +60,7 @@ AMMLiquidity::generateFibSeqOffer( XRPL_ASSERT( !ammContext_.maxItersReached(), - "ripple::AMMLiquidity::generateFibSeqOffer : maximum iterations"); + "xrpl::AMMLiquidity::generateFibSeqOffer : maximum iterations"); cur.out = toAmount( getIssue(balances.out), @@ -245,4 +245,4 @@ template class AMMLiquidity; template class AMMLiquidity; template class AMMLiquidity; -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/detail/AMMOffer.cpp b/src/xrpld/app/paths/detail/AMMOffer.cpp index 42592ee9c9..a58eafbdbf 100644 --- a/src/xrpld/app/paths/detail/AMMOffer.cpp +++ b/src/xrpld/app/paths/detail/AMMOffer.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { template AMMOffer::AMMOffer( @@ -155,4 +155,4 @@ template class AMMOffer; template class AMMOffer; template class AMMOffer; -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/src/xrpld/app/paths/detail/AmountSpec.h index 09ebea9c8a..5249bd30e0 100644 --- a/src/xrpld/app/paths/detail/AmountSpec.h +++ b/src/xrpld/app/paths/detail/AmountSpec.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { struct AmountSpec { @@ -107,7 +107,7 @@ inline IOUAmount& get(EitherAmount& amt) { XRPL_ASSERT( - !amt.native, "ripple::get(EitherAmount&) : is not XRP"); + !amt.native, "xrpl::get(EitherAmount&) : is not XRP"); return amt.iou; } @@ -115,7 +115,7 @@ template <> inline XRPAmount& get(EitherAmount& amt) { - XRPL_ASSERT(amt.native, "ripple::get(EitherAmount&) : is XRP"); + XRPL_ASSERT(amt.native, "xrpl::get(EitherAmount&) : is XRP"); return amt.xrp; } @@ -132,8 +132,7 @@ inline IOUAmount const& get(EitherAmount const& amt) { XRPL_ASSERT( - !amt.native, - "ripple::get(EitherAmount const&) : is not XRP"); + !amt.native, "xrpl::get(EitherAmount const&) : is not XRP"); return amt.iou; } @@ -142,7 +141,7 @@ inline XRPAmount const& get(EitherAmount const& amt) { XRPL_ASSERT( - amt.native, "ripple::get(EitherAmount const&) : is XRP"); + amt.native, "xrpl::get(EitherAmount const&) : is XRP"); return amt.xrp; } @@ -151,7 +150,7 @@ toAmountSpec(STAmount const& amt) { XRPL_ASSERT( amt.mantissa() < std::numeric_limits::max(), - "ripple::toAmountSpec(STAmount const&) : maximum mantissa"); + "xrpl::toAmountSpec(STAmount const&) : maximum mantissa"); bool const isNeg = amt.negative(); std::int64_t const sMant = isNeg ? -std::int64_t(amt.mantissa()) : amt.mantissa(); @@ -188,7 +187,7 @@ toAmountSpec(EitherAmount const& ea, std::optional const& c) r.currency = c; XRPL_ASSERT( ea.native == r.native, - "ripple::toAmountSpec(EitherAmount const&&, std::optional) : " + "xrpl::toAmountSpec(EitherAmount const&&, std::optional) : " "matching native"); if (r.native) { @@ -201,6 +200,6 @@ toAmountSpec(EitherAmount const& ea, std::optional const& c) return r; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index 6144f8adfa..baef42a492 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { template class BookStep : public StepImp> @@ -356,7 +356,7 @@ private: // It's really a programming error if the quality is missing. XRPL_ASSERT( limitQuality, - "ripple::BookOfferCrossingStep::getQuality : nonzero quality"); + "xrpl::BookOfferCrossingStep::getQuality : nonzero quality"); if (!limitQuality) Throw(tefINTERNAL, "Offer requires quality."); return *limitQuality; @@ -1079,7 +1079,7 @@ BookStep::revImp( // LCOV_EXCL_START JLOG(j_.error()) << "BookStep remainingOut < 0 " << to_string(remainingOut); - UNREACHABLE("ripple::BookStep::revImp : remaining less than zero"); + UNREACHABLE("xrpl::BookStep::revImp : remaining less than zero"); cache_.emplace(beast::zero, beast::zero); return {beast::zero, beast::zero}; // LCOV_EXCL_STOP @@ -1103,7 +1103,7 @@ BookStep::fwdImp( boost::container::flat_set& ofrsToRm, TIn const& in) { - XRPL_ASSERT(cache_, "ripple::BookStep::fwdImp : cache is set"); + XRPL_ASSERT(cache_, "xrpl::BookStep::fwdImp : cache is set"); TAmounts result(beast::zero, beast::zero); @@ -1122,8 +1122,7 @@ BookStep::fwdImp( TOut const& ownerGives, std::uint32_t transferRateIn, std::uint32_t transferRateOut) mutable -> bool { - XRPL_ASSERT( - cache_, "ripple::BookStep::fwdImp::eachOffer : cache is set"); + XRPL_ASSERT(cache_, "xrpl::BookStep::fwdImp::eachOffer : cache is set"); if (remainingIn <= beast::zero) return false; @@ -1243,7 +1242,7 @@ BookStep::fwdImp( // something went very wrong JLOG(j_.error()) << "BookStep remainingIn < 0 " << to_string(remainingIn); - UNREACHABLE("ripple::BookStep::fwdImp : remaining less than zero"); + UNREACHABLE("xrpl::BookStep::fwdImp : remaining less than zero"); cache_.emplace(beast::zero, beast::zero); return {beast::zero, beast::zero}; // LCOV_EXCL_STOP @@ -1365,7 +1364,7 @@ namespace test { template static bool -equalHelper(Step const& step, ripple::Book const& book) +equalHelper(Step const& step, xrpl::Book const& book) { if (auto bs = dynamic_cast const*>(&step)) return book == bs->book(); @@ -1373,14 +1372,14 @@ equalHelper(Step const& step, ripple::Book const& book) } bool -bookStepEqual(Step const& step, ripple::Book const& book) +bookStepEqual(Step const& step, xrpl::Book const& book) { bool const inXRP = isXRP(book.in.currency); bool const outXRP = isXRP(book.out.currency); if (inXRP && outXRP) { // LCOV_EXCL_START - UNREACHABLE("ripple::test::bookStepEqual : no XRP to XRP book step"); + UNREACHABLE("xrpl::test::bookStepEqual : no XRP to XRP book step"); return false; // no such thing as xrp/xrp book step // LCOV_EXCL_STOP } @@ -1449,4 +1448,4 @@ make_BookStepXI(StrandContext const& ctx, Issue const& out) return make_BookStepHelper(ctx, xrpIssue(), out); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 2af467c820..5f9d0c86e7 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { template class DirectStepI : public StepImp> @@ -499,7 +499,7 @@ DirectStepI::revImp( qualities(sb, srcDebtDir, StrandDirection::reverse); XRPL_ASSERT( static_cast(this)->verifyDstQualityIn(dstQIn), - "ripple::DirectStepI : valid destination quality"); + "xrpl::DirectStepI : valid destination quality"); Issue const srcToDstIss(currency_, redeems(srcDebtDir) ? dst_ : src_); @@ -618,7 +618,7 @@ DirectStepI::fwdImp( boost::container::flat_set& /*ofrsToRm*/, IOUAmount const& in) { - XRPL_ASSERT(cache_, "ripple::DirectStepI::fwdImp : cache is set"); + XRPL_ASSERT(cache_, "xrpl::DirectStepI::fwdImp : cache is set"); auto const [maxSrcToDst, srcDebtDir] = static_cast(this)->maxFlow(sb, cache_->srcToDst); @@ -705,7 +705,7 @@ DirectStepI::validFwd( auto const savCache = *cache_; - XRPL_ASSERT(!in.native, "ripple::DirectStepI::validFwd : input is not XRP"); + XRPL_ASSERT(!in.native, "xrpl::DirectStepI::validFwd : input is not XRP"); auto const [maxSrcToDst, srcDebtDir] = static_cast(this)->maxFlow(sb, cache_->srcToDst); @@ -772,7 +772,7 @@ DirectStepI::qualitiesSrcIssues( XRPL_ASSERT( static_cast(this)->verifyPrevStepDebtDirection( prevStepDebtDirection), - "ripple::DirectStepI::qualitiesSrcIssues : will prevStepDebtDirection " + "xrpl::DirectStepI::qualitiesSrcIssues : will prevStepDebtDirection " "issue"); std::uint32_t const srcQOut = redeems(prevStepDebtDirection) @@ -896,7 +896,7 @@ DirectStepI::check(StrandContext const& ctx) const { // LCOV_EXCL_START UNREACHABLE( - "ripple::DirectStepI::check : prev seen book without a " + "xrpl::DirectStepI::check : prev seen book without a " "prev step"); return temBAD_PATH_LOOP; // LCOV_EXCL_STOP @@ -975,4 +975,4 @@ make_DirectStepI( return {tesSUCCESS, std::move(r)}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/detail/FlatSets.h b/src/xrpld/app/paths/detail/FlatSets.h index 9438f71532..cb02a09d9a 100644 --- a/src/xrpld/app/paths/detail/FlatSets.h +++ b/src/xrpld/app/paths/detail/FlatSets.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Given two flat sets dst and src, compute dst = dst union src @@ -25,6 +25,6 @@ SetUnion( boost::container::ordered_unique_range_t{}, src.begin(), src.end()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/src/xrpld/app/paths/detail/FlowDebugInfo.h index 1addb5acbd..6c0f0e8e00 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/src/xrpld/app/paths/detail/FlowDebugInfo.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace path { namespace detail { // Track performance information of a single payment @@ -73,7 +73,7 @@ struct FlowDebugInfo { XRPL_ASSERT( !liquiditySrcIn.empty(), - "ripple::path::detail::FlowDebugInfo::pushLiquiditySrc : " + "xrpl::path::detail::FlowDebugInfo::pushLiquiditySrc : " "non-empty liquidity source"); liquiditySrcIn.back().push_back(eIn); liquiditySrcOut.back().push_back(eOut); @@ -109,7 +109,7 @@ struct FlowDebugInfo { // LCOV_EXCL_START UNREACHABLE( - "ripple::path::detail::FlowDebugInfo::duration : timepoint not " + "xrpl::path::detail::FlowDebugInfo::duration : timepoint not " "found"); return std::chrono::duration(0); // LCOV_EXCL_STOP @@ -222,7 +222,7 @@ struct FlowDebugInfo std::vector const& amts, char delim = ';') { auto get_val = [](EitherAmount const& a) -> std::string { - return ripple::to_string(a.xrp); + return xrpl::to_string(a.xrp); }; write_list(amts, get_val, delim); }; @@ -230,7 +230,7 @@ struct FlowDebugInfo std::vector const& amts, char delim = ';') { auto get_val = [](EitherAmount const& a) -> std::string { - return ripple::to_string(a.iou); + return xrpl::to_string(a.iou); }; write_list(amts, get_val, delim); }; @@ -361,5 +361,5 @@ balanceDiffsToString(std::optional const& bd) } // namespace detail } // namespace path -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/PathfinderUtils.h b/src/xrpld/app/paths/detail/PathfinderUtils.h index 42cc6f832f..5571cd4732 100644 --- a/src/xrpld/app/paths/detail/PathfinderUtils.h +++ b/src/xrpld/app/paths/detail/PathfinderUtils.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { inline STAmount largestAmount(STAmount const& amt) @@ -29,6 +29,6 @@ convertAllCheck(STAmount const& a) return a == largestAmount(a); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/PaySteps.cpp b/src/xrpld/app/paths/detail/PaySteps.cpp index 8e189806fb..97d1dad4fa 100644 --- a/src/xrpld/app/paths/detail/PaySteps.cpp +++ b/src/xrpld/app/paths/detail/PaySteps.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { // Check equal with tolerance bool @@ -80,7 +80,7 @@ toStep( // should already be taken care of JLOG(j.error()) << "Found offer/account payment step. Aborting payment strand."; - UNREACHABLE("ripple::toStep : offer/account payment payment strand"); + UNREACHABLE("xrpl::toStep : offer/account payment payment strand"); return {temBAD_PATH, std::unique_ptr{}}; // LCOV_EXCL_STOP } @@ -88,7 +88,7 @@ toStep( XRPL_ASSERT( (e2->getNodeType() & STPathElement::typeCurrency) || (e2->getNodeType() & STPathElement::typeIssuer), - "ripple::toStep : currency or issuer"); + "xrpl::toStep : currency or issuer"); auto const outCurrency = e2->getNodeType() & STPathElement::typeCurrency ? e2->getCurrency() : curIssue.currency; @@ -102,7 +102,7 @@ toStep( return {temBAD_PATH, std::unique_ptr{}}; } - XRPL_ASSERT(e2->isOffer(), "ripple::toStep : is offer"); + XRPL_ASSERT(e2->isOffer(), "xrpl::toStep : is offer"); if (isXRP(outCurrency)) return make_BookStepIX(ctx, curIssue); @@ -376,7 +376,7 @@ toStrand( { // Should never happen // LCOV_EXCL_START - UNREACHABLE("ripple::toStrand : offer currency mismatch"); + UNREACHABLE("xrpl::toStrand : offer currency mismatch"); return {temBAD_PATH, Strand{}}; // LCOV_EXCL_STOP } @@ -444,7 +444,7 @@ toStrand( { // LCOV_EXCL_START JLOG(j.warn()) << "Flow check strand failed"; - UNREACHABLE("ripple::toStrand : invalid strand"); + UNREACHABLE("xrpl::toStrand : invalid strand"); return {temBAD_PATH, Strand{}}; // LCOV_EXCL_STOP } @@ -627,4 +627,4 @@ isDirectXrpToXrp(Strand const& strand); template bool isDirectXrpToXrp(Strand const& strand); -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/paths/detail/StepChecks.h b/src/xrpld/app/paths/detail/StepChecks.h index 7ba1e40d16..969aec2541 100644 --- a/src/xrpld/app/paths/detail/StepChecks.h +++ b/src/xrpld/app/paths/detail/StepChecks.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { inline TER checkFreeze( @@ -17,7 +17,7 @@ checkFreeze( AccountID const& dst, Currency const& currency) { - XRPL_ASSERT(src != dst, "ripple::checkFreeze : unequal input accounts"); + XRPL_ASSERT(src != dst, "xrpl::checkFreeze : unequal input accounts"); // check freeze if (auto sle = view.read(keylet::account(dst))) @@ -93,6 +93,6 @@ checkNoRipple( return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/Steps.h b/src/xrpld/app/paths/detail/Steps.h index 6bdb30dd22..63254c228e 100644 --- a/src/xrpld/app/paths/detail/Steps.h +++ b/src/xrpld/app/paths/detail/Steps.h @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { class PaymentSandbox; class ReadView; class ApplyView; @@ -579,7 +579,7 @@ bool xrpEndpointStepEqual(Step const& step, AccountID const& acc); bool -bookStepEqual(Step const& step, ripple::Book const& book); +bookStepEqual(Step const& step, xrpl::Book const& book); } // namespace test std::pair> @@ -606,6 +606,6 @@ bool isDirectXrpToXrp(Strand const& strand); /// @endcond -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index fb93f3fdb7..5e0a637858 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -21,7 +21,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Result of flow() execution of a single Strand. */ template @@ -154,7 +154,7 @@ flow( << to_string(get(r.first)) << " maxIn: " << to_string(*maxIn); UNREACHABLE( - "ripple::flow : first step re-executing the " + "xrpl::flow : first step re-executing the " "limiting step failed"); return Result{strand, std::move(ofrsToRm)}; // LCOV_EXCL_STOP @@ -194,7 +194,7 @@ flow( JLOG(j.fatal()) << "Re-executed limiting step failed"; #endif UNREACHABLE( - "ripple::flow : limiting step re-executing the " + "xrpl::flow : limiting step re-executing the " "limiting step failed"); return Result{strand, std::move(ofrsToRm)}; // LCOV_EXCL_STOP @@ -232,7 +232,7 @@ flow( JLOG(j.fatal()) << "Re-executed forward pass failed"; #endif UNREACHABLE( - "ripple::flow : non-limiting step re-executing the " + "xrpl::flow : non-limiting step re-executing the " "forward pass failed"); return Result{strand, std::move(ofrsToRm)}; // LCOV_EXCL_STOP @@ -487,7 +487,7 @@ public: if (i >= cur_.size()) { // LCOV_EXCL_START - UNREACHABLE("ripple::ActiveStrands::get : input out of range"); + UNREACHABLE("xrpl::ActiveStrands::get : input out of range"); return nullptr; // LCOV_EXCL_STOP } @@ -698,7 +698,7 @@ flow( XRPL_ASSERT( f.out <= remainingOut && f.sandbox && (!remainingIn || f.in <= *remainingIn), - "ripple::flow : remaining constraints"); + "xrpl::flow : remaining constraints"); Quality const q(f.out, f.in); @@ -719,7 +719,7 @@ flow( continue; } - XRPL_ASSERT(!best, "ripple::flow : best is unset"); + XRPL_ASSERT(!best, "xrpl::flow : best is unset"); if (!f.inactive) activeStrands.push(strand); best.emplace(f.in, f.out, std::move(*f.sandbox), *strand, q); @@ -805,7 +805,7 @@ flow( // running debug builds of rippled. While this issue still needs to // be resolved, the assert is causing more harm than good at this // point. - // UNREACHABLE("ripple::flow : rounding error"); + // UNREACHABLE("xrpl::flow : rounding error"); return {tefEXCEPTION, std::move(ofrsToRmOnFail)}; } @@ -842,7 +842,7 @@ flow( // Handles both cases 1. and 2. // fixFillOrKill amendment: // Handles 2. 1. is handled above and falls through for tfSell. - XRPL_ASSERT(remainingIn, "ripple::flow : nonzero remainingIn"); + XRPL_ASSERT(remainingIn, "xrpl::flow : nonzero remainingIn"); if (remainingIn && *remainingIn != beast::zero) return { tecPATH_PARTIAL, @@ -854,6 +854,6 @@ flow( return {actualIn, actualOut, std::move(sb), std::move(ofrsToRmOnFail)}; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index fb51a68fcc..83271321be 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { template class XRPEndpointStep @@ -106,7 +106,7 @@ protected: XRPAmount xrpLiquidImpl(ReadView& sb, std::int32_t reserveReduction) const { - return ripple::xrpLiquid(sb, acc_, reserveReduction, j_); + return xrpl::xrpLiquid(sb, acc_, reserveReduction, j_); } std::string @@ -263,7 +263,7 @@ XRPEndpointStep::fwdImp( boost::container::flat_set& ofrsToRm, XRPAmount const& in) { - XRPL_ASSERT(cache_, "ripple::XRPEndpointStep::fwdImp : cache is set"); + XRPL_ASSERT(cache_, "xrpl::XRPEndpointStep::fwdImp : cache is set"); auto const balance = static_cast(this)->xrpLiquid(sb); auto const result = isLast_ ? in : std::min(balance, in); @@ -291,7 +291,7 @@ XRPEndpointStep::validFwd( return {false, EitherAmount(XRPAmount(beast::zero))}; } - XRPL_ASSERT(in.native, "ripple::XRPEndpointStep::validFwd : input is XRP"); + XRPL_ASSERT(in.native, "xrpl::XRPEndpointStep::validFwd : input is XRP"); auto const& xrpIn = in.xrp; auto const balance = static_cast(this)->xrpLiquid(sb); @@ -396,4 +396,4 @@ make_XRPEndpointStep(StrandContext const& ctx, AccountID const& acc) return {tesSUCCESS, std::move(r)}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/PeerFinder.h b/src/xrpld/app/rdb/PeerFinder.h index e5e3195b2f..6c1b2779a6 100644 --- a/src/xrpld/app/rdb/PeerFinder.h +++ b/src/xrpld/app/rdb/PeerFinder.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * @brief initPeerFinderDB Opens a session with the peer finder database. @@ -52,6 +52,6 @@ savePeerFinderDB( soci::session& session, std::vector const& v); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/RelationalDatabase.h b/src/xrpld/app/rdb/RelationalDatabase.h index 102479544b..50cd420483 100644 --- a/src/xrpld/app/rdb/RelationalDatabase.h +++ b/src/xrpld/app/rdb/RelationalDatabase.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { struct LedgerHashPair { @@ -218,7 +218,7 @@ rangeCheckedCast(C c) { // This should never happen // LCOV_EXCL_START - UNREACHABLE("ripple::rangeCheckedCast : domain error"); + UNREACHABLE("xrpl::rangeCheckedCast : domain error"); JLOG(debugLog().error()) << "rangeCheckedCast domain error:" << " value = " << c << " min = " << std::numeric_limits::lowest() @@ -229,6 +229,6 @@ rangeCheckedCast(C c) return static_cast(c); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/State.h b/src/xrpld/app/rdb/State.h index 54e1f8219a..e8c14fdd29 100644 --- a/src/xrpld/app/rdb/State.h +++ b/src/xrpld/app/rdb/State.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { struct SavedState { @@ -74,6 +74,6 @@ setSavedState(soci::session& session, SavedState const& state); void setLastRotated(soci::session& session, LedgerIndex seq); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/Vacuum.h b/src/xrpld/app/rdb/Vacuum.h index 40c84796d2..d7ca5f8bce 100644 --- a/src/xrpld/app/rdb/Vacuum.h +++ b/src/xrpld/app/rdb/Vacuum.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** * @brief doVacuumDB Creates, initialises, and performs cleanup on a database. @@ -14,6 +14,6 @@ namespace ripple { bool doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/Wallet.h b/src/xrpld/app/rdb/Wallet.h index c1a17b39dd..961b12d7ef 100644 --- a/src/xrpld/app/rdb/Wallet.h +++ b/src/xrpld/app/rdb/Wallet.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * @brief makeWalletDB Opens the wallet database and returns it. @@ -158,6 +158,6 @@ voteAmendment( std::string const& name, AmendmentVote vote); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/backend/SQLiteDatabase.h b/src/xrpld/app/rdb/backend/SQLiteDatabase.h index cf668137ea..22a4ed8b37 100644 --- a/src/xrpld/app/rdb/backend/SQLiteDatabase.h +++ b/src/xrpld/app/rdb/backend/SQLiteDatabase.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class SQLiteDatabase : public RelationalDatabase { @@ -289,6 +289,6 @@ public: closeTransactionDB() = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index c8458d15db..b112f46409 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -16,7 +16,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { /** @@ -41,7 +41,7 @@ to_string(TableType type) return "AccountTransactions"; // LCOV_EXCL_START default: - UNREACHABLE("ripple::detail::to_string : invalid TableType"); + UNREACHABLE("xrpl::detail::to_string : invalid TableType"); return "Unknown"; // LCOV_EXCL_STOP } @@ -187,7 +187,7 @@ saveValidatedLedger( { // LCOV_EXCL_START JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}}); - UNREACHABLE("ripple::detail::saveValidatedLedger : zero account hash"); + UNREACHABLE("xrpl::detail::saveValidatedLedger : zero account hash"); // LCOV_EXCL_STOP } @@ -200,13 +200,13 @@ saveValidatedLedger( JLOG(j.fatal()) << "saveAcceptedLedger: seq=" << seq << ", current=" << current; UNREACHABLE( - "ripple::detail::saveValidatedLedger : mismatched account hash"); + "xrpl::detail::saveValidatedLedger : mismatched account hash"); // LCOV_EXCL_STOP } XRPL_ASSERT( ledger->header().txHash == ledger->txMap().getHash().as_uint256(), - "ripple::detail::saveValidatedLedger : transaction hash match"); + "xrpl::detail::saveValidatedLedger : transaction hash match"); // Save the ledger header in the hashed object store { @@ -1354,4 +1354,4 @@ dbHasSpace(soci::session& session, Config const& config, beast::Journal j) } } // namespace detail -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/backend/detail/Node.h b/src/xrpld/app/rdb/backend/detail/Node.h index fbf06083d6..37d028c035 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.h +++ b/src/xrpld/app/rdb/backend/detail/Node.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace detail { /* Need to change TableTypeCount if TableType is modified. */ @@ -436,6 +436,6 @@ bool dbHasSpace(soci::session& session, Config const& config, beast::Journal j); } // namespace detail -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index b789685211..796b030a99 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { class SQLiteDatabaseImp final : public SQLiteDatabase { @@ -789,7 +789,7 @@ SQLiteDatabaseImp::getKBUsedAll() { if (existsLedger()) { - return ripple::getKBUsedAll(lgrdb_->getSession()); + return xrpl::getKBUsedAll(lgrdb_->getSession()); } return 0; @@ -800,7 +800,7 @@ SQLiteDatabaseImp::getKBUsedLedger() { if (existsLedger()) { - return ripple::getKBUsedDB(lgrdb_->getSession()); + return xrpl::getKBUsedDB(lgrdb_->getSession()); } return 0; @@ -814,7 +814,7 @@ SQLiteDatabaseImp::getKBUsedTransaction() if (existsTransaction()) { - return ripple::getKBUsedDB(txdb_->getSession()); + return xrpl::getKBUsedDB(txdb_->getSession()); } return 0; @@ -838,4 +838,4 @@ getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue) return std::make_unique(app, config, jobQueue); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/PeerFinder.cpp b/src/xrpld/app/rdb/detail/PeerFinder.cpp index 7ac0a941e2..0c4b5d355c 100644 --- a/src/xrpld/app/rdb/detail/PeerFinder.cpp +++ b/src/xrpld/app/rdb/detail/PeerFinder.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { void initPeerFinderDB( @@ -249,4 +249,4 @@ savePeerFinderDB( tr.commit(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp index a01f0583f6..37ee2a7703 100644 --- a/src/xrpld/app/rdb/detail/RelationalDatabase.cpp +++ b/src/xrpld/app/rdb/detail/RelationalDatabase.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { extern std::unique_ptr getSQLiteDatabase(Application& app, Config const& config, JobQueue& jobQueue); @@ -42,4 +42,4 @@ RelationalDatabase::init( return std::unique_ptr(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/State.cpp b/src/xrpld/app/rdb/detail/State.cpp index d731c98b40..984c8824f2 100644 --- a/src/xrpld/app/rdb/detail/State.cpp +++ b/src/xrpld/app/rdb/detail/State.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { void initStateDB( @@ -108,4 +108,4 @@ setLastRotated(soci::session& session, LedgerIndex seq) soci::use(seq); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/Vacuum.cpp b/src/xrpld/app/rdb/detail/Vacuum.cpp index 49e86ae281..8423f20992 100644 --- a/src/xrpld/app/rdb/detail/Vacuum.cpp +++ b/src/xrpld/app/rdb/detail/Vacuum.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { bool doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j) @@ -49,4 +49,4 @@ doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j) return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/rdb/detail/Wallet.cpp b/src/xrpld/app/rdb/detail/Wallet.cpp index 7dbaab6ef4..fc4f5ea89b 100644 --- a/src/xrpld/app/rdb/detail/Wallet.cpp +++ b/src/xrpld/app/rdb/detail/Wallet.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { std::unique_ptr makeWalletDB(DatabaseCon::Setup const& setup, beast::Journal j) @@ -284,4 +284,4 @@ voteAmendment( tr.commit(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/apply.h b/src/xrpld/app/tx/apply.h index 2e0cd538f2..d578334c31 100644 --- a/src/xrpld/app/tx/apply.h +++ b/src/xrpld/app/tx/apply.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { class Application; class HashRouter; @@ -138,6 +138,6 @@ applyTransaction( ApplyFlags flags, beast::Journal journal); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/applySteps.h b/src/xrpld/app/tx/applySteps.h index 6542a8d6ec..c0c530f3ac 100644 --- a/src/xrpld/app/tx/applySteps.h +++ b/src/xrpld/app/tx/applySteps.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class STTx; @@ -347,6 +347,6 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); ApplyResult doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/AMMBid.cpp b/src/xrpld/app/tx/detail/AMMBid.cpp index 47b89417a3..34b2c811c2 100644 --- a/src/xrpld/app/tx/detail/AMMBid.cpp +++ b/src/xrpld/app/tx/detail/AMMBid.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMBid::checkExtraFeatures(PreflightContext const& ctx) @@ -173,7 +173,7 @@ applyBid( { XRPL_ASSERT( ammSle->isFieldPresent(sfAuctionSlot), - "ripple::applyBid : has auction slot"); + "xrpl::applyBid : has auction slot"); if (!ammSle->isFieldPresent(sfAuctionSlot)) return {tecINTERNAL, false}; } @@ -300,7 +300,7 @@ applyBid( { // Price the slot was purchased at. STAmount const pricePurchased = auctionSlot[sfPrice]; - XRPL_ASSERT(timeSlot, "ripple::applyBid : timeSlot is set"); + XRPL_ASSERT(timeSlot, "xrpl::applyBid : timeSlot is set"); auto const fractionUsed = (Number(*timeSlot) + 1) / AUCTION_SLOT_TIME_INTERVALS; auto const fractionRemaining = Number(1) - fractionUsed; @@ -362,4 +362,4 @@ AMMBid::doApply() return result.first; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMBid.h b/src/xrpld/app/tx/detail/AMMBid.h index 25ad118e05..b402e82f9d 100644 --- a/src/xrpld/app/tx/detail/AMMBid.h +++ b/src/xrpld/app/tx/detail/AMMBid.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** AMMBid implements AMM bid Transactor. * This is a mechanism for an AMM instance to auction-off @@ -65,6 +65,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMBID_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMClawback.cpp b/src/xrpld/app/tx/detail/AMMClawback.cpp index ebde91b43d..5eaed55f23 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.cpp +++ b/src/xrpld/app/tx/detail/AMMClawback.cpp @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { std::uint32_t AMMClawback::getFlagsMask(PreflightContext const& ctx) @@ -321,4 +321,4 @@ AMMClawback::equalWithdrawMatchingOneAmount( ctx_.journal); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMClawback.h b/src/xrpld/app/tx/detail/AMMClawback.h index b1283c9427..0615234ffa 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.h +++ b/src/xrpld/app/tx/detail/AMMClawback.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Sandbox; class AMMClawback : public Transactor { @@ -54,6 +54,6 @@ private: STAmount const& amount); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/AMMCreate.cpp b/src/xrpld/app/tx/detail/AMMCreate.cpp index 65357ad197..3a3ce4b1e1 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.cpp +++ b/src/xrpld/app/tx/detail/AMMCreate.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMCreate::checkExtraFeatures(PreflightContext const& ctx) @@ -330,4 +330,4 @@ AMMCreate::doApply() return result.first; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMCreate.h b/src/xrpld/app/tx/detail/AMMCreate.h index 5be2cc264c..da77f79c5e 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.h +++ b/src/xrpld/app/tx/detail/AMMCreate.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** AMMCreate implements Automatic Market Maker(AMM) creation Transactor. * It creates a new AMM instance with two tokens. Any trader, or Liquidity @@ -61,6 +61,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMCREATE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMDelete.cpp b/src/xrpld/app/tx/detail/AMMDelete.cpp index 476b035bc0..a6cfaac586 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.cpp +++ b/src/xrpld/app/tx/detail/AMMDelete.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMDelete::checkExtraFeatures(PreflightContext const& ctx) @@ -53,4 +53,4 @@ AMMDelete::doApply() return ter; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMDelete.h b/src/xrpld/app/tx/detail/AMMDelete.h index af0b33154b..a09b855c7c 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.h +++ b/src/xrpld/app/tx/detail/AMMDelete.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** AMMDelete implements AMM delete transactor. This is a mechanism to * delete AMM in an empty state when the number of LP tokens is 0. @@ -33,6 +33,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMDELETE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMDeposit.cpp b/src/xrpld/app/tx/detail/AMMDeposit.cpp index 3495ef03f5..36399d4e1c 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.cpp +++ b/src/xrpld/app/tx/detail/AMMDeposit.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMDeposit::checkExtraFeatures(PreflightContext const& ctx) @@ -448,7 +448,7 @@ AMMDeposit::applyGuts(Sandbox& sb) { XRPL_ASSERT( newLPTokenBalance > beast::zero, - "ripple::AMMDeposit::applyGuts : valid new LP token balance"); + "xrpl::AMMDeposit::applyGuts : valid new LP token balance"); ammSle->setFieldAmount(sfLPTokenBalance, newLPTokenBalance); // LP depositing into AMM empty state gets the auction slot // and the voting @@ -1008,4 +1008,4 @@ AMMDeposit::equalDepositInEmptyState( tfee); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMDeposit.h b/src/xrpld/app/tx/detail/AMMDeposit.h index fa0610fcd5..7fd50c4c4d 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.h +++ b/src/xrpld/app/tx/detail/AMMDeposit.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Sandbox; @@ -229,6 +229,6 @@ private: std::uint16_t tfee); }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMDEPOSIT_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMVote.cpp b/src/xrpld/app/tx/detail/AMMVote.cpp index ea11f543dd..ca57ce1f8c 100644 --- a/src/xrpld/app/tx/detail/AMMVote.cpp +++ b/src/xrpld/app/tx/detail/AMMVote.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMVote::checkExtraFeatures(PreflightContext const& ctx) @@ -177,7 +177,7 @@ applyVote( XRPL_ASSERT( !ctx_.view().rules().enabled(fixInnerObjTemplate) || ammSle->isFieldPresent(sfAuctionSlot), - "ripple::applyVote : has auction slot"); + "xrpl::applyVote : has auction slot"); // Update the vote entries and the trading/discounted fee. ammSle->setFieldArray(sfVoteSlots, updatedVoteSlots); @@ -224,4 +224,4 @@ AMMVote::doApply() return result.first; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMVote.h b/src/xrpld/app/tx/detail/AMMVote.h index b38beb56bc..1dec046c29 100644 --- a/src/xrpld/app/tx/detail/AMMVote.h +++ b/src/xrpld/app/tx/detail/AMMVote.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** AMMVote implements AMM vote Transactor. * This transactor allows for the TradingFee of the AMM instance be a votable @@ -50,6 +50,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMVOTE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.cpp b/src/xrpld/app/tx/detail/AMMWithdraw.cpp index ac49298920..78da481b95 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.cpp +++ b/src/xrpld/app/tx/detail/AMMWithdraw.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { bool AMMWithdraw::checkExtraFeatures(PreflightContext const& ctx) @@ -891,7 +891,7 @@ AMMWithdraw::equalWithdrawLimit( // LCOV_EXCL_START XRPL_ASSERT( amountWithdraw <= amount, - "ripple::AMMWithdraw::equalWithdrawLimit : maximum amountWithdraw"); + "xrpl::AMMWithdraw::equalWithdrawLimit : maximum amountWithdraw"); // LCOV_EXCL_STOP } else if (amountWithdraw > amount) @@ -1084,4 +1084,4 @@ AMMWithdraw::isWithdrawAll(STTx const& tx) return WithdrawAll::Yes; return WithdrawAll::No; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.h b/src/xrpld/app/tx/detail/AMMWithdraw.h index 871f8e3a21..916621a5d0 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.h +++ b/src/xrpld/app/tx/detail/AMMWithdraw.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class Sandbox; @@ -293,6 +293,6 @@ private: isWithdrawAll(STTx const& tx); }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_AMMWITHDRAW_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/ApplyContext.cpp b/src/xrpld/app/tx/detail/ApplyContext.cpp index 4a7f72e2e3..d364950b44 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.cpp +++ b/src/xrpld/app/tx/detail/ApplyContext.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { ApplyContext::ApplyContext( Application& app_, @@ -133,7 +133,7 @@ ApplyContext::checkInvariants(TER const result, XRPAmount const fee) { XRPL_ASSERT( isTesSuccess(result) || isTecClaim(result), - "ripple::ApplyContext::checkInvariants : is tesSUCCESS or tecCLAIM"); + "xrpl::ApplyContext::checkInvariants : is tesSUCCESS or tecCLAIM"); return checkInvariantsHelper( result, @@ -141,4 +141,4 @@ ApplyContext::checkInvariants(TER const result, XRPAmount const fee) std::make_index_sequence::value>{}); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/src/xrpld/app/tx/detail/ApplyContext.h index e045189146..4ae2f11a85 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/src/xrpld/app/tx/detail/ApplyContext.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { /** State information when applying a tx. */ class ApplyContext @@ -140,6 +140,6 @@ private: std::optional parentBatchId_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/xrpld/app/tx/detail/Batch.cpp index 8bf0c7fe02..277bd4e3b7 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/xrpld/app/tx/detail/Batch.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** * @brief Calculates the total base fee for a batch transaction. @@ -78,7 +78,7 @@ Batch::calculateBaseFee(ReadView const& view, STTx const& tx) } // LCOV_EXCL_STOP - auto const fee = ripple::calculateBaseFee(view, stx); + auto const fee = xrpl::calculateBaseFee(view, stx); // LCOV_EXCL_START if (txnFees > maxAmount - fee) { @@ -306,7 +306,7 @@ Batch::preflight(PreflightContext const& ctx) } auto const innerAccount = stx.getAccountID(sfAccount); - if (auto const preflightResult = ripple::preflight( + if (auto const preflightResult = xrpl::preflight( ctx.app, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); preflightResult.ter != tesSUCCESS) { @@ -521,4 +521,4 @@ Batch::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Batch.h b/src/xrpld/app/tx/detail/Batch.h index 7889e91bdc..a8cfeadc6b 100644 --- a/src/xrpld/app/tx/detail/Batch.h +++ b/src/xrpld/app/tx/detail/Batch.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class Batch : public Transactor { @@ -55,6 +55,6 @@ public: }); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/BookTip.cpp b/src/xrpld/app/tx/detail/BookTip.cpp index 09a0091995..d3c8e69e01 100644 --- a/src/xrpld/app/tx/detail/BookTip.cpp +++ b/src/xrpld/app/tx/detail/BookTip.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { BookTip::BookTip(ApplyView& view, Book const& book) : view_(view) @@ -59,4 +59,4 @@ BookTip::step(beast::Journal j) return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/BookTip.h b/src/xrpld/app/tx/detail/BookTip.h index f6d05f1df5..51dc252835 100644 --- a/src/xrpld/app/tx/detail/BookTip.h +++ b/src/xrpld/app/tx/detail/BookTip.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { class Logs; @@ -61,6 +61,6 @@ public: step(beast::Journal j); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CancelCheck.cpp b/src/xrpld/app/tx/detail/CancelCheck.cpp index daf4955d47..b673784655 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.cpp +++ b/src/xrpld/app/tx/detail/CancelCheck.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC CancelCheck::preflight(PreflightContext const& ctx) @@ -101,4 +101,4 @@ CancelCheck::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CancelCheck.h b/src/xrpld/app/tx/detail/CancelCheck.h index 6f0b5a969b..4be696520d 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.h +++ b/src/xrpld/app/tx/detail/CancelCheck.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class CancelCheck : public Transactor { @@ -26,6 +26,6 @@ public: using CheckCancel = CancelCheck; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/xrpld/app/tx/detail/CancelOffer.cpp index 149d7e2d9c..1dc9ad0bde 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/xrpld/app/tx/detail/CancelOffer.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC CancelOffer::preflight(PreflightContext const& ctx) @@ -61,4 +61,4 @@ CancelOffer::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CancelOffer.h b/src/xrpld/app/tx/detail/CancelOffer.h index 3ae6afa935..33af365c4d 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.h +++ b/src/xrpld/app/tx/detail/CancelOffer.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class CancelOffer : public Transactor { @@ -28,6 +28,6 @@ public: using OfferCancel = CancelOffer; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CashCheck.cpp b/src/xrpld/app/tx/detail/CashCheck.cpp index 4010aa0714..c32b7dfe4e 100644 --- a/src/xrpld/app/tx/detail/CashCheck.cpp +++ b/src/xrpld/app/tx/detail/CashCheck.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { NotTEC CashCheck::preflight(PreflightContext const& ctx) @@ -475,4 +475,4 @@ CashCheck::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CashCheck.h b/src/xrpld/app/tx/detail/CashCheck.h index cfa0adbe1f..f27a45a0c4 100644 --- a/src/xrpld/app/tx/detail/CashCheck.h +++ b/src/xrpld/app/tx/detail/CashCheck.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class CashCheck : public Transactor { @@ -26,6 +26,6 @@ public: using CheckCash = CashCheck; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/xrpld/app/tx/detail/Change.cpp index 43c6f7c619..191d91863d 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/xrpld/app/tx/detail/Change.cpp @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { template <> NotTEC @@ -131,7 +131,7 @@ Change::doApply() return applyUNLModify(); // LCOV_EXCL_START default: - UNREACHABLE("ripple::Change::doApply : invalid transaction type"); + UNREACHABLE("xrpl::Change::doApply : invalid transaction type"); return tefFAILURE; // LCOV_EXCL_STOP } @@ -141,7 +141,7 @@ void Change::preCompute() { XRPL_ASSERT( - account_ == beast::zero, "ripple::Change::preCompute : zero account"); + account_ == beast::zero, "xrpl::Change::preCompute : zero account"); } TER @@ -407,4 +407,4 @@ Change::applyUNLModify() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Change.h b/src/xrpld/app/tx/detail/Change.h index 9ff37b1515..4d7b76ed78 100644 --- a/src/xrpld/app/tx/detail/Change.h +++ b/src/xrpld/app/tx/detail/Change.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Change : public Transactor { @@ -43,6 +43,6 @@ using EnableAmendment = Change; using SetFee = Change; using UNLModify = Change; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Clawback.cpp b/src/xrpld/app/tx/detail/Clawback.cpp index 0d153771b5..24b1603aab 100644 --- a/src/xrpld/app/tx/detail/Clawback.cpp +++ b/src/xrpld/app/tx/detail/Clawback.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { template static NotTEC @@ -270,4 +270,4 @@ Clawback::doApply() ctx_.tx[sfAmount].asset().value()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Clawback.h b/src/xrpld/app/tx/detail/Clawback.h index 95ebd0e74c..8db93fcc01 100644 --- a/src/xrpld/app/tx/detail/Clawback.h +++ b/src/xrpld/app/tx/detail/Clawback.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Clawback : public Transactor { @@ -27,6 +27,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CreateCheck.cpp b/src/xrpld/app/tx/detail/CreateCheck.cpp index df859c4364..11613a5855 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.cpp +++ b/src/xrpld/app/tx/detail/CreateCheck.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC CreateCheck::preflight(PreflightContext const& ctx) @@ -214,4 +214,4 @@ CreateCheck::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CreateCheck.h b/src/xrpld/app/tx/detail/CreateCheck.h index b8b0add2f9..ac735eecb0 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.h +++ b/src/xrpld/app/tx/detail/CreateCheck.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class CreateCheck : public Transactor { @@ -26,6 +26,6 @@ public: using CheckCreate = CreateCheck; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/xrpld/app/tx/detail/CreateOffer.cpp index fe96436f2f..f81afecd55 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/xrpld/app/tx/detail/CreateOffer.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { TxConsequences CreateOffer::makeTxConsequences(PreflightContext const& ctx) { @@ -216,7 +216,7 @@ CreateOffer::checkAcceptAsset( // Only valid for custom currencies XRPL_ASSERT( !isXRP(issue.currency), - "ripple::CreateOffer::checkAcceptAsset : input is not XRP"); + "xrpl::CreateOffer::checkAcceptAsset : input is not XRP"); auto const issuerAccount = view.read(keylet::account(issue.account)); @@ -460,7 +460,7 @@ CreateOffer::flowCross( afterCross.out -= result.actualAmountOut; XRPL_ASSERT( afterCross.out >= beast::zero, - "ripple::CreateOffer::flowCross : minimum offer"); + "xrpl::CreateOffer::flowCross : minimum offer"); if (afterCross.out < beast::zero) afterCross.out.clear(); afterCross.in = mulRound( @@ -673,7 +673,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) // or give a tec. XRPL_ASSERT( result == tesSUCCESS || isTecClaim(result), - "ripple::CreateOffer::applyGuts : result is tesSUCCESS or " + "xrpl::CreateOffer::applyGuts : result is tesSUCCESS or " "tecCLAIM"); if (auto stream = j_.trace()) @@ -694,10 +694,10 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) XRPL_ASSERT( saTakerGets.issue() == place_offer.in.issue(), - "ripple::CreateOffer::applyGuts : taker gets issue match"); + "xrpl::CreateOffer::applyGuts : taker gets issue match"); XRPL_ASSERT( saTakerPays.issue() == place_offer.out.issue(), - "ripple::CreateOffer::applyGuts : taker pays issue match"); + "xrpl::CreateOffer::applyGuts : taker pays issue match"); if (takerAmount != place_offer) crossed = true; @@ -727,7 +727,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) XRPL_ASSERT( saTakerPays > zero && saTakerGets > zero, - "ripple::CreateOffer::applyGuts : taker pays and gets positive"); + "xrpl::CreateOffer::applyGuts : taker pays and gets positive"); if (result != tesSUCCESS) { @@ -907,4 +907,4 @@ CreateOffer::doApply() return result.first; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CreateOffer.h b/src/xrpld/app/tx/detail/CreateOffer.h index 9593b9d1ad..5aaa60c20e 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.h +++ b/src/xrpld/app/tx/detail/CreateOffer.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class PaymentSandbox; class Sandbox; @@ -78,6 +78,6 @@ private: using OfferCreate = CreateOffer; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/CreateTicket.cpp b/src/xrpld/app/tx/detail/CreateTicket.cpp index 1a49209faf..6432d1b3d5 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.cpp +++ b/src/xrpld/app/tx/detail/CreateTicket.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { TxConsequences CreateTicket::makeTxConsequences(PreflightContext const& ctx) @@ -125,4 +125,4 @@ CreateTicket::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/CreateTicket.h b/src/xrpld/app/tx/detail/CreateTicket.h index da5083c838..a41c7e2b1f 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.h +++ b/src/xrpld/app/tx/detail/CreateTicket.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class CreateTicket : public Transactor { @@ -65,6 +65,6 @@ public: using TicketCreate = CreateTicket; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Credentials.cpp b/src/xrpld/app/tx/detail/Credentials.cpp index 274a25e0c6..6d106535a2 100644 --- a/src/xrpld/app/tx/detail/Credentials.cpp +++ b/src/xrpld/app/tx/detail/Credentials.cpp @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { /* Credentials @@ -353,4 +353,4 @@ CredentialAccept::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Credentials.h b/src/xrpld/app/tx/detail/Credentials.h index 704730e6ee..6723a2f0e4 100644 --- a/src/xrpld/app/tx/detail/Credentials.h +++ b/src/xrpld/app/tx/detail/Credentials.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class CredentialCreate : public Transactor { @@ -75,6 +75,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/DID.cpp b/src/xrpld/app/tx/detail/DID.cpp index b17d4ef1b7..e9b23a15eb 100644 --- a/src/xrpld/app/tx/detail/DID.cpp +++ b/src/xrpld/app/tx/detail/DID.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /* DID @@ -194,4 +194,4 @@ DIDDelete::doApply() return deleteSLE(ctx_, keylet::did(account_), account_); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/DID.h b/src/xrpld/app/tx/detail/DID.h index 9e9de22f84..934a9c9e6f 100644 --- a/src/xrpld/app/tx/detail/DID.h +++ b/src/xrpld/app/tx/detail/DID.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class DIDSet : public Transactor { @@ -49,6 +49,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/DelegateSet.cpp b/src/xrpld/app/tx/detail/DelegateSet.cpp index f8dd696fad..8c64547ae1 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.cpp +++ b/src/xrpld/app/tx/detail/DelegateSet.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC DelegateSet::preflight(PreflightContext const& ctx) @@ -129,4 +129,4 @@ DelegateSet::deleteDelegate( return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/DelegateSet.h b/src/xrpld/app/tx/detail/DelegateSet.h index 2f340efb3b..1f9bc02944 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.h +++ b/src/xrpld/app/tx/detail/DelegateSet.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class DelegateSet : public Transactor { @@ -32,6 +32,6 @@ public: beast::Journal j); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/DeleteAccount.cpp b/src/xrpld/app/tx/detail/DeleteAccount.cpp index c9fd0cc75e..422ed37e2f 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.cpp +++ b/src/xrpld/app/tx/detail/DeleteAccount.cpp @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { bool DeleteAccount::checkExtraFeatures(PreflightContext const& ctx) @@ -237,8 +237,7 @@ DeleteAccount::preclaim(PreclaimContext const& ctx) } auto sleAccount = ctx.view.read(keylet::account(account)); - XRPL_ASSERT( - sleAccount, "ripple::DeleteAccount::preclaim : non-null account"); + XRPL_ASSERT(sleAccount, "xrpl::DeleteAccount::preclaim : non-null account"); if (!sleAccount) return terNO_ACCOUNT; @@ -338,13 +337,12 @@ TER DeleteAccount::doApply() { auto src = view().peek(keylet::account(account_)); - XRPL_ASSERT( - src, "ripple::DeleteAccount::doApply : non-null source account"); + XRPL_ASSERT(src, "xrpl::DeleteAccount::doApply : non-null source account"); auto const dstID = ctx_.tx[sfDestination]; auto dst = view().peek(keylet::account(dstID)); XRPL_ASSERT( - dst, "ripple::DeleteAccount::doApply : non-null destination account"); + dst, "xrpl::DeleteAccount::doApply : non-null destination account"); if (!src || !dst) return tefBAD_LEDGER; // LCOV_EXCL_LINE @@ -374,7 +372,7 @@ DeleteAccount::doApply() // LCOV_EXCL_START UNREACHABLE( - "ripple::DeleteAccount::doApply : undeletable item not found " + "xrpl::DeleteAccount::doApply : undeletable item not found " "in preclaim"); JLOG(j_.error()) << "DeleteAccount undeletable item not " "found in preclaim."; @@ -392,7 +390,7 @@ DeleteAccount::doApply() XRPL_ASSERT( (*src)[sfBalance] == XRPAmount(0), - "ripple::DeleteAccount::doApply : source balance is zero"); + "xrpl::DeleteAccount::doApply : source balance is zero"); // If there's still an owner directory associated with the source account // delete it. @@ -413,4 +411,4 @@ DeleteAccount::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/DeleteAccount.h b/src/xrpld/app/tx/detail/DeleteAccount.h index bfab5591a0..357f87d566 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.h +++ b/src/xrpld/app/tx/detail/DeleteAccount.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class DeleteAccount : public Transactor { @@ -32,6 +32,6 @@ public: using AccountDelete = DeleteAccount; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/DeleteOracle.cpp b/src/xrpld/app/tx/detail/DeleteOracle.cpp index d635721b86..df7b737eed 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.cpp +++ b/src/xrpld/app/tx/detail/DeleteOracle.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC DeleteOracle::preflight(PreflightContext const& ctx) @@ -80,4 +80,4 @@ DeleteOracle::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/DeleteOracle.h b/src/xrpld/app/tx/detail/DeleteOracle.h index a9fcd73ec2..48950cfad9 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.h +++ b/src/xrpld/app/tx/detail/DeleteOracle.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Price Oracle is a system that acts as a bridge between @@ -42,6 +42,6 @@ public: using OracleDelete = DeleteOracle; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_DELETEORACLE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/DepositPreauth.cpp b/src/xrpld/app/tx/detail/DepositPreauth.cpp index 069b356e99..057e240fff 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.cpp +++ b/src/xrpld/app/tx/detail/DepositPreauth.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { bool DepositPreauth::checkExtraFeatures(PreflightContext const& ctx) @@ -299,4 +299,4 @@ DepositPreauth::removeFromLedger( return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/DepositPreauth.h b/src/xrpld/app/tx/detail/DepositPreauth.h index 4e0102952c..003d444bf3 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.h +++ b/src/xrpld/app/tx/detail/DepositPreauth.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class DepositPreauth : public Transactor { @@ -34,6 +34,6 @@ public: beast::Journal j); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index e9aad6ad37..4e5f41a427 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { // During an EscrowFinish, the transaction must specify both // a condition and a fulfillment. We track whether that @@ -141,7 +141,7 @@ EscrowCreate::preflight(PreflightContext const& ctx) if (auto const cb = ctx.tx[~sfCondition]) { - using namespace ripple::cryptoconditions; + using namespace xrpl::cryptoconditions; std::error_code ec; @@ -546,7 +546,7 @@ EscrowCreate::doApply() static bool checkCondition(Slice f, Slice c) { - using namespace ripple::cryptoconditions; + using namespace xrpl::cryptoconditions; std::error_code ec; @@ -1072,7 +1072,7 @@ EscrowFinish::doApply() return temDISABLED; // LCOV_EXCL_LINE Rate lockedRate = slep->isFieldPresent(sfTransferRate) - ? ripple::Rate(slep->getFieldU32(sfTransferRate)) + ? xrpl::Rate(slep->getFieldU32(sfTransferRate)) : parityRate; auto const issuer = amount.getIssuer(); bool const createAsset = destID == account_; @@ -1321,4 +1321,4 @@ EscrowCancel::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Escrow.h b/src/xrpld/app/tx/detail/Escrow.h index d2821bc45d..935fb27cd0 100644 --- a/src/xrpld/app/tx/detail/Escrow.h +++ b/src/xrpld/app/tx/detail/Escrow.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class EscrowCreate : public Transactor { @@ -78,6 +78,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index 27c87e074c..dadc5a7d74 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -25,7 +25,7 @@ #include #include -namespace ripple { +namespace xrpl { /* assert(enforce) @@ -525,7 +525,7 @@ AccountRootsDeletedClean::finalize( // assert. XRPL_ASSERT( enforce, - "ripple::AccountRootsDeletedClean::finalize::objectExists : " + "xrpl::AccountRootsDeletedClean::finalize::objectExists : " "account deletion left no objects behind"); return true; } @@ -542,7 +542,7 @@ AccountRootsDeletedClean::finalize( "behind a non-zero balance"; XRPL_ASSERT( enforce, - "ripple::AccountRootsDeletedClean::finalize : " + "xrpl::AccountRootsDeletedClean::finalize : " "deleted account has zero balance"); if (enforce) return false; @@ -554,7 +554,7 @@ AccountRootsDeletedClean::finalize( "behind a non-zero owner count"; XRPL_ASSERT( enforce, - "ripple::AccountRootsDeletedClean::finalize : " + "xrpl::AccountRootsDeletedClean::finalize : " "deleted account has zero owner count"); if (enforce) return false; @@ -796,7 +796,7 @@ TransfersNotFrozen::finalize( // assert. XRPL_ASSERT( enforce, - "ripple::TransfersNotFrozen::finalize : enforce " + "xrpl::TransfersNotFrozen::finalize : enforce " "invariant."); if (enforce) { @@ -820,8 +820,7 @@ TransfersNotFrozen::isValidEntry( std::shared_ptr const& after) { // `after` can never be null, even if the trust line is deleted. - XRPL_ASSERT( - after, "ripple::TransfersNotFrozen::isValidEntry : valid after."); + XRPL_ASSERT(after, "xrpl::TransfersNotFrozen::isValidEntry : valid after."); if (!after) { return false; @@ -877,7 +876,7 @@ TransfersNotFrozen::recordBalance(Issue const& issue, BalanceChange change) { XRPL_ASSERT( change.balanceChangeSign, - "ripple::TransfersNotFrozen::recordBalance : valid trustline " + "xrpl::TransfersNotFrozen::recordBalance : valid trustline " "balance sign."); auto& changes = balanceChanges_[issue]; if (change.balanceChangeSign < 0) @@ -996,7 +995,7 @@ TransfersNotFrozen::validateFrozenState( // The comment above starting with "assert(enforce)" explains this assert. XRPL_ASSERT( enforce, - "ripple::TransfersNotFrozen::validateFrozenState : enforce " + "xrpl::TransfersNotFrozen::validateFrozenState : enforce " "invariant."); if (enforce) @@ -1084,7 +1083,7 @@ ValidNewAccountRoot::finalize( JLOG(j.fatal()) << "Invariant failed: account root created illegally"; return false; -} // namespace ripple +} // namespace xrpl //------------------------------------------------------------------------------ @@ -1486,7 +1485,7 @@ ValidMPTIssuance::finalize( // assert. XRPL_ASSERT_PARTS( enforceCreatedByIssuer, - "ripple::ValidMPTIssuance::finalize", + "xrpl::ValidMPTIssuance::finalize", "no issuer MPToken"); if (enforceCreatedByIssuer) return false; @@ -1598,7 +1597,7 @@ ValidMPTIssuance::finalize( // non-amendment-gated side effects. XRPL_ASSERT_PARTS( !enforceEscrowFinish, - "ripple::ValidMPTIssuance::finalize", + "xrpl::ValidMPTIssuance::finalize", "not escrow finish tx"); return true; } @@ -1811,7 +1810,7 @@ ValidPseudoAccounts::finalize( bool const enforce = view.rules().enabled(featureSingleAssetVault); XRPL_ASSERT( errors_.empty() || enforce, - "ripple::ValidPseudoAccounts::finalize : no bad " + "xrpl::ValidPseudoAccounts::finalize : no bad " "changes or enforce invariant"); if (!errors_.empty()) { @@ -2089,8 +2088,8 @@ ValidAMM::finalizeDEX(bool enforce, beast::Journal const& j) const bool ValidAMM::generalInvariant( - ripple::STTx const& tx, - ripple::ReadView const& view, + xrpl::STTx const& tx, + xrpl::ReadView const& view, ZeroAllowed zeroAllowed, beast::Journal const& j) const { @@ -2135,8 +2134,8 @@ ValidAMM::generalInvariant( bool ValidAMM::finalizeDeposit( - ripple::STTx const& tx, - ripple::ReadView const& view, + xrpl::STTx const& tx, + xrpl::ReadView const& view, bool enforce, beast::Journal const& j) const { @@ -2156,8 +2155,8 @@ ValidAMM::finalizeDeposit( bool ValidAMM::finalizeWithdraw( - ripple::STTx const& tx, - ripple::ReadView const& view, + xrpl::STTx const& tx, + xrpl::ReadView const& view, bool enforce, beast::Journal const& j) const { @@ -2317,7 +2316,7 @@ NoModifiedUnmodifiableFields::finalize( } XRPL_ASSERT( !bad || enforce, - "ripple::NoModifiedUnmodifiableFields::finalize : no bad " + "xrpl::NoModifiedUnmodifiableFields::finalize : no bad " "changes or enforce invariant"); if (bad) { @@ -2657,7 +2656,7 @@ ValidVault::visitEntry( // `isDelete` indicates whether an object is being deleted or modified. XRPL_ASSERT( after != nullptr && (before != nullptr || !isDelete), - "ripple::ValidVault::visitEntry : some object is available"); + "xrpl::ValidVault::visitEntry : some object is available"); // Number balanceDelta will capture the difference (delta) between "before" // state (zero if created) and "after" state (zero if destroyed), so the @@ -2755,7 +2754,7 @@ ValidVault::finalize( "Invariant failed: vault operation succeeded without modifying " "a vault"; XRPL_ASSERT( - enforce, "ripple::ValidVault::finalize : vault noop invariant"); + enforce, "xrpl::ValidVault::finalize : vault noop invariant"); return !enforce; } @@ -2768,7 +2767,7 @@ ValidVault::finalize( "Invariant failed: vault updated by a wrong transaction type"; XRPL_ASSERT( enforce, - "ripple::ValidVault::finalize : illegal vault transaction " + "xrpl::ValidVault::finalize : illegal vault transaction " "invariant"); return !enforce; // Also not a vault operation } @@ -2778,7 +2777,7 @@ ValidVault::finalize( JLOG(j.fatal()) << // "Invariant failed: vault operation updated more than single vault"; XRPL_ASSERT( - enforce, "ripple::ValidVault::finalize : single vault invariant"); + enforce, "xrpl::ValidVault::finalize : single vault invariant"); return !enforce; // That's all we can do here } @@ -2794,7 +2793,7 @@ ValidVault::finalize( "Invariant failed: vault deleted by a wrong transaction type"; XRPL_ASSERT( enforce, - "ripple::ValidVault::finalize : illegal vault deletion " + "xrpl::ValidVault::finalize : illegal vault deletion " "invariant"); return !enforce; // That's all we can do here } @@ -2821,7 +2820,7 @@ ValidVault::finalize( "delete shares"; XRPL_ASSERT( enforce, - "ripple::ValidVault::finalize : shares deletion invariant"); + "xrpl::ValidVault::finalize : shares deletion invariant"); return !enforce; // That's all we can do here } @@ -2852,7 +2851,7 @@ ValidVault::finalize( JLOG(j.fatal()) << "Invariant failed: vault deletion succeeded without " "deleting a vault"; XRPL_ASSERT( - enforce, "ripple::ValidVault::finalize : vault deletion invariant"); + enforce, "xrpl::ValidVault::finalize : vault deletion invariant"); return !enforce; // That's all we can do here } @@ -2860,7 +2859,7 @@ ValidVault::finalize( auto const& afterVault = afterVault_[0]; XRPL_ASSERT( beforeVault_.empty() || beforeVault_[0].key == afterVault.key, - "ripple::ValidVault::finalize : single vault operation"); + "xrpl::ValidVault::finalize : single vault operation"); auto const updatedShares = [&]() -> std::optional { // At this moment we only know that a vault is being updated and there @@ -2901,8 +2900,7 @@ ValidVault::finalize( { JLOG(j.fatal()) << "Invariant failed: updated vault must have shares"; XRPL_ASSERT( - enforce, - "ripple::ValidVault::finalize : vault has shares invariant"); + enforce, "xrpl::ValidVault::finalize : vault has shares invariant"); return !enforce; // That's all we can do here } @@ -2972,7 +2970,7 @@ ValidVault::finalize( JLOG(j.fatal()) << // "Invariant failed: vault created by a wrong transaction type"; XRPL_ASSERT( - enforce, "ripple::ValidVault::finalize : vault creation invariant"); + enforce, "xrpl::ValidVault::finalize : vault creation invariant"); return !enforce; // That's all we can do here } @@ -3007,7 +3005,7 @@ ValidVault::finalize( JLOG(j.fatal()) << "Invariant failed: vault operation succeeded " "without updating shares"; XRPL_ASSERT( - enforce, "ripple::ValidVault::finalize : shares noop invariant"); + enforce, "xrpl::ValidVault::finalize : shares noop invariant"); return !enforce; // That's all we can do here } @@ -3137,7 +3135,7 @@ ValidVault::finalize( XRPL_ASSERT( !beforeVault_.empty(), - "ripple::ValidVault::finalize : set updated a vault"); + "xrpl::ValidVault::finalize : set updated a vault"); auto const& beforeVault = beforeVault_[0]; auto const vaultDeltaAssets = deltaAssets(afterVault.pseudoId); @@ -3189,7 +3187,7 @@ ValidVault::finalize( XRPL_ASSERT( !beforeVault_.empty(), - "ripple::ValidVault::finalize : deposit updated a vault"); + "xrpl::ValidVault::finalize : deposit updated a vault"); auto const& beforeVault = beforeVault_[0]; auto const vaultDeltaAssets = deltaAssets(afterVault.pseudoId); @@ -3316,7 +3314,7 @@ ValidVault::finalize( XRPL_ASSERT( !beforeVault_.empty(), - "ripple::ValidVault::finalize : withdrawal updated a " + "xrpl::ValidVault::finalize : withdrawal updated a " "vault"); auto const& beforeVault = beforeVault_[0]; @@ -3444,7 +3442,7 @@ ValidVault::finalize( XRPL_ASSERT( !beforeVault_.empty(), - "ripple::ValidVault::finalize : clawback updated a vault"); + "xrpl::ValidVault::finalize : clawback updated a vault"); auto const& beforeVault = beforeVault_[0]; if (vaultAsset.native() || @@ -3536,7 +3534,7 @@ ValidVault::finalize( default: // LCOV_EXCL_START UNREACHABLE( - "ripple::ValidVault::finalize : unknown transaction type"); + "xrpl::ValidVault::finalize : unknown transaction type"); return false; // LCOV_EXCL_STOP } @@ -3546,11 +3544,11 @@ ValidVault::finalize( { // The comment at the top of this file starting with "assert(enforce)" // explains this assert. - XRPL_ASSERT(enforce, "ripple::ValidVault::finalize : vault invariants"); + XRPL_ASSERT(enforce, "xrpl::ValidVault::finalize : vault invariants"); return !enforce; } return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/src/xrpld/app/tx/detail/InvariantCheck.h index 09a84b1ab4..b7f91a1c46 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.h +++ b/src/xrpld/app/tx/detail/InvariantCheck.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { class ReadView; @@ -935,7 +935,7 @@ using InvariantChecks = std::tuple< * @return std::tuple of instances that implement the required invariant check * methods * - * @see ripple::InvariantChecker_PROTOTYPE + * @see xrpl::InvariantChecker_PROTOTYPE */ inline InvariantChecks getInvariantChecks() @@ -943,6 +943,6 @@ getInvariantChecks() return InvariantChecks{}; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.cpp b/src/xrpld/app/tx/detail/LedgerStateFix.cpp index ba750152e7..43001e2fbf 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.cpp +++ b/src/xrpld/app/tx/detail/LedgerStateFix.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC LedgerStateFix::preflight(PreflightContext const& ctx) @@ -67,4 +67,4 @@ LedgerStateFix::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.h b/src/xrpld/app/tx/detail/LedgerStateFix.h index 92f6a22303..e1a7f85ecc 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.h +++ b/src/xrpld/app/tx/detail/LedgerStateFix.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LedgerStateFix : public Transactor { @@ -31,6 +31,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp index 26e978697c..32c8fecf20 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp @@ -2,7 +2,7 @@ // #include -namespace ripple { +namespace xrpl { bool LoanBrokerCoverClawback::checkExtraFeatures(PreflightContext const& ctx) @@ -337,4 +337,4 @@ LoanBrokerCoverClawback::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h index 183d3c4479..3c4f997d95 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanBrokerCoverClawback : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp index 4e9e0e9c05..c894df2c2b 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp @@ -2,7 +2,7 @@ // #include -namespace ripple { +namespace xrpl { bool LoanBrokerCoverDeposit::checkExtraFeatures(PreflightContext const& ctx) @@ -120,4 +120,4 @@ LoanBrokerCoverDeposit::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h index 23863b479c..d2f17b1f1c 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanBrokerCoverDeposit : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp index 1fd5a1a471..4c0b3e9af5 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { bool LoanBrokerCoverWithdraw::checkExtraFeatures(PreflightContext const& ctx) @@ -170,4 +170,4 @@ LoanBrokerCoverWithdraw::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h index eab2c9e60f..e0a9a2e51b 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanBrokerCoverWithdraw : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp index f3dd781bb5..76773037fa 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp @@ -2,7 +2,7 @@ // #include -namespace ripple { +namespace xrpl { bool LoanBrokerDelete::checkExtraFeatures(PreflightContext const& ctx) @@ -194,4 +194,4 @@ LoanBrokerDelete::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.h b/src/xrpld/app/tx/detail/LoanBrokerDelete.h index 8466fe4f95..aaea2af81a 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.h +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanBrokerDelete : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp index c2e6effd7a..7b12a6cf39 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp @@ -2,7 +2,7 @@ // #include -namespace ripple { +namespace xrpl { bool LoanBrokerSet::checkExtraFeatures(PreflightContext const& ctx) @@ -212,4 +212,4 @@ LoanBrokerSet::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.h b/src/xrpld/app/tx/detail/LoanBrokerSet.h index 39ed9bcd61..625c0adeb2 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.h +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanBrokerSet : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanDelete.cpp b/src/xrpld/app/tx/detail/LoanDelete.cpp index 87ff4d594b..659f0bba8b 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanDelete.cpp @@ -2,7 +2,7 @@ // #include -namespace ripple { +namespace xrpl { bool LoanDelete::checkExtraFeatures(PreflightContext const& ctx) @@ -117,7 +117,7 @@ LoanDelete::doApply() debtTotalProxy, getVaultScale(vaultSle), Number::towards_zero) == beast::zero, - "ripple::LoanDelete::doApply", + "xrpl::LoanDelete::doApply", "last loan, remaining debt rounds to zero"); debtTotalProxy = 0; } @@ -130,4 +130,4 @@ LoanDelete::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanDelete.h b/src/xrpld/app/tx/detail/LoanDelete.h index cbc37dec14..a1ebad340c 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.h +++ b/src/xrpld/app/tx/detail/LoanDelete.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanDelete : public Transactor { @@ -29,6 +29,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/xrpld/app/tx/detail/LoanManage.cpp index adf08d71bf..2d405f204b 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/xrpld/app/tx/detail/LoanManage.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { bool LoanManage::checkExtraFeatures(PreflightContext const& ctx) @@ -417,4 +417,4 @@ LoanManage::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanManage.h b/src/xrpld/app/tx/detail/LoanManage.h index dde1023cad..7a02c7a16f 100644 --- a/src/xrpld/app/tx/detail/LoanManage.h +++ b/src/xrpld/app/tx/detail/LoanManage.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanManage : public Transactor { @@ -61,6 +61,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index 43f19743a7..d34a766d70 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { bool LoanPay::checkExtraFeatures(PreflightContext const& ctx) @@ -326,7 +326,7 @@ LoanPay::doApply() { XRPL_ASSERT_PARTS( paymentParts.error(), - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "payment error is an error"); return paymentParts.error(); } @@ -338,22 +338,20 @@ LoanPay::doApply() XRPL_ASSERT_PARTS( // It is possible to pay 0 principal paymentParts->principalPaid >= 0, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "valid principal paid"); XRPL_ASSERT_PARTS( // It is possible to pay 0 interest paymentParts->interestPaid >= 0, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "valid interest paid"); XRPL_ASSERT_PARTS( // It should not be possible to pay 0 total paymentParts->principalPaid + paymentParts->interestPaid > 0, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "valid total paid"); XRPL_ASSERT_PARTS( - paymentParts->feePaid >= 0, - "ripple::LoanPay::doApply", - "valid fee paid"); + paymentParts->feePaid >= 0, "xrpl::LoanPay::doApply", "valid fee paid"); if (paymentParts->principalPaid < 0 || paymentParts->interestPaid < 0 || paymentParts->feePaid < 0) @@ -387,7 +385,7 @@ LoanPay::doApply() roundToAsset(asset, totalPaidToVaultRaw, vaultScale, Number::downward); XRPL_ASSERT_PARTS( !asset.integral() || totalPaidToVaultRaw == totalPaidToVaultRounded, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "rounding does nothing for integral asset"); // Account for value changes when reducing the broker's debt: // - Positive value change (from full/late/overpayments): Subtract from the @@ -403,7 +401,7 @@ LoanPay::doApply() (totalPaidToVaultRaw + totalPaidToBroker) == (paymentParts->principalPaid + paymentParts->interestPaid + paymentParts->feePaid), - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "payments add up"); // Decrease LoanBroker Debt by the amount paid, add the Loan value change @@ -411,7 +409,7 @@ LoanPay::doApply() // increasing the debt XRPL_ASSERT_PARTS( isRounded(asset, totalPaidToVaultForDebt, loanScale), - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "totalPaidToVaultForDebt rounding good"); // Despite our best efforts, it's possible for rounding errors to accumulate // in the loan broker's debt total. This is because the broker may have more @@ -435,7 +433,7 @@ LoanPay::doApply() { XRPL_ASSERT_PARTS( assetsAvailableBefore == pseudoAccountBalanceBefore, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "vault pseudo balance agrees before"); assetsAvailableProxy += totalPaidToVaultRounded; @@ -443,7 +441,7 @@ LoanPay::doApply() XRPL_ASSERT_PARTS( *assetsAvailableProxy <= *assetsTotalProxy, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "assets available must not be greater than assets outstanding"); if (*assetsAvailableProxy > *assetsTotalProxy) @@ -463,7 +461,7 @@ LoanPay::doApply() // Move funds XRPL_ASSERT_PARTS( totalPaidToVaultRounded + totalPaidToBroker <= amount, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "amount is sufficient"); if (!sendBrokerFeeToOwner) @@ -541,7 +539,7 @@ LoanPay::doApply() j_); XRPL_ASSERT_PARTS( assetsAvailableAfter == pseudoAccountBalanceAfter, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "vault pseudo balance agrees after"); #if !NDEBUG @@ -564,33 +562,33 @@ LoanPay::doApply() XRPL_ASSERT_PARTS( accountBalanceBefore + vaultBalanceBefore + brokerBalanceBefore == accountBalanceAfter + vaultBalanceAfter + brokerBalanceAfter, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "funds are conserved (with rounding)"); XRPL_ASSERT_PARTS( accountBalanceAfter >= beast::zero, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "positive account balance"); XRPL_ASSERT_PARTS( accountBalanceAfter < accountBalanceBefore || account_ == asset.getIssuer(), - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "account balance decreased"); XRPL_ASSERT_PARTS( vaultBalanceAfter >= beast::zero && brokerBalanceAfter >= beast::zero, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "positive vault and broker balances"); XRPL_ASSERT_PARTS( vaultBalanceAfter >= vaultBalanceBefore, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "vault balance did not decrease"); XRPL_ASSERT_PARTS( brokerBalanceAfter >= brokerBalanceBefore, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "broker balance did not decrease"); XRPL_ASSERT_PARTS( vaultBalanceAfter > vaultBalanceBefore || brokerBalanceAfter > brokerBalanceBefore, - "ripple::LoanPay::doApply", + "xrpl::LoanPay::doApply", "vault and/or broker balance increased"); #endif @@ -599,4 +597,4 @@ LoanPay::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanPay.h b/src/xrpld/app/tx/detail/LoanPay.h index 3f8eb16d04..f951fdad5f 100644 --- a/src/xrpld/app/tx/detail/LoanPay.h +++ b/src/xrpld/app/tx/detail/LoanPay.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class LoanPay : public Transactor { @@ -35,6 +35,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index 756ea53fc1..e8fe76a48f 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { bool LoanSet::checkExtraFeatures(PreflightContext const& ctx) @@ -50,8 +50,8 @@ LoanSet::preflight(PreflightContext const& ctx) if (counterPartySig) { - if (auto const ret = ripple::detail::preflightCheckSigningKey( - *counterPartySig, ctx.j)) + if (auto const ret = + xrpl::detail::preflightCheckSigningKey(*counterPartySig, ctx.j)) return ret; } @@ -97,7 +97,7 @@ LoanSet::preflight(PreflightContext const& ctx) // Copied from preflight2 if (counterPartySig) { - if (auto const ret = ripple::detail::preflightCheckSimulateKeys( + if (auto const ret = xrpl::detail::preflightCheckSimulateKeys( ctx.flags, *counterPartySig, ctx.j)) return *ret; } @@ -496,7 +496,7 @@ LoanSet::doApply() XRPL_ASSERT_PARTS( borrower == account_ || borrower == counterparty, - "ripple::LoanSet::doApply", + "xrpl::LoanSet::doApply", "borrower signed transaction"); if (auto const ter = addEmptyHolding( view, @@ -521,7 +521,7 @@ LoanSet::doApply() // The owner may have deleted their MPT / line at some point. XRPL_ASSERT_PARTS( brokerOwner == account_ || brokerOwner == counterparty, - "ripple::LoanSet::doApply", + "xrpl::LoanSet::doApply", "broker owner signed transaction"); if (auto const ter = addEmptyHolding( @@ -600,7 +600,7 @@ LoanSet::doApply() vaultTotalProxy += state.interestDue; XRPL_ASSERT_PARTS( *vaultAvailableProxy <= *vaultTotalProxy, - "ripple::LoanSet::doApply", + "xrpl::LoanSet::doApply", "assets available must not be greater than assets outstanding"); view.update(vaultSle); @@ -629,4 +629,4 @@ LoanSet::doApply() //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/LoanSet.h b/src/xrpld/app/tx/detail/LoanSet.h index 91f3960891..d3853fbbdd 100644 --- a/src/xrpld/app/tx/detail/LoanSet.h +++ b/src/xrpld/app/tx/detail/LoanSet.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { class LoanSet : public Transactor { @@ -54,6 +54,6 @@ public: //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp index b6eaacb372..a563849a0b 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp +++ b/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { std::uint32_t MPTokenAuthorize::getFlagsMask(PreflightContext const& ctx) @@ -174,4 +174,4 @@ MPTokenAuthorize::doApply() tx[~sfHolder]); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.h b/src/xrpld/app/tx/detail/MPTokenAuthorize.h index 0bac2f1843..6c0ade324c 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.h +++ b/src/xrpld/app/tx/detail/MPTokenAuthorize.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { struct MPTAuthorizeArgs { @@ -43,6 +43,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp index 05b1720d3d..913c7cf53c 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { bool MPTokenIssuanceCreate::checkExtraFeatures(PreflightContext const& ctx) @@ -161,4 +161,4 @@ MPTokenIssuanceCreate::doApply() return result ? tesSUCCESS : result.error(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h index bff41c9180..5b5268265c 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { struct MPTCreateArgs { @@ -47,6 +47,6 @@ public: create(ApplyView& view, beast::Journal journal, MPTCreateArgs const& args); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp index 5b20a5a4b3..58b3cbea4f 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { std::uint32_t MPTokenIssuanceDestroy::getFlagsMask(PreflightContext const& ctx) @@ -60,4 +60,4 @@ MPTokenIssuanceDestroy::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h index a764ecc652..5f59c9b1bd 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class MPTokenIssuanceDestroy : public Transactor { @@ -27,6 +27,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp index d46a7a2add..578e5f6564 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { bool MPTokenIssuanceSet::checkExtraFeatures(PreflightContext const& ctx) @@ -337,4 +337,4 @@ MPTokenIssuanceSet::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h index bc5d390f97..a687a37b47 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h +++ b/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class MPTokenIssuanceSet : public Transactor { @@ -33,6 +33,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp index 2af0abfdac..f3205f6df3 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp +++ b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { std::uint32_t NFTokenAcceptOffer::getFlagsMask(PreflightContext const& ctx) @@ -551,4 +551,4 @@ NFTokenAcceptOffer::doApply() return tecINTERNAL; // LCOV_EXCL_LINE } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h index 4bc429fcfc..83cd71b734 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenAcceptOffer : public Transactor { @@ -45,6 +45,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.cpp b/src/xrpld/app/tx/detail/NFTokenBurn.cpp index 1e1d19679b..755e9e52c5 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.cpp +++ b/src/xrpld/app/tx/detail/NFTokenBurn.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC NFTokenBurn::preflight(PreflightContext const& ctx) @@ -90,4 +90,4 @@ NFTokenBurn::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.h b/src/xrpld/app/tx/detail/NFTokenBurn.h index 5a3e530c8c..5425f0902d 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.h +++ b/src/xrpld/app/tx/detail/NFTokenBurn.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenBurn : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp b/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp index 45b93b64d6..94512b5e66 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp +++ b/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { std::uint32_t NFTokenCancelOffer::getFlagsMask(PreflightContext const& ctx) @@ -93,4 +93,4 @@ NFTokenCancelOffer::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h b/src/xrpld/app/tx/detail/NFTokenCancelOffer.h index 98444e21d8..13a6ecc065 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenCancelOffer.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenCancelOffer : public Transactor { @@ -27,6 +27,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp b/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp index 3b8758f25d..00e69ccc9f 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp +++ b/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { std::uint32_t NFTokenCreateOffer::getFlagsMask(PreflightContext const& ctx) @@ -82,4 +82,4 @@ NFTokenCreateOffer::doApply() ctx_.tx.getFlags()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h b/src/xrpld/app/tx/detail/NFTokenCreateOffer.h index 4dd1ff93f1..704b253924 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h +++ b/src/xrpld/app/tx/detail/NFTokenCreateOffer.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenCreateOffer : public Transactor { @@ -27,6 +27,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenMint.cpp b/src/xrpld/app/tx/detail/NFTokenMint.cpp index 9a8d828215..fbba92b264 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.cpp +++ b/src/xrpld/app/tx/detail/NFTokenMint.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { static std::uint16_t extractNFTokenFlagsFromTxFlags(std::uint32_t txFlags) @@ -154,7 +154,7 @@ NFTokenMint::createNFTokenID( ptr += sizeof(tokenSeq); XRPL_ASSERT( std::distance(buf.data(), ptr) == buf.size(), - "ripple::NFTokenMint::createNFTokenID : data size matches the buffer"); + "xrpl::NFTokenMint::createNFTokenID : data size matches the buffer"); return uint256::fromVoid(buf.data()); } @@ -325,4 +325,4 @@ NFTokenMint::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenMint.h b/src/xrpld/app/tx/detail/NFTokenMint.h index a4b8fb6fa3..a3b43b8269 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.h +++ b/src/xrpld/app/tx/detail/NFTokenMint.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenMint : public Transactor { @@ -42,6 +42,6 @@ public: std::uint32_t tokenSeq); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenModify.cpp b/src/xrpld/app/tx/detail/NFTokenModify.cpp index 392d837c46..8ecf8de676 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.cpp +++ b/src/xrpld/app/tx/detail/NFTokenModify.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC NFTokenModify::preflight(PreflightContext const& ctx) @@ -59,4 +59,4 @@ NFTokenModify::doApply() return nft::changeTokenURI(view(), owner, nftokenID, ctx_.tx[~sfURI]); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenModify.h b/src/xrpld/app/tx/detail/NFTokenModify.h index 0058b3a8ed..4353c3d58b 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.h +++ b/src/xrpld/app/tx/detail/NFTokenModify.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class NFTokenModify : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.cpp b/src/xrpld/app/tx/detail/NFTokenUtils.cpp index db2b00cb2c..c737855840 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.cpp +++ b/src/xrpld/app/tx/detail/NFTokenUtils.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace nft { @@ -167,7 +167,7 @@ getPageForToken( auto np = std::make_shared(keylet::nftpage(base, tokenIDForNewPage)); XRPL_ASSERT( np->key() > base.key, - "ripple::nft::getPageForToken : valid NFT page index"); + "xrpl::nft::getPageForToken : valid NFT page index"); np->setFieldArray(sfNFTokens, narr); np->setFieldH256(sfNextPageMin, cp->key()); @@ -213,7 +213,7 @@ changeTokenURI( ApplyView& view, AccountID const& owner, uint256 const& nftokenID, - std::optional const& uri) + std::optional const& uri) { std::shared_ptr const page = locatePage(view, owner, nftokenID); @@ -247,7 +247,7 @@ insertToken(ApplyView& view, AccountID owner, STObject&& nft) { XRPL_ASSERT( nft.isFieldPresent(sfNFTokenID), - "ripple::nft::insertToken : has NFT token"); + "xrpl::nft::insertToken : has NFT token"); // First, we need to locate the page the NFT belongs to, creating it // if necessary. This operation may fail if it is impossible to insert @@ -789,7 +789,7 @@ repairNFTokenDirectoryLinks(ApplyView& view, AccountID const& owner) XRPL_ASSERT( nextPage, - "ripple::nft::repairNFTokenDirectoryLinks : next page is available"); + "xrpl::nft::repairNFTokenDirectoryLinks : next page is available"); if (nextPage->isFieldPresent(sfNextPageMin)) { didRepair = true; @@ -887,7 +887,7 @@ tokenOfferCreatePreclaim( { auto const root = view.read(keylet::account(nftIssuer)); XRPL_ASSERT( - root, "ripple::nft::tokenOfferCreatePreclaim : non-null account"); + root, "xrpl::nft::tokenOfferCreatePreclaim : non-null account"); if (auto minter = (*root)[~sfNFTokenMinter]; minter != acctID) return tefNFTOKEN_IS_NOT_TRANSFERABLE; @@ -1035,14 +1035,14 @@ checkTrustlineAuthorized( // Only valid for custom currencies XRPL_ASSERT( !isXRP(issue.currency), - "ripple::nft::checkTrustlineAuthorized : valid to check."); + "xrpl::nft::checkTrustlineAuthorized : valid to check."); if (view.rules().enabled(fixEnforceNFTokenTrustlineV2)) { auto const issuerAccount = view.read(keylet::account(issue.account)); if (!issuerAccount) { - JLOG(j.debug()) << "ripple::nft::checkTrustlineAuthorized: can't " + JLOG(j.debug()) << "xrpl::nft::checkTrustlineAuthorized: can't " "receive IOUs from non-existent issuer: " << to_string(issue.account); @@ -1091,14 +1091,14 @@ checkTrustlineDeepFrozen( // Only valid for custom currencies XRPL_ASSERT( !isXRP(issue.currency), - "ripple::nft::checkTrustlineDeepFrozen : valid to check."); + "xrpl::nft::checkTrustlineDeepFrozen : valid to check."); if (view.rules().enabled(featureDeepFreeze)) { auto const issuerAccount = view.read(keylet::account(issue.account)); if (!issuerAccount) { - JLOG(j.debug()) << "ripple::nft::checkTrustlineDeepFrozen: can't " + JLOG(j.debug()) << "xrpl::nft::checkTrustlineDeepFrozen: can't " "receive IOUs from non-existent issuer: " << to_string(issue.account); @@ -1136,4 +1136,4 @@ checkTrustlineDeepFrozen( } } // namespace nft -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.h b/src/xrpld/app/tx/detail/NFTokenUtils.h index 0294724b51..640f12f9d2 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.h +++ b/src/xrpld/app/tx/detail/NFTokenUtils.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace nft { @@ -91,7 +91,7 @@ changeTokenURI( ApplyView& view, AccountID const& owner, uint256 const& nftokenID, - std::optional const& uri); + std::optional const& uri); /** Preflight checks shared by NFTokenCreateOffer and NFTokenMint */ NotTEC @@ -149,6 +149,6 @@ checkTrustlineDeepFrozen( } // namespace nft -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_IMPL_DETAILS_NFTOKENUTILS_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/Offer.h b/src/xrpld/app/tx/detail/Offer.h index 64bc3f4cbf..b04049b657 100644 --- a/src/xrpld/app/tx/detail/Offer.h +++ b/src/xrpld/app/tx/detail/Offer.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { template class TOfferBase @@ -208,7 +208,7 @@ TOffer::setFieldAmounts() { // LCOV_EXCL_START #ifdef _MSC_VER - UNREACHABLE("ripple::TOffer::setFieldAmounts : must be specialized"); + UNREACHABLE("xrpl::TOffer::setFieldAmounts : must be specialized"); #else static_assert(sizeof(TOut) == -1, "Must be specialized"); #endif @@ -319,6 +319,6 @@ operator<<(std::ostream& os, TOffer const& offer) return os << offer.id(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/OfferStream.cpp b/src/xrpld/app/tx/detail/OfferStream.cpp index 93a26f71da..49e45976eb 100644 --- a/src/xrpld/app/tx/detail/OfferStream.cpp +++ b/src/xrpld/app/tx/detail/OfferStream.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace { bool @@ -37,7 +37,7 @@ TOfferStreamBase::TOfferStreamBase( , counter_(counter) { XRPL_ASSERT( - validBook_, "ripple::TOfferStreamBase::TOfferStreamBase : valid book"); + validBook_, "xrpl::TOfferStreamBase::TOfferStreamBase : valid book"); } // Handle the case where a directory item with no corresponding ledger entry @@ -403,4 +403,4 @@ template class TOfferStreamBase; template class TOfferStreamBase; template class TOfferStreamBase; template class TOfferStreamBase; -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/OfferStream.h b/src/xrpld/app/tx/detail/OfferStream.h index 3969cfb48f..cab5f1384d 100644 --- a/src/xrpld/app/tx/detail/OfferStream.h +++ b/src/xrpld/app/tx/detail/OfferStream.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { template class TOfferStreamBase @@ -174,6 +174,6 @@ public: return permToRemove_; } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/xrpld/app/tx/detail/PayChan.cpp index 40e760e5f5..163ea802a8 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/xrpld/app/tx/detail/PayChan.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { /* PaymentChannel @@ -136,7 +136,7 @@ closeChannel( XRPL_ASSERT( (*slep)[sfAmount] >= (*slep)[sfBalance], - "ripple::closeChannel : minimum channel amount"); + "xrpl::closeChannel : minimum channel amount"); (*sle)[sfBalance] = (*sle)[sfBalance] + (*slep)[sfAmount] - (*slep)[sfBalance]; adjustOwnerCount(view, sle, -1, j); @@ -527,7 +527,7 @@ PayChanClaim::doApply() XRPAmount const reqDelta = reqBalance - chanBalance; XRPL_ASSERT( reqDelta >= beast::zero, - "ripple::PayChanClaim::doApply : minimum balance delta"); + "xrpl::PayChanClaim::doApply : minimum balance delta"); (*sled)[sfBalance] = (*sled)[sfBalance] + reqDelta; ctx_.view().update(sled); ctx_.view().update(slep); @@ -562,4 +562,4 @@ PayChanClaim::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/PayChan.h b/src/xrpld/app/tx/detail/PayChan.h index a68cae49f4..f42e9549b3 100644 --- a/src/xrpld/app/tx/detail/PayChan.h +++ b/src/xrpld/app/tx/detail/PayChan.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class PayChanCreate : public Transactor { @@ -81,6 +81,6 @@ public: using PaymentChannelClaim = PayChanClaim; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/xrpld/app/tx/detail/Payment.cpp index 56aeb1b0aa..7a14cecc2d 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/xrpld/app/tx/detail/Payment.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { TxConsequences Payment::makeTxConsequences(PreflightContext const& ctx) @@ -569,7 +569,7 @@ Payment::doApply() return res; } - XRPL_ASSERT(dstAmount.native(), "ripple::Payment::doApply : amount is XRP"); + XRPL_ASSERT(dstAmount.native(), "xrpl::Payment::doApply : amount is XRP"); // Direct XRP payment. @@ -659,4 +659,4 @@ Payment::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Payment.h b/src/xrpld/app/tx/detail/Payment.h index f41326ecf6..30c9a9e326 100644 --- a/src/xrpld/app/tx/detail/Payment.h +++ b/src/xrpld/app/tx/detail/Payment.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Payment : public Transactor { @@ -42,6 +42,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp b/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp index 08bf778065..6301d6f892 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp +++ b/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp @@ -3,7 +3,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC PermissionedDomainDelete::preflight(PreflightContext const& ctx) @@ -26,7 +26,7 @@ PermissionedDomainDelete::preclaim(PreclaimContext const& ctx) XRPL_ASSERT( sleDomain->isFieldPresent(sfOwner) && ctx.tx.isFieldPresent(sfAccount), - "ripple::PermissionedDomainDelete::preclaim : required fields present"); + "xrpl::PermissionedDomainDelete::preclaim : required fields present"); if (sleDomain->getAccountID(sfOwner) != ctx.tx.getAccountID(sfAccount)) return tecNO_PERMISSION; @@ -39,7 +39,7 @@ PermissionedDomainDelete::doApply() { XRPL_ASSERT( ctx_.tx.isFieldPresent(sfDomainID), - "ripple::PermissionedDomainDelete::doApply : required field present"); + "xrpl::PermissionedDomainDelete::doApply : required field present"); auto const slePd = view().peek({ltPERMISSIONED_DOMAIN, ctx_.tx.at(sfDomainID)}); @@ -57,11 +57,11 @@ PermissionedDomainDelete::doApply() auto const ownerSle = view().peek(keylet::account(account_)); XRPL_ASSERT( ownerSle && ownerSle->getFieldU32(sfOwnerCount) > 0, - "ripple::PermissionedDomainDelete::doApply : nonzero owner count"); + "xrpl::PermissionedDomainDelete::doApply : nonzero owner count"); adjustOwnerCount(view(), ownerSle, -1, ctx_.journal); view().erase(slePd); return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h b/src/xrpld/app/tx/detail/PermissionedDomainDelete.h index 7ea0681279..3ae10a739f 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h +++ b/src/xrpld/app/tx/detail/PermissionedDomainDelete.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class PermissionedDomainDelete : public Transactor { @@ -25,6 +25,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp b/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp index d73d9f7322..3417f1fb0a 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp +++ b/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { bool PermissionedDomainSet::checkExtraFeatures(PreflightContext const& ctx) @@ -123,4 +123,4 @@ PermissionedDomainSet::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.h b/src/xrpld/app/tx/detail/PermissionedDomainSet.h index 6df3448e10..fde06232a5 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.h +++ b/src/xrpld/app/tx/detail/PermissionedDomainSet.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class PermissionedDomainSet : public Transactor { @@ -28,6 +28,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/SetAccount.cpp b/src/xrpld/app/tx/detail/SetAccount.cpp index e860eca22d..efdf63042c 100644 --- a/src/xrpld/app/tx/detail/SetAccount.cpp +++ b/src/xrpld/app/tx/detail/SetAccount.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { TxConsequences SetAccount::makeTxConsequences(PreflightContext const& ctx) @@ -640,4 +640,4 @@ SetAccount::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SetAccount.h b/src/xrpld/app/tx/detail/SetAccount.h index 4c310b7fd1..fb8b4a0ccd 100644 --- a/src/xrpld/app/tx/detail/SetAccount.h +++ b/src/xrpld/app/tx/detail/SetAccount.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class SetAccount : public Transactor { @@ -37,6 +37,6 @@ public: using AccountSet = SetAccount; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/SetOracle.cpp b/src/xrpld/app/tx/detail/SetOracle.cpp index 453d799b0d..10d40b7859 100644 --- a/src/xrpld/app/tx/detail/SetOracle.cpp +++ b/src/xrpld/app/tx/detail/SetOracle.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { static inline std::pair tokenPairKey(STObject const& pair) @@ -310,4 +310,4 @@ SetOracle::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SetOracle.h b/src/xrpld/app/tx/detail/SetOracle.h index 5b69d80214..c1c9a3d3fb 100644 --- a/src/xrpld/app/tx/detail/SetOracle.h +++ b/src/xrpld/app/tx/detail/SetOracle.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { /** Price Oracle is a system that acts as a bridge between @@ -35,6 +35,6 @@ public: using OracleSet = SetOracle; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_SETORACLE_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/SetRegularKey.cpp b/src/xrpld/app/tx/detail/SetRegularKey.cpp index 2e8f01b355..ff1dbdf769 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.cpp +++ b/src/xrpld/app/tx/detail/SetRegularKey.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { XRPAmount SetRegularKey::calculateBaseFee(ReadView const& view, STTx const& tx) @@ -70,4 +70,4 @@ SetRegularKey::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SetRegularKey.h b/src/xrpld/app/tx/detail/SetRegularKey.h index 97754af63c..735ac522fd 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.h +++ b/src/xrpld/app/tx/detail/SetRegularKey.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class SetRegularKey : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/SetSignerList.cpp b/src/xrpld/app/tx/detail/SetSignerList.cpp index 449e0ff90c..f65c17e303 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.cpp +++ b/src/xrpld/app/tx/detail/SetSignerList.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { // We're prepared for there to be multiple signer lists in the future, // but we don't need them yet. So for the time being we're manually @@ -116,7 +116,7 @@ SetSignerList::doApply() break; } // LCOV_EXCL_START - UNREACHABLE("ripple::SetSignerList::doApply : invalid operation"); + UNREACHABLE("xrpl::SetSignerList::doApply : invalid operation"); return temMALFORMED; // LCOV_EXCL_STOP } @@ -128,10 +128,10 @@ SetSignerList::preCompute() auto result = determineOperation(ctx_.tx, view().flags(), j_); XRPL_ASSERT( std::get<0>(result) == tesSUCCESS, - "ripple::SetSignerList::preCompute : result is tesSUCCESS"); + "xrpl::SetSignerList::preCompute : result is tesSUCCESS"); XRPL_ASSERT( std::get<3>(result) != unknown, - "ripple::SetSignerList::preCompute : result is known operation"); + "xrpl::SetSignerList::preCompute : result is known operation"); quorum_ = std::get<1>(result); signers_ = std::get<2>(result); @@ -162,10 +162,10 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules) // We've got a lot of room to grow. XRPL_ASSERT( entryCount >= STTx::minMultiSigners, - "ripple::signerCountBasedOwnerCountDelta : minimum signers"); + "xrpl::signerCountBasedOwnerCountDelta : minimum signers"); XRPL_ASSERT( entryCount <= STTx::maxMultiSigners, - "ripple::signerCountBasedOwnerCountDelta : maximum signers"); + "xrpl::signerCountBasedOwnerCountDelta : maximum signers"); return 2 + static_cast(entryCount); } @@ -257,7 +257,7 @@ SetSignerList::validateQuorumAndSignerEntries( // Make sure there are no duplicate signers. XRPL_ASSERT( std::is_sorted(signers.begin(), signers.end()), - "ripple::SetSignerList::validateQuorumAndSignerEntries : sorted " + "xrpl::SetSignerList::validateQuorumAndSignerEntries : sorted " "signers"); if (std::adjacent_find(signers.begin(), signers.end()) != signers.end()) { @@ -412,4 +412,4 @@ SetSignerList::writeSignersToSLE( ledgerEntry->setFieldArray(sfSignerEntries, toLedger); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SetSignerList.h b/src/xrpld/app/tx/detail/SetSignerList.h index 2ee9b4806a..f6f63d2b7d 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.h +++ b/src/xrpld/app/tx/detail/SetSignerList.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { /** See the README.md for an overview of the SetSignerList transaction that @@ -79,6 +79,6 @@ private: using SignerListSet = SetSignerList; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/xrpld/app/tx/detail/SetTrust.cpp index 4e8f20f3ae..77d7e6d9b5 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/xrpld/app/tx/detail/SetTrust.cpp @@ -24,21 +24,19 @@ computeFreezeFlags( { if (bSetFreeze && !bClearFreeze && !bNoFreeze) { - uFlags |= (bHigh ? ripple::lsfHighFreeze : ripple::lsfLowFreeze); + uFlags |= (bHigh ? xrpl::lsfHighFreeze : xrpl::lsfLowFreeze); } else if (bClearFreeze && !bSetFreeze) { - uFlags &= ~(bHigh ? ripple::lsfHighFreeze : ripple::lsfLowFreeze); + uFlags &= ~(bHigh ? xrpl::lsfHighFreeze : xrpl::lsfLowFreeze); } if (bSetDeepFreeze && !bClearDeepFreeze && !bNoFreeze) { - uFlags |= - (bHigh ? ripple::lsfHighDeepFreeze : ripple::lsfLowDeepFreeze); + uFlags |= (bHigh ? xrpl::lsfHighDeepFreeze : xrpl::lsfLowDeepFreeze); } else if (bClearDeepFreeze && !bSetDeepFreeze) { - uFlags &= - ~(bHigh ? ripple::lsfHighDeepFreeze : ripple::lsfLowDeepFreeze); + uFlags &= ~(bHigh ? xrpl::lsfHighDeepFreeze : xrpl::lsfLowDeepFreeze); } return uFlags; @@ -46,7 +44,7 @@ computeFreezeFlags( } // namespace -namespace ripple { +namespace xrpl { std::uint32_t SetTrust::getFlagsMask(PreflightContext const& ctx) @@ -689,4 +687,4 @@ SetTrust::doApply() return terResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SetTrust.h b/src/xrpld/app/tx/detail/SetTrust.h index 5ae3f2ea23..b5776c6d33 100644 --- a/src/xrpld/app/tx/detail/SetTrust.h +++ b/src/xrpld/app/tx/detail/SetTrust.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { class SetTrust : public Transactor { @@ -34,6 +34,6 @@ public: using TrustSet = SetTrust; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/SignerEntries.cpp b/src/xrpld/app/tx/detail/SignerEntries.cpp index f9bc939190..128cc984e4 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.cpp +++ b/src/xrpld/app/tx/detail/SignerEntries.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { Expected, NotTEC> SignerEntries::deserialize( @@ -48,4 +48,4 @@ SignerEntries::deserialize( return accountVec; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/SignerEntries.h b/src/xrpld/app/tx/detail/SignerEntries.h index f7a7823069..0a66fd33f5 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.h +++ b/src/xrpld/app/tx/detail/SignerEntries.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { // Forward declarations class STObject; @@ -69,6 +69,6 @@ public: std::string_view annotation); }; -} // namespace ripple +} // namespace xrpl #endif // XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 2ddef72c39..7b0cbbbdd4 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Performs early sanity checks on the txid */ NotTEC @@ -307,7 +307,7 @@ Transactor::calculateOwnerReserveFee(ReadView const& view, STTx const& tx) // condition. XRPL_ASSERT( view.fees().increment > view.fees().base * 100, - "ripple::Transactor::calculateOwnerReserveFee : Owner reserve is " + "xrpl::Transactor::calculateOwnerReserveFee : Owner reserve is " "reasonable"); return view.fees().increment; } @@ -527,7 +527,7 @@ TER Transactor::consumeSeqProxy(SLE::pointer const& sleAccount) { XRPL_ASSERT( - sleAccount, "ripple::Transactor::consumeSeqProxy : non-null account"); + sleAccount, "xrpl::Transactor::consumeSeqProxy : non-null account"); SeqProxy const seqProx = ctx_.tx.getSeqProxy(); if (seqProx.isSeq()) { @@ -609,7 +609,7 @@ Transactor::preCompute() { XRPL_ASSERT( account_ != beast::zero, - "ripple::Transactor::preCompute : nonzero account"); + "xrpl::Transactor::preCompute : nonzero account"); } TER @@ -625,7 +625,7 @@ Transactor::apply() // that allow zero account. XRPL_ASSERT( sle != nullptr || account_ == beast::zero, - "ripple::Transactor::apply : non-null SLE or zero account"); + "xrpl::Transactor::apply : non-null SLE or zero account"); if (sle) { @@ -699,7 +699,7 @@ Transactor::checkSign( // Check Single Sign XRPL_ASSERT( - !pkSigner.empty(), "ripple::Transactor::checkSign : non-empty signer"); + !pkSigner.empty(), "xrpl::Transactor::checkSign : non-empty signer"); if (!publicKeyType(makeSlice(pkSigner))) { @@ -829,10 +829,10 @@ Transactor::checkMultiSign( // presence and defaulted value of the SignerListID field will enable that. XRPL_ASSERT( sleAccountSigners->isFieldPresent(sfSignerListID), - "ripple::Transactor::checkMultiSign : has signer list ID"); + "xrpl::Transactor::checkMultiSign : has signer list ID"); XRPL_ASSERT( sleAccountSigners->getFieldU32(sfSignerListID) == 0, - "ripple::Transactor::checkMultiSign : signer list ID is 0"); + "xrpl::Transactor::checkMultiSign : signer list ID is 0"); auto accountSigners = SignerEntries::deserialize(*sleAccountSigners, j, "ledger"); @@ -888,7 +888,7 @@ Transactor::checkMultiSign( XRPL_ASSERT( (flags & tapDRY_RUN) || !spk.empty(), - "ripple::Transactor::checkMultiSign : non-empty signer or " + "xrpl::Transactor::checkMultiSign : non-empty signer or " "simulation"); AccountID const signingAcctIDFromPubKey = spk.empty() ? txSignerAcctID @@ -1087,7 +1087,7 @@ Transactor::reset(XRPAmount fee) // balance should have already been checked in checkFee / preFlight. XRPL_ASSERT( balance != beast::zero && (!view().open() || balance >= fee), - "ripple::Transactor::reset : valid balance"); + "xrpl::Transactor::reset : valid balance"); // We retry/reject the transaction if the account balance is zero or // we're applying against an open ledger and the balance is less than @@ -1104,7 +1104,7 @@ Transactor::reset(XRPAmount fee) payerSle->setFieldAmount(sfBalance, balance - fee); TER const ter{consumeSeqProxy(txnAcct)}; XRPL_ASSERT( - isTesSuccess(ter), "ripple::Transactor::reset : result is tesSUCCESS"); + isTesSuccess(ter), "xrpl::Transactor::reset : result is tesSUCCESS"); if (isTesSuccess(ter)) { @@ -1149,7 +1149,7 @@ Transactor::operator()() JLOG(j_.info()) << to_string(ctx_.tx.getJson(JsonOptions::none)); JLOG(j_.fatal()) << s2.getJson(JsonOptions::none); UNREACHABLE( - "ripple::Transactor::operator() : transaction serdes mismatch"); + "xrpl::Transactor::operator() : transaction serdes mismatch"); // LCOV_EXCL_STOP } } @@ -1169,7 +1169,7 @@ Transactor::operator()() // and it can't be passed in from a preclaim. XRPL_ASSERT( result != temUNKNOWN, - "ripple::Transactor::operator() : result is not temUNKNOWN"); + "xrpl::Transactor::operator() : result is not temUNKNOWN"); if (auto stream = j_.trace()) stream << "preclaim result: " << transToken(result); @@ -1226,7 +1226,7 @@ Transactor::operator()() { XRPL_ASSERT( before && after, - "ripple::Transactor::operator()::visit : non-null SLE " + "xrpl::Transactor::operator()::visit : non-null SLE " "inputs"); if (doOffers && before && after && (before->getType() == ltOFFER) && @@ -1346,4 +1346,4 @@ Transactor::operator()() return {result, applied, metadata}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/Transactor.h b/src/xrpld/app/tx/detail/Transactor.h index ea3479ee6f..7d24df0a3b 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/src/xrpld/app/tx/detail/Transactor.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** State information when preflighting a tx. */ struct PreflightContext @@ -247,7 +247,7 @@ protected: @param app The application hosting the server @param baseFee The base fee of a candidate transaction - @see ripple::calculateBaseFee + @see xrpl::calculateBaseFee @param fees Fee settings from the current ledger @param flags Transaction processing fees */ @@ -452,6 +452,6 @@ Transactor::validNumericMinimum( return validNumericMinimum(value, min.value()); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultClawback.cpp b/src/xrpld/app/tx/detail/VaultClawback.cpp index 7c56ca1d60..cc7dec993a 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.cpp +++ b/src/xrpld/app/tx/detail/VaultClawback.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC VaultClawback::preflight(PreflightContext const& ctx) @@ -144,14 +144,14 @@ VaultClawback::doApply() }(); XRPL_ASSERT( amount.asset() == vaultAsset, - "ripple::VaultClawback::doApply : matching asset"); + "xrpl::VaultClawback::doApply : matching asset"); auto assetsAvailable = vault->at(sfAssetsAvailable); auto assetsTotal = vault->at(sfAssetsTotal); [[maybe_unused]] auto const lossUnrealized = vault->at(sfLossUnrealized); XRPL_ASSERT( lossUnrealized <= (assetsTotal - assetsAvailable), - "ripple::VaultClawback::doApply : loss and assets do balance"); + "xrpl::VaultClawback::doApply : loss and assets do balance"); AccountID holder = tx[sfHolder]; MPTIssue const share{mptIssuanceID}; @@ -311,4 +311,4 @@ VaultClawback::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultClawback.h b/src/xrpld/app/tx/detail/VaultClawback.h index 888ecf59bf..80a5f73ad0 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.h +++ b/src/xrpld/app/tx/detail/VaultClawback.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultClawback : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultCreate.cpp b/src/xrpld/app/tx/detail/VaultCreate.cpp index d8a2e7bc3b..893a1108fa 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.cpp +++ b/src/xrpld/app/tx/detail/VaultCreate.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { bool VaultCreate::checkExtraFeatures(PreflightContext const& ctx) @@ -233,4 +233,4 @@ VaultCreate::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultCreate.h b/src/xrpld/app/tx/detail/VaultCreate.h index 987bbe7df4..78593eb491 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.h +++ b/src/xrpld/app/tx/detail/VaultCreate.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultCreate : public Transactor { @@ -30,6 +30,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultDelete.cpp b/src/xrpld/app/tx/detail/VaultDelete.cpp index 903b5a83a7..756e7b94e6 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.cpp +++ b/src/xrpld/app/tx/detail/VaultDelete.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC VaultDelete::preflight(PreflightContext const& ctx) @@ -208,4 +208,4 @@ VaultDelete::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultDelete.h b/src/xrpld/app/tx/detail/VaultDelete.h index 1144ebcc36..e7c71b408c 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.h +++ b/src/xrpld/app/tx/detail/VaultDelete.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultDelete : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/xrpld/app/tx/detail/VaultDeposit.cpp index aeaf890126..d9471a38f5 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/xrpld/app/tx/detail/VaultDeposit.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC VaultDeposit::preflight(PreflightContext const& ctx) @@ -179,7 +179,7 @@ VaultDeposit::doApply() // This follows from the reverse of the outer enclosing if condition XRPL_ASSERT( account_ == vault->at(sfOwner), - "ripple::VaultDeposit::doApply : account is owner"); + "xrpl::VaultDeposit::doApply : account is owner"); if (auto const err = authorizeMPToken( view(), mPriorBalance, // priorBalance @@ -236,7 +236,7 @@ VaultDeposit::doApply() XRPL_ASSERT( sharesCreated.asset() != assetsDeposited.asset(), - "ripple::VaultDeposit::doApply : assets are not shares"); + "xrpl::VaultDeposit::doApply : assets are not shares"); vault->at(sfAssetsTotal) += assetsDeposited; vault->at(sfAssetsAvailable) += assetsDeposited; @@ -287,4 +287,4 @@ VaultDeposit::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultDeposit.h b/src/xrpld/app/tx/detail/VaultDeposit.h index 7d725fe6fe..1fd62b95ff 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.h +++ b/src/xrpld/app/tx/detail/VaultDeposit.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultDeposit : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultSet.cpp b/src/xrpld/app/tx/detail/VaultSet.cpp index 97522dad12..648ac12c3d 100644 --- a/src/xrpld/app/tx/detail/VaultSet.cpp +++ b/src/xrpld/app/tx/detail/VaultSet.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { bool VaultSet::checkExtraFeatures(PreflightContext const& ctx) @@ -175,4 +175,4 @@ VaultSet::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultSet.h b/src/xrpld/app/tx/detail/VaultSet.h index 0db0e0fd13..bfa38e5284 100644 --- a/src/xrpld/app/tx/detail/VaultSet.h +++ b/src/xrpld/app/tx/detail/VaultSet.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultSet : public Transactor { @@ -27,6 +27,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.cpp b/src/xrpld/app/tx/detail/VaultWithdraw.cpp index a3bef88d49..f8b7a1a739 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.cpp +++ b/src/xrpld/app/tx/detail/VaultWithdraw.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { NotTEC VaultWithdraw::preflight(PreflightContext const& ctx) @@ -182,7 +182,7 @@ VaultWithdraw::doApply() [[maybe_unused]] auto const lossUnrealized = vault->at(sfLossUnrealized); XRPL_ASSERT( lossUnrealized <= (assetsTotal - assetsAvailable), - "ripple::VaultWithdraw::doApply : loss and assets do balance"); + "xrpl::VaultWithdraw::doApply : loss and assets do balance"); // The vault must have enough assets on hand. The vault may hold assets // that it has already pledged. That is why we look at AssetAvailable @@ -250,4 +250,4 @@ VaultWithdraw::doApply() j_); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.h b/src/xrpld/app/tx/detail/VaultWithdraw.h index 4a6ee3b548..33463831e5 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.h +++ b/src/xrpld/app/tx/detail/VaultWithdraw.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class VaultWithdraw : public Transactor { @@ -24,6 +24,6 @@ public: doApply() override; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/xrpld/app/tx/detail/XChainBridge.cpp index e555dca0a1..88cc236e0b 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/xrpld/app/tx/detail/XChainBridge.cpp @@ -27,7 +27,7 @@ #include #include -namespace ripple { +namespace xrpl { /* Bridges connect two independent ledgers: a "locking chain" and an "issuing @@ -206,8 +206,8 @@ claimHelper( { // LCOV_EXCL_START UNREACHABLE( - "ripple::claimHelper : invalid inputs"); // should have already - // been checked + "xrpl::claimHelper : invalid inputs"); // should have already + // been checked continue; // LCOV_EXCL_STOP } @@ -423,7 +423,7 @@ transferHelper( if (amt.native()) { auto const sleSrc = psb.peek(keylet::account(src)); - XRPL_ASSERT(sleSrc, "ripple::transferHelper : non-null source account"); + XRPL_ASSERT(sleSrc, "xrpl::transferHelper : non-null source account"); if (!sleSrc) return tecINTERNAL; // LCOV_EXCL_LINE @@ -2238,4 +2238,4 @@ XChainCreateAccountCommit::doApply() return tesSUCCESS; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/XChainBridge.h b/src/xrpld/app/tx/detail/XChainBridge.h index 8636f4f30e..db1026ebb4 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.h +++ b/src/xrpld/app/tx/detail/XChainBridge.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { constexpr size_t xbridgeMaxAccountCreateClaims = 128; @@ -239,6 +239,6 @@ using XChainAccountCreateCommit = XChainCreateAccountCommit; //------------------------------------------------------------------------------ -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/xrpld/app/tx/detail/apply.cpp index 06be378c2b..5209c46f8f 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/xrpld/app/tx/detail/apply.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // These are the same flags defined as HashRouterFlags::PRIVATE1-4 in // HashRouter.h @@ -267,4 +267,4 @@ applyTransaction( } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/xrpld/app/tx/detail/applySteps.cpp index 81a930f562..7f0d971fdc 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/xrpld/app/tx/detail/applySteps.cpp @@ -18,7 +18,7 @@ #include -namespace ripple { +namespace xrpl { namespace { @@ -113,7 +113,7 @@ invoke_preflight(PreflightContext const& ctx) // LCOV_EXCL_START JLOG(ctx.j.fatal()) << "Unknown transaction type in preflight: " << e.txnType; - UNREACHABLE("ripple::invoke_preflight : unknown transaction type"); + UNREACHABLE("xrpl::invoke_preflight : unknown transaction type"); return {temUNKNOWN, TxConsequences{temUNKNOWN}}; // LCOV_EXCL_STOP } @@ -177,7 +177,7 @@ invoke_preclaim(PreclaimContext const& ctx) // LCOV_EXCL_START JLOG(ctx.j.fatal()) << "Unknown transaction type in preclaim: " << e.txnType; - UNREACHABLE("ripple::invoke_preclaim : unknown transaction type"); + UNREACHABLE("xrpl::invoke_preclaim : unknown transaction type"); return temUNKNOWN; // LCOV_EXCL_STOP } @@ -211,8 +211,7 @@ invoke_calculateBaseFee(ReadView const& view, STTx const& tx) catch (UnknownTxnType const& e) { // LCOV_EXCL_START - UNREACHABLE( - "ripple::invoke_calculateBaseFee : unknown transaction type"); + UNREACHABLE("xrpl::invoke_calculateBaseFee : unknown transaction type"); return XRPAmount{0}; // LCOV_EXCL_STOP } @@ -227,7 +226,7 @@ TxConsequences::TxConsequences(NotTEC pfresult) { XRPL_ASSERT( !isTesSuccess(pfresult), - "ripple::TxConsequences::TxConsequences : is not tesSUCCESS"); + "xrpl::TxConsequences::TxConsequences : is not tesSUCCESS"); } TxConsequences::TxConsequences(STTx const& tx) @@ -275,7 +274,7 @@ invoke_apply(ApplyContext& ctx) // LCOV_EXCL_START JLOG(ctx.journal.fatal()) << "Unknown transaction type in apply: " << e.txnType; - UNREACHABLE("ripple::invoke_apply : unknown transaction type"); + UNREACHABLE("xrpl::invoke_apply : unknown transaction type"); return {temUNKNOWN, false}; // LCOV_EXCL_STOP } @@ -426,4 +425,4 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/conditions/Condition.h b/src/xrpld/conditions/Condition.h index ff83f69afe..52a6bcd9bb 100644 --- a/src/xrpld/conditions/Condition.h +++ b/src/xrpld/conditions/Condition.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { enum class Type : std::uint8_t { @@ -94,6 +94,6 @@ operator!=(Condition const& lhs, Condition const& rhs) } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/conditions/Fulfillment.h b/src/xrpld/conditions/Fulfillment.h index 13144288d9..970aed121c 100644 --- a/src/xrpld/conditions/Fulfillment.h +++ b/src/xrpld/conditions/Fulfillment.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { struct Fulfillment @@ -122,6 +122,6 @@ bool validate(Fulfillment const& f, Condition const& c); } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/conditions/detail/Condition.cpp b/src/xrpld/conditions/detail/Condition.cpp index b6ba60e6d5..ebf61dd245 100644 --- a/src/xrpld/conditions/detail/Condition.cpp +++ b/src/xrpld/conditions/detail/Condition.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { namespace detail { @@ -212,4 +212,4 @@ Condition::deserialize(Slice s, std::error_code& ec) } } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/conditions/detail/Fulfillment.cpp b/src/xrpld/conditions/detail/Fulfillment.cpp index e8c5928fcf..9ecaa44ab8 100644 --- a/src/xrpld/conditions/detail/Fulfillment.cpp +++ b/src/xrpld/conditions/detail/Fulfillment.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { bool @@ -130,4 +130,4 @@ Fulfillment::deserialize(Slice s, std::error_code& ec) } } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/conditions/detail/PreimageSha256.h b/src/xrpld/conditions/detail/PreimageSha256.h index 62043f5a45..642a7afdc0 100644 --- a/src/xrpld/conditions/detail/PreimageSha256.h +++ b/src/xrpld/conditions/detail/PreimageSha256.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { class PreimageSha256 final : public Fulfillment @@ -130,6 +130,6 @@ public: }; } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/conditions/detail/error.cpp b/src/xrpld/conditions/detail/error.cpp index fbcd70d009..a74aa79e3f 100644 --- a/src/xrpld/conditions/detail/error.cpp +++ b/src/xrpld/conditions/detail/error.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { namespace detail { @@ -116,4 +116,4 @@ make_error_code(error ev) } } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/conditions/detail/error.h b/src/xrpld/conditions/detail/error.h index bd1f2413f3..65584e974a 100644 --- a/src/xrpld/conditions/detail/error.h +++ b/src/xrpld/conditions/detail/error.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { enum class error { @@ -30,12 +30,12 @@ std::error_code make_error_code(error ev); } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl namespace std { template <> -struct is_error_code_enum +struct is_error_code_enum { explicit is_error_code_enum() = default; diff --git a/src/xrpld/conditions/detail/utils.h b/src/xrpld/conditions/detail/utils.h index b03b393e43..b07b7b29e0 100644 --- a/src/xrpld/conditions/detail/utils.h +++ b/src/xrpld/conditions/detail/utils.h @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { namespace cryptoconditions { // A collection of functions to decode binary blobs @@ -208,6 +208,6 @@ parseInteger(Slice& s, std::size_t count, std::error_code& ec) } // namespace der } // namespace cryptoconditions -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/Consensus.cpp b/src/xrpld/consensus/Consensus.cpp index 8a0bec236e..b71a36d538 100644 --- a/src/xrpld/consensus/Consensus.cpp +++ b/src/xrpld/consensus/Consensus.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { bool shouldCloseLedger( @@ -250,4 +250,4 @@ checkConsensus( return ConsensusState::No; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index d1aed31870..01d4dfaedf 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Determines whether the current ledger should close at this time. @@ -897,7 +897,7 @@ Consensus::gotTxSet( // so this txSet must differ XRPL_ASSERT( id != result_->position.position(), - "ripple::Consensus::gotTxSet : updated transaction set"); + "xrpl::Consensus::gotTxSet : updated transaction set"); bool any = false; for (auto const& [nodeId, peerPos] : currPeerPositions_) { @@ -1047,7 +1047,7 @@ Consensus::handleWrongLedger( CLOG(clog) << "handleWrongLedger. "; XRPL_ASSERT( lgrId != prevLedgerID_ || previousLedger_.id() != lgrId, - "ripple::Consensus::handleWrongLedger : have wrong ledger"); + "xrpl::Consensus::handleWrongLedger : have wrong ledger"); // Stop proposing because we are out of sync leaveConsensus(clog); @@ -1349,7 +1349,7 @@ Consensus::phaseEstablish( { CLOG(clog) << "phaseEstablish. "; // can only establish consensus if we already took a stance - XRPL_ASSERT(result_, "ripple::Consensus::phaseEstablish : result is set"); + XRPL_ASSERT(result_, "xrpl::Consensus::phaseEstablish : result is set"); ++peerUnchangedCounter_; ++establishCounter_; @@ -1415,7 +1415,7 @@ void Consensus::closeLedger(std::unique_ptr const& clog) { // We should not be closing if we already have a position - XRPL_ASSERT(!result_, "ripple::Consensus::closeLedger : result is not set"); + XRPL_ASSERT(!result_, "xrpl::Consensus::closeLedger : result is not set"); phase_ = ConsensusPhase::establish; JLOG(j_.debug()) << "transitioned to ConsensusPhase::establish"; @@ -1474,8 +1474,7 @@ Consensus::updateOurPositions( std::unique_ptr const& clog) { // We must have a position if we are updating it - XRPL_ASSERT( - result_, "ripple::Consensus::updateOurPositions : result is set"); + XRPL_ASSERT(result_, "xrpl::Consensus::updateOurPositions : result is set"); ConsensusParms const& parms = adaptor_.parms(); // Compute a cutoff time @@ -1664,7 +1663,7 @@ Consensus::haveConsensus( std::unique_ptr const& clog) { // Must have a stance if we are checking for consensus - XRPL_ASSERT(result_, "ripple::Consensus::haveConsensus : has result"); + XRPL_ASSERT(result_, "xrpl::Consensus::haveConsensus : has result"); // CHECKME: should possibly count unacquired TX sets as disagreeing int agree = 0, disagree = 0; @@ -1804,7 +1803,7 @@ Consensus::createDisputes( std::unique_ptr const& clog) { // Cannot create disputes without our stance - XRPL_ASSERT(result_, "ripple::Consensus::createDisputes : result is set"); + XRPL_ASSERT(result_, "xrpl::Consensus::createDisputes : result is set"); // Only create disputes if this is a new set auto const emplaced = result_->compares.emplace(o.id()).second; @@ -1835,7 +1834,7 @@ Consensus::createDisputes( XRPL_ASSERT( (inThisSet && result_->txns.find(txId) && !o.find(txId)) || (!inThisSet && !result_->txns.find(txId) && o.find(txId)), - "ripple::Consensus::createDisputes : has disputed transactions"); + "xrpl::Consensus::createDisputes : has disputed transactions"); Tx_t tx = inThisSet ? result_->txns.find(txId) : o.find(txId); auto txID = tx.id(); @@ -1873,7 +1872,7 @@ void Consensus::updateDisputes(NodeID_t const& node, TxSet_t const& other) { // Cannot updateDisputes without our stance - XRPL_ASSERT(result_, "ripple::Consensus::updateDisputes : result is set"); + XRPL_ASSERT(result_, "xrpl::Consensus::updateDisputes : result is set"); // Ensure we have created disputes against this set if we haven't seen // it before @@ -1895,6 +1894,6 @@ Consensus::asCloseTime(NetClock::time_point raw) const return roundCloseTime(raw, closeResolution_); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/ConsensusParms.h b/src/xrpld/consensus/ConsensusParms.h index 8015c2547b..bd1d866082 100644 --- a/src/xrpld/consensus/ConsensusParms.h +++ b/src/xrpld/consensus/ConsensusParms.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Consensus algorithm parameters @@ -170,7 +170,7 @@ getNeededWeight( // See if enough time has passed to move on to the next. XRPL_ASSERT( nextCutoff.consensusTime >= currentCutoff.consensusTime, - "ripple::getNeededWeight : next state valid"); + "xrpl::getNeededWeight : next state valid"); if (percentTime >= nextCutoff.consensusTime) { return {nextCutoff.consensusPct, currentCutoff.next}; @@ -179,5 +179,5 @@ getNeededWeight( return {currentCutoff.consensusPct, {}}; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/ConsensusProposal.h b/src/xrpld/consensus/ConsensusProposal.h index 344f87f0db..eadf3565f2 100644 --- a/src/xrpld/consensus/ConsensusProposal.h +++ b/src/xrpld/consensus/ConsensusProposal.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents a proposed position taken during a round of consensus. During consensus, peers seek agreement on a set of transactions to @@ -262,5 +262,5 @@ operator==( a.prevLedger() == b.prevLedger() && a.position() == b.position() && a.closeTime() == b.closeTime() && a.seenTime() == b.seenTime(); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/ConsensusTypes.h b/src/xrpld/consensus/ConsensusTypes.h index b2712f17e7..43fb4021b1 100644 --- a/src/xrpld/consensus/ConsensusTypes.h +++ b/src/xrpld/consensus/ConsensusTypes.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents how a node currently participates in Consensus. @@ -200,7 +200,7 @@ struct ConsensusResult { XRPL_ASSERT( txns.id() == position.position(), - "ripple::ConsensusResult : valid inputs"); + "xrpl::ConsensusResult : valid inputs"); } //! The set of transactions consensus agrees go in the ledger @@ -225,6 +225,6 @@ struct ConsensusResult // The number of peers proposing during the round std::size_t proposers = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index ce15b4b7f3..f4b841c795 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { /** A transaction discovered to be in dispute during consensus. @@ -341,6 +341,6 @@ DisputedTx::getJson() const return ret; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/LedgerTiming.h b/src/xrpld/consensus/LedgerTiming.h index 869cf1980e..5d6348ffb6 100644 --- a/src/xrpld/consensus/LedgerTiming.h +++ b/src/xrpld/consensus/LedgerTiming.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { /** Possible ledger close time resolutions. @@ -149,5 +149,5 @@ effCloseTime( roundCloseTime(closeTime, resolution), (priorCloseTime + 1s)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/LedgerTrie.h b/src/xrpld/consensus/LedgerTrie.h index 0f23a8ffc3..b8382c555f 100644 --- a/src/xrpld/consensus/LedgerTrie.h +++ b/src/xrpld/consensus/LedgerTrie.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { /** The tip of a span of ledger ancestry */ @@ -45,7 +45,7 @@ public: ID ancestor(Seq const& s) const { - XRPL_ASSERT(s <= seq, "ripple::SpanTip::ancestor : valid input"); + XRPL_ASSERT(s <= seq, "xrpl::SpanTip::ancestor : valid input"); return ledger[s]; } @@ -72,7 +72,7 @@ public: { // Require default ledger to be genesis seq XRPL_ASSERT( - ledger_.seq() == start_, "ripple::Span::Span : ledger is genesis"); + ledger_.seq() == start_, "xrpl::Span::Span : ledger is genesis"); } Span(Ledger ledger) @@ -141,7 +141,7 @@ private: : start_{start}, end_{end}, ledger_{l} { // Spans cannot be empty - XRPL_ASSERT(start < end, "ripple::Span::Span : non-empty span input"); + XRPL_ASSERT(start < end, "xrpl::Span::Span : non-empty span input"); } Seq @@ -214,7 +214,7 @@ struct Node [child](std::unique_ptr const& curr) { return curr.get() == child; }); - XRPL_ASSERT(it != children.end(), "ripple::Node::erase : valid input"); + XRPL_ASSERT(it != children.end(), "xrpl::Node::erase : valid input"); std::swap(*it, children.back()); children.pop_back(); } @@ -355,7 +355,7 @@ class LedgerTrie Node* curr = root.get(); // Root is always defined and is in common with all ledgers - XRPL_ASSERT(curr, "ripple::LedgerTrie::find : non-null root"); + XRPL_ASSERT(curr, "xrpl::LedgerTrie::find : non-null root"); Seq pos = curr->span.diff(ledger); bool done = false; @@ -436,7 +436,7 @@ public: auto const [loc, diffSeq] = find(ledger); // There is always a place to insert - XRPL_ASSERT(loc, "ripple::LedgerTrie::insert : valid input ledger"); + XRPL_ASSERT(loc, "xrpl::LedgerTrie::insert : valid input ledger"); // Node from which to start incrementing branchSupport Node* incNode = loc; @@ -473,12 +473,12 @@ public: newNode->children = std::move(loc->children); XRPL_ASSERT( loc->children.empty(), - "ripple::LedgerTrie::insert : moved-from children"); + "xrpl::LedgerTrie::insert : moved-from children"); for (std::unique_ptr& child : newNode->children) child->parent = newNode.get(); // Loc truncates to prefix and newNode is its child - XRPL_ASSERT(prefix, "ripple::LedgerTrie::insert : prefix is set"); + XRPL_ASSERT(prefix, "xrpl::LedgerTrie::insert : prefix is set"); loc->span = *prefix; newNode->parent = loc; loc->children.emplace_back(std::move(newNode)); @@ -533,7 +533,7 @@ public: auto const it = seqSupport.find(ledger.seq()); XRPL_ASSERT( it != seqSupport.end() && it->second >= count, - "ripple::LedgerTrie::remove : valid input ledger"); + "xrpl::LedgerTrie::remove : valid input ledger"); it->second -= count; if (it->second == 0) seqSupport.erase(it->first); @@ -830,5 +830,5 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/consensus/Validations.h b/src/xrpld/consensus/Validations.h index 830d05f188..15b33c89c4 100644 --- a/src/xrpld/consensus/Validations.h +++ b/src/xrpld/consensus/Validations.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Timing parameters to control validation staleness and expiration. @@ -418,7 +418,7 @@ private: { XRPL_ASSERT( val.trusted(), - "ripple::Validations::updateTrie : trusted input validation"); + "xrpl::Validations::updateTrie : trusted input validation"); // Clear any prior acquiring ledger for this node if (prior) @@ -698,7 +698,7 @@ public: { std::lock_guard lock{mutex_}; XRPL_ASSERT( - low < high, "ripple::Validations::setSeqToKeep : valid inputs"); + low < high, "xrpl::Validations::setSeqToKeep : valid inputs"); toKeep_ = {low, high}; } @@ -1156,5 +1156,5 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index f48f2765e3..cfd260787c 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { class Rules; @@ -362,6 +362,6 @@ public: FeeSetup setup_FeeVote(Section const& section); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/core/ConfigSections.h b/src/xrpld/core/ConfigSections.h index 554362edd6..6f8a13a145 100644 --- a/src/xrpld/core/ConfigSections.h +++ b/src/xrpld/core/ConfigSections.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // VFALCO DEPRECATED in favor of the BasicConfig interface struct ConfigSection @@ -78,6 +78,6 @@ struct ConfigSection #define SECTION_VETO_AMENDMENTS "veto_amendments" #define SECTION_WORKERS "workers" -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/core/DatabaseCon.h b/src/xrpld/core/DatabaseCon.h index b2f400780b..a7fc21bc38 100644 --- a/src/xrpld/core/DatabaseCon.h +++ b/src/xrpld/core/DatabaseCon.h @@ -17,7 +17,7 @@ namespace soci { class session; } -namespace ripple { +namespace xrpl { class LockedSociSession { @@ -83,7 +83,7 @@ public: { XRPL_ASSERT( !useGlobalPragma || globalPragma, - "ripple::DatabaseCon::Setup::commonPragma : consistent global " + "xrpl::DatabaseCon::Setup::commonPragma : consistent global " "pragma"); return useGlobalPragma && globalPragma ? globalPragma.get() : nullptr; @@ -242,6 +242,6 @@ setup_DatabaseCon( Config const& c, std::optional j = std::nullopt); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/core/SociDB.h b/src/xrpld/core/SociDB.h index 7e2c7323d8..fe3c15e26e 100644 --- a/src/xrpld/core/SociDB.h +++ b/src/xrpld/core/SociDB.h @@ -28,7 +28,7 @@ namespace sqlite_api { struct sqlite3; } -namespace ripple { +namespace xrpl { class BasicConfig; @@ -121,7 +121,7 @@ makeCheckpointer( JobQueue&, Logs&); -} // namespace ripple +} // namespace xrpl #if defined(__clang__) #pragma clang diagnostic pop diff --git a/src/xrpld/core/TimeKeeper.h b/src/xrpld/core/TimeKeeper.h index f5c14a67fd..67b389bf94 100644 --- a/src/xrpld/core/TimeKeeper.h +++ b/src/xrpld/core/TimeKeeper.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { /** Manages various times used by the server. */ class TimeKeeper : public beast::abstract_clock @@ -97,6 +97,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index 6a49416a45..e6c61e1471 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -26,7 +26,7 @@ #if BOOST_OS_WINDOWS #include -namespace ripple { +namespace xrpl { namespace detail { [[nodiscard]] std::uint64_t @@ -39,13 +39,13 @@ getMemorySize() } } // namespace detail -} // namespace ripple +} // namespace xrpl #endif #if BOOST_OS_LINUX #include -namespace ripple { +namespace xrpl { namespace detail { [[nodiscard]] std::uint64_t @@ -58,7 +58,7 @@ getMemorySize() } } // namespace detail -} // namespace ripple +} // namespace xrpl #endif @@ -66,7 +66,7 @@ getMemorySize() #include #include -namespace ripple { +namespace xrpl { namespace detail { [[nodiscard]] std::uint64_t @@ -83,10 +83,10 @@ getMemorySize() } } // namespace detail -} // namespace ripple +} // namespace xrpl #endif -namespace ripple { +namespace xrpl { // clang-format off // The configurable node sizes are "tiny", "small", "medium", "large", "huge" @@ -250,7 +250,7 @@ void Config::setupControl(bool bQuiet, bool bSilent, bool bStandalone) { XRPL_ASSERT( - NODE_SIZE == 0, "ripple::Config::setupControl : node size not set"); + NODE_SIZE == 0, "xrpl::Config::setupControl : node size not set"); QUIET = bQuiet || bSilent; SILENT = bSilent; @@ -273,7 +273,7 @@ Config::setupControl(bool bQuiet, bool bSilent, bool bStandalone) XRPL_ASSERT( ns != threshold.second.end(), - "ripple::Config::setupControl : valid node size"); + "xrpl::Config::setupControl : valid node size"); if (ns != threshold.second.end()) NODE_SIZE = std::distance(threshold.second.begin(), ns); @@ -285,7 +285,7 @@ Config::setupControl(bool bQuiet, bool bSilent, bool bStandalone) } XRPL_ASSERT( - NODE_SIZE <= 4, "ripple::Config::setupControl : node size is set"); + NODE_SIZE <= 4, "xrpl::Config::setupControl : node size is set"); } void @@ -1099,10 +1099,9 @@ Config::getValueFor(SizedItem item, std::optional node) const auto const index = static_cast>(item); XRPL_ASSERT( index < sizedItems.size(), - "ripple::Config::getValueFor : valid index input"); + "xrpl::Config::getValueFor : valid index input"); XRPL_ASSERT( - !node || *node <= 4, - "ripple::Config::getValueFor : unset or valid node"); + !node || *node <= 4, "xrpl::Config::getValueFor : unset or valid node"); return sizedItems.at(index).second.at(node.value_or(NODE_SIZE)); } @@ -1126,4 +1125,4 @@ setup_FeeVote(Section const& section) return setup; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/core/detail/DatabaseCon.cpp b/src/xrpld/core/detail/DatabaseCon.cpp index efff0d8192..35eaf31898 100644 --- a/src/xrpld/core/detail/DatabaseCon.cpp +++ b/src/xrpld/core/detail/DatabaseCon.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { class CheckpointersCollection { @@ -215,7 +215,7 @@ setup_DatabaseCon(Config const& c, std::optional j) } XRPL_ASSERT( result->size() == 3, - "ripple::setup_DatabaseCon::globalPragma : result size is 3"); + "xrpl::setup_DatabaseCon::globalPragma : result size is 3"); return result; }(); } @@ -265,4 +265,4 @@ DatabaseCon::setupCheckpointing(JobQueue* q, Logs& l) checkpointer_ = checkpointers.create(session_, *q, l); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/core/detail/SociDB.cpp b/src/xrpld/core/detail/SociDB.cpp index 65294acc4c..a90e59beed 100644 --- a/src/xrpld/core/detail/SociDB.cpp +++ b/src/xrpld/core/detail/SociDB.cpp @@ -16,7 +16,7 @@ #include -namespace ripple { +namespace xrpl { static auto checkpointPageCount = 1000; @@ -206,7 +206,7 @@ public: { if (auto p = session_.lock()) { - return {ripple::getConnection(*p), p}; + return {xrpl::getConnection(*p), p}; } return {nullptr, std::shared_ptr{}}; } @@ -324,7 +324,7 @@ makeCheckpointer( id, std::move(session), queue, logs); } -} // namespace ripple +} // namespace xrpl #if defined(__clang__) #pragma clang diagnostic pop diff --git a/src/xrpld/overlay/Cluster.h b/src/xrpld/overlay/Cluster.h index ff0a1a97f5..30627f90ae 100644 --- a/src/xrpld/overlay/Cluster.h +++ b/src/xrpld/overlay/Cluster.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { class Cluster { @@ -94,6 +94,6 @@ public: load(Section const& nodes); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/ClusterNode.h b/src/xrpld/overlay/ClusterNode.h index a21f7a3870..03c294c736 100644 --- a/src/xrpld/overlay/ClusterNode.h +++ b/src/xrpld/overlay/ClusterNode.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class ClusterNode { @@ -54,6 +54,6 @@ private: NetClock::time_point mReportTime = {}; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/Compression.h b/src/xrpld/overlay/Compression.h index b13b009dcf..8f9b1e2a14 100644 --- a/src/xrpld/overlay/Compression.h +++ b/src/xrpld/overlay/Compression.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace compression { @@ -37,7 +37,7 @@ decompress( try { if (algorithm == Algorithm::LZ4) - return ripple::compression_algorithms::lz4Decompress( + return xrpl::compression_algorithms::lz4Decompress( in, inSize, decompressed, decompressedSize); else { @@ -46,7 +46,7 @@ decompress( << "decompress: invalid compression algorithm " << static_cast(algorithm); UNREACHABLE( - "ripple::compression::decompress : invalid compression " + "xrpl::compression::decompress : invalid compression " "algorithm"); // LCOV_EXCL_STOP } @@ -77,7 +77,7 @@ compress( try { if (algorithm == Algorithm::LZ4) - return ripple::compression_algorithms::lz4Compress( + return xrpl::compression_algorithms::lz4Compress( in, inSize, std::forward(bf)); else { @@ -85,7 +85,7 @@ compress( JLOG(debugLog().warn()) << "compress: invalid compression algorithm" << static_cast(algorithm); UNREACHABLE( - "ripple::compression::compress : invalid compression " + "xrpl::compression::compress : invalid compression " "algorithm"); // LCOV_EXCL_STOP } @@ -97,6 +97,6 @@ compress( } } // namespace compression -} // namespace ripple +} // namespace xrpl #endif // XRPL_COMPRESSION_H_INCLUDED diff --git a/src/xrpld/overlay/Message.h b/src/xrpld/overlay/Message.h index afa15657f0..f2b021840d 100644 --- a/src/xrpld/overlay/Message.h +++ b/src/xrpld/overlay/Message.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { constexpr std::size_t maximiumMessageSize = megabytes(64); @@ -117,6 +117,6 @@ private: getType(std::uint8_t const* in) const; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/Overlay.h b/src/xrpld/overlay/Overlay.h index 6eaf14b8df..c30d0f5205 100644 --- a/src/xrpld/overlay/Overlay.h +++ b/src/xrpld/overlay/Overlay.h @@ -23,7 +23,7 @@ class context; } // namespace asio } // namespace boost -namespace ripple { +namespace xrpl { /** Manages the set of connected peers. */ class Overlay : public beast::PropertyStream::Source @@ -215,6 +215,6 @@ public: txMetrics() const = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/Peer.h b/src/xrpld/overlay/Peer.h index abe18d48dc..35feb05271 100644 --- a/src/xrpld/overlay/Peer.h +++ b/src/xrpld/overlay/Peer.h @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace Resource { class Charge; @@ -119,6 +119,6 @@ public: txReduceRelayEnabled() const = 0; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/PeerReservationTable.h b/src/xrpld/overlay/PeerReservationTable.h index 1cabbb56f9..9ddf79aca9 100644 --- a/src/xrpld/overlay/PeerReservationTable.h +++ b/src/xrpld/overlay/PeerReservationTable.h @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { class DatabaseCon; @@ -97,6 +97,6 @@ private: std::unordered_set, KeyEqual> table_; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/PeerSet.h b/src/xrpld/overlay/PeerSet.h index f90d1670f4..850ba21c53 100644 --- a/src/xrpld/overlay/PeerSet.h +++ b/src/xrpld/overlay/PeerSet.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Supports data retrieval by managing a set of peers. @@ -73,6 +73,6 @@ make_PeerSetBuilder(Application& app); std::unique_ptr make_DummyPeerSet(Application& app); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/ReduceRelayCommon.h b/src/xrpld/overlay/ReduceRelayCommon.h index 207a279cd6..990e4b51d2 100644 --- a/src/xrpld/overlay/ReduceRelayCommon.h +++ b/src/xrpld/overlay/ReduceRelayCommon.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { // Blog post explaining the rationale behind reduction of flooding gossip // protocol: @@ -41,6 +41,6 @@ static constexpr std::size_t MAX_TX_QUEUE_SIZE = 10000; } // namespace reduce_relay -} // namespace ripple +} // namespace xrpl #endif // XRPL_REDUCERELAYCOMMON_H_INCLUDED diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index 388323d3c0..9e717fef9c 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace reduce_relay { @@ -374,7 +374,7 @@ Slot::update( XRPL_ASSERT( peers_.size() >= maxSelectedPeers_, - "ripple::reduce_relay::Slot::update : minimum peers"); + "xrpl::reduce_relay::Slot::update : minimum peers"); // squelch peers which are not selected and // not already squelched @@ -417,7 +417,7 @@ Slot::getSquelchDuration(std::size_t npeers) JLOG(journal_.warn()) << "getSquelchDuration: unexpected squelch duration " << npeers; } - return seconds{ripple::rand_int(MIN_UNSQUELCH_EXPIRE / 1s, m / 1s)}; + return seconds{xrpl::rand_int(MIN_UNSQUELCH_EXPIRE / 1s, m / 1s)}; } template @@ -821,6 +821,6 @@ Slots::deleteIdlePeers() } // namespace reduce_relay -} // namespace ripple +} // namespace xrpl #endif // XRPL_OVERLAY_SLOT_H_INCLUDED diff --git a/src/xrpld/overlay/Squelch.h b/src/xrpld/overlay/Squelch.h index d935087fbc..486cb0073c 100644 --- a/src/xrpld/overlay/Squelch.h +++ b/src/xrpld/overlay/Squelch.h @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace reduce_relay { @@ -105,6 +105,6 @@ Squelch::expireSquelch(PublicKey const& validator) } // namespace reduce_relay -} // namespace ripple +} // namespace xrpl #endif // XRPL_SQUELCH_H diff --git a/src/xrpld/overlay/detail/Cluster.cpp b/src/xrpld/overlay/detail/Cluster.cpp index f4505116b1..606699b841 100644 --- a/src/xrpld/overlay/detail/Cluster.cpp +++ b/src/xrpld/overlay/detail/Cluster.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { Cluster::Cluster(beast::Journal j) : j_(j) { @@ -114,4 +114,4 @@ Cluster::load(Section const& nodes) return true; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/ConnectAttempt.cpp b/src/xrpld/overlay/detail/ConnectAttempt.cpp index 57565b5c19..bd18d96442 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.cpp +++ b/src/xrpld/overlay/detail/ConnectAttempt.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { ConnectAttempt::ConnectAttempt( Application& app, @@ -92,7 +92,7 @@ ConnectAttempt::shutdown() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::ConnectAttempt::shutdown: strand in this thread"); + "xrpl::ConnectAttempt::shutdown: strand in this thread"); if (!socket_.is_open()) return; @@ -108,7 +108,7 @@ ConnectAttempt::tryAsyncShutdown() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::ConnectAttempt::tryAsyncShutdown : strand in this thread"); + "xrpl::ConnectAttempt::tryAsyncShutdown : strand in this thread"); if (!shutdown_ || currentStep_ == ConnectionStep::ShutdownStarted) return; @@ -165,7 +165,7 @@ ConnectAttempt::close() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::ConnectAttempt::close : strand in this thread"); + "xrpl::ConnectAttempt::close : strand in this thread"); if (!socket_.is_open()) return; @@ -619,4 +619,4 @@ ConnectAttempt::processResponse() } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/ConnectAttempt.h b/src/xrpld/overlay/detail/ConnectAttempt.h index 6f0a151383..69053f3bc1 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.h +++ b/src/xrpld/overlay/detail/ConnectAttempt.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { /** * @class ConnectAttempt @@ -273,6 +273,6 @@ private: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/Handshake.cpp b/src/xrpld/overlay/detail/Handshake.cpp index 45dc37f52c..411884dc12 100644 --- a/src/xrpld/overlay/detail/Handshake.cpp +++ b/src/xrpld/overlay/detail/Handshake.cpp @@ -14,7 +14,7 @@ // VFALCO Shouldn't we have to include the OpenSSL // headers or something for SSL_get_finished? -namespace ripple { +namespace xrpl { std::optional getFeatureValue( @@ -158,7 +158,7 @@ makeSharedValue(stream_type& ssl, beast::Journal journal) void buildHandshake( boost::beast::http::fields& h, - ripple::uint256 const& sharedValue, + xrpl::uint256 const& sharedValue, std::optional networkID, beast::IP::Address public_ip, beast::IP::Address remote_ip, @@ -207,7 +207,7 @@ buildHandshake( PublicKey verifyHandshake( boost::beast::http::fields const& headers, - ripple::uint256 const& sharedValue, + xrpl::uint256 const& sharedValue, std::optional networkID, beast::IP::Address public_ip, beast::IP::Address remote, @@ -402,4 +402,4 @@ makeResponse( return resp; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/Handshake.h b/src/xrpld/overlay/detail/Handshake.h index 52777d2bd8..95eb18394d 100644 --- a/src/xrpld/overlay/detail/Handshake.h +++ b/src/xrpld/overlay/detail/Handshake.h @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { using socket_type = boost::beast::tcp_stream; using stream_type = boost::beast::ssl_stream; @@ -233,6 +233,6 @@ makeFeaturesResponseHeader( bool txReduceRelayEnabled, bool vpReduceRelayEnabled); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/Message.cpp b/src/xrpld/overlay/detail/Message.cpp index b4cd4262aa..eb7b88894a 100644 --- a/src/xrpld/overlay/detail/Message.cpp +++ b/src/xrpld/overlay/detail/Message.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { Message::Message( ::google::protobuf::Message const& message, @@ -12,12 +12,12 @@ Message::Message( : category_(TrafficCount::categorize(message, type, false)) , validatorKey_(validator) { - using namespace ripple::compression; + using namespace xrpl::compression; auto const messageBytes = messageSize(message); XRPL_ASSERT( - messageBytes, "ripple::Message::Message : non-empty message input"); + messageBytes, "xrpl::Message::Message : non-empty message input"); buffer_.resize(headerBytes + messageBytes); @@ -28,7 +28,7 @@ Message::Message( XRPL_ASSERT( getBufferSize() == totalSize(message), - "ripple::Message::Message : message size matches the buffer"); + "xrpl::Message::Message : message size matches the buffer"); } // static @@ -52,7 +52,7 @@ Message::totalSize(::google::protobuf::Message const& message) void Message::compress() { - using namespace ripple::compression; + using namespace xrpl::compression; auto const messageBytes = buffer_.size() - headerBytes; auto type = getType(buffer_.data()); @@ -92,7 +92,7 @@ Message::compress() { auto payload = static_cast(buffer_.data() + headerBytes); - auto compressedSize = ripple::compression::compress( + auto compressedSize = xrpl::compression::compress( payload, messageBytes, [&](std::size_t inSize) { // size of required compressed buffer @@ -208,4 +208,4 @@ Message::getType(std::uint8_t const* in) const return type; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index d2a994fa8e..e5f77021d7 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace CrawlOptions { enum { @@ -285,7 +285,7 @@ OverlayImpl::onHandoff( auto const result = m_peers.emplace(peer->slot(), peer); XRPL_ASSERT( result.second, - "ripple::OverlayImpl::onHandoff : peer is inserted"); + "xrpl::OverlayImpl::onHandoff : peer is inserted"); (void)result.second; } list_.emplace(peer.get(), peer); @@ -378,7 +378,7 @@ OverlayImpl::makeErrorResponse( void OverlayImpl::connect(beast::IP::Endpoint const& remote_endpoint) { - XRPL_ASSERT(work_, "ripple::OverlayImpl::connect : work is set"); + XRPL_ASSERT(work_, "xrpl::OverlayImpl::connect : work is set"); auto usage = resourceManager().newOutboundEndpoint(remote_endpoint); if (usage.disconnect(journal_)) @@ -425,8 +425,7 @@ OverlayImpl::add_active(std::shared_ptr const& peer) { auto const result = m_peers.emplace(peer->slot(), peer); XRPL_ASSERT( - result.second, - "ripple::OverlayImpl::add_active : peer is inserted"); + result.second, "xrpl::OverlayImpl::add_active : peer is inserted"); (void)result.second; } @@ -437,7 +436,7 @@ OverlayImpl::add_active(std::shared_ptr const& peer) std::make_tuple(peer)); XRPL_ASSERT( result.second, - "ripple::OverlayImpl::add_active : peer ID is inserted"); + "xrpl::OverlayImpl::add_active : peer ID is inserted"); (void)result.second; } @@ -457,7 +456,7 @@ OverlayImpl::remove(std::shared_ptr const& slot) std::lock_guard lock(mutex_); auto const iter = m_peers.find(slot); XRPL_ASSERT( - iter != m_peers.end(), "ripple::OverlayImpl::remove : valid input"); + iter != m_peers.end(), "xrpl::OverlayImpl::remove : valid input"); m_peers.erase(iter); } @@ -598,15 +597,14 @@ OverlayImpl::activate(std::shared_ptr const& peer) std::make_tuple(peer->id()), std::make_tuple(peer))); XRPL_ASSERT( - result.second, - "ripple::OverlayImpl::activate : peer ID is inserted"); + result.second, "xrpl::OverlayImpl::activate : peer ID is inserted"); (void)result.second; } JLOG(journal.debug()) << "activated"; // We just accepted this peer so we have non-zero active peers - XRPL_ASSERT(size(), "ripple::OverlayImpl::activate : nonzero peers"); + XRPL_ASSERT(size(), "xrpl::OverlayImpl::activate : nonzero peers"); } void @@ -647,7 +645,7 @@ OverlayImpl::onManifests( mo = deserializeManifest(serialized); XRPL_ASSERT( mo, - "ripple::OverlayImpl::onManifests : manifest " + "xrpl::OverlayImpl::onManifests : manifest " "deserialization succeeded"); app_.getOPs().pubManifest(*mo); @@ -1603,4 +1601,4 @@ make_Overlay( collector); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index 18f2aa0c3f..dc7e4975a3 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -35,7 +35,7 @@ #include #include -namespace ripple { +namespace xrpl { class PeerImp; class BasicConfig; @@ -595,7 +595,7 @@ private: std::lock_guard lock(m_statsMutex); XRPL_ASSERT( counts.size() == m_stats.trafficGauges.size(), - "ripple::OverlayImpl::collect_metrics : counts size do match"); + "xrpl::OverlayImpl::collect_metrics : counts size do match"); for (auto const& [key, value] : counts) { @@ -607,7 +607,7 @@ private: XRPL_ASSERT( gauge.name == value.name, - "ripple::OverlayImpl::collect_metrics : gauge and counter " + "xrpl::OverlayImpl::collect_metrics : gauge and counter " "match"); gauge.bytesIn = value.bytesIn; @@ -620,6 +620,6 @@ private: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 7adfef4064..c92a95149e 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -33,7 +33,7 @@ using namespace std::chrono_literals; -namespace ripple { +namespace xrpl { namespace { /** The threshold above which we treat a peer connection as high latency */ @@ -562,7 +562,7 @@ PeerImp::fail(std::string const& name, error_code ec) { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::fail : strand in this thread"); + "xrpl::PeerImp::fail : strand in this thread"); if (!socket_.is_open()) return; @@ -601,7 +601,7 @@ PeerImp::tryAsyncShutdown() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::tryAsyncShutdown : strand in this thread"); + "xrpl::PeerImp::tryAsyncShutdown : strand in this thread"); if (!shutdown_ || shutdownStarted_) return; @@ -625,7 +625,7 @@ PeerImp::shutdown() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::shutdown: strand in this thread"); + "xrpl::PeerImp::shutdown: strand in this thread"); if (!socket_.is_open() || shutdown_) return; @@ -668,7 +668,7 @@ PeerImp::close() { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::close : strand in this thread"); + "xrpl::PeerImp::close : strand in this thread"); if (!socket_.is_open()) return; @@ -723,7 +723,7 @@ PeerImp::onTimer(error_code const& ec) { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::onTimer : strand in this thread"); + "xrpl::PeerImp::onTimer : strand in this thread"); if (!socket_.is_open()) return; @@ -804,7 +804,7 @@ PeerImp::doAccept() { XRPL_ASSERT( read_buffer_.size() == 0, - "ripple::PeerImp::doAccept : empty read buffer"); + "xrpl::PeerImp::doAccept : empty read buffer"); JLOG(journal_.debug()) << "doAccept"; @@ -933,7 +933,7 @@ PeerImp::onReadMessage(error_code ec, std::size_t bytes_transferred) { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::onReadMessage : strand in this thread"); + "xrpl::PeerImp::onReadMessage : strand in this thread"); readPending_ = false; @@ -1005,7 +1005,7 @@ PeerImp::onReadMessage(error_code ec, std::size_t bytes_transferred) readPending_ = true; XRPL_ASSERT( - !shutdownStarted_, "ripple::PeerImp::onReadMessage : shutdown started"); + !shutdownStarted_, "xrpl::PeerImp::onReadMessage : shutdown started"); // Timeout on writes only stream_.async_read_some( @@ -1024,7 +1024,7 @@ PeerImp::onWriteMessage(error_code ec, std::size_t bytes_transferred) { XRPL_ASSERT( strand_.running_in_this_thread(), - "ripple::PeerImp::onWriteMessage : strand in this thread"); + "xrpl::PeerImp::onWriteMessage : strand in this thread"); writePending_ = false; @@ -1051,7 +1051,7 @@ PeerImp::onWriteMessage(error_code ec, std::size_t bytes_transferred) XRPL_ASSERT( !send_queue_.empty(), - "ripple::PeerImp::onWriteMessage : non-empty send buffer"); + "xrpl::PeerImp::onWriteMessage : non-empty send buffer"); send_queue_.pop(); if (shutdown_) @@ -1062,7 +1062,7 @@ PeerImp::onWriteMessage(error_code ec, std::size_t bytes_transferred) writePending_ = true; XRPL_ASSERT( !shutdownStarted_, - "ripple::PeerImp::onWriteMessage : shutdown started"); + "xrpl::PeerImp::onWriteMessage : shutdown started"); // Timeout on writes only return boost::asio::async_write( @@ -1343,7 +1343,7 @@ PeerImp::handleTransaction( { XRPL_ASSERT( eraseTxQueue != batch, - ("ripple::PeerImp::handleTransaction : valid inputs")); + ("xrpl::PeerImp::handleTransaction : valid inputs")); if (tracking_.load() == Tracking::diverged) return; @@ -2186,7 +2186,7 @@ PeerImp::onValidatorListMessage( XRPL_ASSERT( applyResult.publisherKey, - "ripple::PeerImp::onValidatorListMessage : publisher key is " + "xrpl::PeerImp::onValidatorListMessage : publisher key is " "set"); auto const& pubKey = *applyResult.publisherKey; #ifndef NDEBUG @@ -2195,7 +2195,7 @@ PeerImp::onValidatorListMessage( { XRPL_ASSERT( iter->second < applyResult.sequence, - "ripple::PeerImp::onValidatorListMessage : lower sequence"); + "xrpl::PeerImp::onValidatorListMessage : lower sequence"); } #endif publisherListSequences_[pubKey] = applyResult.sequence; @@ -2208,12 +2208,12 @@ PeerImp::onValidatorListMessage( std::lock_guard sl(recentLock_); XRPL_ASSERT( applyResult.sequence && applyResult.publisherKey, - "ripple::PeerImp::onValidatorListMessage : nonzero sequence " + "xrpl::PeerImp::onValidatorListMessage : nonzero sequence " "and set publisher key"); XRPL_ASSERT( publisherListSequences_[*applyResult.publisherKey] <= applyResult.sequence, - "ripple::PeerImp::onValidatorListMessage : maximum sequence"); + "xrpl::PeerImp::onValidatorListMessage : maximum sequence"); } #endif // !NDEBUG @@ -2226,7 +2226,7 @@ PeerImp::onValidatorListMessage( // LCOV_EXCL_START default: UNREACHABLE( - "ripple::PeerImp::onValidatorListMessage : invalid best list " + "xrpl::PeerImp::onValidatorListMessage : invalid best list " "disposition"); // LCOV_EXCL_STOP } @@ -2272,7 +2272,7 @@ PeerImp::onValidatorListMessage( // LCOV_EXCL_START default: UNREACHABLE( - "ripple::PeerImp::onValidatorListMessage : invalid worst list " + "xrpl::PeerImp::onValidatorListMessage : invalid worst list " "disposition"); // LCOV_EXCL_STOP } @@ -2327,7 +2327,7 @@ PeerImp::onValidatorListMessage( // LCOV_EXCL_START default: UNREACHABLE( - "ripple::PeerImp::onValidatorListMessage : invalid list " + "xrpl::PeerImp::onValidatorListMessage : invalid list " "disposition"); // LCOV_EXCL_STOP } @@ -2986,7 +2986,7 @@ PeerImp::checkTransaction( auto tx = std::make_shared(stx, reason, app_); XRPL_ASSERT( tx->getStatus() == NEW, - "ripple::PeerImp::checkTransaction Transaction created " + "xrpl::PeerImp::checkTransaction Transaction created " "correctly"); if (tx->getStatus() == NEW) { @@ -3089,7 +3089,7 @@ PeerImp::checkPropose( JLOG(p_journal_.trace()) << "Checking " << (isTrusted ? "trusted" : "UNTRUSTED") << " proposal"; - XRPL_ASSERT(packet, "ripple::PeerImp::checkPropose : non-null packet"); + XRPL_ASSERT(packet, "xrpl::PeerImp::checkPropose : non-null packet"); if (!cluster() && !peerPos.checkSign()) { @@ -3655,4 +3655,4 @@ PeerImp::Metrics::total_bytes() const return totalBytes_; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 78f3e46509..565c3f9d0f 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -26,7 +26,7 @@ #include #include -namespace ripple { +namespace xrpl { struct ValidatorBlobInfo; class SHAMap; @@ -202,7 +202,7 @@ private: { XRPL_ASSERT( f >= fee, - "ripple::PeerImp::ChargeWithContext::update : fee increases"); + "xrpl::PeerImp::ChargeWithContext::update : fee increases"); fee = f; if (!context.empty()) { @@ -903,6 +903,6 @@ PeerImp::sendEndpoints(FwdIt first, FwdIt last) send(std::make_shared(tm, protocol::mtENDPOINTS)); } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/PeerReservationTable.cpp b/src/xrpld/overlay/detail/PeerReservationTable.cpp index 27cf749ab1..1e3452ca17 100644 --- a/src/xrpld/overlay/detail/PeerReservationTable.cpp +++ b/src/xrpld/overlay/detail/PeerReservationTable.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { auto PeerReservation::toJson() const -> Json::Value @@ -111,4 +111,4 @@ PeerReservationTable::erase(PublicKey const& nodeId) return previous; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/PeerSet.cpp b/src/xrpld/overlay/detail/PeerSet.cpp index 9f5b810ffc..f11a07f7a3 100644 --- a/src/xrpld/overlay/detail/PeerSet.cpp +++ b/src/xrpld/overlay/detail/PeerSet.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { class PeerSetImpl : public PeerSet { @@ -29,7 +29,7 @@ public: private: // Used in this class for access to boost::asio::io_context and - // ripple::Overlay. + // xrpl::Overlay. Application& app_; beast::Journal journal_; @@ -171,4 +171,4 @@ make_DummyPeerSet(Application& app) return std::make_unique(app); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/ProtocolMessage.h b/src/xrpld/overlay/detail/ProtocolMessage.h index 0eaa4ca720..1a35deb6f0 100644 --- a/src/xrpld/overlay/detail/ProtocolMessage.h +++ b/src/xrpld/overlay/detail/ProtocolMessage.h @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { inline protocol::MessageType protocolMessageType(protocol::TMGetLedger const&) @@ -152,13 +152,13 @@ parseMessageHeader( BufferSequence const& bufs, std::size_t size) { - using namespace ripple::compression; + using namespace xrpl::compression; MessageHeader hdr; auto iter = buffersBegin(bufs); XRPL_ASSERT( iter != buffersEnd(bufs), - "ripple::detail::parseMessageHeader : non-empty buffer"); + "xrpl::detail::parseMessageHeader : non-empty buffer"); // Check valid header compressed message: // - 4 bits are the compression algorithm, 1st bit is always set to 1 @@ -256,7 +256,7 @@ parseMessageContent(MessageHeader const& header, Buffers const& buffers) std::vector payload; payload.resize(header.uncompressed_size); - auto const payloadSize = ripple::compression::decompress( + auto const payloadSize = xrpl::compression::decompress( stream, header.payload_wire_size, payload.data(), @@ -285,7 +285,7 @@ invoke(MessageHeader const& header, Buffers const& buffers, Handler& handler) if (!m) return false; - using namespace ripple::compression; + using namespace xrpl::compression; handler.onMessageBegin( header.message_type, m, @@ -465,6 +465,6 @@ invokeProtocolMessage( return result; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/ProtocolVersion.cpp b/src/xrpld/overlay/detail/ProtocolVersion.cpp index 4a5c3d10b3..a99e38e8ea 100644 --- a/src/xrpld/overlay/detail/ProtocolVersion.cpp +++ b/src/xrpld/overlay/detail/ProtocolVersion.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** The list of protocol versions we speak and we prefer to use. @@ -164,4 +164,4 @@ isProtocolSupported(ProtocolVersion const& v) v); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/ProtocolVersion.h b/src/xrpld/overlay/detail/ProtocolVersion.h index 02b8720563..ff49c89f1a 100644 --- a/src/xrpld/overlay/detail/ProtocolVersion.h +++ b/src/xrpld/overlay/detail/ProtocolVersion.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Represents a particular version of the peer-to-peer protocol. @@ -58,6 +58,6 @@ supportedProtocolVersions(); bool isProtocolSupported(ProtocolVersion const& v); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/TrafficCount.cpp b/src/xrpld/overlay/detail/TrafficCount.cpp index 03b83d29de..6fb397ea71 100644 --- a/src/xrpld/overlay/detail/TrafficCount.cpp +++ b/src/xrpld/overlay/detail/TrafficCount.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { std::unordered_map const type_lookup = { @@ -127,4 +127,4 @@ TrafficCount::categorize( return TrafficCount::category::unknown; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/TrafficCount.h b/src/xrpld/overlay/detail/TrafficCount.h index c6d10ee286..7d005c22d0 100644 --- a/src/xrpld/overlay/detail/TrafficCount.h +++ b/src/xrpld/overlay/detail/TrafficCount.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /** TrafficCount is used to count ingress and egress wire bytes and number of @@ -196,7 +196,7 @@ public: { XRPL_ASSERT( cat <= category::unknown, - "ripple::TrafficCount::addCount : valid category input"); + "xrpl::TrafficCount::addCount : valid category input"); auto it = counts_.find(cat); @@ -355,5 +355,5 @@ protected: }; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/Tuning.h b/src/xrpld/overlay/detail/Tuning.h index c78ac20572..c18d17c359 100644 --- a/src/xrpld/overlay/detail/Tuning.h +++ b/src/xrpld/overlay/detail/Tuning.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace Tuning { @@ -47,6 +47,6 @@ std::size_t constexpr readBufferBytes = 16384; } // namespace Tuning -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/TxMetrics.cpp b/src/xrpld/overlay/detail/TxMetrics.cpp index 088137c58d..10f14183a3 100644 --- a/src/xrpld/overlay/detail/TxMetrics.cpp +++ b/src/xrpld/overlay/detail/TxMetrics.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace metrics { @@ -130,4 +130,4 @@ TxMetrics::json() const } // namespace metrics -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/TxMetrics.h b/src/xrpld/overlay/detail/TxMetrics.h index 2db755466c..3c34aaf9f9 100644 --- a/src/xrpld/overlay/detail/TxMetrics.h +++ b/src/xrpld/overlay/detail/TxMetrics.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace metrics { @@ -117,6 +117,6 @@ struct TxMetrics } // namespace metrics -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/detail/ZeroCopyStream.h b/src/xrpld/overlay/detail/ZeroCopyStream.h index 2f5279a6fe..2373ea16d0 100644 --- a/src/xrpld/overlay/detail/ZeroCopyStream.h +++ b/src/xrpld/overlay/detail/ZeroCopyStream.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** Implements ZeroCopyInputStream around a buffer sequence. @tparam Buffers A type meeting the requirements of ConstBufferSequence. @@ -188,13 +188,13 @@ void ZeroCopyOutputStream::BackUp(int count) { XRPL_ASSERT( - count <= commit_, "ripple::ZeroCopyOutputStream::BackUp : valid input"); + count <= commit_, "xrpl::ZeroCopyOutputStream::BackUp : valid input"); auto const n = commit_ - count; streambuf_.commit(n); count_ += n; commit_ = 0; } -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/make_Overlay.h b/src/xrpld/overlay/make_Overlay.h index 9bf867fba6..6c37c1c825 100644 --- a/src/xrpld/overlay/make_Overlay.h +++ b/src/xrpld/overlay/make_Overlay.h @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { Overlay::Setup setup_Overlay(BasicConfig const& config); @@ -25,6 +25,6 @@ make_Overlay( BasicConfig const& config, beast::insight::Collector::ptr const& collector); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/overlay/predicates.h b/src/xrpld/overlay/predicates.h index 36d0cf28b1..6683d8007f 100644 --- a/src/xrpld/overlay/predicates.h +++ b/src/xrpld/overlay/predicates.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { /** Sends a message to all peers */ struct send_always @@ -156,6 +156,6 @@ struct peer_in_set } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/PeerfinderManager.h b/src/xrpld/peerfinder/PeerfinderManager.h index bde9645efd..7a25edcce5 100644 --- a/src/xrpld/peerfinder/PeerfinderManager.h +++ b/src/xrpld/peerfinder/PeerfinderManager.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { using clock_type = beast::abstract_clock; @@ -86,7 +86,7 @@ struct Config */ static Config makeConfig( - ripple::Config const& config, + xrpl::Config const& config, std::uint16_t port, bool validationPublicKey, int ipLimit); @@ -303,6 +303,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/Slot.h b/src/xrpld/peerfinder/Slot.h index 6a8515fc29..1d5d58884a 100644 --- a/src/xrpld/peerfinder/Slot.h +++ b/src/xrpld/peerfinder/Slot.h @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Properties and state associated with a peer to peer overlay connection. */ @@ -60,6 +60,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Bootcache.cpp b/src/xrpld/peerfinder/detail/Bootcache.cpp index 3d11ee74ee..4505c02872 100644 --- a/src/xrpld/peerfinder/detail/Bootcache.cpp +++ b/src/xrpld/peerfinder/detail/Bootcache.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { Bootcache::Bootcache(Store& store, clock_type& clock, beast::Journal journal) @@ -270,4 +270,4 @@ Bootcache::flagForUpdate() } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/Bootcache.h b/src/xrpld/peerfinder/detail/Bootcache.h index b0646a21d5..42867907c1 100644 --- a/src/xrpld/peerfinder/detail/Bootcache.h +++ b/src/xrpld/peerfinder/detail/Bootcache.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Stores IP addresses useful for gaining initial connections. @@ -68,8 +68,8 @@ private: using left_t = boost::bimaps::unordered_set_of< beast::IP::Endpoint, boost::hash, - ripple::equal_to>; - using right_t = boost::bimaps::multiset_of>; + xrpl::equal_to>; + using right_t = boost::bimaps::multiset_of>; using map_type = boost::bimap; using value_type = map_type::value_type; @@ -176,6 +176,6 @@ private: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Checker.h b/src/xrpld/peerfinder/detail/Checker.h index d8a3d667e4..277ce8c74d 100644 --- a/src/xrpld/peerfinder/detail/Checker.h +++ b/src/xrpld/peerfinder/detail/Checker.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Tests remote listening sockets to make sure they are connectible. */ @@ -210,6 +210,6 @@ Checker::remove(basic_async_op& op) } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Counts.h b/src/xrpld/peerfinder/detail/Counts.h index ec4b068802..7bb17278cc 100644 --- a/src/xrpld/peerfinder/detail/Counts.h +++ b/src/xrpld/peerfinder/detail/Counts.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Manages the count of available connections for the various slots. */ @@ -53,7 +53,7 @@ public: // Must be handshaked and in the right state XRPL_ASSERT( s.state() == Slot::connected || s.state() == Slot::accept, - "ripple::PeerFinder::Counts::can_activate : valid input state"); + "xrpl::PeerFinder::Counts::can_activate : valid input state"); if (s.fixed() || s.reserved()) return true; @@ -246,7 +246,7 @@ private: case Slot::accept: XRPL_ASSERT( s.inbound(), - "ripple::PeerFinder::Counts::adjust : input is inbound"); + "xrpl::PeerFinder::Counts::adjust : input is inbound"); m_acceptCount += n; break; @@ -254,7 +254,7 @@ private: case Slot::connected: XRPL_ASSERT( !s.inbound(), - "ripple::PeerFinder::Counts::adjust : input is not " + "xrpl::PeerFinder::Counts::adjust : input is not " "inbound"); m_attempts += n; break; @@ -279,7 +279,7 @@ private: // LCOV_EXCL_START default: UNREACHABLE( - "ripple::PeerFinder::Counts::adjust : invalid input state"); + "xrpl::PeerFinder::Counts::adjust : invalid input state"); break; // LCOV_EXCL_STOP }; @@ -322,6 +322,6 @@ private: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Endpoint.cpp b/src/xrpld/peerfinder/detail/Endpoint.cpp index 5ae3839cb5..46f4f28b88 100644 --- a/src/xrpld/peerfinder/detail/Endpoint.cpp +++ b/src/xrpld/peerfinder/detail/Endpoint.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { Endpoint::Endpoint(beast::IP::Endpoint const& ep, std::uint32_t hops_) @@ -10,4 +10,4 @@ Endpoint::Endpoint(beast::IP::Endpoint const& ep, std::uint32_t hops_) } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/Fixed.h b/src/xrpld/peerfinder/detail/Fixed.h index c238c34477..4c89bc598e 100644 --- a/src/xrpld/peerfinder/detail/Fixed.h +++ b/src/xrpld/peerfinder/detail/Fixed.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Metadata for a Fixed slot. */ @@ -47,6 +47,6 @@ private: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Handouts.h b/src/xrpld/peerfinder/detail/Handouts.h index e88376d0d6..60789ae7ab 100644 --- a/src/xrpld/peerfinder/detail/Handouts.h +++ b/src/xrpld/peerfinder/detail/Handouts.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { namespace detail { @@ -25,7 +25,7 @@ handout_one(Target& t, HopContainer& h) { XRPL_ASSERT( !t.full(), - "ripple::PeerFinder::detail::handout_one : target is not full"); + "xrpl::PeerFinder::detail::handout_one : target is not full"); for (auto it = h.begin(); it != h.end(); ++it) { auto const& e = *it; @@ -340,6 +340,6 @@ ConnectHandouts::try_insert(beast::IP::Endpoint const& endpoint) } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Livecache.h b/src/xrpld/peerfinder/detail/Livecache.h index 2664d2cbf3..0927593ed1 100644 --- a/src/xrpld/peerfinder/detail/Livecache.h +++ b/src/xrpld/peerfinder/detail/Livecache.h @@ -15,7 +15,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { template @@ -417,7 +417,7 @@ Livecache::insert(Endpoint const& ep) // XRPL_ASSERT( ep.hops <= (Tuning::maxHops + 1), - "ripple::PeerFinder::Livecache::insert : maximum input hops"); + "xrpl::PeerFinder::Livecache::insert : maximum input hops"); auto result = m_cache.emplace(ep.address, ep); Element& e(result.first->second); if (result.second) @@ -517,7 +517,7 @@ Livecache::hops_t::insert(Element& e) { XRPL_ASSERT( e.endpoint.hops <= Tuning::maxHops + 1, - "ripple::PeerFinder::Livecache::hops_t::insert : maximum input hops"); + "xrpl::PeerFinder::Livecache::hops_t::insert : maximum input hops"); // This has security implications without a shuffle m_lists[e.endpoint.hops].push_front(e); ++m_hist[e.endpoint.hops]; @@ -529,7 +529,7 @@ Livecache::hops_t::reinsert(Element& e, std::uint32_t numHops) { XRPL_ASSERT( numHops <= Tuning::maxHops + 1, - "ripple::PeerFinder::Livecache::hops_t::reinsert : maximum hops input"); + "xrpl::PeerFinder::Livecache::hops_t::reinsert : maximum hops input"); auto& list = m_lists[e.endpoint.hops]; list.erase(list.iterator_to(e)); @@ -551,6 +551,6 @@ Livecache::hops_t::remove(Element& e) } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Logic.h b/src/xrpld/peerfinder/detail/Logic.h index a4ec77fd96..50026cc886 100644 --- a/src/xrpld/peerfinder/detail/Logic.h +++ b/src/xrpld/peerfinder/detail/Logic.h @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** The Logic for maintaining the list of Slot addresses. @@ -288,7 +288,7 @@ public: // Remote address must not already exist XRPL_ASSERT( result.second, - "ripple::PeerFinder::Logic::new_inbound_slot : remote endpoint " + "xrpl::PeerFinder::Logic::new_inbound_slot : remote endpoint " "inserted"); // Add to the connected address list connectedAddresses_.emplace(remote_endpoint.address()); @@ -326,7 +326,7 @@ public: // Remote address must not already exist XRPL_ASSERT( result.second, - "ripple::PeerFinder::Logic::new_outbound_slot : remote endpoint " + "xrpl::PeerFinder::Logic::new_outbound_slot : remote endpoint " "inserted"); // Add to the connected address list @@ -353,7 +353,7 @@ public: // The object must exist in our table XRPL_ASSERT( slots_.find(slot->remote_endpoint()) != slots_.end(), - "ripple::PeerFinder::Logic::onConnected : valid slot input"); + "xrpl::PeerFinder::Logic::onConnected : valid slot input"); // Assign the local endpoint now that it's known slot->local_endpoint(local_endpoint); @@ -364,7 +364,7 @@ public: { XRPL_ASSERT( iter->second->local_endpoint() == slot->remote_endpoint(), - "ripple::PeerFinder::Logic::onConnected : local and remote " + "xrpl::PeerFinder::Logic::onConnected : local and remote " "endpoints do match"); JLOG(journal.warn()) << "Logic dropping as self connect"; return false; @@ -393,11 +393,11 @@ public: // The object must exist in our table XRPL_ASSERT( slots_.find(slot->remote_endpoint()) != slots_.end(), - "ripple::PeerFinder::Logic::activate : valid slot input"); + "xrpl::PeerFinder::Logic::activate : valid slot input"); // Must be accepted or connected XRPL_ASSERT( slot->state() == Slot::accept || slot->state() == Slot::connected, - "ripple::PeerFinder::Logic::activate : valid slot state"); + "xrpl::PeerFinder::Logic::activate : valid slot state"); // Check for duplicate connection by key if (keys_.find(key) != keys_.end()) @@ -427,7 +427,7 @@ public: // Public key must not already exist XRPL_ASSERT( inserted, - "ripple::PeerFinder::Logic::activate : public key inserted"); + "xrpl::PeerFinder::Logic::activate : public key inserted"); } // Change state and update counts @@ -792,12 +792,12 @@ public: // The object must exist in our table XRPL_ASSERT( slots_.find(slot->remote_endpoint()) != slots_.end(), - "ripple::PeerFinder::Logic::on_endpoints : valid slot input"); + "xrpl::PeerFinder::Logic::on_endpoints : valid slot input"); // Must be handshaked! XRPL_ASSERT( slot->state() == Slot::active, - "ripple::PeerFinder::Logic::on_endpoints : valid slot state"); + "xrpl::PeerFinder::Logic::on_endpoints : valid slot state"); clock_type::time_point const now(m_clock.now()); @@ -811,7 +811,7 @@ public: { XRPL_ASSERT( ep.hops, - "ripple::PeerFinder::Logic::on_endpoints : nonzero hops"); + "xrpl::PeerFinder::Logic::on_endpoints : nonzero hops"); slot->recent.insert(ep.address, ep.hops); @@ -964,7 +964,7 @@ public: // LCOV_EXCL_START default: UNREACHABLE( - "ripple::PeerFinder::Logic::on_closed : invalid slot " + "xrpl::PeerFinder::Logic::on_closed : invalid slot " "state"); break; // LCOV_EXCL_STOP @@ -1264,6 +1264,6 @@ Logic::onRedirects( } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/PeerfinderConfig.cpp b/src/xrpld/peerfinder/detail/PeerfinderConfig.cpp index 44e4f64197..726c18fdc0 100644 --- a/src/xrpld/peerfinder/detail/PeerfinderConfig.cpp +++ b/src/xrpld/peerfinder/detail/PeerfinderConfig.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { Config::Config() @@ -68,7 +68,7 @@ Config::onWrite(beast::PropertyStream::Map& map) Config Config::makeConfig( - ripple::Config const& cfg, + xrpl::Config const& cfg, std::uint16_t port, bool validationPublicKey, int ipLimit) @@ -129,4 +129,4 @@ Config::makeConfig( } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/PeerfinderManager.cpp b/src/xrpld/peerfinder/detail/PeerfinderManager.cpp index 05a9a89362..17faf35351 100644 --- a/src/xrpld/peerfinder/detail/PeerfinderManager.cpp +++ b/src/xrpld/peerfinder/detail/PeerfinderManager.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { class ManagerImp : public Manager @@ -266,4 +266,4 @@ make_Manager( } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/SlotImp.cpp b/src/xrpld/peerfinder/detail/SlotImp.cpp index be08bcff7c..ac2ae25d46 100644 --- a/src/xrpld/peerfinder/detail/SlotImp.cpp +++ b/src/xrpld/peerfinder/detail/SlotImp.cpp @@ -2,7 +2,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { SlotImp::SlotImp( @@ -47,29 +47,29 @@ SlotImp::state(State state_) // Must go through activate() to set active state XRPL_ASSERT( state_ != active, - "ripple::PeerFinder::SlotImp::state : input state is not active"); + "xrpl::PeerFinder::SlotImp::state : input state is not active"); // The state must be different XRPL_ASSERT( state_ != m_state, - "ripple::PeerFinder::SlotImp::state : input state is different from " + "xrpl::PeerFinder::SlotImp::state : input state is different from " "current"); // You can't transition into the initial states XRPL_ASSERT( state_ != accept && state_ != connect, - "ripple::PeerFinder::SlotImp::state : input state is not an initial"); + "xrpl::PeerFinder::SlotImp::state : input state is not an initial"); // Can only become connected from outbound connect state XRPL_ASSERT( state_ != connected || (!m_inbound && m_state == connect), - "ripple::PeerFinder::SlotImp::state : input state is not connected an " + "xrpl::PeerFinder::SlotImp::state : input state is not connected an " "invalid state"); // Can't gracefully close on an outbound connection attempt XRPL_ASSERT( state_ != closing || m_state != connect, - "ripple::PeerFinder::SlotImp::state : input state is not closing an " + "xrpl::PeerFinder::SlotImp::state : input state is not closing an " "invalid state"); m_state = state_; @@ -81,7 +81,7 @@ SlotImp::activate(clock_type::time_point const& now) // Can only become active from the accept or connected state XRPL_ASSERT( m_state == accept || m_state == connected, - "ripple::PeerFinder::SlotImp::activate : valid state"); + "xrpl::PeerFinder::SlotImp::activate : valid state"); m_state = active; whenAcceptEndpoints = now; @@ -131,4 +131,4 @@ SlotImp::recent_t::expire() } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/SlotImp.h b/src/xrpld/peerfinder/detail/SlotImp.h index 9898ca490d..cb5ce87202 100644 --- a/src/xrpld/peerfinder/detail/SlotImp.h +++ b/src/xrpld/peerfinder/detail/SlotImp.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { class SlotImp : public Slot @@ -195,6 +195,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Source.h b/src/xrpld/peerfinder/detail/Source.h index b6971790b3..1fe33e053a 100644 --- a/src/xrpld/peerfinder/detail/Source.h +++ b/src/xrpld/peerfinder/detail/Source.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** A static or dynamic source of peer addresses. @@ -45,6 +45,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/SourceStrings.cpp b/src/xrpld/peerfinder/detail/SourceStrings.cpp index 0c7431917a..772ec2d485 100644 --- a/src/xrpld/peerfinder/detail/SourceStrings.cpp +++ b/src/xrpld/peerfinder/detail/SourceStrings.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { class SourceStringsImp : public SourceStrings @@ -49,4 +49,4 @@ SourceStrings::New(std::string const& name, Strings const& strings) } } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/peerfinder/detail/SourceStrings.h b/src/xrpld/peerfinder/detail/SourceStrings.h index cbd03ed352..2babe1d616 100644 --- a/src/xrpld/peerfinder/detail/SourceStrings.h +++ b/src/xrpld/peerfinder/detail/SourceStrings.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Provides addresses from a static set of strings. */ @@ -21,6 +21,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Store.h b/src/xrpld/peerfinder/detail/Store.h index 738462c9c3..d3b283eabf 100644 --- a/src/xrpld/peerfinder/detail/Store.h +++ b/src/xrpld/peerfinder/detail/Store.h @@ -1,7 +1,7 @@ #ifndef XRPL_PEERFINDER_STORE_H_INCLUDED #define XRPL_PEERFINDER_STORE_H_INCLUDED -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Abstract persistence for PeerFinder data. */ @@ -30,6 +30,6 @@ public: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/StoreSqdb.h b/src/xrpld/peerfinder/detail/StoreSqdb.h index 1d87545522..074428c0bc 100644 --- a/src/xrpld/peerfinder/detail/StoreSqdb.h +++ b/src/xrpld/peerfinder/detail/StoreSqdb.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Database persistence for PeerFinder using SQLite */ @@ -89,6 +89,6 @@ private: }; } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/detail/Tuning.h b/src/xrpld/peerfinder/detail/Tuning.h index 856a11a9fe..ba9cf9e615 100644 --- a/src/xrpld/peerfinder/detail/Tuning.h +++ b/src/xrpld/peerfinder/detail/Tuning.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Heuristically tuned constants. */ @@ -116,6 +116,6 @@ std::chrono::seconds constexpr recentAttemptDuration(60); /** @} */ } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/peerfinder/make_Manager.h b/src/xrpld/peerfinder/make_Manager.h index e4bd571261..a86e6d4ccb 100644 --- a/src/xrpld/peerfinder/make_Manager.h +++ b/src/xrpld/peerfinder/make_Manager.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace PeerFinder { /** Create a new Manager. */ @@ -20,6 +20,6 @@ make_Manager( beast::insight::Collector::ptr const& collector); } // namespace PeerFinder -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index 8d6d68137a..4c0c4d2f6f 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -18,7 +18,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace perf { PerfLogImp::Counters::Counters( @@ -36,7 +36,7 @@ PerfLogImp::Counters::Counters( // Ensure that no other function populates this entry. // LCOV_EXCL_START UNREACHABLE( - "ripple::perf::PerfLogImp::Counters::Counters : failed to " + "xrpl::perf::PerfLogImp::Counters::Counters : failed to " "insert label"); // LCOV_EXCL_STOP } @@ -53,7 +53,7 @@ PerfLogImp::Counters::Counters( // Ensure that no other function populates this entry. // LCOV_EXCL_START UNREACHABLE( - "ripple::perf::PerfLogImp::Counters::Counters : failed to " + "xrpl::perf::PerfLogImp::Counters::Counters : failed to " "insert job type"); // LCOV_EXCL_STOP } @@ -315,7 +315,7 @@ PerfLogImp::rpcStart(std::string const& method, std::uint64_t const requestId) if (counter == counters_.rpc_.end()) { // LCOV_EXCL_START - UNREACHABLE("ripple::perf::PerfLogImp::rpcStart : valid method input"); + UNREACHABLE("xrpl::perf::PerfLogImp::rpcStart : valid method input"); return; // LCOV_EXCL_STOP } @@ -339,7 +339,7 @@ PerfLogImp::rpcEnd( if (counter == counters_.rpc_.end()) { // LCOV_EXCL_START - UNREACHABLE("ripple::perf::PerfLogImp::rpcEnd : valid method input"); + UNREACHABLE("xrpl::perf::PerfLogImp::rpcEnd : valid method input"); return; // LCOV_EXCL_STOP } @@ -356,7 +356,7 @@ PerfLogImp::rpcEnd( { // LCOV_EXCL_START UNREACHABLE( - "ripple::perf::PerfLogImp::rpcEnd : valid requestId input"); + "xrpl::perf::PerfLogImp::rpcEnd : valid requestId input"); // LCOV_EXCL_STOP } } @@ -376,8 +376,7 @@ PerfLogImp::jobQueue(JobType const type) if (counter == counters_.jq_.end()) { // LCOV_EXCL_START - UNREACHABLE( - "ripple::perf::PerfLogImp::jobQueue : valid job type input"); + UNREACHABLE("xrpl::perf::PerfLogImp::jobQueue : valid job type input"); return; // LCOV_EXCL_STOP } @@ -396,8 +395,7 @@ PerfLogImp::jobStart( if (counter == counters_.jq_.end()) { // LCOV_EXCL_START - UNREACHABLE( - "ripple::perf::PerfLogImp::jobStart : valid job type input"); + UNREACHABLE("xrpl::perf::PerfLogImp::jobStart : valid job type input"); return; // LCOV_EXCL_STOP } @@ -419,8 +417,7 @@ PerfLogImp::jobFinish(JobType const type, microseconds dur, int instance) if (counter == counters_.jq_.end()) { // LCOV_EXCL_START - UNREACHABLE( - "ripple::perf::PerfLogImp::jobFinish : valid job type input"); + UNREACHABLE("xrpl::perf::PerfLogImp::jobFinish : valid job type input"); return; // LCOV_EXCL_STOP } @@ -511,4 +508,4 @@ make_PerfLog( } } // namespace perf -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/perflog/detail/PerfLogImp.h b/src/xrpld/perflog/detail/PerfLogImp.h index d8e5e7943d..740d7ea952 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.h +++ b/src/xrpld/perflog/detail/PerfLogImp.h @@ -17,7 +17,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace perf { /** A box coupling data with a mutex for locking access to it. */ @@ -103,7 +103,7 @@ class PerfLogImp : public PerfLog Application& app_; beast::Journal const j_; std::function const signalStop_; - Counters counters_{ripple::RPC::getHandlerNames(), JobTypes::instance()}; + Counters counters_{xrpl::RPC::getHandlerNames(), JobTypes::instance()}; std::ofstream logFile_; std::thread thread_; std::mutex mutex_; @@ -185,6 +185,6 @@ public: }; } // namespace perf -} // namespace ripple +} // namespace xrpl #endif // XRPL_BASICS_PERFLOGIMP_H diff --git a/src/xrpld/rpc/BookChanges.h b/src/xrpld/rpc/BookChanges.h index c30dadb9fe..dc20b60c49 100644 --- a/src/xrpld/rpc/BookChanges.h +++ b/src/xrpld/rpc/BookChanges.h @@ -14,7 +14,7 @@ namespace Json { class Value; } -namespace ripple { +namespace xrpl { class ReadView; class Transaction; @@ -205,6 +205,6 @@ computeBookChanges(std::shared_ptr const& lpAccepted) } } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/CTID.h b/src/xrpld/rpc/CTID.h index 0fbd15601e..b7f25894ee 100644 --- a/src/xrpld/rpc/CTID.h +++ b/src/xrpld/rpc/CTID.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -113,6 +113,6 @@ decodeCTID(T const ctid) noexcept } } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/Context.h b/src/xrpld/rpc/Context.h index 1faafa1627..8bb0bd3cbc 100644 --- a/src/xrpld/rpc/Context.h +++ b/src/xrpld/rpc/Context.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; class NetworkOPs; @@ -53,6 +53,6 @@ struct GRPCContext : public Context }; } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/DeliveredAmount.h b/src/xrpld/rpc/DeliveredAmount.h index 25af5c084e..fbd2545963 100644 --- a/src/xrpld/rpc/DeliveredAmount.h +++ b/src/xrpld/rpc/DeliveredAmount.h @@ -11,7 +11,7 @@ namespace Json { class Value; } -namespace ripple { +namespace xrpl { class ReadView; class Transaction; @@ -62,6 +62,6 @@ getDeliveredAmount( /** @} */ } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/GRPCHandlers.h b/src/xrpld/rpc/GRPCHandlers.h index e9bce3ccbf..f3e8d74f9d 100644 --- a/src/xrpld/rpc/GRPCHandlers.h +++ b/src/xrpld/rpc/GRPCHandlers.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /* * These handlers are for gRPC. They each take in a protobuf message that is @@ -32,6 +32,6 @@ std::pair doLedgerDiffGrpc( RPC::GRPCContext& context); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/InfoSub.h b/src/xrpld/rpc/InfoSub.h index f3affd40ae..97ff266364 100644 --- a/src/xrpld/rpc/InfoSub.h +++ b/src/xrpld/rpc/InfoSub.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { // Operations that clients may wish to perform against the network // Master operational handler, server sequencer, network tracker @@ -237,6 +237,6 @@ private: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/MPTokenIssuanceID.h b/src/xrpld/rpc/MPTokenIssuanceID.h index ad96c2b78b..85f44e79b8 100644 --- a/src/xrpld/rpc/MPTokenIssuanceID.h +++ b/src/xrpld/rpc/MPTokenIssuanceID.h @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -37,6 +37,6 @@ insertMPTokenIssuanceID( /** @} */ } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/Output.h b/src/xrpld/rpc/Output.h index 0b0d62bbf9..431cbb6bbf 100644 --- a/src/xrpld/rpc/Output.h +++ b/src/xrpld/rpc/Output.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { using Output = std::function; @@ -15,6 +15,6 @@ stringOutput(std::string& s) } } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/README.md b/src/xrpld/rpc/README.md index 5bb9655a76..749f3d0ed1 100644 --- a/src/xrpld/rpc/README.md +++ b/src/xrpld/rpc/README.md @@ -15,7 +15,7 @@ For this purpose, the rippled RPC handler allows _suspension with continuation_ ## The classes. -Suspension with continuation uses four `std::function`s in the `ripple::RPC` +Suspension with continuation uses four `std::function`s in the `xrpl::RPC` namespace: using Callback = std::function ; diff --git a/src/xrpld/rpc/RPCCall.h b/src/xrpld/rpc/RPCCall.h index b27e60c8ea..2ee9e33cf3 100644 --- a/src/xrpld/rpc/RPCCall.h +++ b/src/xrpld/rpc/RPCCall.h @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { // This a trusted interface, the user is expected to provide valid input to // perform valid requests. Error catching and reporting is not a requirement of @@ -66,6 +66,6 @@ rpcClient( unsigned int apiVersion, std::unordered_map const& headers = {}); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/RPCHandler.h b/src/xrpld/rpc/RPCHandler.h index c6f4dfc6bd..0b91528605 100644 --- a/src/xrpld/rpc/RPCHandler.h +++ b/src/xrpld/rpc/RPCHandler.h @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { struct JsonContext; @@ -17,6 +17,6 @@ Role roleRequired(unsigned int version, bool betaEnabled, std::string const& method); } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/RPCSub.h b/src/xrpld/rpc/RPCSub.h index ea0cc993e8..b6bb32aaf3 100644 --- a/src/xrpld/rpc/RPCSub.h +++ b/src/xrpld/rpc/RPCSub.h @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { /** Subscription object for JSON RPC. */ class RPCSub : public InfoSub @@ -33,6 +33,6 @@ make_RPCSub( std::string const& strPassword, Logs& logs); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/Request.h b/src/xrpld/rpc/Request.h index ceab2944d7..c7b2cedef0 100644 --- a/src/xrpld/rpc/Request.h +++ b/src/xrpld/rpc/Request.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { class Application; @@ -51,6 +51,6 @@ private: }; } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/Role.h b/src/xrpld/rpc/Role.h index 6967474f17..04b288600a 100644 --- a/src/xrpld/rpc/Role.h +++ b/src/xrpld/rpc/Role.h @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { /** Indicates the level of administrative permission to grant. * IDENTIFIED role has unlimited resources but cannot perform some @@ -70,6 +70,6 @@ ipAllowed( std::string_view forwardedFor(http_request_type const& request); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/ServerHandler.h b/src/xrpld/rpc/ServerHandler.h index 4cf5a0ce88..0ad3144caf 100644 --- a/src/xrpld/rpc/ServerHandler.h +++ b/src/xrpld/rpc/ServerHandler.h @@ -20,7 +20,7 @@ #include #include -namespace ripple { +namespace xrpl { inline bool operator<(Port const& lhs, Port const& rhs) @@ -210,6 +210,6 @@ make_ServerHandler( Resource::Manager&, CollectorManager& cm); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/Status.h b/src/xrpld/rpc/Status.h index 2ff804f17c..f4ffcae9b2 100644 --- a/src/xrpld/rpc/Status.h +++ b/src/xrpld/rpc/Status.h @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { /** Status represents the results of an operation that might fail. @@ -77,7 +77,7 @@ public: toTER() const { XRPL_ASSERT( - type_ == Type::TER, "ripple::RPC::Status::toTER : type is TER"); + type_ == Type::TER, "xrpl::RPC::Status::toTER : type is TER"); return TER::fromInt(code_); } @@ -88,7 +88,7 @@ public: { XRPL_ASSERT( type_ == Type::error_code_i, - "ripple::RPC::Status::toTER : type is error code"); + "xrpl::RPC::Status::toTER : type is error code"); return error_code_i(code_); } @@ -139,6 +139,6 @@ private: }; } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/DeliveredAmount.cpp b/src/xrpld/rpc/detail/DeliveredAmount.cpp index bcc7c4389d..7a0629a42d 100644 --- a/src/xrpld/rpc/detail/DeliveredAmount.cpp +++ b/src/xrpld/rpc/detail/DeliveredAmount.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { /* @@ -186,4 +186,4 @@ insertDeliveredAmount( } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/Handler.cpp b/src/xrpld/rpc/detail/Handler.cpp index a4a1be3343..2000af5e81 100644 --- a/src/xrpld/rpc/detail/Handler.cpp +++ b/src/xrpld/rpc/detail/Handler.cpp @@ -7,7 +7,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { namespace { @@ -21,7 +21,7 @@ byRef(Function const& f) if (result.type() != Json::objectValue) { // LCOV_EXCL_START - UNREACHABLE("ripple::RPC::byRef : result is object"); + UNREACHABLE("xrpl::RPC::byRef : result is object"); result = RPC::makeObjectValue(result); // LCOV_EXCL_STOP } @@ -37,7 +37,7 @@ handle(JsonContext& context, Object& object) XRPL_ASSERT( context.apiVersion >= HandlerImpl::minApiVer && context.apiVersion <= HandlerImpl::maxApiVer, - "ripple::RPC::handle : valid API version"); + "xrpl::RPC::handle : valid API version"); HandlerImpl handler(context); auto status = handler.check(); @@ -193,10 +193,10 @@ private: { XRPL_ASSERT( minVer <= maxVer, - "ripple::RPC::HandlerTable : valid API version range"); + "xrpl::RPC::HandlerTable : valid API version range"); XRPL_ASSERT( maxVer <= RPC::apiMaximumValidVersion, - "ripple::RPC::HandlerTable : valid max API version"); + "xrpl::RPC::HandlerTable : valid max API version"); return std::any_of( range.first, @@ -304,4 +304,4 @@ getHandlerNames() } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/Handler.h b/src/xrpld/rpc/detail/Handler.h index 8178d83dee..dac18c966f 100644 --- a/src/xrpld/rpc/detail/Handler.h +++ b/src/xrpld/rpc/detail/Handler.h @@ -13,7 +13,7 @@ namespace Json { class Object; } -namespace ripple { +namespace xrpl { namespace RPC { // Under what condition can we call this RPC? @@ -121,6 +121,6 @@ conditionMet(Condition condition_required, T& context) } } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/InfoSub.cpp b/src/xrpld/rpc/detail/InfoSub.cpp index 14696292f8..a0869b9d96 100644 --- a/src/xrpld/rpc/detail/InfoSub.cpp +++ b/src/xrpld/rpc/detail/InfoSub.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { // This is the primary interface into the "client" portion of the program. // Code that wants to do normal operations on the network such as @@ -126,8 +126,8 @@ unsigned int InfoSub::getApiVersion() const noexcept { XRPL_ASSERT( - apiVersion_ > 0, "ripple::InfoSub::getApiVersion : valid API version"); + apiVersion_ > 0, "xrpl::InfoSub::getApiVersion : valid API version"); return apiVersion_; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/LegacyPathFind.cpp b/src/xrpld/rpc/detail/LegacyPathFind.cpp index c3bcd928cd..e06ae4062d 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.cpp +++ b/src/xrpld/rpc/detail/LegacyPathFind.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { LegacyPathFind::LegacyPathFind(bool isAdmin, Application& app) : m_isOk(false) @@ -50,4 +50,4 @@ LegacyPathFind::~LegacyPathFind() std::atomic LegacyPathFind::inProgress(0); } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/LegacyPathFind.h b/src/xrpld/rpc/detail/LegacyPathFind.h index 40fc11aee8..d175e7c532 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.h +++ b/src/xrpld/rpc/detail/LegacyPathFind.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Application; @@ -28,6 +28,6 @@ private: }; } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/MPTokenIssuanceID.cpp b/src/xrpld/rpc/detail/MPTokenIssuanceID.cpp index 440b783316..3c7f2c5fc3 100644 --- a/src/xrpld/rpc/detail/MPTokenIssuanceID.cpp +++ b/src/xrpld/rpc/detail/MPTokenIssuanceID.cpp @@ -1,6 +1,6 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { @@ -56,4 +56,4 @@ insertMPTokenIssuanceID( } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/RPCCall.cpp b/src/xrpld/rpc/detail/RPCCall.cpp index 185043302a..fa1a089efb 100644 --- a/src/xrpld/rpc/detail/RPCCall.cpp +++ b/src/xrpld/rpc/detail/RPCCall.cpp @@ -28,7 +28,7 @@ #include #include -namespace ripple { +namespace xrpl { class RPCParser; @@ -102,7 +102,7 @@ private: jvParseCurrencyIssuer(std::string const& strCurrencyIssuer) { // Matches a sequence of 3 characters from - // `ripple::detail::isoCharSet` (the currency), + // `xrpl::detail::isoCharSet` (the currency), // optionally followed by a forward slash and some other characters // (the issuer). // https://www.boost.org/doc/libs/1_82_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html @@ -140,7 +140,7 @@ private: std::string const& strPk, TokenType type = TokenType::AccountPublic) { - if (parseBase58(type, strPk)) + if (parseBase58(type, strPk)) return true; auto pkHex = strUnHex(strPk); @@ -1033,7 +1033,7 @@ private: // Parameter count should have already been verified. XRPL_ASSERT( jvParams.size() == 2, - "ripple::RPCParser::parseTransactionEntry : valid parameter count"); + "xrpl::RPCParser::parseTransactionEntry : valid parameter count"); std::string const txHash = jvParams[0u].asString(); if (txHash.length() != 64) @@ -1516,7 +1516,7 @@ rpcClient( } else { - ripple::ServerHandler::Setup setup; + xrpl::ServerHandler::Setup setup; try { setup = setup_ServerHandler( @@ -1720,4 +1720,4 @@ fromNetwork( } // namespace RPCCall -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/RPCHandler.cpp b/src/xrpld/rpc/detail/RPCHandler.cpp index fca926a1c7..eb5b3f7340 100644 --- a/src/xrpld/rpc/detail/RPCHandler.cpp +++ b/src/xrpld/rpc/detail/RPCHandler.cpp @@ -22,7 +22,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { namespace { @@ -250,4 +250,4 @@ roleRequired(unsigned int version, bool betaEnabled, std::string const& method) } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index a9c75a05e8..d10f4f9a5a 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -15,7 +15,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { std::uint64_t @@ -355,7 +355,7 @@ chooseLedgerEntryType(Json::Value const& params) rpcINVALID_PARAMS, "Invalid field 'type', not string."}; XRPL_ASSERT( result.first.type() == RPC::Status::Type::error_code_i, - "ripple::RPC::chooseLedgerEntryType : first valid result type"); + "xrpl::RPC::chooseLedgerEntryType : first valid result type"); return result; } @@ -374,7 +374,7 @@ chooseLedgerEntryType(Json::Value const& params) RPC::Status{rpcINVALID_PARAMS, "Invalid field 'type'."}; XRPL_ASSERT( result.first.type() == RPC::Status::Type::error_code_i, - "ripple::RPC::chooseLedgerEntryType : second valid result " + "xrpl::RPC::chooseLedgerEntryType : second valid result " "type"); return result; } @@ -400,4 +400,4 @@ isAccountObjectsValidType(LedgerEntryType const& type) } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/RPCHelpers.h b/src/xrpld/rpc/detail/RPCHelpers.h index 3fa652d93b..0f26ca8667 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.h +++ b/src/xrpld/rpc/detail/RPCHelpers.h @@ -13,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { class ReadView; @@ -160,6 +160,6 @@ keypairForSignature( } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index d2bf7d5349..c58a7ba561 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { namespace { @@ -277,7 +277,7 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context const& context) } XRPL_ASSERT( - !ledger->open(), "ripple::RPC::getLedger : validated is not open"); + !ledger->open(), "xrpl::RPC::getLedger : validated is not open"); } else { @@ -285,13 +285,13 @@ getLedger(T& ledger, LedgerShortcut shortcut, Context const& context) { ledger = context.ledgerMaster.getCurrentLedger(); XRPL_ASSERT( - ledger->open(), "ripple::RPC::getLedger : current is open"); + ledger->open(), "xrpl::RPC::getLedger : current is open"); } else if (shortcut == LedgerShortcut::Closed) { ledger = context.ledgerMaster.getClosedLedger(); XRPL_ASSERT( - !ledger->open(), "ripple::RPC::getLedger : closed is not open"); + !ledger->open(), "xrpl::RPC::getLedger : closed is not open"); } else { @@ -449,8 +449,7 @@ getOrAcquireLedger(RPC::JsonContext const& context) auto const refIndex = getCandidateLedger(ledgerIndex); auto refHash = hashOfSeq(*ledger, refIndex, j); XRPL_ASSERT( - refHash, - "ripple::RPC::getOrAcquireLedger : nonzero ledger hash"); + refHash, "xrpl::RPC::getOrAcquireLedger : nonzero ledger hash"); ledger = ledgerMaster.getLedgerByHash(*refHash); if (!ledger) @@ -485,8 +484,7 @@ getOrAcquireLedger(RPC::JsonContext const& context) neededHash = hashOfSeq(*ledger, ledgerIndex, j); } XRPL_ASSERT( - neededHash, - "ripple::RPC::getOrAcquireLedger : nonzero needed hash"); + neededHash, "xrpl::RPC::getOrAcquireLedger : nonzero needed hash"); ledgerHash = neededHash ? *neededHash : beast::zero; // kludge } @@ -510,4 +508,4 @@ getOrAcquireLedger(RPC::JsonContext const& context) } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.h b/src/xrpld/rpc/detail/RPCLedgerHelpers.h index 0a070a16ab..8fe81ef024 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.h +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.h @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { class ReadView; class Transaction; @@ -176,6 +176,6 @@ getOrAcquireLedger(RPC::JsonContext const& context); } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/RPCSub.cpp b/src/xrpld/rpc/detail/RPCSub.cpp index 9477eab231..5d008e4ee6 100644 --- a/src/xrpld/rpc/detail/RPCSub.cpp +++ b/src/xrpld/rpc/detail/RPCSub.cpp @@ -8,7 +8,7 @@ #include -namespace ripple { +namespace xrpl { // Subscription object for JSON-RPC class RPCSubImp : public RPCSub @@ -205,4 +205,4 @@ make_RPCSub( logs); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/Role.cpp b/src/xrpld/rpc/detail/Role.cpp index 95549068a0..28d00245a5 100644 --- a/src/xrpld/rpc/detail/Role.cpp +++ b/src/xrpld/rpc/detail/Role.cpp @@ -5,14 +5,14 @@ #include -namespace ripple { +namespace xrpl { bool passwordUnrequiredOrSentCorrect(Port const& port, Json::Value const& params) { XRPL_ASSERT( !(port.admin_nets_v4.empty() && port.admin_nets_v6.empty()), - "ripple::passwordUnrequiredOrSentCorrect : non-empty admin nets"); + "xrpl::passwordUnrequiredOrSentCorrect : non-empty admin nets"); bool const passwordRequired = (!port.admin_user.empty() || !port.admin_password.empty()); @@ -292,4 +292,4 @@ forwardedFor(http_request_type const& request) return {}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index de44f93749..91b709bc06 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -35,7 +35,7 @@ #include #include -namespace ripple { +namespace xrpl { class Peer; class LedgerMaster; @@ -1276,4 +1276,4 @@ make_ServerHandler( cm); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/Status.cpp b/src/xrpld/rpc/detail/Status.cpp index 3b5aded8b2..ce3082f0fa 100644 --- a/src/xrpld/rpc/detail/Status.cpp +++ b/src/xrpld/rpc/detail/Status.cpp @@ -2,7 +2,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { std::string @@ -19,7 +19,7 @@ Status::codeString() const std::string s1, s2; [[maybe_unused]] auto const success = transResultInfo(toTER(), s1, s2); - XRPL_ASSERT(success, "ripple::RPC::codeString : valid TER result"); + XRPL_ASSERT(success, "xrpl::RPC::codeString : valid TER result"); return s1 + ": " + s2; } @@ -33,7 +33,7 @@ Status::codeString() const } // LCOV_EXCL_START - UNREACHABLE("ripple::RPC::codeString : invalid type"); + UNREACHABLE("xrpl::RPC::codeString : invalid type"); return ""; // LCOV_EXCL_STOP } @@ -80,4 +80,4 @@ Status::toString() const } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 8ca58d671e..252e5fc91e 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -24,7 +24,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { namespace detail { @@ -654,7 +654,7 @@ transactionPreProcessImpl( { Serializer s = buildMultiSigningData(*stTx, signingArgs.getSigner()); - auto multisig = ripple::sign(pk, sk, s.slice()); + auto multisig = xrpl::sign(pk, sk, s.slice()); signingArgs.moveMultiSignature(std::move(multisig)); } @@ -1206,7 +1206,7 @@ transactionSignFor( XRPL_ASSERT( signForParams.validMultiSign(), - "ripple::RPC::transactionSignFor : valid multi-signature"); + "xrpl::RPC::transactionSignFor : valid multi-signature"); { std::shared_ptr account_state = @@ -1452,4 +1452,4 @@ transactionSubmitMultiSigned( } } // namespace RPC -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index ba14ad0cdc..181737ad28 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // Forward declarations class Application; @@ -126,6 +126,6 @@ transactionSubmitMultiSigned( ProcessTransactionFn const& processTransaction); } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/Tuning.h b/src/xrpld/rpc/detail/Tuning.h index 902ba2ecf0..5837146b02 100644 --- a/src/xrpld/rpc/detail/Tuning.h +++ b/src/xrpld/rpc/detail/Tuning.h @@ -1,7 +1,7 @@ #ifndef XRPL_RPC_TUNING_H_INCLUDED #define XRPL_RPC_TUNING_H_INCLUDED -namespace ripple { +namespace xrpl { namespace RPC { /** Tuned constants. */ @@ -71,6 +71,6 @@ static int constexpr max_auto_src_cur = 88; /** @} */ } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/detail/WSInfoSub.h b/src/xrpld/rpc/detail/WSInfoSub.h index 707f81fb19..91dc47fa2b 100644 --- a/src/xrpld/rpc/detail/WSInfoSub.h +++ b/src/xrpld/rpc/detail/WSInfoSub.h @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { class WSInfoSub : public InfoSub { @@ -65,6 +65,6 @@ public: } }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/handlers/AMMInfo.cpp b/src/xrpld/rpc/handlers/AMMInfo.cpp index 5ea826fce5..7bf2dd7eae 100644 --- a/src/xrpld/rpc/handlers/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/AMMInfo.cpp @@ -10,7 +10,7 @@ #include -namespace ripple { +namespace xrpl { Expected getIssue(Json::Value const& v, beast::Journal j) @@ -118,12 +118,12 @@ doAMMInfo(RPC::JsonContext& context) XRPL_ASSERT( (issue1.has_value() == issue2.has_value()) && (issue1.has_value() != ammID.has_value()), - "ripple::doAMMInfo : issue1 and issue2 do match"); + "xrpl::doAMMInfo : issue1 and issue2 do match"); auto const ammKeylet = [&]() { if (issue1 && issue2) return keylet::amm(*issue1, *issue2); - XRPL_ASSERT(ammID, "ripple::doAMMInfo::ammKeylet : ammID is set"); + XRPL_ASSERT(ammID, "xrpl::doAMMInfo::ammKeylet : ammID is set"); return keylet::amm(*ammID); }(); auto const amm = ledger->read(ammKeylet); @@ -185,7 +185,7 @@ doAMMInfo(RPC::JsonContext& context) XRPL_ASSERT( !ledger->rules().enabled(fixInnerObjTemplate) || amm->isFieldPresent(sfAuctionSlot), - "ripple::doAMMInfo : auction slot is set"); + "xrpl::doAMMInfo : auction slot is set"); if (amm->isFieldPresent(sfAuctionSlot)) { auto const& auctionSlot = @@ -236,4 +236,4 @@ doAMMInfo(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountChannels.cpp b/src/xrpld/rpc/handlers/AccountChannels.cpp index 281b0ec8c4..597a6f893a 100644 --- a/src/xrpld/rpc/handlers/AccountChannels.cpp +++ b/src/xrpld/rpc/handlers/AccountChannels.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { void addChannel(Json::Value& jsonLines, SLE const& line) @@ -149,7 +149,7 @@ doAccountChannels(RPC::JsonContext& context) if (!sleCur) { // LCOV_EXCL_START - UNREACHABLE("ripple::doAccountChannels : null SLE"); + UNREACHABLE("xrpl::doAccountChannels : null SLE"); return false; // LCOV_EXCL_STOP } @@ -194,4 +194,4 @@ doAccountChannels(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountCurrenciesHandler.cpp b/src/xrpld/rpc/handlers/AccountCurrenciesHandler.cpp index 10f22ad654..cc43992723 100644 --- a/src/xrpld/rpc/handlers/AccountCurrenciesHandler.cpp +++ b/src/xrpld/rpc/handlers/AccountCurrenciesHandler.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doAccountCurrencies(RPC::JsonContext& context) @@ -76,4 +76,4 @@ doAccountCurrencies(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountInfo.cpp b/src/xrpld/rpc/handlers/AccountInfo.cpp index 1bf05276f2..30d16e3099 100644 --- a/src/xrpld/rpc/handlers/AccountInfo.cpp +++ b/src/xrpld/rpc/handlers/AccountInfo.cpp @@ -13,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { /** * @brief Injects JSON describing a ledger entry. @@ -179,7 +179,7 @@ doAccountInfo(RPC::JsonContext& context) name = name.substr(0, name.size() - 2); XRPL_ASSERT_PARTS( !name.empty(), - "ripple::doAccountInfo", + "xrpl::doAccountInfo", "name is not empty"); } // ValidPseudoAccounts invariant guarantees that only one field @@ -331,4 +331,4 @@ doAccountInfo(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountLines.cpp b/src/xrpld/rpc/handlers/AccountLines.cpp index b28f4d7483..fc92707aa6 100644 --- a/src/xrpld/rpc/handlers/AccountLines.cpp +++ b/src/xrpld/rpc/handlers/AccountLines.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { void addLine(Json::Value& jsonLines, RPCTrustLine const& line) @@ -173,7 +173,7 @@ doAccountLines(RPC::JsonContext& context) if (!sleCur) { // LCOV_EXCL_START - UNREACHABLE("ripple::doAccountLines : null SLE"); + UNREACHABLE("xrpl::doAccountLines : null SLE"); return false; // LCOV_EXCL_STOP } @@ -240,4 +240,4 @@ doAccountLines(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountObjects.cpp b/src/xrpld/rpc/handlers/AccountObjects.cpp index 669d96a44f..6440c78e58 100644 --- a/src/xrpld/rpc/handlers/AccountObjects.cpp +++ b/src/xrpld/rpc/handlers/AccountObjects.cpp @@ -15,7 +15,7 @@ #include -namespace ripple { +namespace xrpl { /** General RPC command that can retrieve objects in the account root. { @@ -482,4 +482,4 @@ doAccountObjects(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountOffers.cpp b/src/xrpld/rpc/handlers/AccountOffers.cpp index e8bc2bcf79..c0f29b0b8f 100644 --- a/src/xrpld/rpc/handlers/AccountOffers.cpp +++ b/src/xrpld/rpc/handlers/AccountOffers.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { void appendOfferJson(std::shared_ptr const& offer, Json::Value& offers) @@ -125,7 +125,7 @@ doAccountOffers(RPC::JsonContext& context) if (!sle) { // LCOV_EXCL_START - UNREACHABLE("ripple::doAccountOffers : null SLE"); + UNREACHABLE("xrpl::doAccountOffers : null SLE"); return false; // LCOV_EXCL_STOP } @@ -164,4 +164,4 @@ doAccountOffers(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/AccountTx.cpp b/src/xrpld/rpc/handlers/AccountTx.cpp index efb246b4d5..362bdd0eaa 100644 --- a/src/xrpld/rpc/handlers/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/AccountTx.cpp @@ -19,7 +19,7 @@ #include #include -namespace ripple { +namespace xrpl { using TxnsData = RelationalDatabase::AccountTxs; using TxnsDataBinary = RelationalDatabase::MetaTxsList; @@ -289,8 +289,7 @@ populateJsonResponse( if (auto txnsData = std::get_if(&result.transactions)) { XRPL_ASSERT( - !args.binary, - "ripple::populateJsonResponse : binary is not set"); + !args.binary, "xrpl::populateJsonResponse : binary is not set"); for (auto const& [txn, txnMeta] : *txnsData) { @@ -340,7 +339,7 @@ populateJsonResponse( { // LCOV_EXCL_START UNREACHABLE( - "ripple::populateJsonResponse : missing " + "xrpl::populateJsonResponse : missing " "transaction medatata"); // LCOV_EXCL_STOP } @@ -350,7 +349,7 @@ populateJsonResponse( else { XRPL_ASSERT( - args.binary, "ripple::populateJsonResponse : binary is set"); + args.binary, "xrpl::populateJsonResponse : binary is set"); for (auto const& binaryData : std::get(result.transactions)) @@ -466,4 +465,4 @@ doAccountTxJson(RPC::JsonContext& context) return populateJsonResponse(res, args, context); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/BlackList.cpp b/src/xrpld/rpc/handlers/BlackList.cpp index 859eb1fbce..102041b8d0 100644 --- a/src/xrpld/rpc/handlers/BlackList.cpp +++ b/src/xrpld/rpc/handlers/BlackList.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doBlackList(RPC::JsonContext& context) @@ -16,4 +16,4 @@ doBlackList(RPC::JsonContext& context) return rm.getJson(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/BookOffers.cpp b/src/xrpld/rpc/handlers/BookOffers.cpp index e82b2fa345..6cbefe5dc7 100644 --- a/src/xrpld/rpc/handlers/BookOffers.cpp +++ b/src/xrpld/rpc/handlers/BookOffers.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doBookOffers(RPC::JsonContext& context) @@ -212,4 +212,4 @@ doBookChanges(RPC::JsonContext& context) return RPC::computeBookChanges(ledger); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/CanDelete.cpp b/src/xrpld/rpc/handlers/CanDelete.cpp index d07d344242..ea19736bc2 100644 --- a/src/xrpld/rpc/handlers/CanDelete.cpp +++ b/src/xrpld/rpc/handlers/CanDelete.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { // can_delete [||now|always|never] Json::Value @@ -79,4 +79,4 @@ doCanDelete(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Connect.cpp b/src/xrpld/rpc/handlers/Connect.cpp index 2c6d67c3f0..2cd3b70149 100644 --- a/src/xrpld/rpc/handlers/Connect.cpp +++ b/src/xrpld/rpc/handlers/Connect.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // ip: , @@ -51,4 +51,4 @@ doConnect(RPC::JsonContext& context) " port: " + std::to_string(iPort)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ConsensusInfo.cpp b/src/xrpld/rpc/handlers/ConsensusInfo.cpp index 8459cc6520..386ff99458 100644 --- a/src/xrpld/rpc/handlers/ConsensusInfo.cpp +++ b/src/xrpld/rpc/handlers/ConsensusInfo.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doConsensusInfo(RPC::JsonContext& context) @@ -17,4 +17,4 @@ doConsensusInfo(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/DepositAuthorized.cpp b/src/xrpld/rpc/handlers/DepositAuthorized.cpp index 7beaffaf99..8c2f7dce96 100644 --- a/src/xrpld/rpc/handlers/DepositAuthorized.cpp +++ b/src/xrpld/rpc/handlers/DepositAuthorized.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // source_account : @@ -182,4 +182,4 @@ doDepositAuthorized(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/DoManifest.cpp b/src/xrpld/rpc/handlers/DoManifest.cpp index eabdc51d56..5928947e21 100644 --- a/src/xrpld/rpc/handlers/DoManifest.cpp +++ b/src/xrpld/rpc/handlers/DoManifest.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doManifest(RPC::JsonContext& context) { @@ -56,4 +56,4 @@ doManifest(RPC::JsonContext& context) ret[jss::details] = details; return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Feature1.cpp b/src/xrpld/rpc/handlers/Feature1.cpp index f452f562c2..dc1ccaee6c 100644 --- a/src/xrpld/rpc/handlers/Feature1.cpp +++ b/src/xrpld/rpc/handlers/Feature1.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // feature : @@ -78,4 +78,4 @@ doFeature(RPC::JsonContext& context) return jvReply; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Fee1.cpp b/src/xrpld/rpc/handlers/Fee1.cpp index 8349c67875..49a36261f4 100644 --- a/src/xrpld/rpc/handlers/Fee1.cpp +++ b/src/xrpld/rpc/handlers/Fee1.cpp @@ -6,7 +6,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doFee(RPC::JsonContext& context) { @@ -15,10 +15,10 @@ doFee(RPC::JsonContext& context) return result; // LCOV_EXCL_START - UNREACHABLE("ripple::doFee : invalid result type"); + UNREACHABLE("xrpl::doFee : invalid result type"); RPC::inject_error(rpcINTERNAL, context.params); return context.params; // LCOV_EXCL_STOP } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/FetchInfo.cpp b/src/xrpld/rpc/handlers/FetchInfo.cpp index 9e3f61495b..0c251fe9d6 100644 --- a/src/xrpld/rpc/handlers/FetchInfo.cpp +++ b/src/xrpld/rpc/handlers/FetchInfo.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doFetchInfo(RPC::JsonContext& context) @@ -24,4 +24,4 @@ doFetchInfo(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/GatewayBalances.cpp b/src/xrpld/rpc/handlers/GatewayBalances.cpp index 88411b020e..55959d8641 100644 --- a/src/xrpld/rpc/handlers/GatewayBalances.cpp +++ b/src/xrpld/rpc/handlers/GatewayBalances.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { // Query: // 1) Specify ledger to query. @@ -271,4 +271,4 @@ doGatewayBalances(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/GetAggregatePrice.cpp b/src/xrpld/rpc/handlers/GetAggregatePrice.cpp index c74a4331fd..6d40ee707b 100644 --- a/src/xrpld/rpc/handlers/GetAggregatePrice.cpp +++ b/src/xrpld/rpc/handlers/GetAggregatePrice.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { using namespace boost::bimaps; // sorted descending by lastUpdateTime, ascending by AssetPrice @@ -361,4 +361,4 @@ doGetAggregatePrice(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/GetCounts.cpp b/src/xrpld/rpc/handlers/GetCounts.cpp index 17b2c8565b..ad158a57a5 100644 --- a/src/xrpld/rpc/handlers/GetCounts.cpp +++ b/src/xrpld/rpc/handlers/GetCounts.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { static void textTime( @@ -126,4 +126,4 @@ doGetCounts(RPC::JsonContext& context) return getCountsJson(context.app, minCount); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/GetCounts.h b/src/xrpld/rpc/handlers/GetCounts.h index aed024ca1a..0d544a4f11 100644 --- a/src/xrpld/rpc/handlers/GetCounts.h +++ b/src/xrpld/rpc/handlers/GetCounts.h @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value getCountsJson(Application& app, int minObjectCount); diff --git a/src/xrpld/rpc/handlers/Handlers.h b/src/xrpld/rpc/handlers/Handlers.h index 6f4abfd421..773186237b 100644 --- a/src/xrpld/rpc/handlers/Handlers.h +++ b/src/xrpld/rpc/handlers/Handlers.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doAccountCurrencies(RPC::JsonContext&); @@ -149,6 +149,6 @@ Json::Value doValidatorInfo(RPC::JsonContext&); Json::Value doVaultInfo(RPC::JsonContext&); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/handlers/LedgerAccept.cpp b/src/xrpld/rpc/handlers/LedgerAccept.cpp index 6221b2f7fc..8938e3f152 100644 --- a/src/xrpld/rpc/handlers/LedgerAccept.cpp +++ b/src/xrpld/rpc/handlers/LedgerAccept.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doLedgerAccept(RPC::JsonContext& context) @@ -31,4 +31,4 @@ doLedgerAccept(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerCleanerHandler.cpp b/src/xrpld/rpc/handlers/LedgerCleanerHandler.cpp index 5926bfed8f..408cd16023 100644 --- a/src/xrpld/rpc/handlers/LedgerCleanerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerCleanerHandler.cpp @@ -5,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doLedgerCleaner(RPC::JsonContext& context) @@ -14,4 +14,4 @@ doLedgerCleaner(RPC::JsonContext& context) return RPC::makeObjectValue("Cleaner configured"); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerClosed.cpp b/src/xrpld/rpc/handlers/LedgerClosed.cpp index 3628c0f8d6..3b93e0734f 100644 --- a/src/xrpld/rpc/handlers/LedgerClosed.cpp +++ b/src/xrpld/rpc/handlers/LedgerClosed.cpp @@ -5,13 +5,13 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doLedgerClosed(RPC::JsonContext& context) { auto ledger = context.ledgerMaster.getClosedLedger(); - XRPL_ASSERT(ledger, "ripple::doLedgerClosed : non-null closed ledger"); + XRPL_ASSERT(ledger, "xrpl::doLedgerClosed : non-null closed ledger"); Json::Value jvResult; jvResult[jss::ledger_index] = ledger->header().seq; @@ -20,4 +20,4 @@ doLedgerClosed(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerCurrent.cpp b/src/xrpld/rpc/handlers/LedgerCurrent.cpp index 84e9820ac5..21b72147c6 100644 --- a/src/xrpld/rpc/handlers/LedgerCurrent.cpp +++ b/src/xrpld/rpc/handlers/LedgerCurrent.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doLedgerCurrent(RPC::JsonContext& context) @@ -16,4 +16,4 @@ doLedgerCurrent(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerData.cpp b/src/xrpld/rpc/handlers/LedgerData.cpp index 35e5055242..5e0c9152e7 100644 --- a/src/xrpld/rpc/handlers/LedgerData.cpp +++ b/src/xrpld/rpc/handlers/LedgerData.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { // Get state nodes from a ledger // Inputs: @@ -192,4 +192,4 @@ doLedgerDataGrpc( return {response, status}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerDiff.cpp b/src/xrpld/rpc/handlers/LedgerDiff.cpp index 3628138329..61ab7da93f 100644 --- a/src/xrpld/rpc/handlers/LedgerDiff.cpp +++ b/src/xrpld/rpc/handlers/LedgerDiff.cpp @@ -1,7 +1,7 @@ #include #include -namespace ripple { +namespace xrpl { std::pair doLedgerDiffGrpc( RPC::GRPCContext& context) @@ -75,7 +75,7 @@ doLedgerDiffGrpc( { XRPL_ASSERT( inDesired->size() > 0, - "ripple::doLedgerDiffGrpc : non-empty desired"); + "xrpl::doLedgerDiffGrpc : non-empty desired"); diff->set_key(k.data(), k.size()); if (request.include_blobs()) { @@ -86,4 +86,4 @@ doLedgerDiffGrpc( return {response, status}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 5a1dfb4ace..5b5db72c22 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { static Expected parseObjectID( @@ -918,4 +918,4 @@ doLedgerEntryGrpc( *(response.mutable_ledger()) = request.ledger(); return {response, status}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerEntryHelpers.h b/src/xrpld/rpc/handlers/LedgerEntryHelpers.h index d83b7e2896..0a4453c063 100644 --- a/src/xrpld/rpc/handlers/LedgerEntryHelpers.h +++ b/src/xrpld/rpc/handlers/LedgerEntryHelpers.h @@ -12,7 +12,7 @@ #include -namespace ripple { +namespace xrpl { namespace LedgerEntryHelpers { @@ -277,4 +277,4 @@ parseBridgeFields(Json::Value const& params) } // namespace LedgerEntryHelpers -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerHandler.cpp b/src/xrpld/rpc/handlers/LedgerHandler.cpp index 14c6fc67d9..2929776549 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerHandler.cpp @@ -10,7 +10,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { LedgerHandler::LedgerHandler(JsonContext& context) : context_(context) @@ -114,7 +114,7 @@ doLedgerGrpc(RPC::GRPCContext& context) for (auto& i : ledger->txs) { XRPL_ASSERT( - i.first, "ripple::doLedgerGrpc : non-null transaction"); + i.first, "xrpl::doLedgerGrpc : non-null transaction"); if (request.expand()) { auto txn = response.mutable_transactions_list() @@ -192,7 +192,7 @@ doLedgerGrpc(RPC::GRPCContext& context) { XRPL_ASSERT( inDesired->size() > 0, - "ripple::doLedgerGrpc : non-empty desired"); + "xrpl::doLedgerGrpc : non-empty desired"); obj->set_data(inDesired->data(), inDesired->size()); } if (inBase && inDesired) @@ -298,4 +298,4 @@ doLedgerGrpc(RPC::GRPCContext& context) return {response, status}; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerHandler.h b/src/xrpld/rpc/handlers/LedgerHandler.h index e1a789b66f..fbf60fb22e 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.h +++ b/src/xrpld/rpc/handlers/LedgerHandler.h @@ -18,7 +18,7 @@ namespace Json { class Object; } -namespace ripple { +namespace xrpl { namespace RPC { struct JsonContext; @@ -103,6 +103,6 @@ LedgerHandler::writeResult(Object& value) } } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/handlers/LedgerHeader.cpp b/src/xrpld/rpc/handlers/LedgerHeader.cpp index 8c34b8a7cc..6b93594020 100644 --- a/src/xrpld/rpc/handlers/LedgerHeader.cpp +++ b/src/xrpld/rpc/handlers/LedgerHeader.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // ledger_hash : @@ -31,4 +31,4 @@ doLedgerHeader(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LedgerRequest.cpp b/src/xrpld/rpc/handlers/LedgerRequest.cpp index 8ae0e543f2..da29addd2d 100644 --- a/src/xrpld/rpc/handlers/LedgerRequest.cpp +++ b/src/xrpld/rpc/handlers/LedgerRequest.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // ledger_hash : @@ -29,4 +29,4 @@ doLedgerRequest(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LogLevel.cpp b/src/xrpld/rpc/handlers/LogLevel.cpp index cf5a1d2573..373db55fa0 100644 --- a/src/xrpld/rpc/handlers/LogLevel.cpp +++ b/src/xrpld/rpc/handlers/LogLevel.cpp @@ -9,7 +9,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doLogLevel(RPC::JsonContext& context) @@ -64,4 +64,4 @@ doLogLevel(RPC::JsonContext& context) return rpcError(rpcINVALID_PARAMS); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/LogRotate.cpp b/src/xrpld/rpc/handlers/LogRotate.cpp index 595d84b191..3d52dc6538 100644 --- a/src/xrpld/rpc/handlers/LogRotate.cpp +++ b/src/xrpld/rpc/handlers/LogRotate.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doLogRotate(RPC::JsonContext& context) @@ -13,4 +13,4 @@ doLogRotate(RPC::JsonContext& context) return RPC::makeObjectValue(context.app.logs().rotate()); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/NFTOffers.cpp b/src/xrpld/rpc/handlers/NFTOffers.cpp index 51290a404c..3c6898b5c2 100644 --- a/src/xrpld/rpc/handlers/NFTOffers.cpp +++ b/src/xrpld/rpc/handlers/NFTOffers.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { static void appendNftOfferJson( @@ -157,4 +157,4 @@ doNFTBuyOffers(RPC::JsonContext& context) return enumerateNFTOffers(context, nftId, keylet::nft_buys(nftId)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/NoRippleCheck.cpp b/src/xrpld/rpc/handlers/NoRippleCheck.cpp index 9ff2757a40..521ba1599a 100644 --- a/src/xrpld/rpc/handlers/NoRippleCheck.cpp +++ b/src/xrpld/rpc/handlers/NoRippleCheck.cpp @@ -12,7 +12,7 @@ #include #include -namespace ripple { +namespace xrpl { static void fillTransaction( @@ -185,4 +185,4 @@ doNoRippleCheck(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/OwnerInfo.cpp b/src/xrpld/rpc/handlers/OwnerInfo.cpp index 8f43bfcc99..37a4ceb60d 100644 --- a/src/xrpld/rpc/handlers/OwnerInfo.cpp +++ b/src/xrpld/rpc/handlers/OwnerInfo.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // 'ident' : , @@ -40,4 +40,4 @@ doOwnerInfo(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/PathFind.cpp b/src/xrpld/rpc/handlers/PathFind.cpp index 430212fe46..55575b5513 100644 --- a/src/xrpld/rpc/handlers/PathFind.cpp +++ b/src/xrpld/rpc/handlers/PathFind.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doPathFind(RPC::JsonContext& context) @@ -63,4 +63,4 @@ doPathFind(RPC::JsonContext& context) return rpcError(rpcINVALID_PARAMS); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/PayChanClaim.cpp b/src/xrpld/rpc/handlers/PayChanClaim.cpp index 95c4ba5f3d..89eb1806b8 100644 --- a/src/xrpld/rpc/handlers/PayChanClaim.cpp +++ b/src/xrpld/rpc/handlers/PayChanClaim.cpp @@ -11,7 +11,7 @@ #include -namespace ripple { +namespace xrpl { // { // secret_key: @@ -45,7 +45,7 @@ doChannelAuthorize(RPC::JsonContext& context) XRPL_ASSERT( keyPair || RPC::contains_error(result), - "ripple::doChannelAuthorize : valid keyPair or an error"); + "xrpl::doChannelAuthorize : valid keyPair or an error"); if (!keyPair || RPC::contains_error(result)) return result; @@ -141,4 +141,4 @@ doChannelVerify(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Peers.cpp b/src/xrpld/rpc/handlers/Peers.cpp index ba9f459b41..5a34f4b557 100644 --- a/src/xrpld/rpc/handlers/Peers.cpp +++ b/src/xrpld/rpc/handlers/Peers.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doPeers(RPC::JsonContext& context) @@ -63,4 +63,4 @@ doPeers(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Ping.cpp b/src/xrpld/rpc/handlers/Ping.cpp index 459f743e86..cc3c558cd9 100644 --- a/src/xrpld/rpc/handlers/Ping.cpp +++ b/src/xrpld/rpc/handlers/Ping.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { struct JsonContext; @@ -41,4 +41,4 @@ doPing(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Print.cpp b/src/xrpld/rpc/handlers/Print.cpp index 2c3b886797..6ea1f355aa 100644 --- a/src/xrpld/rpc/handlers/Print.cpp +++ b/src/xrpld/rpc/handlers/Print.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doPrint(RPC::JsonContext& context) @@ -24,4 +24,4 @@ doPrint(RPC::JsonContext& context) return stream.top(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Random.cpp b/src/xrpld/rpc/handlers/Random.cpp index 7156e20f59..2fb8abf3c9 100644 --- a/src/xrpld/rpc/handlers/Random.cpp +++ b/src/xrpld/rpc/handlers/Random.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace RPC { struct JsonContext; @@ -36,4 +36,4 @@ doRandom(RPC::JsonContext& context) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Reservations.cpp b/src/xrpld/rpc/handlers/Reservations.cpp index 2c7ec2d8c9..195a5be453 100644 --- a/src/xrpld/rpc/handlers/Reservations.cpp +++ b/src/xrpld/rpc/handlers/Reservations.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doPeerReservationsAdd(RPC::JsonContext& context) @@ -108,4 +108,4 @@ doPeerReservationsList(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/RipplePathFind.cpp b/src/xrpld/rpc/handlers/RipplePathFind.cpp index 771c1cb95f..5baf6820f4 100644 --- a/src/xrpld/rpc/handlers/RipplePathFind.cpp +++ b/src/xrpld/rpc/handlers/RipplePathFind.cpp @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { // This interface is deprecated. Json::Value @@ -155,4 +155,4 @@ doRipplePathFind(RPC::JsonContext& context) return result; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ServerDefinitions.cpp b/src/xrpld/rpc/handlers/ServerDefinitions.cpp index a25716066e..9fce4d5a5b 100644 --- a/src/xrpld/rpc/handlers/ServerDefinitions.cpp +++ b/src/xrpld/rpc/handlers/ServerDefinitions.cpp @@ -14,7 +14,7 @@ #include -namespace ripple { +namespace xrpl { namespace detail { @@ -214,7 +214,7 @@ ServerDefinitions::ServerDefinitions() : defs_{Json::objectValue} defs_[jss::FIELDS][i++] = a; } - for (auto const& [code, f] : ripple::SField::getKnownCodeToField()) + for (auto const& [code, f] : xrpl::SField::getKnownCodeToField()) { if (f->fieldName == "") continue; @@ -268,7 +268,7 @@ ServerDefinitions::ServerDefinitions() : defs_{Json::objectValue} // generate hash { std::string const out = Json::FastWriter().write(defs_); - defsHash_ = ripple::sha512Half(ripple::Slice{out.data(), out.size()}); + defsHash_ = xrpl::sha512Half(xrpl::Slice{out.data(), out.size()}); defs_[jss::hash] = to_string(defsHash_); } } @@ -298,4 +298,4 @@ doServerDefinitions(RPC::JsonContext& context) return defs.get(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ServerInfo.cpp b/src/xrpld/rpc/handlers/ServerInfo.cpp index c13ebfe788..c7bd7f271d 100644 --- a/src/xrpld/rpc/handlers/ServerInfo.cpp +++ b/src/xrpld/rpc/handlers/ServerInfo.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doServerInfo(RPC::JsonContext& context) @@ -22,4 +22,4 @@ doServerInfo(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ServerState.cpp b/src/xrpld/rpc/handlers/ServerState.cpp index 7769b32f71..4ec08540fb 100644 --- a/src/xrpld/rpc/handlers/ServerState.cpp +++ b/src/xrpld/rpc/handlers/ServerState.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doServerState(RPC::JsonContext& context) @@ -21,4 +21,4 @@ doServerState(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/SignFor.cpp b/src/xrpld/rpc/handlers/SignFor.cpp index 5750e20245..7926dd7c8e 100644 --- a/src/xrpld/rpc/handlers/SignFor.cpp +++ b/src/xrpld/rpc/handlers/SignFor.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // tx_json: , @@ -40,4 +40,4 @@ doSignFor(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/SignHandler.cpp b/src/xrpld/rpc/handlers/SignHandler.cpp index 5a6a5a2947..cab957d8c7 100644 --- a/src/xrpld/rpc/handlers/SignHandler.cpp +++ b/src/xrpld/rpc/handlers/SignHandler.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // tx_json: , @@ -41,4 +41,4 @@ doSign(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index 42cdd66a69..09d9688ad0 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -16,7 +16,7 @@ #include #include -namespace ripple { +namespace xrpl { static Expected getAutofillSequence(Json::Value const& tx_json, RPC::JsonContext& context) @@ -369,4 +369,4 @@ doSimulate(RPC::JsonContext& context) // LCOV_EXCL_STOP } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Stop.cpp b/src/xrpld/rpc/handlers/Stop.cpp index 33221d601d..d2f1cd7a80 100644 --- a/src/xrpld/rpc/handlers/Stop.cpp +++ b/src/xrpld/rpc/handlers/Stop.cpp @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { struct JsonContext; @@ -16,4 +16,4 @@ doStop(RPC::JsonContext& context) return RPC::makeObjectValue(systemName() + " server stopping"); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Submit.cpp b/src/xrpld/rpc/handlers/Submit.cpp index 5cce61a1a6..e3888187ae 100644 --- a/src/xrpld/rpc/handlers/Submit.cpp +++ b/src/xrpld/rpc/handlers/Submit.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { static NetworkOPs::FailHard getFailHard(RPC::JsonContext const& context) @@ -173,4 +173,4 @@ doSubmit(RPC::JsonContext& context) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/SubmitMultiSigned.cpp b/src/xrpld/rpc/handlers/SubmitMultiSigned.cpp index 614ba4abbf..52213e174a 100644 --- a/src/xrpld/rpc/handlers/SubmitMultiSigned.cpp +++ b/src/xrpld/rpc/handlers/SubmitMultiSigned.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // SigningAccounts , @@ -28,4 +28,4 @@ doSubmitMultiSigned(RPC::JsonContext& context) RPC::getProcessTxnFn(context.netOps)); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Subscribe.cpp b/src/xrpld/rpc/handlers/Subscribe.cpp index ab4f20d8ce..018268defb 100644 --- a/src/xrpld/rpc/handlers/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/Subscribe.cpp @@ -13,7 +13,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doSubscribe(RPC::JsonContext& context) @@ -367,4 +367,4 @@ doSubscribe(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/TransactionEntry.cpp b/src/xrpld/rpc/handlers/TransactionEntry.cpp index 9553c2d41e..a554b242c5 100644 --- a/src/xrpld/rpc/handlers/TransactionEntry.cpp +++ b/src/xrpld/rpc/handlers/TransactionEntry.cpp @@ -6,7 +6,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // ledger_hash : , @@ -95,4 +95,4 @@ doTransactionEntry(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index e7e812563d..c79f40ce3d 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -18,7 +18,7 @@ #include -namespace ripple { +namespace xrpl { static bool isValidated(LedgerMaster& ledgerMaster, std::uint32_t seq, uint256 const& hash) @@ -236,7 +236,7 @@ populateJsonResponse( if (auto blob = std::get_if(&result.meta)) { XRPL_ASSERT( - args.binary, "ripple::populateJsonResponse : binary is set"); + args.binary, "xrpl::populateJsonResponse : binary is set"); auto json_meta = (context.apiVersion > 1 ? jss::meta_blob : jss::meta); response[json_meta] = strHex(makeSlice(*blob)); @@ -327,4 +327,4 @@ doTxJson(RPC::JsonContext& context) return populateJsonResponse(res, args, context); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/TxHistory.cpp b/src/xrpld/rpc/handlers/TxHistory.cpp index 9c8c2faece..a210f61c54 100644 --- a/src/xrpld/rpc/handlers/TxHistory.cpp +++ b/src/xrpld/rpc/handlers/TxHistory.cpp @@ -11,7 +11,7 @@ #include #include -namespace ripple { +namespace xrpl { // { // start: @@ -49,4 +49,4 @@ doTxHistory(RPC::JsonContext& context) return obj; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/TxReduceRelay.cpp b/src/xrpld/rpc/handlers/TxReduceRelay.cpp index e2ef4c5b18..d269ef448e 100644 --- a/src/xrpld/rpc/handlers/TxReduceRelay.cpp +++ b/src/xrpld/rpc/handlers/TxReduceRelay.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doTxReduceRelay(RPC::JsonContext& context) @@ -12,4 +12,4 @@ doTxReduceRelay(RPC::JsonContext& context) return context.app.overlay().txMetrics(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/UnlList.cpp b/src/xrpld/rpc/handlers/UnlList.cpp index 6a23daab58..8c28373a05 100644 --- a/src/xrpld/rpc/handlers/UnlList.cpp +++ b/src/xrpld/rpc/handlers/UnlList.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doUnlList(RPC::JsonContext& context) @@ -26,4 +26,4 @@ doUnlList(RPC::JsonContext& context) return obj; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Unsubscribe.cpp b/src/xrpld/rpc/handlers/Unsubscribe.cpp index f84ae00cfc..bc192510bf 100644 --- a/src/xrpld/rpc/handlers/Unsubscribe.cpp +++ b/src/xrpld/rpc/handlers/Unsubscribe.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doUnsubscribe(RPC::JsonContext& context) @@ -244,4 +244,4 @@ doUnsubscribe(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ValidationCreate.cpp b/src/xrpld/rpc/handlers/ValidationCreate.cpp index fc7be5777c..c4bdf1b3de 100644 --- a/src/xrpld/rpc/handlers/ValidationCreate.cpp +++ b/src/xrpld/rpc/handlers/ValidationCreate.cpp @@ -5,7 +5,7 @@ #include #include -namespace ripple { +namespace xrpl { static std::optional validationSeed(Json::Value const& params) @@ -47,4 +47,4 @@ doValidationCreate(RPC::JsonContext& context) return obj; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ValidatorInfo.cpp b/src/xrpld/rpc/handlers/ValidatorInfo.cpp index ba2f963851..20d07df866 100644 --- a/src/xrpld/rpc/handlers/ValidatorInfo.cpp +++ b/src/xrpld/rpc/handlers/ValidatorInfo.cpp @@ -9,7 +9,7 @@ #include #include -namespace ripple { +namespace xrpl { Json::Value doValidatorInfo(RPC::JsonContext& context) { @@ -43,4 +43,4 @@ doValidatorInfo(RPC::JsonContext& context) return ret; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/ValidatorListSites.cpp b/src/xrpld/rpc/handlers/ValidatorListSites.cpp index 22644d65e3..7acaa27168 100644 --- a/src/xrpld/rpc/handlers/ValidatorListSites.cpp +++ b/src/xrpld/rpc/handlers/ValidatorListSites.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doValidatorListSites(RPC::JsonContext& context) @@ -12,4 +12,4 @@ doValidatorListSites(RPC::JsonContext& context) return context.app.validatorSites().getJson(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Validators.cpp b/src/xrpld/rpc/handlers/Validators.cpp index 67d1c60e3a..a83a6fe4b0 100644 --- a/src/xrpld/rpc/handlers/Validators.cpp +++ b/src/xrpld/rpc/handlers/Validators.cpp @@ -4,7 +4,7 @@ #include -namespace ripple { +namespace xrpl { Json::Value doValidators(RPC::JsonContext& context) @@ -12,4 +12,4 @@ doValidators(RPC::JsonContext& context) return context.app.validators().getJson(); } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/VaultInfo.cpp b/src/xrpld/rpc/handlers/VaultInfo.cpp index 7e040fef82..ca2c1d070f 100644 --- a/src/xrpld/rpc/handlers/VaultInfo.cpp +++ b/src/xrpld/rpc/handlers/VaultInfo.cpp @@ -8,7 +8,7 @@ #include #include -namespace ripple { +namespace xrpl { static std::optional parseVault(Json::Value const& params, Json::Value& jvResult) @@ -92,4 +92,4 @@ doVaultInfo(RPC::JsonContext& context) return jvResult; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Version.h b/src/xrpld/rpc/handlers/Version.h index 57c5abfd4b..8af2fd20bc 100644 --- a/src/xrpld/rpc/handlers/Version.h +++ b/src/xrpld/rpc/handlers/Version.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { namespace RPC { class VersionHandler @@ -43,6 +43,6 @@ private: }; } // namespace RPC -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/handlers/WalletPropose.cpp b/src/xrpld/rpc/handlers/WalletPropose.cpp index 575bb84322..c245d5546d 100644 --- a/src/xrpld/rpc/handlers/WalletPropose.cpp +++ b/src/xrpld/rpc/handlers/WalletPropose.cpp @@ -14,7 +14,7 @@ #include #include -namespace ripple { +namespace xrpl { double estimate_entropy(std::string const& input) @@ -158,4 +158,4 @@ walletPropose(Json::Value const& params) return obj; } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/rpc/handlers/WalletPropose.h b/src/xrpld/rpc/handlers/WalletPropose.h index e041b6608f..42c7973055 100644 --- a/src/xrpld/rpc/handlers/WalletPropose.h +++ b/src/xrpld/rpc/handlers/WalletPropose.h @@ -3,11 +3,11 @@ #include -namespace ripple { +namespace xrpl { Json::Value walletPropose(Json::Value const& params); -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/rpc/json_body.h b/src/xrpld/rpc/json_body.h index 4dd9142c09..af20ec17ac 100644 --- a/src/xrpld/rpc/json_body.h +++ b/src/xrpld/rpc/json_body.h @@ -7,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { /// Body that holds JSON struct json_body @@ -91,6 +91,6 @@ struct json_body }; }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/src/xrpld/shamap/NodeFamily.cpp b/src/xrpld/shamap/NodeFamily.cpp index b9cca65d36..d43ab1d648 100644 --- a/src/xrpld/shamap/NodeFamily.cpp +++ b/src/xrpld/shamap/NodeFamily.cpp @@ -4,7 +4,7 @@ #include #include -namespace ripple { +namespace xrpl { NodeFamily::NodeFamily(Application& app, CollectorManager& cm) : app_(app) @@ -87,4 +87,4 @@ NodeFamily::acquire(uint256 const& hash, std::uint32_t seq) } } -} // namespace ripple +} // namespace xrpl diff --git a/src/xrpld/shamap/NodeFamily.h b/src/xrpld/shamap/NodeFamily.h index f8bb278ac9..14c2ebb093 100644 --- a/src/xrpld/shamap/NodeFamily.h +++ b/src/xrpld/shamap/NodeFamily.h @@ -3,7 +3,7 @@ #include -namespace ripple { +namespace xrpl { class Application; @@ -83,6 +83,6 @@ private: acquire(uint256 const& hash, std::uint32_t seq); }; -} // namespace ripple +} // namespace xrpl #endif diff --git a/tests/conan/src/example.cpp b/tests/conan/src/example.cpp index 41dcd62462..acfb253a7d 100644 --- a/tests/conan/src/example.cpp +++ b/tests/conan/src/example.cpp @@ -5,6 +5,6 @@ int main(int argc, char const** argv) { - std::printf("%s\n", ripple::BuildInfo::getVersionString().c_str()); + std::printf("%s\n", xrpl::BuildInfo::getVersionString().c_str()); return 0; } From cf748702af3a7cfe78171313832fdc0fb5ae8e4f Mon Sep 17 00:00:00 2001 From: liuyueyangxmu Date: Sat, 13 Dec 2025 00:06:17 +0800 Subject: [PATCH 08/62] chore: Fix some typos in comments (#6082) --- src/test/app/CrossingLimits_test.cpp | 4 ++-- src/test/app/Offer_test.cpp | 2 +- src/test/app/RCLValidations_test.cpp | 4 ++-- src/test/app/TxQ_test.cpp | 2 +- src/test/csf/Histogram.h | 4 ++-- src/test/csf/submitters.h | 2 +- src/xrpld/rpc/detail/TransactionSign.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test/app/CrossingLimits_test.cpp b/src/test/app/CrossingLimits_test.cpp index 9e9b1a3d45..8c11dd6737 100644 --- a/src/test/app/CrossingLimits_test.cpp +++ b/src/test/app/CrossingLimits_test.cpp @@ -303,7 +303,7 @@ public: // offers unfunded. // b. Carol's remaining 800 offers are consumed as unfunded. // c. 199 of alice's XRP(1) to USD(3) offers are consumed. - // A book step is allowed to consume a maxium of 1000 offers + // A book step is allowed to consume a maximum of 1000 offers // at a given quality, and that limit is now reached. // d. Now the strand is dry, even though there are still funded // XRP(1) to USD(3) offers available. @@ -384,7 +384,7 @@ public: // offers unfunded. // b. Carol's remaining 800 offers are consumed as unfunded. // c. 199 of alice's XRP(1) to USD(3) offers are consumed. - // A book step is allowed to consume a maxium of 1000 offers + // A book step is allowed to consume a maximum of 1000 offers // at a given quality, and that limit is now reached. // d. Now the strand is dry, even though there are still funded // XRP(1) to USD(3) offers available. Bob has spent 400 EUR and diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 1117510a45..46a2cabec1 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -1298,7 +1298,7 @@ public: testNegativeBalance(FeatureBitset features) { // This test creates an offer test for negative balance - // with transfer fees and miniscule funds. + // with transfer fees and minuscule funds. testcase("Negative Balance"); using namespace jtx; diff --git a/src/test/app/RCLValidations_test.cpp b/src/test/app/RCLValidations_test.cpp index a4f0d6a7cb..729f373738 100644 --- a/src/test/app/RCLValidations_test.cpp +++ b/src/test/app/RCLValidations_test.cpp @@ -254,7 +254,7 @@ class RCLValidations_test : public beast::unit_test::suite BEAST_EXPECT(trie.branchSupport(ledg_258) == 4); // Move three of the s258 ledgers to s259, which splits the trie - // due to the 256 ancestory limit + // due to the 256 ancestry limit BEAST_EXPECT(trie.remove(ledg_258, 3)); trie.insert(ledg_259, 3); trie.getPreferred(1); @@ -275,7 +275,7 @@ class RCLValidations_test : public beast::unit_test::suite // then verify the remove call works // past bug: remove had assumed the first child of a node in the trie // which matches is the *only* child in the trie which matches. - // This is **NOT** true with the limited 256 ledger ancestory + // This is **NOT** true with the limited 256 ledger ancestry // quirk of RCLValidation and prevents deleting the old support // for ledger 257 diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 3e19fc2842..f6ab13e04f 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -3821,7 +3821,7 @@ public: return result; }; - testcase("straightfoward positive case"); + testcase("straightforward positive case"); { // Queue up some transactions at a too-low fee. auto aliceSeq = env.seq(alice); diff --git a/src/test/csf/Histogram.h b/src/test/csf/Histogram.h index b55af34846..e32fded2f2 100644 --- a/src/test/csf/Histogram.h +++ b/src/test/csf/Histogram.h @@ -18,14 +18,14 @@ namespace csf { - Comparison : T a, b; bool res = a < b - Addition: T a, b; T c = a + b; - Multiplication : T a, std::size_t b; T c = a * b; - - Divison: T a; std::size_t b; T c = a/b; + - Division: T a; std::size_t b; T c = a/b; */ template > class Histogram { - // TODO: Consider logarithimic bins around expected median if this becomes + // TODO: Consider logarithmic bins around expected median if this becomes // unscaleable std::map counts_; std::size_t samples = 0; diff --git a/src/test/csf/submitters.h b/src/test/csf/submitters.h index 8a3632eb97..0c5d46e075 100644 --- a/src/test/csf/submitters.h +++ b/src/test/csf/submitters.h @@ -31,7 +31,7 @@ struct Rate /** Submits transactions to a specified peer Submits successive transactions beginning at start, then spaced according - to succesive calls of distribution(), until stop. + to successive calls of distribution(), until stop. @tparam Distribution is a `UniformRandomBitGenerator` from the STL that is used by random distributions to generate random samples diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 252e5fc91e..a4ac32ee17 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -277,7 +277,7 @@ checkPayment( app); if (pf.findPaths(app.config().PATH_SEARCH_OLD)) { - // 4 is the maxium paths + // 4 is the maximum paths pf.computePathRanks(4); STPath fullLiquidityPath; STPathSet paths; From f816ffa55ffac8d78e150cf13fa90cad8a4f6f0f Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 12 Dec 2025 14:47:34 -0500 Subject: [PATCH 09/62] ci: Update shared actions (#6147) The latest update to `cleanup-workspace`, `get-nproc`, and `prepare-runner` moved the action to the repository root directory, and also includes some ccache changes. In response, this change updates the various shared actions to the latest commit hash. --- .github/workflows/publish-docs.yml | 2 +- .github/workflows/reusable-build-test-config.yml | 6 +++--- .github/workflows/upload-conan-deps.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 14a2ba2fc0..6f0927a2b3 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -36,7 +36,7 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Get number of processors - uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a + uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6 id: nproc with: subtract: ${{ env.NPROC_SUBTRACT }} diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 70d4f93e16..43acfab542 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -71,13 +71,13 @@ jobs: steps: - name: Cleanup workspace (macOS and Windows) if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }} - uses: XRPLF/actions/.github/actions/cleanup-workspace@01b244d2718865d427b499822fbd3f15e7197fcc + uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6 - name: Checkout repository uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a + uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 with: disable_ccache: false @@ -85,7 +85,7 @@ jobs: uses: ./.github/actions/print-env - name: Get number of processors - uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a + uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6 id: nproc with: subtract: ${{ inputs.nproc_subtract }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 320396c899..ec283e564c 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -64,13 +64,13 @@ jobs: steps: - name: Cleanup workspace (macOS and Windows) if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }} - uses: XRPLF/actions/.github/actions/cleanup-workspace@01b244d2718865d427b499822fbd3f15e7197fcc + uses: XRPLF/actions/cleanup-workspace@2ece4ec6ab7de266859a6f053571425b2bd684b6 - name: Checkout repository uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/.github/actions/prepare-runner@99685816bb60a95a66852f212f382580e180df3a + uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 with: disable_ccache: false @@ -78,7 +78,7 @@ jobs: uses: ./.github/actions/print-env - name: Get number of processors - uses: XRPLF/actions/.github/actions/get-nproc@046b1620f6bfd6cd0985dc82c3df02786801fe0a + uses: XRPLF/actions/get-nproc@2ece4ec6ab7de266859a6f053571425b2bd684b6 id: nproc with: subtract: ${{ env.NPROC_SUBTRACT }} From 41c1be2baca43ee2b7a6f85fac3ee329a25ae2cc Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 15 Dec 2025 10:40:08 -0800 Subject: [PATCH 10/62] refactor: remove `Json::Object` and related files/classes (#5894) `Json::Object` and related objects are not used at all, so this change removes `include/xrpl/json/Object.h` and all downstream files. There are a number of minor downstream changes as well. Full list of deleted classes and functions: * `Json::Collections` * `Json::Object` * `Json::Array` * `Json::WriterObject` * `Json::setArray` * `Json::addObject` * `Json::appendArray` * `Json::appendObject` The last helper function, `copyFrom`, seemed a bit more complex and was actually used in a few places, so it was moved to `LedgerToJson.h` instead of deleting it. --- include/xrpl/json/Object.h | 445 ------------------- include/xrpl/protocol/ApiVersion.h | 8 +- include/xrpl/protocol/ErrorCodes.h | 26 +- include/xrpl/protocol/RPCErr.h | 2 +- src/libxrpl/json/Object.cpp | 233 ---------- src/libxrpl/protocol/ErrorCodes.cpp | 18 + src/libxrpl/protocol/RPCErr.cpp | 2 +- src/test/json/Object_test.cpp | 239 ---------- src/test/jtx/impl/utility.cpp | 3 +- src/xrpld/app/ledger/LedgerToJson.h | 8 +- src/xrpld/app/ledger/detail/LedgerToJson.cpp | 46 +- src/xrpld/rpc/Status.h | 3 +- src/xrpld/rpc/handlers/GetCounts.h | 2 - src/xrpld/rpc/handlers/LedgerHandler.cpp | 37 ++ src/xrpld/rpc/handlers/LedgerHandler.h | 47 +- src/xrpld/rpc/handlers/Version.h | 3 +- 16 files changed, 100 insertions(+), 1022 deletions(-) delete mode 100644 include/xrpl/json/Object.h delete mode 100644 src/libxrpl/json/Object.cpp delete mode 100644 src/test/json/Object_test.cpp diff --git a/include/xrpl/json/Object.h b/include/xrpl/json/Object.h deleted file mode 100644 index 754d0dcb08..0000000000 --- a/include/xrpl/json/Object.h +++ /dev/null @@ -1,445 +0,0 @@ -#ifndef XRPL_JSON_OBJECT_H_INCLUDED -#define XRPL_JSON_OBJECT_H_INCLUDED - -#include - -#include - -namespace Json { - -/** - Collection is a base class for Array and Object, classes which provide the - facade of JSON collections for the O(1) JSON writer, while still using no - heap memory and only a very small amount of stack. - - From http://json.org, JSON has two types of collection: array, and object. - Everything else is a *scalar* - a number, a string, a boolean, the special - value null, or a legacy Json::Value. - - Collections must write JSON "as-it-goes" in order to get the strong - performance guarantees. This puts restrictions upon API users: - - 1. Only one collection can be open for change at any one time. - - This condition is enforced automatically and a std::logic_error thrown if - it is violated. - - 2. A tag may only be used once in an Object. - - Some objects have many tags, so this condition might be a little - expensive. Enforcement of this condition is turned on in debug builds and - a std::logic_error is thrown when the tag is added for a second time. - - Code samples: - - Writer writer; - - // An empty object. - { - Object::Root (writer); - } - // Outputs {} - - // An object with one scalar value. - { - Object::Root root (writer); - write["hello"] = "world"; - } - // Outputs {"hello":"world"} - - // Same, using chaining. - { - Object::Root (writer)["hello"] = "world"; - } - // Output is the same. - - // Add several scalars, with chaining. - { - Object::Root (writer) - .set ("hello", "world") - .set ("flag", false) - .set ("x", 42); - } - // Outputs {"hello":"world","flag":false,"x":42} - - // Add an array. - { - Object::Root root (writer); - { - auto array = root.setArray ("hands"); - array.append ("left"); - array.append ("right"); - } - } - // Outputs {"hands":["left", "right"]} - - // Same, using chaining. - { - Object::Root (writer) - .setArray ("hands") - .append ("left") - .append ("right"); - } - // Output is the same. - - // Add an object. - { - Object::Root root (writer); - { - auto object = root.setObject ("hands"); - object["left"] = false; - object["right"] = true; - } - } - // Outputs {"hands":{"left":false,"right":true}} - - // Same, using chaining. - { - Object::Root (writer) - .setObject ("hands") - .set ("left", false) - .set ("right", true); - } - } - // Outputs {"hands":{"left":false,"right":true}} - - - Typical ways to make mistakes and get a std::logic_error: - - Writer writer; - Object::Root root (writer); - - // Repeat a tag. - { - root ["hello"] = "world"; - root ["hello"] = "there"; // THROWS! in a debug build. - } - - // Open a subcollection, then set something else. - { - auto object = root.setObject ("foo"); - root ["hello"] = "world"; // THROWS! - } - - // Open two subcollections at a time. - { - auto object = root.setObject ("foo"); - auto array = root.setArray ("bar"); // THROWS!! - } - - For more examples, check the unit tests. - */ - -class Collection -{ -public: - Collection(Collection&& c) noexcept; - Collection& - operator=(Collection&& c) noexcept; - Collection() = delete; - - ~Collection(); - -protected: - // A null parent means "no parent at all". - // Writers cannot be null. - Collection(Collection* parent, Writer*); - void - checkWritable(std::string const& label); - - Collection* parent_; - Writer* writer_; - bool enabled_; -}; - -class Array; - -//------------------------------------------------------------------------------ - -/** Represents a JSON object being written to a Writer. */ -class Object : protected Collection -{ -public: - /** Object::Root is the only Collection that has a public constructor. */ - class Root; - - /** Set a scalar value in the Object for a key. - - A JSON scalar is a single value - a number, string, boolean, nullptr or - a Json::Value. - - `set()` throws an exception if this object is disabled (which means that - one of its children is enabled). - - In a debug build, `set()` also throws an exception if the key has - already been set() before. - - An operator[] is provided to allow writing `object["key"] = scalar;`. - */ - template - void - set(std::string const& key, Scalar const&); - - void - set(std::string const& key, Json::Value const&); - - // Detail class and method used to implement operator[]. - class Proxy; - - Proxy - operator[](std::string const& key); - Proxy - operator[](Json::StaticString const& key); - - /** Make a new Object at a key and return it. - - This Object is disabled until that sub-object is destroyed. - Throws an exception if this Object was already disabled. - */ - Object - setObject(std::string const& key); - - /** Make a new Array at a key and return it. - - This Object is disabled until that sub-array is destroyed. - Throws an exception if this Object was already disabled. - */ - Array - setArray(std::string const& key); - -protected: - friend class Array; - Object(Collection* parent, Writer* w) : Collection(parent, w) - { - } -}; - -class Object::Root : public Object -{ -public: - /** Each Object::Root must be constructed with its own unique Writer. */ - Root(Writer&); -}; - -//------------------------------------------------------------------------------ - -/** Represents a JSON array being written to a Writer. */ -class Array : private Collection -{ -public: - /** Append a scalar to the Arrary. - - Throws an exception if this array is disabled (which means that one of - its sub-collections is enabled). - */ - template - void - append(Scalar const&); - - /** - Appends a Json::Value to an array. - Throws an exception if this Array was disabled. - */ - void - append(Json::Value const&); - - /** Append a new Object and return it. - - This Array is disabled until that sub-object is destroyed. - Throws an exception if this Array was disabled. - */ - Object - appendObject(); - - /** Append a new Array and return it. - - This Array is disabled until that sub-array is destroyed. - Throws an exception if this Array was already disabled. - */ - Array - appendArray(); - -protected: - friend class Object; - Array(Collection* parent, Writer* w) : Collection(parent, w) - { - } -}; - -//------------------------------------------------------------------------------ - -// Generic accessor functions to allow Json::Value and Collection to -// interoperate. - -/** Add a new subarray at a named key in a Json object. */ -Json::Value& -setArray(Json::Value&, Json::StaticString const& key); - -/** Add a new subarray at a named key in a Json object. */ -Array -setArray(Object&, Json::StaticString const& key); - -/** Add a new subobject at a named key in a Json object. */ -Json::Value& -addObject(Json::Value&, Json::StaticString const& key); - -/** Add a new subobject at a named key in a Json object. */ -Object -addObject(Object&, Json::StaticString const& key); - -/** Append a new subarray to a Json array. */ -Json::Value& -appendArray(Json::Value&); - -/** Append a new subarray to a Json array. */ -Array -appendArray(Array&); - -/** Append a new subobject to a Json object. */ -Json::Value& -appendObject(Json::Value&); - -/** Append a new subobject to a Json object. */ -Object -appendObject(Array&); - -/** Copy all the keys and values from one object into another. */ -void -copyFrom(Json::Value& to, Json::Value const& from); - -/** Copy all the keys and values from one object into another. */ -void -copyFrom(Object& to, Json::Value const& from); - -/** An Object that contains its own Writer. */ -class WriterObject -{ -public: - WriterObject(Output const& output) - : writer_(std::make_unique(output)) - , object_(std::make_unique(*writer_)) - { - } - - WriterObject(WriterObject&& other) = default; - - Object* - operator->() - { - return object_.get(); - } - - Object& - operator*() - { - return *object_; - } - -private: - std::unique_ptr writer_; - std::unique_ptr object_; -}; - -WriterObject -stringWriterObject(std::string&); - -//------------------------------------------------------------------------------ -// Implementation details. - -// Detail class for Object::operator[]. -class Object::Proxy -{ -private: - Object& object_; - std::string const key_; - -public: - Proxy(Object& object, std::string const& key); - - template - void - operator=(T const& t) - { - object_.set(key_, t); - // Note: This function shouldn't return *this, because it's a trap. - // - // In Json::Value, foo[jss::key] returns a reference to a - // mutable Json::Value contained _inside_ foo. But in the case of - // Json::Object, where we write once only, there isn't any such - // reference that can be returned. Returning *this would return an - // object "a level higher" than in Json::Value, leading to obscure bugs, - // particularly in generic code. - } -}; - -//------------------------------------------------------------------------------ - -template -void -Array::append(Scalar const& value) -{ - checkWritable("append"); - if (writer_) - writer_->append(value); -} - -template -void -Object::set(std::string const& key, Scalar const& value) -{ - checkWritable("set"); - if (writer_) - writer_->set(key, value); -} - -inline Json::Value& -setArray(Json::Value& json, Json::StaticString const& key) -{ - return (json[key] = Json::arrayValue); -} - -inline Array -setArray(Object& json, Json::StaticString const& key) -{ - return json.setArray(std::string(key)); -} - -inline Json::Value& -addObject(Json::Value& json, Json::StaticString const& key) -{ - return (json[key] = Json::objectValue); -} - -inline Object -addObject(Object& object, Json::StaticString const& key) -{ - return object.setObject(std::string(key)); -} - -inline Json::Value& -appendArray(Json::Value& json) -{ - return json.append(Json::arrayValue); -} - -inline Array -appendArray(Array& json) -{ - return json.appendArray(); -} - -inline Json::Value& -appendObject(Json::Value& json) -{ - return json.append(Json::objectValue); -} - -inline Object -appendObject(Array& json) -{ - return json.appendObject(); -} - -} // namespace Json - -#endif diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index b2ee64621e..d1a84e76b0 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -58,14 +58,14 @@ static_assert(apiMaximumSupportedVersion >= apiMinimumSupportedVersion); static_assert(apiBetaVersion >= apiMaximumSupportedVersion); static_assert(apiMaximumValidVersion >= apiMaximumSupportedVersion); -template -void -setVersion(JsonObject& parent, unsigned int apiVersion, bool betaEnabled) +inline void +setVersion(Json::Value& parent, unsigned int apiVersion, bool betaEnabled) { XRPL_ASSERT( apiVersion != apiInvalidVersion, "xrpl::RPC::setVersion : input is valid"); - auto& retObj = addObject(parent, jss::version); + + auto& retObj = parent[jss::version] = Json::objectValue; if (apiVersion == apiVersionIfUnspecified) { diff --git a/include/xrpl/protocol/ErrorCodes.h b/include/xrpl/protocol/ErrorCodes.h index 8d5d871aa1..3a2645347a 100644 --- a/include/xrpl/protocol/ErrorCodes.h +++ b/include/xrpl/protocol/ErrorCodes.h @@ -209,33 +209,11 @@ get_error_info(error_code_i code); /** Add or update the json update to reflect the error code. */ /** @{ */ -template void -inject_error(error_code_i code, JsonValue& json) -{ - ErrorInfo const& info(get_error_info(code)); - json[jss::error] = info.token; - json[jss::error_code] = info.code; - json[jss::error_message] = info.message; -} +inject_error(error_code_i code, Json::Value& json); -template void -inject_error(int code, JsonValue& json) -{ - inject_error(error_code_i(code), json); -} - -template -void -inject_error(error_code_i code, std::string const& message, JsonValue& json) -{ - ErrorInfo const& info(get_error_info(code)); - json[jss::error] = info.token; - json[jss::error_code] = info.code; - json[jss::error_message] = message; -} - +inject_error(error_code_i code, std::string const& message, Json::Value& json); /** @} */ /** Returns a new json object that reflects the error code. */ diff --git a/include/xrpl/protocol/RPCErr.h b/include/xrpl/protocol/RPCErr.h index 90df1562e7..fcca15747e 100644 --- a/include/xrpl/protocol/RPCErr.h +++ b/include/xrpl/protocol/RPCErr.h @@ -9,7 +9,7 @@ namespace xrpl { bool isRpcError(Json::Value jvResult); Json::Value -rpcError(int iError); +rpcError(error_code_i iError); } // namespace xrpl diff --git a/src/libxrpl/json/Object.cpp b/src/libxrpl/json/Object.cpp deleted file mode 100644 index ea5e5a32d8..0000000000 --- a/src/libxrpl/json/Object.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace Json { - -Collection::Collection(Collection* parent, Writer* writer) - : parent_(parent), writer_(writer), enabled_(true) -{ - checkWritable("Collection::Collection()"); - if (parent_) - { - check(parent_->enabled_, "Parent not enabled in constructor"); - parent_->enabled_ = false; - } -} - -Collection::~Collection() -{ - if (writer_) - writer_->finish(); - if (parent_) - parent_->enabled_ = true; -} - -Collection& -Collection::operator=(Collection&& that) noexcept -{ - parent_ = that.parent_; - writer_ = that.writer_; - enabled_ = that.enabled_; - - that.parent_ = nullptr; - that.writer_ = nullptr; - that.enabled_ = false; - - return *this; -} - -Collection::Collection(Collection&& that) noexcept -{ - *this = std::move(that); -} - -void -Collection::checkWritable(std::string const& label) -{ - if (!enabled_) - xrpl::Throw(label + ": not enabled"); - if (!writer_) - xrpl::Throw(label + ": not writable"); -} - -//------------------------------------------------------------------------------ - -Object::Root::Root(Writer& w) : Object(nullptr, &w) -{ - writer_->startRoot(Writer::object); -} - -Object -Object::setObject(std::string const& key) -{ - checkWritable("Object::setObject"); - if (writer_) - writer_->startSet(Writer::object, key); - return Object(this, writer_); -} - -Array -Object::setArray(std::string const& key) -{ - checkWritable("Object::setArray"); - if (writer_) - writer_->startSet(Writer::array, key); - return Array(this, writer_); -} - -//------------------------------------------------------------------------------ - -Object -Array::appendObject() -{ - checkWritable("Array::appendObject"); - if (writer_) - writer_->startAppend(Writer::object); - return Object(this, writer_); -} - -Array -Array::appendArray() -{ - checkWritable("Array::makeArray"); - if (writer_) - writer_->startAppend(Writer::array); - return Array(this, writer_); -} - -//------------------------------------------------------------------------------ - -Object::Proxy::Proxy(Object& object, std::string const& key) - : object_(object), key_(key) -{ -} - -Object::Proxy -Object::operator[](std::string const& key) -{ - return Proxy(*this, key); -} - -Object::Proxy -Object::operator[](Json::StaticString const& key) -{ - return Proxy(*this, std::string(key)); -} - -//------------------------------------------------------------------------------ - -void -Array::append(Json::Value const& v) -{ - auto t = v.type(); - switch (t) - { - case Json::nullValue: - return append(nullptr); - case Json::intValue: - return append(v.asInt()); - case Json::uintValue: - return append(v.asUInt()); - case Json::realValue: - return append(v.asDouble()); - case Json::stringValue: - return append(v.asString()); - case Json::booleanValue: - return append(v.asBool()); - - case Json::objectValue: { - auto object = appendObject(); - copyFrom(object, v); - return; - } - - case Json::arrayValue: { - auto array = appendArray(); - for (auto& item : v) - array.append(item); - return; - } - } - UNREACHABLE("Json::Array::append : invalid type"); // LCOV_EXCL_LINE -} - -void -Object::set(std::string const& k, Json::Value const& v) -{ - auto t = v.type(); - switch (t) - { - case Json::nullValue: - return set(k, nullptr); - case Json::intValue: - return set(k, v.asInt()); - case Json::uintValue: - return set(k, v.asUInt()); - case Json::realValue: - return set(k, v.asDouble()); - case Json::stringValue: - return set(k, v.asString()); - case Json::booleanValue: - return set(k, v.asBool()); - - case Json::objectValue: { - auto object = setObject(k); - copyFrom(object, v); - return; - } - - case Json::arrayValue: { - auto array = setArray(k); - for (auto& item : v) - array.append(item); - return; - } - } - UNREACHABLE("Json::Object::set : invalid type"); // LCOV_EXCL_LINE -} - -//------------------------------------------------------------------------------ - -namespace { - -template -void -doCopyFrom(Object& to, Json::Value const& from) -{ - XRPL_ASSERT(from.isObjectOrNull(), "Json::doCopyFrom : valid input type"); - auto members = from.getMemberNames(); - for (auto& m : members) - to[m] = from[m]; -} - -} // namespace - -void -copyFrom(Json::Value& to, Json::Value const& from) -{ - if (!to) // Short circuit this very common case. - to = from; - else - doCopyFrom(to, from); -} - -void -copyFrom(Object& to, Json::Value const& from) -{ - doCopyFrom(to, from); -} - -WriterObject -stringWriterObject(std::string& s) -{ - return WriterObject(stringOutput(s)); -} - -} // namespace Json diff --git a/src/libxrpl/protocol/ErrorCodes.cpp b/src/libxrpl/protocol/ErrorCodes.cpp index f37ba0c8e4..d78ff594e1 100644 --- a/src/libxrpl/protocol/ErrorCodes.cpp +++ b/src/libxrpl/protocol/ErrorCodes.cpp @@ -160,6 +160,24 @@ constexpr ErrorInfo unknownError; //------------------------------------------------------------------------------ +void +inject_error(error_code_i code, Json::Value& json) +{ + ErrorInfo const& info(get_error_info(code)); + json[jss::error] = info.token; + json[jss::error_code] = info.code; + json[jss::error_message] = info.message; +} + +void +inject_error(error_code_i code, std::string const& message, Json::Value& json) +{ + ErrorInfo const& info(get_error_info(code)); + json[jss::error] = info.token; + json[jss::error_code] = info.code; + json[jss::error_message] = message; +} + ErrorInfo const& get_error_info(error_code_i code) { diff --git a/src/libxrpl/protocol/RPCErr.cpp b/src/libxrpl/protocol/RPCErr.cpp index 658dd06b3d..e25b5e574b 100644 --- a/src/libxrpl/protocol/RPCErr.cpp +++ b/src/libxrpl/protocol/RPCErr.cpp @@ -9,7 +9,7 @@ struct RPCErr; // VFALCO NOTE Deprecated function Json::Value -rpcError(int iError) +rpcError(error_code_i iError) { Json::Value jvResult(Json::objectValue); RPC::inject_error(iError, jvResult); diff --git a/src/test/json/Object_test.cpp b/src/test/json/Object_test.cpp deleted file mode 100644 index b74754db33..0000000000 --- a/src/test/json/Object_test.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include - -#include -#include - -namespace Json { - -class JsonObject_test : public xrpl::test::TestOutputSuite -{ - void - setup(std::string const& testName) - { - testcase(testName); - output_.clear(); - } - - std::unique_ptr writerObject_; - - Object& - makeRoot() - { - writerObject_ = - std::make_unique(stringWriterObject(output_)); - return **writerObject_; - } - - void - expectResult(std::string const& expected) - { - writerObject_.reset(); - TestOutputSuite::expectResult(expected); - } - -public: - void - testTrivial() - { - setup("trivial"); - - { - auto& root = makeRoot(); - (void)root; - } - expectResult("{}"); - } - - void - testSimple() - { - setup("simple"); - { - auto& root = makeRoot(); - root["hello"] = "world"; - root["skidoo"] = 23; - root["awake"] = false; - root["temperature"] = 98.6; - } - - expectResult( - "{\"hello\":\"world\"," - "\"skidoo\":23," - "\"awake\":false," - "\"temperature\":98.6}"); - } - - void - testOneSub() - { - setup("oneSub"); - { - auto& root = makeRoot(); - root.setArray("ar"); - } - expectResult("{\"ar\":[]}"); - } - - void - testSubs() - { - setup("subs"); - { - auto& root = makeRoot(); - - { - // Add an array with three entries. - auto array = root.setArray("ar"); - array.append(23); - array.append(false); - array.append(23.5); - } - - { - // Add an object with one entry. - auto obj = root.setObject("obj"); - obj["hello"] = "world"; - } - - { - // Add another object with two entries. - Json::Value value; - value["h"] = "w"; - value["f"] = false; - root["obj2"] = value; - } - } - - // Json::Value has an unstable order... - auto case1 = - "{\"ar\":[23,false,23.5]," - "\"obj\":{\"hello\":\"world\"}," - "\"obj2\":{\"h\":\"w\",\"f\":false}}"; - auto case2 = - "{\"ar\":[23,false,23.5]," - "\"obj\":{\"hello\":\"world\"}," - "\"obj2\":{\"f\":false,\"h\":\"w\"}}"; - writerObject_.reset(); - BEAST_EXPECT(output_ == case1 || output_ == case2); - } - - void - testSubsShort() - { - setup("subsShort"); - - { - auto& root = makeRoot(); - - { - // Add an array with three entries. - auto array = root.setArray("ar"); - array.append(23); - array.append(false); - array.append(23.5); - } - - // Add an object with one entry. - root.setObject("obj")["hello"] = "world"; - - { - // Add another object with two entries. - auto object = root.setObject("obj2"); - object.set("h", "w"); - object.set("f", false); - } - } - expectResult( - "{\"ar\":[23,false,23.5]," - "\"obj\":{\"hello\":\"world\"}," - "\"obj2\":{\"h\":\"w\",\"f\":false}}"); - } - - void - testFailureObject() - { - { - setup("object failure assign"); - auto& root = makeRoot(); - auto obj = root.setObject("o1"); - expectException([&]() { root["fail"] = "complete"; }); - } - { - setup("object failure object"); - auto& root = makeRoot(); - auto obj = root.setObject("o1"); - expectException([&]() { root.setObject("o2"); }); - } - { - setup("object failure Array"); - auto& root = makeRoot(); - auto obj = root.setArray("o1"); - expectException([&]() { root.setArray("o2"); }); - } - } - - void - testFailureArray() - { - { - setup("array failure append"); - auto& root = makeRoot(); - auto array = root.setArray("array"); - auto subarray = array.appendArray(); - auto fail = [&]() { array.append("fail"); }; - expectException(fail); - } - { - setup("array failure appendArray"); - auto& root = makeRoot(); - auto array = root.setArray("array"); - auto subarray = array.appendArray(); - auto fail = [&]() { array.appendArray(); }; - expectException(fail); - } - { - setup("array failure appendObject"); - auto& root = makeRoot(); - auto array = root.setArray("array"); - auto subarray = array.appendArray(); - auto fail = [&]() { array.appendObject(); }; - expectException(fail); - } - } - - void - testKeyFailure() - { - setup("repeating keys"); - auto& root = makeRoot(); - root.set("foo", "bar"); - root.set("baz", 0); - // setting key again throws in !NDEBUG builds - auto set_again = [&]() { root.set("foo", "bar"); }; -#ifdef NDEBUG - set_again(); - pass(); -#else - expectException(set_again); -#endif - } - - void - run() override - { - testTrivial(); - testSimple(); - - testOneSub(); - testSubs(); - testSubsShort(); - - testFailureObject(); - testFailureArray(); - testKeyFailure(); - } -}; - -BEAST_DEFINE_TESTSUITE(JsonObject, json, xrpl); - -} // namespace Json diff --git a/src/test/jtx/impl/utility.cpp b/src/test/jtx/impl/utility.cpp index 81bce576ce..920e715c16 100644 --- a/src/test/jtx/impl/utility.cpp +++ b/src/test/jtx/impl/utility.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -83,7 +82,7 @@ cmdToJSONRPC( // If paramsObj is not empty, put it in a [params] array. if (paramsObj.begin() != paramsObj.end()) { - auto& paramsArray = Json::setArray(jv, jss::params); + auto& paramsArray = jv[jss::params] = Json::arrayValue; paramsArray.append(paramsObj); } if (paramsObj.isMember(jss::jsonrpc)) diff --git a/src/xrpld/app/ledger/LedgerToJson.h b/src/xrpld/app/ledger/LedgerToJson.h index 7ebbfc655e..7b7e267d81 100644 --- a/src/xrpld/app/ledger/LedgerToJson.h +++ b/src/xrpld/app/ledger/LedgerToJson.h @@ -7,7 +7,6 @@ #include #include -#include #include namespace xrpl { @@ -42,10 +41,9 @@ struct LedgerFill std::optional closeTime; }; -/** Given a Ledger and options, fill a Json::Object or Json::Value with a +/** Given a Ledger and options, fill a Json::Value with a description of the ledger. */ - void addJson(Json::Value&, LedgerFill const&); @@ -53,6 +51,10 @@ addJson(Json::Value&, LedgerFill const&); Json::Value getJson(LedgerFill const&); +/** Copy all the keys and values from one object into another. */ +void +copyFrom(Json::Value& to, Json::Value const& from); + } // namespace xrpl #endif diff --git a/src/xrpld/app/ledger/detail/LedgerToJson.cpp b/src/xrpld/app/ledger/detail/LedgerToJson.cpp index 8c9e21acde..b1f6d6b297 100644 --- a/src/xrpld/app/ledger/detail/LedgerToJson.cpp +++ b/src/xrpld/app/ledger/detail/LedgerToJson.cpp @@ -32,10 +32,9 @@ isBinary(LedgerFill const& fill) return fill.options & LedgerFill::binary; } -template void fillJson( - Object& json, + Json::Value& json, bool closed, LedgerHeader const& info, bool bFull, @@ -78,9 +77,8 @@ fillJson( } } -template void -fillJsonBinary(Object& json, bool closed, LedgerHeader const& info) +fillJsonBinary(Json::Value& json, bool closed, LedgerHeader const& info) { if (!closed) json[jss::closed] = false; @@ -207,11 +205,10 @@ fillJsonTx( return txJson; } -template void -fillJsonTx(Object& json, LedgerFill const& fill) +fillJsonTx(Json::Value& json, LedgerFill const& fill) { - auto&& txns = setArray(json, jss::transactions); + auto& txns = json[jss::transactions] = Json::arrayValue; auto bBinary = isBinary(fill); auto bExpanded = isExpanded(fill); @@ -238,12 +235,11 @@ fillJsonTx(Object& json, LedgerFill const& fill) } } -template void -fillJsonState(Object& json, LedgerFill const& fill) +fillJsonState(Json::Value& json, LedgerFill const& fill) { auto& ledger = fill.ledger; - auto&& array = Json::setArray(json, jss::accountState); + auto& array = json[jss::accountState] = Json::arrayValue; auto expanded = isExpanded(fill); auto binary = isBinary(fill); @@ -251,7 +247,7 @@ fillJsonState(Object& json, LedgerFill const& fill) { if (binary) { - auto&& obj = appendObject(array); + auto& obj = array.append(Json::objectValue); obj[jss::hash] = to_string(sle->key()); obj[jss::tx_blob] = serializeHex(*sle); } @@ -262,17 +258,16 @@ fillJsonState(Object& json, LedgerFill const& fill) } } -template void -fillJsonQueue(Object& json, LedgerFill const& fill) +fillJsonQueue(Json::Value& json, LedgerFill const& fill) { - auto&& queueData = Json::setArray(json, jss::queue_data); + auto& queueData = json[jss::queue_data] = Json::arrayValue; auto bBinary = isBinary(fill); auto bExpanded = isExpanded(fill); for (auto const& tx : fill.txQueue) { - auto&& txJson = appendObject(queueData); + auto& txJson = queueData.append(Json::objectValue); txJson[jss::fee_level] = to_string(tx.feeLevel); if (tx.lastValid) txJson[jss::LastLedgerSequence] = *tx.lastValid; @@ -297,9 +292,8 @@ fillJsonQueue(Object& json, LedgerFill const& fill) } } -template void -fillJson(Object& json, LedgerFill const& fill) +fillJson(Json::Value& json, LedgerFill const& fill) { // TODO: what happens if bBinary and bExtracted are both set? // Is there a way to report this back? @@ -327,7 +321,7 @@ fillJson(Object& json, LedgerFill const& fill) void addJson(Json::Value& json, LedgerFill const& fill) { - auto&& object = Json::addObject(json, jss::ledger); + auto& object = json[jss::ledger] = Json::objectValue; fillJson(object, fill); if ((fill.options & LedgerFill::dumpQueue) && !fill.txQueue.empty()) @@ -342,4 +336,20 @@ getJson(LedgerFill const& fill) return json; } +void +copyFrom(Json::Value& to, Json::Value const& from) +{ + if (!to) // Short circuit this very common case. + to = from; + else + { + // TODO: figure out if there is a way to remove this clause + // or check that it does/needs to do a deep copy + XRPL_ASSERT(from.isObjectOrNull(), "copyFrom : invalid input type"); + auto const members = from.getMemberNames(); + for (auto const& m : members) + to[m] = from[m]; + } +} + } // namespace xrpl diff --git a/src/xrpld/rpc/Status.h b/src/xrpld/rpc/Status.h index f4ffcae9b2..5d6175336e 100644 --- a/src/xrpld/rpc/Status.h +++ b/src/xrpld/rpc/Status.h @@ -94,9 +94,8 @@ public: /** Apply the Status to a JsonObject */ - template void - inject(Object& object) const + inject(Json::Value& object) const { if (auto ec = toErrorCode()) { diff --git a/src/xrpld/rpc/handlers/GetCounts.h b/src/xrpld/rpc/handlers/GetCounts.h index 0d544a4f11..de2c4f2f96 100644 --- a/src/xrpld/rpc/handlers/GetCounts.h +++ b/src/xrpld/rpc/handlers/GetCounts.h @@ -3,8 +3,6 @@ #include -#include - namespace xrpl { Json::Value diff --git a/src/xrpld/rpc/handlers/LedgerHandler.cpp b/src/xrpld/rpc/handlers/LedgerHandler.cpp index 2929776549..f8e8111aad 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerHandler.cpp @@ -75,6 +75,43 @@ LedgerHandler::check() return Status::OK; } +void +LedgerHandler::writeResult(Json::Value& value) +{ + if (ledger_) + { + copyFrom(value, result_); + addJson(value, {*ledger_, &context_, options_, queueTxs_}); + } + else + { + auto& master = context_.app.getLedgerMaster(); + { + auto& closed = value[jss::closed] = Json::objectValue; + addJson(closed, {*master.getClosedLedger(), &context_, 0}); + } + { + auto& open = value[jss::open] = Json::objectValue; + addJson(open, {*master.getCurrentLedger(), &context_, 0}); + } + } + + Json::Value warnings{Json::arrayValue}; + if (context_.params.isMember(jss::type)) + { + Json::Value& w = warnings.append(Json::objectValue); + w[jss::id] = warnRPC_FIELDS_DEPRECATED; + w[jss::message] = + "Some fields from your request are deprecated. Please check the " + "documentation at " + "https://xrpl.org/docs/references/http-websocket-apis/ " + "and update your request. Field `type` is deprecated."; + } + + if (warnings.size()) + value[jss::warnings] = std::move(warnings); +} + } // namespace RPC std::pair diff --git a/src/xrpld/rpc/handlers/LedgerHandler.h b/src/xrpld/rpc/handlers/LedgerHandler.h index fbf60fb22e..3285118d11 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.h +++ b/src/xrpld/rpc/handlers/LedgerHandler.h @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -37,9 +36,8 @@ public: Status check(); - template void - writeResult(Object&); + writeResult(Json::Value&); static constexpr char name[] = "ledger"; @@ -59,49 +57,6 @@ private: int options_ = 0; }; -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// -// Implementation. - -template -void -LedgerHandler::writeResult(Object& value) -{ - if (ledger_) - { - Json::copyFrom(value, result_); - addJson(value, {*ledger_, &context_, options_, queueTxs_}); - } - else - { - auto& master = context_.app.getLedgerMaster(); - { - auto&& closed = Json::addObject(value, jss::closed); - addJson(closed, {*master.getClosedLedger(), &context_, 0}); - } - { - auto&& open = Json::addObject(value, jss::open); - addJson(open, {*master.getCurrentLedger(), &context_, 0}); - } - } - - Json::Value warnings{Json::arrayValue}; - if (context_.params.isMember(jss::type)) - { - Json::Value& w = warnings.append(Json::objectValue); - w[jss::id] = warnRPC_FIELDS_DEPRECATED; - w[jss::message] = - "Some fields from your request are deprecated. Please check the " - "documentation at " - "https://xrpl.org/docs/references/http-websocket-apis/ " - "and update your request. Field `type` is deprecated."; - } - - if (warnings.size()) - value[jss::warnings] = std::move(warnings); -} - } // namespace RPC } // namespace xrpl diff --git a/src/xrpld/rpc/handlers/Version.h b/src/xrpld/rpc/handlers/Version.h index 8af2fd20bc..b8f9512ef3 100644 --- a/src/xrpld/rpc/handlers/Version.h +++ b/src/xrpld/rpc/handlers/Version.h @@ -20,9 +20,8 @@ public: return Status::OK; } - template void - writeResult(Object& obj) + writeResult(Json::Value& obj) { setVersion(obj, apiVersion_, betaEnabled_); } From f059f0beda746b444d191a207b343ac457fd58db Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 17 Dec 2025 18:21:01 -0500 Subject: [PATCH 11/62] Set version to 3.2.0-b0 (#6153) --- src/libxrpl/protocol/BuildInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libxrpl/protocol/BuildInfo.cpp b/src/libxrpl/protocol/BuildInfo.cpp index 472a8cb039..65caa9ecd3 100644 --- a/src/libxrpl/protocol/BuildInfo.cpp +++ b/src/libxrpl/protocol/BuildInfo.cpp @@ -17,7 +17,7 @@ namespace BuildInfo { // and follow the format described at http://semver.org/ //------------------------------------------------------------------------------ // clang-format off -char const* const versionString = "3.1.0-b0" +char const* const versionString = "3.2.0-b0" // clang-format on #if defined(DEBUG) || defined(SANITIZER) From 40198d9792af68df4f5a7610c614e8420c487d7b Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 22 Dec 2025 16:30:23 -0500 Subject: [PATCH 12/62] ci: Remove superfluous build directory creation (#6159) This change modifies the build directory structure from `build/build/xxx` or `.build/build/xxx` to just `build/xxx`. Namely, the `conanfile.py` has the CMake generators build directory hardcoded to `build/generators`. We may as well leverage the top-level build directory without introducing another layer of directory nesting. --- .github/actions/build-deps/action.yml | 9 +----- .github/workflows/publish-docs.yml | 2 +- .../workflows/reusable-build-test-config.yml | 29 +++++++++---------- .github/workflows/reusable-build-test.yml | 6 ---- .github/workflows/upload-conan-deps.yml | 1 - 5 files changed, 15 insertions(+), 32 deletions(-) diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml index f20eb3a595..d1fb980dac 100644 --- a/.github/actions/build-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -4,9 +4,6 @@ description: "Install Conan dependencies, optionally forcing a rebuild of all de # Note that actions do not support 'type' and all inputs are strings, see # https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs. inputs: - build_dir: - description: "The directory where to build." - required: true build_type: description: 'The build type to use ("Debug", "Release").' required: true @@ -28,17 +25,13 @@ runs: - name: Install Conan dependencies shell: bash env: - BUILD_DIR: ${{ inputs.build_dir }} BUILD_NPROC: ${{ inputs.build_nproc }} BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }} BUILD_TYPE: ${{ inputs.build_type }} LOG_VERBOSITY: ${{ inputs.log_verbosity }} run: | echo 'Installing dependencies.' - mkdir -p "${BUILD_DIR}" - cd "${BUILD_DIR}" conan install \ - --output-folder . \ --build="${BUILD_OPTION}" \ --options:host='&:tests=True' \ --options:host='&:xrpld=True' \ @@ -46,4 +39,4 @@ runs: --conf:all tools.build:jobs=${BUILD_NPROC} \ --conf:all tools.build:verbosity="${LOG_VERBOSITY}" \ --conf:all tools.compilation:verbosity="${LOG_VERBOSITY}" \ - .. + . diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 6f0927a2b3..c37a82a2f3 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -22,7 +22,7 @@ defaults: shell: bash env: - BUILD_DIR: .build + BUILD_DIR: build NPROC_SUBTRACT: 2 jobs: diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 43acfab542..98bf107225 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -3,11 +3,6 @@ name: Build and test configuration on: workflow_call: inputs: - build_dir: - description: "The directory where to build." - required: true - type: string - build_only: description: 'Whether to only build or to build and test the code ("true", "false").' required: true @@ -59,6 +54,11 @@ defaults: run: shell: bash +env: + # Conan installs the generators in the build/generators directory, see the + # layout() method in conanfile.py. We then run CMake from the build directory. + BUILD_DIR: build + jobs: build-and-test: name: ${{ inputs.config_name }} @@ -96,7 +96,6 @@ jobs: - name: Build dependencies uses: ./.github/actions/build-deps with: - build_dir: ${{ inputs.build_dir }} build_nproc: ${{ steps.nproc.outputs.nproc }} build_type: ${{ inputs.build_type }} # Set the verbosity to "quiet" for Windows to avoid an excessive @@ -104,7 +103,7 @@ jobs: log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }} - name: Configure CMake - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} env: BUILD_TYPE: ${{ inputs.build_type }} CMAKE_ARGS: ${{ inputs.cmake_args }} @@ -117,7 +116,7 @@ jobs: .. - name: Build the binary - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} BUILD_TYPE: ${{ inputs.build_type }} @@ -132,8 +131,6 @@ jobs: - name: Upload the binary (Linux) if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }} uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - env: - BUILD_DIR: ${{ inputs.build_dir }} with: name: xrpld-${{ inputs.config_name }} path: ${{ env.BUILD_DIR }}/xrpld @@ -142,7 +139,7 @@ jobs: - name: Check linking (Linux) if: ${{ runner.os == 'Linux' }} - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} run: | ldd ./xrpld if [ "$(ldd ./xrpld | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then @@ -154,13 +151,13 @@ jobs: - name: Verify presence of instrumentation (Linux) if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }} - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} run: | ./xrpld --version | grep libvoidstar - name: Run the separate tests if: ${{ !inputs.build_only }} - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} # Windows locks some of the build files while running tests, and parallel jobs can collide env: BUILD_TYPE: ${{ inputs.build_type }} @@ -173,7 +170,7 @@ jobs: - name: Run the embedded tests if: ${{ !inputs.build_only }} - working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', inputs.build_dir, inputs.build_type) || inputs.build_dir }} + working-directory: ${{ runner.os == 'Windows' && format('{0}/{1}', env.BUILD_DIR, inputs.build_type) || env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} run: | @@ -189,7 +186,7 @@ jobs: - name: Prepare coverage report if: ${{ !inputs.build_only && env.ENABLED_COVERAGE == 'true' }} - working-directory: ${{ inputs.build_dir }} + working-directory: ${{ env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} BUILD_TYPE: ${{ inputs.build_type }} @@ -207,7 +204,7 @@ jobs: disable_search: true disable_telem: true fail_ci_if_error: true - files: ${{ inputs.build_dir }}/coverage.xml + files: ${{ env.BUILD_DIR }}/coverage.xml plugins: noop token: ${{ secrets.CODECOV_TOKEN }} verbose: true diff --git a/.github/workflows/reusable-build-test.yml b/.github/workflows/reusable-build-test.yml index c6e991df79..7f14aacb9b 100644 --- a/.github/workflows/reusable-build-test.yml +++ b/.github/workflows/reusable-build-test.yml @@ -8,11 +8,6 @@ name: Build and test on: workflow_call: inputs: - build_dir: - description: "The directory where to build." - required: false - type: string - default: ".build" os: description: 'The operating system to use for the build ("linux", "macos", "windows").' required: true @@ -46,7 +41,6 @@ jobs: matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} max-parallel: 10 with: - build_dir: ${{ inputs.build_dir }} build_only: ${{ matrix.build_only }} build_type: ${{ matrix.build_type }} cmake_args: ${{ matrix.cmake_args }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index ec283e564c..5024666394 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -92,7 +92,6 @@ jobs: - name: Build dependencies uses: ./.github/actions/build-deps with: - build_dir: .build build_nproc: ${{ steps.nproc.outputs.nproc }} build_type: ${{ matrix.build_type }} force_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }} From b7139da4d09c55cae3f6ec69c092b1c87c34b631 Mon Sep 17 00:00:00 2001 From: Michael Legleux Date: Tue, 23 Dec 2025 16:38:35 -0800 Subject: [PATCH 13/62] fix: Remove cryptographic libs from libxrpl Conan package (#6163) * fix: rm crypto libs and fix protobuf path * update/rm comments --- conanfile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/conanfile.py b/conanfile.py index 8dc09da0af..48e28cb275 100644 --- a/conanfile.py +++ b/conanfile.py @@ -182,12 +182,10 @@ class Xrpl(ConanFile): libxrpl.libs = [ "xrpl", "xrpl.libpb", - "ed25519", - "secp256k1", ] # TODO: Fix the protobufs to include each other relative to - # `include/`, not `include/ripple/proto/`. - libxrpl.includedirs = ["include", "include/ripple/proto"] + # `include/`, not `include/xrpl/proto/`. + libxrpl.includedirs = ["include", "include/xrpl/proto"] libxrpl.requires = [ "boost::headers", "boost::chrono", From 0f23ad820c84d0c8e97e2f0caa7c2e2690397207 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 2 Jan 2026 16:53:33 +0000 Subject: [PATCH 14/62] chore: Pin ruamel.yaml<0.19 in pre-commit-hooks (#6166) See https://github.com/pre-commit/pre-commit-hooks/issues/1229 for more details. --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c85e0798f7..01b0e85930 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,10 +13,16 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: + # https://github.com/pre-commit/pre-commit-hooks/issues/1229 + # regarding ruamel.yaml version - id: trailing-whitespace + additional_dependencies: [ruamel.yaml<0.19] - id: end-of-file-fixer + additional_dependencies: [ruamel.yaml<0.19] - id: mixed-line-ending + additional_dependencies: [ruamel.yaml<0.19] - id: check-merge-conflict + additional_dependencies: [ruamel.yaml<0.19] args: [--assume-in-merge] - repo: https://github.com/pre-commit/mirrors-clang-format From 0b87a26f04641b1d48a7738d6a2228bc02159e85 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 5 Jan 2026 14:01:14 +0000 Subject: [PATCH 15/62] Revert "chore: Pin ruamel.yaml<0.19 in pre-commit-hooks (#6166)" (#6167) This reverts commit 0f23ad820c84d0c8e97e2f0caa7c2e2690397207. --- .pre-commit-config.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01b0e85930..c85e0798f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,16 +13,10 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: - # https://github.com/pre-commit/pre-commit-hooks/issues/1229 - # regarding ruamel.yaml version - id: trailing-whitespace - additional_dependencies: [ruamel.yaml<0.19] - id: end-of-file-fixer - additional_dependencies: [ruamel.yaml<0.19] - id: mixed-line-ending - additional_dependencies: [ruamel.yaml<0.19] - id: check-merge-conflict - additional_dependencies: [ruamel.yaml<0.19] args: [--assume-in-merge] - repo: https://github.com/pre-commit/mirrors-clang-format From 3d1b3a49b3601a0a7037fa0b19d5df7b5e0e2fc1 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 5 Jan 2026 09:55:12 -0500 Subject: [PATCH 16/62] refactor: Rename `rippled.cfg` to `xrpld.cfg` (#6098) This change renames all occurrences of `rippled.cfg` to `xrpld.cfg`. It also provides a script to allow developers to replicate the changes in their local branch or fork to avoid conflicts. For the time being it maintains support for `rippled.cfg` as config file, if `xrpld.cfg` does not exist. --- .github/scripts/rename/README.md | 4 + .github/scripts/rename/config.sh | 72 ++++ .github/workflows/reusable-check-rename.yml | 2 + .gitignore | 1 + cfg/validators-example.txt | 2 +- ...{rippled-example.cfg => xrpld-example.cfg} | 108 +++--- cmake/XrplInstall.cmake | 2 +- include/xrpl/core/PerfLog.h | 2 +- include/xrpl/nodestore/README.md | 2 +- src/libxrpl/nodestore/ManagerImp.cpp | 4 +- src/test/core/Config_test.cpp | 310 +++++++++++++----- src/xrpld/app/misc/SHAMapStoreImp.h | 2 +- src/xrpld/core/Config.h | 1 + src/xrpld/core/detail/Config.cpp | 113 +++---- src/xrpld/overlay/README.md | 2 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- 16 files changed, 433 insertions(+), 196 deletions(-) create mode 100755 .github/scripts/rename/config.sh rename cfg/{rippled-example.cfg => xrpld-example.cfg} (94%) diff --git a/.github/scripts/rename/README.md b/.github/scripts/rename/README.md index 392f0b1efc..8336f23bec 100644 --- a/.github/scripts/rename/README.md +++ b/.github/scripts/rename/README.md @@ -31,6 +31,9 @@ run from the repository root. the `xrpld` binary. 5. `.github/scripts/rename/namespace.sh`: This script will rename the C++ namespaces from `ripple` to `xrpl`. +6. `.github/scripts/rename/config.sh`: This script will rename the config from + `rippled.cfg` to `xrpld.cfg`, and updating the code accordingly. The old + filename will still be accepted. You can run all these scripts from the repository root as follows: @@ -40,4 +43,5 @@ You can run all these scripts from the repository root as follows: ./.github/scripts/rename/cmake.sh . ./.github/scripts/rename/binary.sh . ./.github/scripts/rename/namespace.sh . +./.github/scripts/rename/config.sh . ``` diff --git a/.github/scripts/rename/config.sh b/.github/scripts/rename/config.sh new file mode 100755 index 0000000000..7f36e8fd21 --- /dev/null +++ b/.github/scripts/rename/config.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Exit the script as soon as an error occurs. +set -e + +# On MacOS, ensure that GNU sed is installed and available as `gsed`. +SED_COMMAND=sed +if [[ "${OSTYPE}" == 'darwin'* ]]; then + if ! command -v gsed &> /dev/null; then + echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'." + exit 1 + fi + SED_COMMAND=gsed +fi + +# This script renames the config from `rippled.cfg` to `xrpld.cfg`, and updates +# the code accordingly. The old filename will still be accepted. +# Usage: .github/scripts/rename/config.sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIRECTORY=$1 +echo "Processing directory: ${DIRECTORY}" +if [ ! -d "${DIRECTORY}" ]; then + echo "Error: Directory '${DIRECTORY}' does not exist." + exit 1 +fi +pushd ${DIRECTORY} + +# Add the xrpld.cfg to the .gitignore. +if ! grep -q 'xrpld.cfg' .gitignore; then + ${SED_COMMAND} -i '/rippled.cfg/a\ +/xrpld.cfg' .gitignore +fi + +# Rename the files. +if [ -e rippled.cfg ]; then + mv rippled.cfg xrpld.cfg +fi +if [ -e cfg/rippled-example.cfg ]; then + mv cfg/rippled-example.cfg cfg/xrpld-example.cfg +fi + +# Rename inside the files. +DIRECTORIES=("cfg" "cmake" "include" "src") +for DIRECTORY in "${DIRECTORIES[@]}"; do + echo "Processing directory: ${DIRECTORY}" + + find "${DIRECTORY}" -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.ipp" -o -name "*.cpp" -o -name "*.cmake" -o -name "*.txt" -o -name "*.cfg" -o -name "*.md" \) | while read -r FILE; do + echo "Processing file: ${FILE}" + ${SED_COMMAND} -i -E 's/rippled(-example)?[ .]cfg/xrpld\1.cfg/g' "${FILE}" + done +done +${SED_COMMAND} -i 's/rippled/xrpld/g' cfg/xrpld-example.cfg +${SED_COMMAND} -i 's/rippled/xrpld/g' src/test/core/Config_test.cpp +${SED_COMMAND} -i 's/ripplevalidators/xrplvalidators/g' src/test/core/Config_test.cpp +${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' src/test/core/Config_test.cpp +${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp +${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp + + +# Restore the old config file name in the code that maintains support for now. +${SED_COMMAND} -i 's/configLegacyName = "xrpld.cfg"/configLegacyName = "rippled.cfg"/g' src/xrpld/core/detail/Config.cpp + +# Restore an URL. +${SED_COMMAND} -i 's/connect-your-xrpld-to-the-xrp-test-net.html/connect-your-rippled-to-the-xrp-test-net.html/g' cfg/xrpld-example.cfg + +popd +echo "Renaming complete." diff --git a/.github/workflows/reusable-check-rename.yml b/.github/workflows/reusable-check-rename.yml index fb9ed2c6a8..af55084405 100644 --- a/.github/workflows/reusable-check-rename.yml +++ b/.github/workflows/reusable-check-rename.yml @@ -29,6 +29,8 @@ jobs: run: .github/scripts/rename/binary.sh . - name: Check namespaces run: .github/scripts/rename/namespace.sh . + - name: Check config name + run: .github/scripts/rename/config.sh . - name: Check for differences env: MESSAGE: | diff --git a/.gitignore b/.gitignore index 55844462e5..c4e81408bb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ gmon.out # Customized configs. /rippled.cfg +/xrpld.cfg /validators.txt # Locally patched Conan recipes diff --git a/cfg/validators-example.txt b/cfg/validators-example.txt index dbcff90f12..6eb49da697 100644 --- a/cfg/validators-example.txt +++ b/cfg/validators-example.txt @@ -1,7 +1,7 @@ # # Default validators.txt # -# This file is located in the same folder as your rippled.cfg file +# This file is located in the same folder as your xrpld.cfg file # and defines which validators your server trusts not to collude. # # This file is UTF-8 with DOS, UNIX, or Mac style line endings. diff --git a/cfg/rippled-example.cfg b/cfg/xrpld-example.cfg similarity index 94% rename from cfg/rippled-example.cfg rename to cfg/xrpld-example.cfg index 5db008431d..b5180dce52 100644 --- a/cfg/rippled-example.cfg +++ b/cfg/xrpld-example.cfg @@ -29,18 +29,18 @@ # # Purpose # -# This file documents and provides examples of all rippled server process -# configuration options. When the rippled server instance is launched, it +# This file documents and provides examples of all xrpld server process +# configuration options. When the xrpld server instance is launched, it # looks for a file with the following name: # -# rippled.cfg +# xrpld.cfg # -# For more information on where the rippled server instance searches for the +# For more information on where the xrpld server instance searches for the # file, visit: # # https://xrpl.org/commandline-usage.html#generic-options # -# This file should be named rippled.cfg. This file is UTF-8 with DOS, UNIX, +# This file should be named xrpld.cfg. This file is UTF-8 with DOS, UNIX, # or Mac style end of lines. Blank lines and lines beginning with '#' are # ignored. Undefined sections are reserved. No escapes are currently defined. # @@ -89,8 +89,8 @@ # # # -# rippled offers various server protocols to clients making inbound -# connections. The listening ports rippled uses are "universal" ports +# xrpld offers various server protocols to clients making inbound +# connections. The listening ports xrpld uses are "universal" ports # which may be configured to handshake in one or more of the available # supported protocols. These universal ports simplify administration: # A single open port can be used for multiple protocols. @@ -103,7 +103,7 @@ # # A list of port names and key/value pairs. A port name must start with a # letter and contain only letters and numbers. The name is not case-sensitive. -# For each name in this list, rippled will look for a configuration file +# For each name in this list, xrpld will look for a configuration file # section with the same name and use it to create a listening port. The # name is informational only; the choice of name does not affect the function # of the listening port. @@ -134,7 +134,7 @@ # ip = 127.0.0.1 # protocol = http # -# When rippled is used as a command line client (for example, issuing a +# When xrpld is used as a command line client (for example, issuing a # server stop command), the first port advertising the http or https # protocol will be used to make the connection. # @@ -175,7 +175,7 @@ # same time. It is possible have both Websockets and Secure Websockets # together in one port. # -# NOTE If no ports support the peer protocol, rippled cannot +# NOTE If no ports support the peer protocol, xrpld cannot # receive incoming peer connections or become a superpeer. # # limit = @@ -194,7 +194,7 @@ # required. IP address restrictions, if any, will be checked in addition # to the credentials specified here. # -# When acting in the client role, rippled will supply these credentials +# When acting in the client role, xrpld will supply these credentials # using HTTP's Basic Authentication headers when making outbound HTTP/S # requests. # @@ -237,7 +237,7 @@ # WS, or WSS protocol interfaces. If administrative commands are # disabled for a port, these credentials have no effect. # -# When acting in the client role, rippled will supply these credentials +# When acting in the client role, xrpld will supply these credentials # in the submitted JSON for any administrative command requests when # invoking JSON-RPC commands on remote servers. # @@ -258,7 +258,7 @@ # resource controls will default to those for non-administrative users. # # The secure_gateway IP addresses are intended to represent -# proxies. Since rippled trusts these hosts, they must be +# proxies. Since xrpld trusts these hosts, they must be # responsible for properly authenticating the remote user. # # If some IP addresses are included for both "admin" and @@ -272,7 +272,7 @@ # Use the specified files when configuring SSL on the port. # # NOTE If no files are specified and secure protocols are selected, -# rippled will generate an internal self-signed certificate. +# xrpld will generate an internal self-signed certificate. # # The files have these meanings: # @@ -297,12 +297,12 @@ # Control the ciphers which the server will support over SSL on the port, # specified using the OpenSSL "cipher list format". # -# NOTE If unspecified, rippled will automatically configure a modern +# NOTE If unspecified, xrpld will automatically configure a modern # cipher suite. This default suite should be widely supported. # # You should not modify this string unless you have a specific # reason and cryptographic expertise. Incorrect modification may -# keep rippled from connecting to other instances of rippled or +# keep xrpld from connecting to other instances of xrpld or # prevent RPC and WebSocket clients from connecting. # # send_queue_limit = [1..65535] @@ -382,7 +382,7 @@ #----------------- # # These settings control security and access attributes of the Peer to Peer -# server section of the rippled process. Peer Protocol implements the +# server section of the xrpld process. Peer Protocol implements the # Ripple Payment protocol. It is over peer connections that transactions # and validations are passed from to machine to machine, to determine the # contents of validated ledgers. @@ -396,7 +396,7 @@ # true - enables compression # false - disables compression [default]. # -# The rippled server can save bandwidth by compressing its peer-to-peer communications, +# The xrpld server can save bandwidth by compressing its peer-to-peer communications, # at a cost of greater CPU usage. If you enable link compression, # the server automatically compresses communications with peer servers # that also have link compression enabled. @@ -432,7 +432,7 @@ # # [ips_fixed] # -# List of IP addresses or hostnames to which rippled should always attempt to +# List of IP addresses or hostnames to which xrpld should always attempt to # maintain peer connections with. This is useful for manually forming private # networks, for example to configure a validation server that connects to the # Ripple network through a public-facing server, or for building a set @@ -573,7 +573,7 @@ # # minimum_txn_in_ledger_standalone = # -# Like minimum_txn_in_ledger when rippled is running in standalone +# Like minimum_txn_in_ledger when xrpld is running in standalone # mode. Default: 1000. # # target_txn_in_ledger = @@ -710,7 +710,7 @@ # # [validator_token] # -# This is an alternative to [validation_seed] that allows rippled to perform +# This is an alternative to [validation_seed] that allows xrpld to perform # validation without having to store the validator keys on the network # connected server. The field should contain a single token in the form of a # base64-encoded blob. @@ -745,7 +745,7 @@ # # Specify the file by its name or path. # Unless an absolute path is specified, it will be considered relative to -# the folder in which the rippled.cfg file is located. +# the folder in which the xrpld.cfg file is located. # # Examples: # /home/ripple/validators.txt @@ -840,7 +840,7 @@ # # 0: Disable the ledger replay feature [default] # 1: Enable the ledger replay feature. With this feature enabled, when -# acquiring a ledger from the network, a rippled node only downloads +# acquiring a ledger from the network, a xrpld node only downloads # the ledger header and the transactions instead of the whole ledger. # And the ledger is built by applying the transactions to the parent # ledger. @@ -851,7 +851,7 @@ # #---------------- # -# The rippled server instance uses HTTPS GET requests in a variety of +# The xrpld server instance uses HTTPS GET requests in a variety of # circumstances, including but not limited to contacting trusted domains to # fetch information such as mapping an email address to a Ripple Payment # Network address. @@ -891,7 +891,7 @@ # #------------ # -# rippled creates 4 SQLite database to hold bookkeeping information +# xrpld creates 4 SQLite database to hold bookkeeping information # about transactions, local credentials, and various other things. # It also creates the NodeDB, which holds all the objects that # make up the current and historical ledgers. @@ -902,7 +902,7 @@ # the performance of the server. # # Partial pathnames will be considered relative to the location of -# the rippled.cfg file. +# the xrpld.cfg file. # # [node_db] Settings for the Node Database (required) # @@ -920,11 +920,11 @@ # type = NuDB # # NuDB is a high-performance database written by Ripple Labs and optimized -# for rippled and solid-state drives. +# for xrpld and solid-state drives. # # NuDB maintains its high speed regardless of the amount of history # stored. Online delete may be selected, but is not required. NuDB is -# available on all platforms that rippled runs on. +# available on all platforms that xrpld runs on. # # type = RocksDB # @@ -1049,7 +1049,7 @@ # # recovery_wait_seconds # The online delete process checks periodically -# that rippled is still in sync with the network, +# that xrpld is still in sync with the network, # and that the validated ledger is less than # 'age_threshold_seconds' old. If not, then continue # sleeping for this number of seconds and @@ -1069,8 +1069,8 @@ # The server creates and maintains 4 to 5 bookkeeping SQLite databases in # the 'database_path' location. If you omit this configuration setting, # the server creates a directory called "db" located in the same place as -# your rippled.cfg file. -# Partial pathnames are relative to the location of the rippled executable. +# your xrpld.cfg file. +# Partial pathnames are relative to the location of the xrpld executable. # # [sqlite] Tuning settings for the SQLite databases (optional) # @@ -1120,7 +1120,7 @@ # The default is "wal", which uses a write-ahead # log to implement database transactions. # Alternately, "memory" saves disk I/O, but if -# rippled crashes during a transaction, the +# xrpld crashes during a transaction, the # database is likely to be corrupted. # See https://www.sqlite.org/pragma.html#pragma_journal_mode # for more details about the available options. @@ -1130,7 +1130,7 @@ # synchronous Valid values: off, normal, full, extra # The default is "normal", which works well with # the "wal" journal mode. Alternatively, "off" -# allows rippled to continue as soon as data is +# allows xrpld to continue as soon as data is # passed to the OS, which can significantly # increase speed, but risks data corruption if # the host computer crashes before writing that @@ -1144,7 +1144,7 @@ # The default is "file", which will use files # for temporary database tables and indices. # Alternatively, "memory" may save I/O, but -# rippled does not currently use many, if any, +# xrpld does not currently use many, if any, # of these temporary objects. # See https://www.sqlite.org/pragma.html#pragma_temp_store # for more details about the available options. @@ -1173,7 +1173,7 @@ # # These settings are designed to help server administrators diagnose # problems, and obtain detailed information about the activities being -# performed by the rippled process. +# performed by the xrpld process. # # # @@ -1190,7 +1190,7 @@ # # Configuration parameters for the Beast. Insight stats collection module. # -# Insight is a module that collects information from the areas of rippled +# Insight is a module that collects information from the areas of xrpld # that have instrumentation. The configuration parameters control where the # collection metrics are sent. The parameters are expressed as key = value # pairs with no white space. The main parameter is the choice of server: @@ -1199,7 +1199,7 @@ # # Choice of server to send metrics to. Currently the only choice is # "statsd" which sends UDP packets to a StatsD daemon, which must be -# running while rippled is running. More information on StatsD is +# running while xrpld is running. More information on StatsD is # available here: # https://github.com/b/statsd_spec # @@ -1209,7 +1209,7 @@ # in the format, n.n.n.n:port. # # "prefix" A string prepended to each collected metric. This is used -# to distinguish between different running instances of rippled. +# to distinguish between different running instances of xrpld. # # If this section is missing, or the server type is unspecified or unknown, # statistics are not collected or reported. @@ -1236,7 +1236,7 @@ # # Example: # [perf] -# perf_log=/var/log/rippled/perf.log +# perf_log=/var/log/xrpld/perf.log # log_interval=2 # #------------------------------------------------------------------------------- @@ -1246,7 +1246,7 @@ #---------- # # The vote settings configure settings for the entire Ripple network. -# While a single instance of rippled cannot unilaterally enforce network-wide +# While a single instance of xrpld cannot unilaterally enforce network-wide # settings, these choices become part of the instance's vote during the # consensus process for each voting ledger. # @@ -1260,7 +1260,7 @@ # The reference transaction is the simplest form of transaction. # It represents an XRP payment between two parties. # -# If this parameter is unspecified, rippled will use an internal +# If this parameter is unspecified, xrpld will use an internal # default. Don't change this without understanding the consequences. # # Example: @@ -1272,7 +1272,7 @@ # account's XRP balance that is at or below the reserve may only be # spent on transaction fees, and not transferred out of the account. # -# If this parameter is unspecified, rippled will use an internal +# If this parameter is unspecified, xrpld will use an internal # default. Don't change this without understanding the consequences. # # Example: @@ -1284,7 +1284,7 @@ # each ledger item owned by the account. Ledger items an account may # own include trust lines, open orders, and tickets. # -# If this parameter is unspecified, rippled will use an internal +# If this parameter is unspecified, xrpld will use an internal # default. Don't change this without understanding the consequences. # # Example: @@ -1326,7 +1326,7 @@ # tool instead. # # This flag has no effect on the "sign" and "sign_for" command line options -# that rippled makes available. +# that xrpld makes available. # # The default value of this field is "false" # @@ -1405,7 +1405,7 @@ #-------------------- # # Administrators can use these values as a starting point for configuring -# their instance of rippled, but each value should be checked to make sure +# their instance of xrpld, but each value should be checked to make sure # it meets the business requirements for the organization. # # Server @@ -1415,7 +1415,7 @@ # "peer" # # Peer protocol open to everyone. This is required to accept -# incoming rippled connections. This does not affect automatic +# incoming xrpld connections. This does not affect automatic # or manual outgoing Peer protocol connections. # # "rpc" @@ -1432,7 +1432,7 @@ # # ETL commands for Clio. We recommend setting secure_gateway # in this section to a comma-separated list of the addresses -# of your Clio servers, in order to bypass rippled's rate limiting. +# of your Clio servers, in order to bypass xrpld's rate limiting. # # This port is commented out but can be enabled by removing # the '#' from each corresponding line including the entry under [server] @@ -1449,8 +1449,8 @@ # NOTE # # To accept connections on well known ports such as 80 (HTTP) or -# 443 (HTTPS), most operating systems will require rippled to -# run with administrator privileges, or else rippled will not start. +# 443 (HTTPS), most operating systems will require xrpld to +# run with administrator privileges, or else xrpld will not start. [server] port_rpc_admin_local @@ -1496,7 +1496,7 @@ secure_gateway = 127.0.0.1 #------------------------------------------------------------------------------- -# This is primary persistent datastore for rippled. This includes transaction +# This is primary persistent datastore for xrpld. This includes transaction # metadata, account states, and ledger headers. Helpful information can be # found at https://xrpl.org/capacity-planning.html#node-db-type # type=NuDB is recommended for non-validators with fast SSDs. Validators or @@ -1511,19 +1511,19 @@ secure_gateway = 127.0.0.1 # deletion. [node_db] type=NuDB -path=/var/lib/rippled/db/nudb +path=/var/lib/xrpld/db/nudb nudb_block_size=4096 online_delete=512 advisory_delete=0 [database_path] -/var/lib/rippled/db +/var/lib/xrpld/db # This needs to be an absolute directory reference, not a relative one. # Modify this value as required. [debug_logfile] -/var/log/rippled/debug.log +/var/log/xrpld/debug.log # To use the XRP test network # (see https://xrpl.org/connect-your-rippled-to-the-xrp-test-net.html), @@ -1533,7 +1533,7 @@ advisory_delete=0 # File containing trusted validator keys or validator list publishers. # Unless an absolute path is specified, it will be considered relative to the -# folder in which the rippled.cfg file is located. +# folder in which the xrpld.cfg file is located. [validators_file] validators.txt diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index 67aca8f048..310436998d 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -62,7 +62,7 @@ if (is_root_project AND TARGET xrpld) message (\"-- Skipping : \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DEST}/\${NEWNAME}\") endif () endmacro() - copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/rippled-example.cfg\" etc rippled.cfg) + copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/xrpld-example.cfg\" etc xrpld.cfg) copy_if_not_exists(\"${CMAKE_CURRENT_SOURCE_DIR}/cfg/validators-example.txt\" etc validators.txt) ") install(CODE " diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index eb009de433..f8ca779963 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -40,7 +40,7 @@ public: using microseconds = std::chrono::microseconds; /** - * Configuration from [perf] section of rippled.cfg. + * Configuration from [perf] section of xrpld.cfg. */ struct Setup { diff --git a/include/xrpl/nodestore/README.md b/include/xrpl/nodestore/README.md index a5d1128d17..83da29d9ce 100644 --- a/include/xrpl/nodestore/README.md +++ b/include/xrpl/nodestore/README.md @@ -130,7 +130,7 @@ newer versions of RocksDB (TBD). ## Discussion RocksDBQuickFactory is intended to provide a testbed for comparing potential -rocksdb performance with the existing recommended configuration in rippled.cfg. +rocksdb performance with the existing recommended configuration in xrpld.cfg. Through various executions and profiling some conclusions are presented below. - If the write ahead log is enabled, insert speed soon clogs up under load. The diff --git a/src/libxrpl/nodestore/ManagerImp.cpp b/src/libxrpl/nodestore/ManagerImp.cpp index b53d03e668..58accd4108 100644 --- a/src/libxrpl/nodestore/ManagerImp.cpp +++ b/src/libxrpl/nodestore/ManagerImp.cpp @@ -18,8 +18,8 @@ void ManagerImp::missing_backend() { Throw( - "Your rippled.cfg is missing a [node_db] entry, " - "please see the rippled-example.cfg file!"); + "Your xrpld.cfg is missing a [node_db] entry, " + "please see the xrpld-example.cfg file!"); } // We shouldn't rely on global variables for lifetime management because their diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 86f09e6c02..139e8702eb 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -18,7 +19,7 @@ namespace detail { std::string configContents(std::string const& dbPath, std::string const& validatorsFile) { - static boost::format configContentsTemplate(R"rippleConfig( + static boost::format configContentsTemplate(R"xrpldConfig( [server] port_rpc port_peer @@ -51,14 +52,14 @@ protocol = wss [node_size] medium -# This is primary persistent datastore for rippled. This includes transaction +# This is primary persistent datastore for xrpld. This includes transaction # metadata, account states, and ledger headers. Helpful information can be # found on https://xrpl.org/capacity-planning.html#node-db-type # delete old ledgers while maintaining at least 2000. Do not require an # external administrative command to initiate deletion. [node_db] type=memory -path=/Users/dummy/ripple/config/db/rocksdb +path=/Users/dummy/xrpld/config/db/rocksdb open_files=2000 filter_bits=12 cache_mb=256 @@ -72,7 +73,7 @@ file_size_mult=2 # This needs to be an absolute directory reference, not a relative one. # Modify this value as required. [debug_logfile] -/Users/dummy/ripple/config/log/debug.log +/Users/dummy/xrpld/config/log/debug.log [sntp_servers] time.windows.com @@ -97,7 +98,7 @@ r.ripple.com 51235 [sqdb] backend=sqlite -)rippleConfig"); +)xrpldConfig"); std::string dbPathSection = dbPath.empty() ? "" : "[database_path]\n" + dbPath; @@ -107,9 +108,9 @@ backend=sqlite } /** - Write a rippled config file and remove when done. + Write a xrpld config file and remove when done. */ -class RippledCfgGuard : public xrpl::detail::FileDirGuard +class FileCfgGuard : public xrpl::detail::FileDirGuard { private: path dataDir_; @@ -119,17 +120,18 @@ private: Config config_; public: - RippledCfgGuard( + FileCfgGuard( beast::unit_test::suite& test, path subDir, path const& dbPath, + path const& configFile, path const& validatorsFile, bool useCounter = true, std::string confContents = "") : FileDirGuard( test, std::move(subDir), - path(Config::configFileName), + configFile, confContents.empty() ? configContents(dbPath.string(), validatorsFile.string()) : confContents, @@ -171,7 +173,7 @@ public: return fileExists(); } - ~RippledCfgGuard() + ~FileCfgGuard() { try { @@ -182,7 +184,7 @@ public: catch (std::exception& e) { // if we throw here, just let it die. - test_.log << "Error in ~RippledCfgGuard: " << e.what() << std::endl; + test_.log << "Error in ~FileCfgGuard: " << e.what() << std::endl; }; } }; @@ -190,7 +192,7 @@ public: std::string valFileContents() { - std::string configContents(R"rippleConfig( + std::string configContents(R"xrpldConfig( [validators] n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj @@ -204,8 +206,8 @@ nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8 nHUPDdcdb2Y5DZAJne4c2iabFuAP3F34xZUgYQT2NH7qfkdapgnz [validator_list_sites] -recommendedripplevalidators.com -moreripplevalidators.net +recommendedxrplvalidators.com +morexrplvalidators.net [validator_list_keys] 03E74EE14CB525AFBB9F1B7D86CD58ECC4B91452294B42AB4E78F260BD905C091D @@ -213,7 +215,7 @@ moreripplevalidators.net [validator_list_threshold] 2 -)rippleConfig"); +)xrpldConfig"); return configContents; } @@ -270,7 +272,7 @@ public: Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [server] port_rpc port_peer @@ -278,7 +280,7 @@ port_wss_admin [ssl_verify] 0 -)rippleConfig"); +)xrpldConfig"); c.loadFromString(toLoad); @@ -291,6 +293,126 @@ port_wss_admin BEAST_EXPECT(c.legacy("not_in_file") == "new_value"); } void + testConfigFile() + { + testcase("config_file"); + + using namespace boost::filesystem; + auto const cwd = current_path(); + + // Test both config file names. + char const* configFiles[] = { + Config::configFileName, Config::configLegacyName}; + + // Config file in current directory. + for (auto const& configFile : configFiles) + { + // Use a temporary directory for testing. + beast::temp_dir td; + current_path(td.path()); + path const f = td.file(configFile); + std::ofstream o(f.string()); + o << detail::configContents("", ""); + o.close(); + + // Load the config file from the current directory and verify it. + Config c; + c.setup("", true, false, true); + BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values().size() == 1); + BEAST_EXPECT( + c.section(SECTION_DEBUG_LOGFILE).values()[0] == + "/Users/dummy/xrpld/config/log/debug.log"); + } + + // Config file in HOME or XDG_CONFIG_HOME directory. +#if BOOST_OS_LINUX || BOOST_OS_MACOS + for (auto const& configFile : configFiles) + { + // Point the current working directory to a temporary directory, so + // we don't pick up an actual config file from the repository root. + beast::temp_dir td; + current_path(td.path()); + + // The XDG config directory is set: the config file must be in a + // subdirectory named after the system. + { + beast::temp_dir tc; + + // Set the HOME and XDG_CONFIG_HOME environment variables. The + // HOME variable is not used when XDG_CONFIG_HOME is set, but + // must be set. + char const* h = getenv("HOME"); + setenv("HOME", tc.path().c_str(), 1); + char const* x = getenv("XDG_CONFIG_HOME"); + setenv("XDG_CONFIG_HOME", tc.path().c_str(), 1); + + // Create the config file in '${XDG_CONFIG_HOME}/[systemName]'. + path p = tc.file(systemName()); + create_directory(p); + p = tc.file(systemName() + "/" + configFile); + std::ofstream o(p.string()); + o << detail::configContents("", ""); + o.close(); + + // Load the config file from the config directory and verify it. + Config c; + c.setup("", true, false, true); + BEAST_EXPECT( + c.section(SECTION_DEBUG_LOGFILE).values().size() == 1); + BEAST_EXPECT( + c.section(SECTION_DEBUG_LOGFILE).values()[0] == + "/Users/dummy/xrpld/config/log/debug.log"); + + // Restore the environment variables. + h ? setenv("HOME", h, 1) : unsetenv("HOME"); + x ? setenv("XDG_CONFIG_HOME", x, 1) + : unsetenv("XDG_CONFIG_HOME"); + } + + // The XDG config directory is not set: the config file must be in a + // subdirectory named .config followed by the system name. + { + beast::temp_dir tc; + + // Set only the HOME environment variable. + char const* h = getenv("HOME"); + setenv("HOME", tc.path().c_str(), 1); + char const* x = getenv("XDG_CONFIG_HOME"); + unsetenv("XDG_CONFIG_HOME"); + + // Create the config file in '${HOME}/.config/[systemName]'. + std::string s = ".config"; + path p = tc.file(s); + create_directory(p); + s += "/" + systemName(); + p = tc.file(s); + create_directory(p); + p = tc.file(s + "/" + configFile); + std::ofstream o(p.string()); + o << detail::configContents("", ""); + o.close(); + + // Load the config file from the config directory and verify it. + Config c; + c.setup("", true, false, true); + BEAST_EXPECT( + c.section(SECTION_DEBUG_LOGFILE).values().size() == 1); + BEAST_EXPECT( + c.section(SECTION_DEBUG_LOGFILE).values()[0] == + "/Users/dummy/xrpld/config/log/debug.log"); + + // Restore the environment variables. + h ? setenv("HOME", h, 1) : unsetenv("HOME"); + if (x) + setenv("XDG_CONFIG_HOME", x, 1); + } + } +#endif + + // Restore the current working directory. + current_path(cwd); + } + void testDbPath() { testcase("database_path"); @@ -326,11 +448,16 @@ port_wss_admin { // read from file absolute path auto const cwd = current_path(); - xrpl::detail::DirGuard const g0(*this, "test_db"); + detail::DirGuard const g0(*this, "test_db"); path const dataDirRel("test_data_dir"); path const dataDirAbs(cwd / g0.subdir() / dataDirRel); - detail::RippledCfgGuard const g( - *this, g0.subdir(), dataDirAbs, "", false); + detail::FileCfgGuard const g( + *this, + g0.subdir(), + dataDirAbs, + Config::configFileName, + "", + false); auto const& c(g.config()); BEAST_EXPECT(g.dataDirExists()); BEAST_EXPECT(g.configFileExists()); @@ -339,7 +466,8 @@ port_wss_admin { // read from file relative path std::string const dbPath("my_db"); - detail::RippledCfgGuard const g(*this, "test_db", dbPath, ""); + detail::FileCfgGuard const g( + *this, "test_db", dbPath, Config::configFileName, ""); auto const& c(g.config()); std::string const nativeDbPath = absolute(path(dbPath)).string(); BEAST_EXPECT(g.dataDirExists()); @@ -348,7 +476,8 @@ port_wss_admin } { // read from file no path - detail::RippledCfgGuard const g(*this, "test_db", "", ""); + detail::FileCfgGuard const g( + *this, "test_db", "", Config::configFileName, ""); auto const& c(g.config()); std::string const nativeDbPath = absolute(g.subdir() / path(Config::databaseDirName)).string(); @@ -378,13 +507,13 @@ port_wss_admin { Config c; - static boost::format configTemplate(R"rippleConfig( + static boost::format configTemplate(R"xrpldConfig( [validation_seed] %1% [validator_token] %2% -)rippleConfig"); +)xrpldConfig"); std::string error; auto const expectedError = "Cannot have both [validation_seed] " @@ -410,10 +539,10 @@ port_wss_admin Config c; try { - c.loadFromString(R"rippleConfig( + c.loadFromString(R"xrpldConfig( [network_id] main -)rippleConfig"); +)xrpldConfig"); } catch (std::runtime_error& e) { @@ -425,8 +554,8 @@ main try { - c.loadFromString(R"rippleConfig( -)rippleConfig"); + c.loadFromString(R"xrpldConfig( +)xrpldConfig"); } catch (std::runtime_error& e) { @@ -438,10 +567,10 @@ main try { - c.loadFromString(R"rippleConfig( + c.loadFromString(R"xrpldConfig( [network_id] 255 -)rippleConfig"); +)xrpldConfig"); } catch (std::runtime_error& e) { @@ -453,10 +582,10 @@ main try { - c.loadFromString(R"rippleConfig( + c.loadFromString(R"xrpldConfig( [network_id] 10000 -)rippleConfig"); +)xrpldConfig"); } catch (std::runtime_error& e) { @@ -516,7 +645,7 @@ main { // load validators from config into single section Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validators] n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj @@ -525,7 +654,7 @@ n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C [validator_keys] nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5 nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8 -)rippleConfig"); +)xrpldConfig"); c.loadFromString(toLoad); BEAST_EXPECT(c.legacy("validators_file").empty()); BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 5); @@ -534,9 +663,9 @@ nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8 { // load validator list sites and keys from config Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] @@ -544,13 +673,13 @@ trustthesevalidators.gov [validator_list_threshold] 1 -)rippleConfig"); +)xrpldConfig"); c.loadFromString(toLoad); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == - "ripplevalidators.com"); + "xrplvalidators.com"); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov"); @@ -570,9 +699,9 @@ trustthesevalidators.gov { // load validator list sites and keys from config Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] @@ -580,13 +709,13 @@ trustthesevalidators.gov [validator_list_threshold] 0 -)rippleConfig"); +)xrpldConfig"); c.loadFromString(toLoad); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == - "ripplevalidators.com"); + "xrplvalidators.com"); BEAST_EXPECT( c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov"); @@ -607,9 +736,9 @@ trustthesevalidators.gov // load should throw if [validator_list_threshold] is greater than // the number of [validator_list_keys] Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] @@ -617,7 +746,7 @@ trustthesevalidators.gov [validator_list_threshold] 2 -)rippleConfig"); +)xrpldConfig"); std::string error; auto const expectedError = "Value in config section [validator_list_threshold] exceeds " @@ -636,9 +765,9 @@ trustthesevalidators.gov { // load should throw if [validator_list_threshold] is malformed Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] @@ -646,7 +775,7 @@ trustthesevalidators.gov [validator_list_threshold] value = 2 -)rippleConfig"); +)xrpldConfig"); std::string error; auto const expectedError = "Config section [validator_list_threshold] should contain " @@ -665,9 +794,9 @@ value = 2 { // load should throw if [validator_list_threshold] is negative Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] @@ -675,7 +804,7 @@ trustthesevalidators.gov [validator_list_threshold] -1 -)rippleConfig"); +)xrpldConfig"); bool error = false; try { @@ -692,11 +821,11 @@ trustthesevalidators.gov // load should throw if [validator_list_sites] is configured but // [validator_list_keys] is not Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov -)rippleConfig"); +)xrpldConfig"); std::string error; auto const expectedError = "[validator_list_keys] config section is missing"; @@ -736,8 +865,13 @@ trustthesevalidators.gov std::string const valFileName = "validators.txt"; detail::ValidatorsTxtGuard const vtg( *this, "test_cfg", valFileName); - detail::RippledCfgGuard const rcg( - *this, vtg.subdir(), "", valFileName, false); + detail::FileCfgGuard const rcg( + *this, + vtg.subdir(), + "", + Config::configFileName, + valFileName, + false); BEAST_EXPECT(vtg.validatorsFileExists()); BEAST_EXPECT(rcg.configFileExists()); auto const& c(rcg.config()); @@ -758,8 +892,13 @@ trustthesevalidators.gov detail::ValidatorsTxtGuard const vtg( *this, "test_cfg", "validators.txt"); auto const valFilePath = ".." / vtg.subdir() / "validators.txt"; - detail::RippledCfgGuard const rcg( - *this, vtg.subdir(), "", valFilePath, false); + detail::FileCfgGuard const rcg( + *this, + vtg.subdir(), + "", + Config::configFileName, + valFilePath, + false); BEAST_EXPECT(vtg.validatorsFileExists()); BEAST_EXPECT(rcg.configFileExists()); auto const& c(rcg.config()); @@ -778,8 +917,8 @@ trustthesevalidators.gov // load from validators file in default location detail::ValidatorsTxtGuard const vtg( *this, "test_cfg", "validators.txt"); - detail::RippledCfgGuard const rcg( - *this, vtg.subdir(), "", "", false); + detail::FileCfgGuard const rcg( + *this, vtg.subdir(), "", Config::configFileName, "", false); BEAST_EXPECT(vtg.validatorsFileExists()); BEAST_EXPECT(rcg.configFileExists()); auto const& c(rcg.config()); @@ -803,8 +942,13 @@ trustthesevalidators.gov detail::ValidatorsTxtGuard const vtgDefault( *this, vtg.subdir(), "validators.txt", false); BEAST_EXPECT(vtgDefault.validatorsFileExists()); - detail::RippledCfgGuard const rcg( - *this, vtg.subdir(), "", vtg.validatorsFile(), false); + detail::FileCfgGuard const rcg( + *this, + vtg.subdir(), + "", + Config::configFileName, + vtg.validatorsFile(), + false); BEAST_EXPECT(rcg.configFileExists()); auto const& c(rcg.config()); BEAST_EXPECT(c.legacy("validators_file") == vtg.validatorsFile()); @@ -821,7 +965,7 @@ trustthesevalidators.gov { // load validators from both config and validators file - boost::format cc(R"rippleConfig( + boost::format cc(R"xrpldConfig( [validators_file] %1% @@ -837,12 +981,12 @@ nHB1X37qrniVugfQcuBTAjswphC1drx7QjFFojJPZwKHHnt8kU7v nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB [validator_list_sites] -ripplevalidators.com +xrplvalidators.com trustthesevalidators.gov [validator_list_keys] 021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566 -)rippleConfig"); +)xrpldConfig"); detail::ValidatorsTxtGuard const vtg( *this, "test_cfg", "validators.cfg"); BEAST_EXPECT(vtg.validatorsFileExists()); @@ -861,14 +1005,14 @@ trustthesevalidators.gov } { // load should throw if [validator_list_threshold] is present both - // in rippled cfg and validators file - boost::format cc(R"rippleConfig( + // in xrpld.cfg and validators file + boost::format cc(R"xrpldConfig( [validators_file] %1% [validator_list_threshold] 1 -)rippleConfig"); +)xrpldConfig"); std::string error; detail::ValidatorsTxtGuard const vtg( *this, "test_cfg", "validators.cfg"); @@ -890,7 +1034,7 @@ trustthesevalidators.gov } { // load should throw if [validators], [validator_keys] and - // [validator_list_keys] are missing from rippled cfg and + // [validator_list_keys] are missing from xrpld.cfg and // validators file Config c; boost::format cc("[validators_file]\n%1%\n"); @@ -920,9 +1064,13 @@ trustthesevalidators.gov void testSetup(bool explicitPath) { - detail::RippledCfgGuard const cfg( - *this, "testSetup", explicitPath ? "test_db" : "", ""); - /* RippledCfgGuard has a Config object that gets loaded on + detail::FileCfgGuard const cfg( + *this, + "testSetup", + explicitPath ? "test_db" : "", + Config::configFileName, + ""); + /* FileCfgGuard has a Config object that gets loaded on construction, but Config::setup is not reentrant, so we need a fresh config for every test case, so ignore it. */ @@ -1039,7 +1187,8 @@ trustthesevalidators.gov void testPort() { - detail::RippledCfgGuard const cfg(*this, "testPort", "", ""); + detail::FileCfgGuard const cfg( + *this, "testPort", "", Config::configFileName, ""); auto const& conf = cfg.config(); if (!BEAST_EXPECT(conf.exists("port_rpc"))) return; @@ -1065,8 +1214,14 @@ trustthesevalidators.gov try { - detail::RippledCfgGuard const cfg( - *this, "testPort", "", "", true, contents); + detail::FileCfgGuard const cfg( + *this, + "testPort", + "", + Config::configFileName, + "", + true, + contents); BEAST_EXPECT(false); } catch (std::exception const& ex) @@ -1377,9 +1532,9 @@ r.ripple.com:51235 for (auto& [unit, sec, val, shouldPass] : units) { Config c; - std::string toLoad(R"rippleConfig( + std::string toLoad(R"xrpldConfig( [amendment_majority_time] -)rippleConfig"); +)xrpldConfig"); toLoad += std::to_string(val) + space + unit; space = space == "" ? " " : ""; @@ -1480,6 +1635,7 @@ r.ripple.com:51235 run() override { testLegacy(); + testConfigFile(); testDbPath(); testValidatorKeys(); testValidatorsFile(); diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index e5a7435b0a..aed2343a49 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -87,7 +87,7 @@ private: /// If the node is out of sync during an online_delete healthWait() /// call, sleep the thread for this time, and continue checking until /// recovery. - /// See also: "recovery_wait_seconds" in rippled-example.cfg + /// See also: "recovery_wait_seconds" in xrpld-example.cfg std::chrono::seconds recoveryWaitTime_{5}; // these do not exist upon SHAMapStore creation, but do exist diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index cfd260787c..e25148aaa9 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -68,6 +68,7 @@ class Config : public BasicConfig public: // Settings related to the configuration file location and directories static char const* const configFileName; + static char const* const configLegacyName; static char const* const databaseDirName; static char const* const validatorsFileName; diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index e6c61e1471..1eb8d5984e 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -221,11 +221,12 @@ getSingleSection( //------------------------------------------------------------------------------ // -// Config (DEPRECATED) +// Config // //------------------------------------------------------------------------------ -char const* const Config::configFileName = "rippled.cfg"; +char const* const Config::configFileName = "xrpld.cfg"; +char const* const Config::configLegacyName = "rippled.cfg"; char const* const Config::databaseDirName = "db"; char const* const Config::validatorsFileName = "validators.txt"; @@ -295,76 +296,78 @@ Config::setup( bool bSilent, bool bStandalone) { - boost::filesystem::path dataDir; - std::string strDbPath, strConfFile; + setupControl(bQuiet, bSilent, bStandalone); // Determine the config and data directories. // If the config file is found in the current working // directory, use the current working directory as the // config directory and that with "db" as the data // directory. - - setupControl(bQuiet, bSilent, bStandalone); - - strDbPath = databaseDirName; - - if (!strConf.empty()) - strConfFile = strConf; - else - strConfFile = configFileName; + boost::filesystem::path dataDir; if (!strConf.empty()) { // --conf= : everything is relative that file. - CONFIG_FILE = strConfFile; + CONFIG_FILE = strConf; CONFIG_DIR = boost::filesystem::absolute(CONFIG_FILE); CONFIG_DIR.remove_filename(); - dataDir = CONFIG_DIR / strDbPath; + dataDir = CONFIG_DIR / databaseDirName; } else { - CONFIG_DIR = boost::filesystem::current_path(); - CONFIG_FILE = CONFIG_DIR / strConfFile; - dataDir = CONFIG_DIR / strDbPath; - - // Construct XDG config and data home. - // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - auto const strHome = getEnvVar("HOME"); - auto strXdgConfigHome = getEnvVar("XDG_CONFIG_HOME"); - auto strXdgDataHome = getEnvVar("XDG_DATA_HOME"); - - if (boost::filesystem::exists(CONFIG_FILE) - // Can we figure out XDG dirs? - || (strHome.empty() && - (strXdgConfigHome.empty() || strXdgDataHome.empty()))) + do { - // Current working directory is fine, put dbs in a subdir. - } - else - { - if (strXdgConfigHome.empty()) + // Check if either of the config files exist in the current working + // directory, in which case the databases will be stored in a + // subdirectory. + CONFIG_DIR = boost::filesystem::current_path(); + dataDir = CONFIG_DIR / databaseDirName; + CONFIG_FILE = CONFIG_DIR / configFileName; + if (boost::filesystem::exists(CONFIG_FILE)) + break; + CONFIG_FILE = CONFIG_DIR / configLegacyName; + if (boost::filesystem::exists(CONFIG_FILE)) + break; + + // Check if the home directory is set, and optionally the XDG config + // and/or data directories, as the config may be there. See + // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html. + auto const strHome = getEnvVar("HOME"); + if (!strHome.empty()) { - // $XDG_CONFIG_HOME was not set, use default based on $HOME. - strXdgConfigHome = strHome + "/.config"; + auto strXdgConfigHome = getEnvVar("XDG_CONFIG_HOME"); + auto strXdgDataHome = getEnvVar("XDG_DATA_HOME"); + if (strXdgConfigHome.empty()) + { + // $XDG_CONFIG_HOME was not set, use default based on $HOME. + strXdgConfigHome = strHome + "/.config"; + } + if (strXdgDataHome.empty()) + { + // $XDG_DATA_HOME was not set, use default based on $HOME. + strXdgDataHome = strHome + "/.local/share"; + } + + // Check if either of the config files exist in the XDG config + // dir. + dataDir = strXdgDataHome + "/" + systemName(); + CONFIG_DIR = strXdgConfigHome + "/" + systemName(); + CONFIG_FILE = CONFIG_DIR / configFileName; + if (boost::filesystem::exists(CONFIG_FILE)) + break; + CONFIG_FILE = CONFIG_DIR / configLegacyName; + if (boost::filesystem::exists(CONFIG_FILE)) + break; } - if (strXdgDataHome.empty()) - { - // $XDG_DATA_HOME was not set, use default based on $HOME. - strXdgDataHome = strHome + "/.local/share"; - } - - CONFIG_DIR = strXdgConfigHome + "/" + systemName(); - CONFIG_FILE = CONFIG_DIR / strConfFile; - dataDir = strXdgDataHome + "/" + systemName(); - - if (!boost::filesystem::exists(CONFIG_FILE)) - { - CONFIG_DIR = "/etc/opt/" + systemName(); - CONFIG_FILE = CONFIG_DIR / strConfFile; - dataDir = "/var/opt/" + systemName(); - } - } + // As a last resort, check the system config directory. + dataDir = "/var/opt/" + systemName(); + CONFIG_DIR = "/etc/opt/" + systemName(); + CONFIG_FILE = CONFIG_DIR / configFileName; + if (boost::filesystem::exists(CONFIG_FILE)) + break; + CONFIG_FILE = CONFIG_DIR / configLegacyName; + } while (false); } // Update default values @@ -374,11 +377,9 @@ Config::setup( std::string const dbPath(legacy("database_path")); if (!dbPath.empty()) dataDir = boost::filesystem::path(dbPath); - else if (RUN_STANDALONE) - dataDir.clear(); } - if (!dataDir.empty()) + if (!RUN_STANDALONE) { boost::system::error_code ec; boost::filesystem::create_directories(dataDir, ec); diff --git a/src/xrpld/overlay/README.md b/src/xrpld/overlay/README.md index cd00488915..51eb96a001 100644 --- a/src/xrpld/overlay/README.md +++ b/src/xrpld/overlay/README.md @@ -373,7 +373,7 @@ command. The key is in the `pubkey_node` value, and is a text string beginning with the letter `n`. The key is maintained across runs in a database. -Cluster members are configured in the `rippled.cfg` file under +Cluster members are configured in the `xrpld.cfg` file under `[cluster_nodes]`. Each member should be configured on a line beginning with the node public key, followed optionally by a space and a friendly name. diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index e5f77021d7..7cd02c72e0 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -514,7 +514,7 @@ OverlayImpl::start() m_peerFinder->addFallbackStrings(base + name, ips); }); - // Add the ips_fixed from the rippled.cfg file + // Add the ips_fixed from the xrpld.cfg file if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty()) { m_resolver.resolve( From 44d21b8f6daf87b286473686c5e75b7b513c7db2 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Mon, 5 Jan 2026 10:54:24 -0500 Subject: [PATCH 17/62] test: add more tests for `ledger_entry` RPC (#5858) This change adds some basic tests for all the `ledger_entry` helper functions, so each ledger entry type is covered. There are further some minor refactors in `parseAMM` to provide better error messages. Finally, to improve readability, alphabetization was applied in the helper functions. --- src/test/rpc/LedgerEntry_test.cpp | 482 +++++++++++++++++--- src/xrpld/rpc/handlers/LedgerEntry.cpp | 23 +- src/xrpld/rpc/handlers/LedgerEntryHelpers.h | 23 + 3 files changed, 447 insertions(+), 81 deletions(-) diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index ef5abdd800..551e67dc5e 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -30,6 +30,7 @@ enum class FieldType { CurrencyField, HashField, HashOrObjectField, + IssueField, ObjectField, StringField, TwoAccountArrayField, @@ -40,6 +41,8 @@ enum class FieldType { std::vector> mappings{ {jss::account, FieldType::AccountField}, {jss::accounts, FieldType::TwoAccountArrayField}, + {jss::asset, FieldType::IssueField}, + {jss::asset2, FieldType::IssueField}, {jss::authorize, FieldType::AccountField}, {jss::authorized, FieldType::AccountField}, {jss::credential_type, FieldType::BlobField}, @@ -74,24 +77,26 @@ getTypeName(FieldType typeID) { switch (typeID) { - case FieldType::UInt32Field: - return "number"; - case FieldType::UInt64Field: - return "number"; - case FieldType::HashField: - return "hex string"; case FieldType::AccountField: return "AccountID"; + case FieldType::ArrayField: + return "array"; case FieldType::BlobField: return "hex string"; case FieldType::CurrencyField: return "Currency"; - case FieldType::ArrayField: - return "array"; + case FieldType::HashField: + return "hex string"; case FieldType::HashOrObjectField: return "hex string or object"; + case FieldType::IssueField: + return "Issue"; case FieldType::TwoAccountArrayField: return "length-2 array of Accounts"; + case FieldType::UInt32Field: + return "number"; + case FieldType::UInt64Field: + return "number"; default: Throw( "unknown type " + std::to_string(static_cast(typeID))); @@ -192,34 +197,37 @@ class LedgerEntry_test : public beast::unit_test::suite return values; }; - static auto const& badUInt32Values = remove({2, 3}); - static auto const& badUInt64Values = remove({2, 3}); - static auto const& badHashValues = remove({2, 3, 7, 8, 16}); static auto const& badAccountValues = remove({12}); + static auto const& badArrayValues = remove({17, 20}); static auto const& badBlobValues = remove({3, 7, 8, 16}); static auto const& badCurrencyValues = remove({14}); - static auto const& badArrayValues = remove({17, 20}); + static auto const& badHashValues = remove({2, 3, 7, 8, 16}); static auto const& badIndexValues = remove({12, 16, 18, 19}); + static auto const& badUInt32Values = remove({2, 3}); + static auto const& badUInt64Values = remove({2, 3}); + static auto const& badIssueValues = remove({}); switch (fieldType) { - case FieldType::UInt32Field: - return badUInt32Values; - case FieldType::UInt64Field: - return badUInt64Values; - case FieldType::HashField: - return badHashValues; case FieldType::AccountField: return badAccountValues; + case FieldType::ArrayField: + case FieldType::TwoAccountArrayField: + return badArrayValues; case FieldType::BlobField: return badBlobValues; case FieldType::CurrencyField: return badCurrencyValues; - case FieldType::ArrayField: - case FieldType::TwoAccountArrayField: - return badArrayValues; + case FieldType::HashField: + return badHashValues; case FieldType::HashOrObjectField: return badIndexValues; + case FieldType::IssueField: + return badIssueValues; + case FieldType::UInt32Field: + return badUInt32Values; + case FieldType::UInt64Field: + return badUInt64Values; default: Throw( "unknown type " + @@ -236,30 +244,37 @@ class LedgerEntry_test : public beast::unit_test::suite arr[1u] = "r4MrUGTdB57duTnRs6KbsRGQXgkseGb1b5"; return arr; }(); + static Json::Value const issueObject = []() { + Json::Value arr(Json::objectValue); + arr[jss::currency] = "XRP"; + return arr; + }(); auto const typeID = getFieldType(fieldName); switch (typeID) { - case FieldType::UInt32Field: - return 1; - case FieldType::UInt64Field: - return 1; - case FieldType::HashField: - return "5233D68B4D44388F98559DE42903767803EFA7C1F8D01413FC16EE6" - "B01403D6D"; case FieldType::AccountField: return "r4MrUGTdB57duTnRs6KbsRGQXgkseGb1b5"; + case FieldType::ArrayField: + return Json::arrayValue; case FieldType::BlobField: return "ABCDEF"; case FieldType::CurrencyField: return "USD"; - case FieldType::ArrayField: - return Json::arrayValue; + case FieldType::HashField: + return "5233D68B4D44388F98559DE42903767803EFA7C1F8D01413FC16EE6" + "B01403D6D"; + case FieldType::IssueField: + return issueObject; case FieldType::HashOrObjectField: return "5233D68B4D44388F98559DE42903767803EFA7C1F8D01413FC16EE6" "B01403D6D"; case FieldType::TwoAccountArrayField: return twoAccountArray; + case FieldType::UInt32Field: + return 1; + case FieldType::UInt64Field: + return 1; default: Throw( "unknown type " + @@ -444,7 +459,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryInvalid() + testInvalid() { testcase("Invalid requests"); using namespace test::jtx; @@ -526,7 +541,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryAccountRoot() + testAccountRoot() { testcase("AccountRoot"); using namespace test::jtx; @@ -632,7 +647,147 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryCheck() + testAmendments() + { + testcase("Amendments"); + using namespace test::jtx; + Env env{*this}; + + // positive test + { + Keylet const keylet = keylet::amendments(); + + // easier to hack an object into the ledger than generate it + // legitimately + { + auto const amendments = [&](OpenView& view, + beast::Journal) -> bool { + auto const sle = std::make_shared(keylet); + + // Create Amendments vector (enabled amendments) + std::vector enabledAmendments; + enabledAmendments.push_back( + uint256::fromVoid("42426C4D4F1009EE67080A9B7965B44656D7" + "714D104A72F9B4369F97ABF044EE")); + enabledAmendments.push_back( + uint256::fromVoid("4C97EBA926031A7CF7D7B36FDE3ED66DDA54" + "21192D63DE53FFB46E43B9DC8373")); + enabledAmendments.push_back( + uint256::fromVoid("03BDC0099C4E14163ADA272C1B6F6FABB448" + "CC3E51F522F978041E4B57D9158C")); + enabledAmendments.push_back( + uint256::fromVoid("35291ADD2D79EB6991343BDA0912269C817D" + "0F094B02226C1C14AD2858962ED4")); + sle->setFieldV256( + sfAmendments, STVector256(enabledAmendments)); + + // Create Majorities array + STArray majorities; + + auto majority1 = STObject::makeInnerObject(sfMajority); + majority1.setFieldH256( + sfAmendment, + uint256::fromVoid("7BB62DC13EC72B775091E9C71BF8CF97E122" + "647693B50C5E87A80DFD6FCFAC50")); + majority1.setFieldU32(sfCloseTime, 779561310); + majorities.push_back(std::move(majority1)); + + auto majority2 = STObject::makeInnerObject(sfMajority); + majority2.setFieldH256( + sfAmendment, + uint256::fromVoid("755C971C29971C9F20C6F080F2ED96F87884" + "E40AD19554A5EBECDCEC8A1F77FE")); + majority2.setFieldU32(sfCloseTime, 779561310); + majorities.push_back(std::move(majority2)); + + sle->setFieldArray(sfMajorities, majorities); + + view.rawInsert(sle); + return true; + }; + env.app().openLedger().modify(amendments); + } + + Json::Value jvParams; + jvParams[jss::amendments] = to_string(keylet.key); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == jss::Amendments); + } + + // negative tests + runLedgerEntryTest(env, jss::amendments); + } + + void + testAMM() + { + testcase("AMM"); + using namespace test::jtx; + Env env{*this}; + + // positive test + Account const alice{"alice"}; + env.fund(XRP(10000), alice); + env.close(); + AMM amm(env, alice, XRP(10), alice["USD"](1000)); + env.close(); + + { + Json::Value jvParams; + jvParams[jss::amm] = to_string(amm.ammID()); + auto const result = + env.rpc("json", "ledger_entry", to_string(jvParams)); + BEAST_EXPECT( + result.isObject() && result.isMember(jss::result) && + !result[jss::result].isMember(jss::error) && + result[jss::result].isMember(jss::node) && + result[jss::result][jss::node].isMember( + sfLedgerEntryType.jsonName) && + result[jss::result][jss::node][sfLedgerEntryType.jsonName] == + jss::AMM); + } + + { + Json::Value jvParams; + Json::Value ammParams(Json::objectValue); + { + Json::Value obj(Json::objectValue); + obj[jss::currency] = "XRP"; + ammParams[jss::asset] = obj; + } + { + Json::Value obj(Json::objectValue); + obj[jss::currency] = "USD"; + obj[jss::issuer] = alice.human(); + ammParams[jss::asset2] = obj; + } + jvParams[jss::amm] = ammParams; + auto const result = + env.rpc("json", "ledger_entry", to_string(jvParams)); + BEAST_EXPECT( + result.isObject() && result.isMember(jss::result) && + !result[jss::result].isMember(jss::error) && + result[jss::result].isMember(jss::node) && + result[jss::result][jss::node].isMember( + sfLedgerEntryType.jsonName) && + result[jss::result][jss::node][sfLedgerEntryType.jsonName] == + jss::AMM); + } + + // negative tests + runLedgerEntryTest( + env, + jss::amm, + { + {jss::asset, "malformedRequest"}, + {jss::asset2, "malformedRequest"}, + }); + } + + void + testCheck() { testcase("Check"); using namespace test::jtx; @@ -684,7 +839,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryCredentials() + testCredentials() { testcase("Credentials"); @@ -752,7 +907,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryDelegate() + testDelegate() { testcase("Delegate"); @@ -807,7 +962,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryDepositPreauth() + testDepositPreauth() { testcase("Deposit Preauth"); @@ -868,7 +1023,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryDepositPreauthCred() + testDepositPreauthCred() { testcase("Deposit Preauth with credentials"); @@ -1149,7 +1304,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryDirectory() + testDirectory() { testcase("Directory"); using namespace test::jtx; @@ -1303,7 +1458,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryEscrow() + testEscrow() { testcase("Escrow"); using namespace test::jtx; @@ -1365,7 +1520,177 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryOffer() + testFeeSettings() + { + testcase("Fee Settings"); + using namespace test::jtx; + Env env{*this}; + + // positive test + { + Keylet const keylet = keylet::fees(); + Json::Value jvParams; + jvParams[jss::fee] = to_string(keylet.key); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == jss::FeeSettings); + } + + // negative tests + runLedgerEntryTest(env, jss::fee); + } + + void + testLedgerHashes() + { + testcase("Ledger Hashes"); + using namespace test::jtx; + Env env{*this}; + + // positive test + { + Keylet const keylet = keylet::skip(); + Json::Value jvParams; + jvParams[jss::hashes] = to_string(keylet.key); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == + jss::LedgerHashes); + } + + // negative tests + runLedgerEntryTest(env, jss::hashes); + } + + void + testNFTokenOffer() + { + testcase("NFT Offer"); + using namespace test::jtx; + Env env{*this}; + + // positive test + Account const issuer{"issuer"}; + Account const buyer{"buyer"}; + env.fund(XRP(1000), issuer, buyer); + + uint256 const nftokenID0 = + token::getNextID(env, issuer, 0, tfTransferable); + env(token::mint(issuer, 0), txflags(tfTransferable)); + env.close(); + uint256 const offerID = keylet::nftoffer(issuer, env.seq(issuer)).key; + env(token::createOffer(issuer, nftokenID0, drops(1)), + token::destination(buyer), + txflags(tfSellNFToken)); + + { + Json::Value jvParams; + jvParams[jss::nft_offer] = to_string(offerID); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == + jss::NFTokenOffer); + BEAST_EXPECT(jrr[jss::node][sfOwner.jsonName] == issuer.human()); + BEAST_EXPECT( + jrr[jss::node][sfNFTokenID.jsonName] == to_string(nftokenID0)); + BEAST_EXPECT(jrr[jss::node][sfAmount.jsonName] == "1"); + } + + // negative tests + runLedgerEntryTest(env, jss::nft_offer); + } + + void + testNFTokenPage() + { + testcase("NFT Page"); + using namespace test::jtx; + Env env{*this}; + + // positive test + Account const issuer{"issuer"}; + env.fund(XRP(1000), issuer); + + env(token::mint(issuer, 0), txflags(tfTransferable)); + env.close(); + + auto const nftpage = keylet::nftpage_max(issuer); + BEAST_EXPECT(env.le(nftpage) != nullptr); + + { + Json::Value jvParams; + jvParams[jss::nft_page] = to_string(nftpage.key); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == jss::NFTokenPage); + } + + // negative tests + runLedgerEntryTest(env, jss::nft_page); + } + + void + testNegativeUNL() + { + testcase("Negative UNL"); + using namespace test::jtx; + Env env{*this}; + + // positive test + { + Keylet const keylet = keylet::negativeUNL(); + + // easier to hack an object into the ledger than generate it + // legitimately + { + auto const nUNL = [&](OpenView& view, beast::Journal) -> bool { + auto const sle = std::make_shared(keylet); + + // Create DisabledValidators array + STArray disabledValidators; + auto disabledValidator = + STObject::makeInnerObject(sfDisabledValidator); + auto pubKeyBlob = strUnHex( + "ED58F6770DB5DD77E59D28CB650EC3816E2FC95021BB56E720C9A1" + "2DA79C58A3AB"); + disabledValidator.setFieldVL(sfPublicKey, *pubKeyBlob); + disabledValidator.setFieldU32( + sfFirstLedgerSequence, 91371264); + disabledValidators.push_back(std::move(disabledValidator)); + + sle->setFieldArray( + sfDisabledValidators, disabledValidators); + sle->setFieldH256( + sfPreviousTxnID, + uint256::fromVoid("8D47FFE664BE6C335108DF689537625855A6" + "A95160CC6D351341B9" + "2624D9C5E3")); + sle->setFieldU32(sfPreviousTxnLgrSeq, 91442944); + + view.rawInsert(sle); + return true; + }; + env.app().openLedger().modify(nUNL); + } + + Json::Value jvParams; + jvParams[jss::nunl] = to_string(keylet.key); + Json::Value const jrr = env.rpc( + "json", "ledger_entry", to_string(jvParams))[jss::result]; + BEAST_EXPECT( + jrr[jss::node][sfLedgerEntryType.jsonName] == jss::NegativeUNL); + } + + // negative tests + runLedgerEntryTest(env, jss::nunl); + } + + void + testOffer() { testcase("Offer"); using namespace test::jtx; @@ -1413,7 +1738,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryPayChan() + testPayChan() { testcase("Pay Chan"); using namespace test::jtx; @@ -1475,7 +1800,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryRippleState() + testRippleState() { testcase("RippleState"); using namespace test::jtx; @@ -1626,7 +1951,16 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryTicket() + testSignerList() + { + testcase("Signer List"); + using namespace test::jtx; + Env env{*this}; + runLedgerEntryTest(env, jss::signer_list); + } + + void + testTicket() { testcase("Ticket"); using namespace test::jtx; @@ -1711,7 +2045,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryDID() + testDID() { testcase("DID"); using namespace test::jtx; @@ -1848,7 +2182,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryMPT() + testMPT() { testcase("MPT"); using namespace test::jtx; @@ -1931,7 +2265,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryPermissionedDomain() + testPermissionedDomain() { testcase("PermissionedDomain"); @@ -2010,7 +2344,7 @@ class LedgerEntry_test : public beast::unit_test::suite } void - testLedgerEntryCLI() + testCLI() { testcase("command-line"); using namespace test::jtx; @@ -2040,25 +2374,33 @@ public: void run() override { - testLedgerEntryInvalid(); - testLedgerEntryAccountRoot(); - testLedgerEntryCheck(); - testLedgerEntryCredentials(); - testLedgerEntryDelegate(); - testLedgerEntryDepositPreauth(); - testLedgerEntryDepositPreauthCred(); - testLedgerEntryDirectory(); - testLedgerEntryEscrow(); - testLedgerEntryOffer(); - testLedgerEntryPayChan(); - testLedgerEntryRippleState(); - testLedgerEntryTicket(); - testLedgerEntryDID(); + testInvalid(); + testAccountRoot(); + testAmendments(); + testAMM(); + testCheck(); + testCredentials(); + testDelegate(); + testDepositPreauth(); + testDepositPreauthCred(); + testDirectory(); + testEscrow(); + testFeeSettings(); + testLedgerHashes(); + testNFTokenOffer(); + testNFTokenPage(); + testNegativeUNL(); + testOffer(); + testPayChan(); + testRippleState(); + testSignerList(); + testTicket(); + testDID(); testInvalidOracleLedgerEntry(); testOracleLedgerEntry(); - testLedgerEntryMPT(); - testLedgerEntryPermissionedDomain(); - testLedgerEntryCLI(); + testMPT(); + testPermissionedDomain(); + testCLI(); } }; @@ -2086,7 +2428,7 @@ class LedgerEntry_XChain_test : public beast::unit_test::suite, } void - testLedgerEntryBridge() + testBridge() { testcase("ledger_entry: bridge"); using namespace test::jtx; @@ -2177,7 +2519,7 @@ class LedgerEntry_XChain_test : public beast::unit_test::suite, } void - testLedgerEntryClaimID() + testClaimID() { testcase("ledger_entry: xchain_claim_id"); using namespace test::jtx; @@ -2235,7 +2577,7 @@ class LedgerEntry_XChain_test : public beast::unit_test::suite, } void - testLedgerEntryCreateAccountClaimID() + testCreateAccountClaimID() { testcase("ledger_entry: xchain_create_account_claim_id"); using namespace test::jtx; @@ -2362,9 +2704,9 @@ public: void run() override { - testLedgerEntryBridge(); - testLedgerEntryClaimID(); - testLedgerEntryCreateAccountClaimID(); + testBridge(); + testClaimID(); + testCreateAccountClaimID(); } }; diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 5b5db72c22..2e9d5b35bf 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -71,16 +71,17 @@ parseAMM(Json::Value const& params, Json::StaticString const fieldName) return Unexpected(value.error()); } - try - { - auto const issue = issueFromJson(params[jss::asset]); - auto const issue2 = issueFromJson(params[jss::asset2]); - return keylet::amm(issue, issue2).key; - } - catch (std::runtime_error const&) - { - return LedgerEntryHelpers::malformedError("malformedRequest", ""); - } + auto const asset = LedgerEntryHelpers::requiredIssue( + params, jss::asset, "malformedRequest"); + if (!asset) + return Unexpected(asset.error()); + + auto const asset2 = LedgerEntryHelpers::requiredIssue( + params, jss::asset2, "malformedRequest"); + if (!asset2) + return Unexpected(asset2.error()); + + return keylet::amm(*asset, *asset2).key; } static Expected @@ -424,7 +425,7 @@ parseLoan(Json::Value const& params, Json::StaticString const fieldName) } auto const id = LedgerEntryHelpers::requiredUInt256( - params, jss::loan_broker_id, "malformedOwner"); + params, jss::loan_broker_id, "malformedLoanBrokerID"); if (!id) return Unexpected(id.error()); auto const seq = LedgerEntryHelpers::requiredUInt32( diff --git a/src/xrpld/rpc/handlers/LedgerEntryHelpers.h b/src/xrpld/rpc/handlers/LedgerEntryHelpers.h index 0a4453c063..4b656e6b05 100644 --- a/src/xrpld/rpc/handlers/LedgerEntryHelpers.h +++ b/src/xrpld/rpc/handlers/LedgerEntryHelpers.h @@ -218,6 +218,29 @@ requiredUInt192( return required(params, fieldName, err, "Hash192"); } +template <> +std::optional +parse(Json::Value const& param) +{ + try + { + return issueFromJson(param); + } + catch (std::runtime_error const&) + { + return std::nullopt; + } +} + +Expected +requiredIssue( + Json::Value const& params, + Json::StaticString const fieldName, + std::string const& err) +{ + return required(params, fieldName, err, "Issue"); +} + Expected parseBridgeFields(Json::Value const& params) { From d734c8ddddb5ad0e4322f45d7dc47b2d609175b1 Mon Sep 17 00:00:00 2001 From: Bart Date: Tue, 6 Jan 2026 20:34:21 -0500 Subject: [PATCH 18/62] ci: Use ccache to cache build objects for speeding up building (#6104) Right now, each pipeline invocation builds the source code from scratch. Although compiled Conan dependencies are cached in a remote server, the source build objects are not. We are able to further speed up our builds by leveraging `ccache`. This change enables caching of build objects using `ccache` on Linux, macOS, and Windows. --- .github/actions/print-env/action.yml | 24 ++++---- .github/scripts/strategy-matrix/generate.py | 2 + .github/scripts/strategy-matrix/linux.json | 56 +++++++++---------- .github/workflows/on-pr.yml | 3 + .github/workflows/on-trigger.yml | 6 ++ .../workflows/reusable-build-test-config.yml | 52 ++++++++++++++--- .github/workflows/reusable-build-test.yml | 9 +++ .github/workflows/upload-conan-deps.yml | 2 +- CMakeLists.txt | 3 + cmake/Ccache.cmake | 51 +++++++++++++++++ 10 files changed, 159 insertions(+), 49 deletions(-) create mode 100644 cmake/Ccache.cmake diff --git a/.github/actions/print-env/action.yml b/.github/actions/print-env/action.yml index 6019a6de2f..3527ca6f02 100644 --- a/.github/actions/print-env/action.yml +++ b/.github/actions/print-env/action.yml @@ -11,12 +11,6 @@ runs: echo 'Checking environment variables.' set - echo 'Checking CMake version.' - cmake --version - - echo 'Checking Conan version.' - conan --version - - name: Check configuration (Linux and macOS) if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} shell: bash @@ -27,17 +21,23 @@ runs: echo 'Checking environment variables.' env | sort - echo 'Checking CMake version.' - cmake --version - echo 'Checking compiler version.' ${{ runner.os == 'Linux' && '${CC}' || 'clang' }} --version - echo 'Checking Conan version.' - conan --version - echo 'Checking Ninja version.' ninja --version echo 'Checking nproc version.' nproc --version + + - name: Check configuration (all) + shell: bash + run: | + echo 'Checking Ccache version.' + ccache --version + + echo 'Checking CMake version.' + cmake --version + + echo 'Checking Conan version.' + conan --version diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index 79530a1d75..c3d2da1f9f 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -232,6 +232,8 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: f"-{architecture['platform'][architecture['platform'].find('/') + 1 :]}" ) config_name += f"-{build_type.lower()}" + if "-Dcoverage=ON" in cmake_args: + config_name += "-coverage" if "-Dunity=ON" in cmake_args: config_name += "-unity" diff --git a/.github/scripts/strategy-matrix/linux.json b/.github/scripts/strategy-matrix/linux.json index 748ee031c9..669754554c 100644 --- a/.github/scripts/strategy-matrix/linux.json +++ b/.github/scripts/strategy-matrix/linux.json @@ -15,196 +15,196 @@ "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "15", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "16", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "17", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "18", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "19", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "20", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "gcc", "compiler_version": "15", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "clang", "compiler_version": "20", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "clang", "compiler_version": "21", - "image_sha": "0525eae" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "8", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "8", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "10", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "rhel", "distro_version": "10", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "jammy", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "16", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "17", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "18", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "19", - "image_sha": "e1782cd" + "image_sha": "cc09fd3" } ], "build_type": ["Debug", "Release"], diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index ff3d25812a..3aa48ac070 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -114,6 +114,9 @@ jobs: matrix: os: [linux, macos, windows] with: + # Enable ccache only for events targeting the XRPLF repository, since + # other accounts will not have access to our remote cache storage. + ccache_enabled: ${{ github.repository_owner == 'XRPLF' }} os: ${{ matrix.os }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index b5a56fb671..a95402ced7 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -66,6 +66,12 @@ jobs: strategy: fail-fast: ${{ github.event_name == 'merge_group' }} matrix: + # Enable ccache only for events targeting the XRPLF repository, since + # other accounts will not have access to our remote cache storage. + # However, we do not enable ccache for events targeting the master or a + # release branch, to protect against the rare case that the output + # produced by ccache is not identical to a regular compilation. + ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !(github.base_ref == 'master' || startsWith(github.base_ref, 'release')) }} os: [linux, macos, windows] with: os: ${{ matrix.os }} diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 98bf107225..575984162e 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -10,8 +10,14 @@ on: build_type: description: 'The build type to use ("Debug", "Release").' - type: string required: true + type: string + + ccache_enabled: + description: "Whether to enable ccache." + required: false + type: boolean + default: false cmake_args: description: "Additional arguments to pass to CMake." @@ -21,8 +27,8 @@ on: cmake_target: description: "The CMake target to build." - type: string required: true + type: string runs_on: description: Runner to run the job on as a JSON string @@ -66,8 +72,25 @@ jobs: container: ${{ inputs.image != '' && inputs.image || null }} timeout-minutes: 60 env: - ENABLED_VOIDSTAR: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }} - ENABLED_COVERAGE: ${{ contains(inputs.cmake_args, '-Dcoverage=ON') }} + # Use a namespace to keep the objects separate for each configuration. + CCACHE_NAMESPACE: ${{ inputs.config_name }} + # Ccache supports both Redis and HTTP endpoints. + # * For Redis, use the following format: redis://ip:port, see + # https://github.com/ccache/ccache/wiki/Redis-storage. Note that TLS is + # not directly supported by ccache, and requires use of a proxy. + # * For HTTP use the following format: http://ip:port/cache when using + # nginx as backend or http://ip:port|layout=bazel when using Bazel + # Remote Cache, see https://github.com/ccache/ccache/wiki/HTTP-storage. + # Note that HTTPS is not directly supported by ccache. + CCACHE_REMOTE_ONLY: true + CCACHE_REMOTE_STORAGE: http://cache.dev.ripplex.io:8080|layout=bazel + # Ignore the creation and modification timestamps on files, since the + # header files are copied into separate directories by CMake, which will + # otherwise result in cache misses. + CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime + # Determine if coverage and voidstar should be enabled. + COVERAGE_ENABLED: ${{ contains(inputs.cmake_args, '-Dcoverage=ON') }} + VOIDSTAR_ENABLED: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }} steps: - name: Cleanup workspace (macOS and Windows) if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }} @@ -79,7 +102,11 @@ jobs: - name: Prepare runner uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 with: - disable_ccache: false + disable_ccache: ${{ !inputs.ccache_enabled }} + + - name: Set ccache log file + if: ${{ inputs.ccache_enabled && runner.debug == '1' }} + run: echo "CCACHE_LOGFILE=${{ runner.temp }}/ccache.log" >> "${GITHUB_ENV}" - name: Print build environment uses: ./.github/actions/print-env @@ -128,6 +155,15 @@ jobs: --parallel "${BUILD_NPROC}" \ --target "${CMAKE_TARGET}" + - name: Show ccache statistics + if: ${{ inputs.ccache_enabled }} + run: | + ccache --show-stats -vv + if [ '${{ runner.debug }}' = '1' ]; then + cat "${CCACHE_LOGFILE}" + curl ${CCACHE_REMOTE_STORAGE%|*}/status || true + fi + - name: Upload the binary (Linux) if: ${{ github.repository_owner == 'XRPLF' && runner.os == 'Linux' }} uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 @@ -150,7 +186,7 @@ jobs: fi - name: Verify presence of instrumentation (Linux) - if: ${{ runner.os == 'Linux' && env.ENABLED_VOIDSTAR == 'true' }} + if: ${{ runner.os == 'Linux' && env.VOIDSTAR_ENABLED == 'true' }} working-directory: ${{ env.BUILD_DIR }} run: | ./xrpld --version | grep libvoidstar @@ -185,7 +221,7 @@ jobs: netstat -an - name: Prepare coverage report - if: ${{ !inputs.build_only && env.ENABLED_COVERAGE == 'true' }} + if: ${{ !inputs.build_only && env.COVERAGE_ENABLED == 'true' }} working-directory: ${{ env.BUILD_DIR }} env: BUILD_NPROC: ${{ steps.nproc.outputs.nproc }} @@ -198,7 +234,7 @@ jobs: --target coverage - name: Upload coverage report - if: ${{ github.repository_owner == 'XRPLF' && !inputs.build_only && env.ENABLED_COVERAGE == 'true' }} + if: ${{ github.repository_owner == 'XRPLF' && !inputs.build_only && env.COVERAGE_ENABLED == 'true' }} uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 with: disable_search: true diff --git a/.github/workflows/reusable-build-test.yml b/.github/workflows/reusable-build-test.yml index 7f14aacb9b..2b4d38da61 100644 --- a/.github/workflows/reusable-build-test.yml +++ b/.github/workflows/reusable-build-test.yml @@ -8,16 +8,24 @@ name: Build and test on: workflow_call: inputs: + ccache_enabled: + description: "Whether to enable ccache." + required: false + type: boolean + default: false + os: description: 'The operating system to use for the build ("linux", "macos", "windows").' required: true type: string + strategy_matrix: # TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations. description: 'The strategy matrix to use for generating the configurations ("minimal", "all").' required: false type: string default: "minimal" + secrets: CODECOV_TOKEN: description: "The Codecov token to use for uploading coverage reports." @@ -43,6 +51,7 @@ jobs: with: build_only: ${{ matrix.build_only }} build_type: ${{ matrix.build_type }} + ccache_enabled: ${{ inputs.ccache_enabled }} cmake_args: ${{ matrix.cmake_args }} cmake_target: ${{ matrix.cmake_target }} runs_on: ${{ toJSON(matrix.architecture.runner) }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 5024666394..8a9993d37a 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -72,7 +72,7 @@ jobs: - name: Prepare runner uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 with: - disable_ccache: false + disable_ccache: true - name: Print build environment uses: ./.github/actions/print-env diff --git a/CMakeLists.txt b/CMakeLists.txt index ade9c2f995..70bc02c66d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,9 @@ elseif(MSVC) add_compile_options(/wd4068) # Ignore unknown pragmas endif() +# Enable ccache to speed up builds. +include(Ccache) + # make GIT_COMMIT_HASH define available to all sources find_package(Git) if(Git_FOUND) diff --git a/cmake/Ccache.cmake b/cmake/Ccache.cmake new file mode 100644 index 0000000000..092212075c --- /dev/null +++ b/cmake/Ccache.cmake @@ -0,0 +1,51 @@ +find_program(CCACHE_PATH "ccache") +if (NOT CCACHE_PATH) + return() +endif () + +# For Linux and macOS we can use the ccache binary directly. +if (NOT MSVC) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PATH}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PATH}") + message(STATUS "Found ccache: ${CCACHE_PATH}") + return() +endif () + +# For Windows more effort is required. The code below is a modified version of +# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake. +if ("${CCACHE_PATH}" MATCHES "chocolatey") + message(DEBUG "Ccache path: ${CCACHE_PATH}") + # Chocolatey uses a shim executable that we cannot use directly, in which + # case we have to find the executable it points to. If we cannot find the + # target executable then we cannot use ccache. + find_program(BASH_PATH "bash") + if (NOT BASH_PATH) + message(WARNING "Could not find bash.") + return() + endif () + + execute_process( + COMMAND bash -c "export LC_ALL='en_US.UTF-8'; ${CCACHE_PATH} --shimgen-noop | grep -oP 'path to executable: \\K.+' | head -c -1" + OUTPUT_VARIABLE CCACHE_PATH) + + if (NOT CCACHE_PATH) + message(WARNING "Could not find ccache target.") + return() + endif () + file(TO_CMAKE_PATH "${CCACHE_PATH}" CCACHE_PATH) +endif () +message(STATUS "Found ccache: ${CCACHE_PATH}") + +# Tell cmake to use ccache for compiling with Visual Studio. +file(COPY_FILE + ${CCACHE_PATH} ${CMAKE_BINARY_DIR}/cl.exe + ONLY_IF_DIFFERENT) +set(CMAKE_VS_GLOBALS + "CLToolExe=cl.exe" + "CLToolPath=${CMAKE_BINARY_DIR}" + "TrackFileAccess=false" + "UseMultiToolTask=true") + +# By default Visual Studio generators will use /Zi, which is not compatible with +# ccache, so tell it to use /Z7 instead. +set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$:Embedded>") From f80059e4673ad96010229c14dcdf0ac6cb11d9a0 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 7 Jan 2026 06:07:53 -0500 Subject: [PATCH 19/62] ci: Move variable into right place (#6179) This change moves the `enable_ccache` variable in the `on-trigger.yml` file to the correct location. --- .github/workflows/on-trigger.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index a95402ced7..2c63c2baa5 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -66,14 +66,14 @@ jobs: strategy: fail-fast: ${{ github.event_name == 'merge_group' }} matrix: - # Enable ccache only for events targeting the XRPLF repository, since - # other accounts will not have access to our remote cache storage. - # However, we do not enable ccache for events targeting the master or a - # release branch, to protect against the rare case that the output - # produced by ccache is not identical to a regular compilation. - ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !(github.base_ref == 'master' || startsWith(github.base_ref, 'release')) }} os: [linux, macos, windows] with: + # Enable ccache only for events targeting the XRPLF repository, since + # other accounts will not have access to our remote cache storage. + # However, we do not enable ccache for events targeting the master or a + # release branch, to protect against the rare case that the output + # produced by ccache is not identical to a regular compilation. + ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !(github.base_ref == 'master' || startsWith(github.base_ref, 'release')) }} os: ${{ matrix.os }} strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }} secrets: From 3c9f5b62525cb1d6ca1153eeb10433db7d7379fd Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 7 Jan 2026 12:10:19 -0500 Subject: [PATCH 20/62] refactor: Fix typos in comments, configure cspell (#6164) This change sets up a `cspell `configuration and fixes lots of typos in comments. There are no other code changes. --- .config/cspell.config.yaml | 272 ++++++++++++++++++ .github/scripts/levelization/README.md | 2 +- .pre-commit-config.yaml | 15 + CONTRIBUTING.md | 12 +- SECURITY.md | 2 +- cfg/xrpld-example.cfg | 2 +- cmake/XrplCore.cmake | 2 +- docs/0001-negative-unl/README.md | 2 +- .../negativeUNLSqDiagram.puml | 4 +- docs/consensus.md | 4 +- include/xrpl/basics/IntrusiveRefCounts.h | 2 +- include/xrpl/basics/Log.h | 3 +- include/xrpl/beast/core/LexicalCast.h | 2 +- include/xrpl/json/json_reader.h | 4 +- include/xrpl/json/json_value.h | 2 +- include/xrpl/ledger/CredentialHelpers.h | 5 +- include/xrpl/nodestore/DummyScheduler.h | 2 +- include/xrpl/nodestore/README.md | 4 +- .../proto/org/xrpl/rpc/v1/xrp_ledger.proto | 2 +- include/xrpl/protocol/Indexes.h | 2 +- include/xrpl/protocol/Protocol.h | 2 +- include/xrpl/protocol/Quality.h | 2 +- include/xrpl/protocol/TxFlags.h | 2 +- include/xrpl/protocol/XChainAttestations.h | 6 +- include/xrpl/protocol/detail/STVar.h | 2 +- .../xrpl/protocol/detail/ledger_entries.macro | 4 +- include/xrpl/resource/README.md | 2 +- include/xrpl/resource/detail/Logic.h | 2 +- include/xrpl/server/detail/LowestLayer.h | 2 +- include/xrpl/shamap/README.md | 2 +- include/xrpl/shamap/SHAMapItem.h | 4 +- src/libxrpl/basics/Number.cpp | 4 +- src/libxrpl/basics/make_SSLContext.cpp | 4 +- src/libxrpl/json/Writer.cpp | 2 +- src/libxrpl/ledger/View.cpp | 2 +- src/libxrpl/protocol/IOUAmount.cpp | 2 +- src/libxrpl/protocol/STAmount.cpp | 2 +- src/libxrpl/protocol/tokens.cpp | 2 +- src/test/app/AccountDelete_test.cpp | 6 +- src/test/app/AmendmentTable_test.cpp | 2 +- src/test/app/DepositAuth_test.cpp | 20 +- src/test/app/Escrow_test.cpp | 4 +- src/test/app/FixNFTokenPageLinks_test.cpp | 2 +- src/test/app/Invariants_test.cpp | 10 +- src/test/app/LoanBroker_test.cpp | 2 +- src/test/app/MPToken_test.cpp | 8 +- src/test/app/NFTokenBurn_test.cpp | 2 +- src/test/app/NFToken_test.cpp | 14 +- src/test/app/PayChan_test.cpp | 6 +- src/test/app/PermissionedDEX_test.cpp | 2 +- src/test/app/ValidatorSite_test.cpp | 6 +- src/test/basics/IntrusiveShared_test.cpp | 2 +- src/test/basics/XRPAmount_test.cpp | 2 +- .../consensus/ByzantineFailureSim_test.cpp | 2 +- src/test/consensus/Consensus_test.cpp | 12 +- .../DistributedValidatorsSim_test.cpp | 4 +- src/test/consensus/ScaleFreeSim_test.cpp | 2 +- src/test/csf/CollectorRef.h | 2 +- src/test/csf/Histogram.h | 2 +- src/test/jtx/TestHelpers.h | 2 +- src/test/jtx/deposit.h | 2 +- src/test/jtx/rpc.h | 2 +- src/test/protocol/Seed_test.cpp | 2 +- src/test/rpc/AccountObjects_test.cpp | 2 +- src/test/rpc/ManifestRPC_test.cpp | 2 +- src/test/rpc/Subscribe_test.cpp | 2 +- src/tests/libxrpl/basics/base64.cpp | 2 + src/xrpld/app/consensus/RCLConsensus.h | 2 +- .../app/ledger/AbstractFetchPackContainer.h | 2 +- src/xrpld/app/ledger/BookListeners.cpp | 2 +- src/xrpld/app/ledger/README.md | 2 +- src/xrpld/app/main/GRPCServer.cpp | 2 +- src/xrpld/app/main/GRPCServer.h | 2 +- src/xrpld/app/misc/FeeEscalation.md | 4 +- src/xrpld/app/misc/HashRouter.cpp | 2 +- src/xrpld/app/misc/HashRouter.h | 2 +- src/xrpld/app/misc/Manifest.h | 2 +- src/xrpld/app/misc/NetworkOPs.cpp | 14 +- src/xrpld/app/misc/NetworkOPs.h | 6 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 2 +- src/xrpld/app/misc/Transaction.h | 2 +- src/xrpld/app/misc/TxQ.h | 2 +- src/xrpld/app/misc/detail/LendingHelpers.cpp | 2 +- src/xrpld/app/paths/Pathfinder.cpp | 4 +- src/xrpld/app/paths/detail/DirectStep.cpp | 2 +- src/xrpld/app/rdb/backend/detail/Node.h | 14 +- src/xrpld/app/tx/detail/CreateOffer.cpp | 4 +- src/xrpld/app/tx/detail/InvariantCheck.h | 2 +- src/xrpld/app/tx/detail/NFTokenUtils.cpp | 2 +- src/xrpld/app/tx/detail/Payment.cpp | 4 +- src/xrpld/conditions/detail/PreimageSha256.h | 2 +- src/xrpld/consensus/Consensus.cpp | 2 +- src/xrpld/core/Config.h | 2 +- src/xrpld/core/detail/SociDB.cpp | 2 +- src/xrpld/overlay/detail/PeerImp.cpp | 2 +- src/xrpld/peerfinder/PeerfinderManager.h | 2 +- src/xrpld/peerfinder/README.md | 14 +- src/xrpld/peerfinder/detail/Checker.h | 2 +- src/xrpld/peerfinder/detail/Fixed.h | 2 +- src/xrpld/rpc/GRPCHandlers.h | 2 +- src/xrpld/rpc/detail/Handler.cpp | 2 +- src/xrpld/rpc/detail/InfoSub.cpp | 6 +- src/xrpld/rpc/detail/RPCCall.cpp | 2 +- src/xrpld/rpc/detail/RPCSub.cpp | 2 +- src/xrpld/rpc/detail/TransactionSign.cpp | 4 +- src/xrpld/rpc/handlers/GatewayBalances.cpp | 2 +- src/xrpld/rpc/handlers/NoRippleCheck.cpp | 2 +- 107 files changed, 473 insertions(+), 182 deletions(-) create mode 100644 .config/cspell.config.yaml diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml new file mode 100644 index 0000000000..969720a11d --- /dev/null +++ b/.config/cspell.config.yaml @@ -0,0 +1,272 @@ +ignorePaths: + - build/** + - src/libxrpl/crypto + - src/test/** # Will be removed in the future + - CMakeUserPresets.json + - Doxyfile + - docs/**/*.puml + - cmake/** + - LICENSE.md +language: en +allowCompoundWords: true +ignoreRandomStrings: true +minWordLength: 5 +dictionaries: + - cpp + - en_US + - en_GB +ignoreRegExpList: + - /[rs][1-9A-HJ-NP-Za-km-z]{25,34}/g # addresses and seeds + - /(XRPL|BEAST)_[A-Z_0-9]+_H_INCLUDED+/g # include guards + - /(XRPL|BEAST)_[A-Z_0-9]+_H+/g # include guards + - /::[a-z:_]+/g # things from other namespaces + - /lib[a-z]+/g # libraries + - /[0-9]{4}-[0-9]{2}-[0-9]{2}[,:][A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright dates + - /[0-9]{4}[,:]?\s*[A-Za-zÀ-ÖØ-öø-ÿ.\s]+/g # copyright years + - /\[[A-Za-z0-9-]+\]\(https:\/\/github.com\/[A-Za-z0-9-]+\)/g # Github usernames + - /-[DWw][a-zA-Z0-9_-]+=/g # compile flags + - /[\['"`]-[DWw][a-zA-Z0-9_-]+['"`\]]/g # compile flags +suggestWords: + - xprl->xrpl + - unsynched->unsynced + - synched->synced + - synch->sync +words: + - abempty + - AMMID + - amt + - amts + - asnode + - asynchrony + - attestation + - authorises + - autobridge + - autobridged + - autobridging + - bimap + - bindir + - bookdir + - Bougalis + - Britto + - Btrfs + - canonicality + - checkme + - chrono + - citardauq + - clawback + - clawbacks + - coeffs + - coldwallet + - compr + - conanfile + - conanrun + - connectability + - coro + - coros + - cowid + - cryptocondition + - cryptoconditional + - cryptoconditions + - csprng + - ctid + - currenttxhash + - daria + - dcmake + - dearmor + - deleteme + - demultiplexer + - deserializaton + - desync + - desynced + - determ + - distro + - doxyfile + - dxrpl + - endmacro + - endpointv + - exceptioned + - Falco + - finalizers + - firewalled + - fmtdur + - funclets + - gcov + - gcovr + - Gnutella + - gpgcheck + - gpgkey + - hotwallet + - ifndef + - inequation + - insuf + - insuff + - iou + - ious + - isrdc + - jemalloc + - jlog + - keylet + - keylets + - keyvadb + - ledgerentry + - ledgerhash + - ledgerindex + - leftw + - legleux + - levelization + - levelized + - libpb + - libxrpl + - llection + - LOCALGOOD + - logwstream + - lseq + - lsmf + - ltype + - MEMORYSTATUSEX + - Merkle + - Metafuncton + - misprediction + - mptbalance + - mptflags + - mptid + - mptissuance + - mptissuanceid + - mptoken + - mptokenid + - mptokenissuance + - mptokens + - mpts + - multisig + - multisign + - multisigned + - Nakamoto + - nftid + - nftoffer + - nftoken + - nftokenid + - nftokenpages + - nftokens + - nftpage + - nikb + - nonxrp + - noripple + - nudb + - nullptr + - nunl + - Nyffenegger + - ostr + - partitioner + - paychan + - paychans + - permdex + - perminute + - permissioned + - pointee + - preauth + - preauthorization + - preauthorize + - preauthorizes + - preclaim + - protobuf + - protos + - ptrs + - pyenv + - qalloc + - queuable + - Raphson + - replayer + - rerere + - retriable + - RIPD + - ripdtop + - rippleci + - rippled + - ripplerpc + - rippletest + - RLUSD + - rngfill + - rocksdb + - Rohrs + - roundings + - sahyadri + - Satoshi + - secp + - sendq + - seqit + - sf + - shamap + - shamapitem + - sidechain + - SIGGOOD + - sle + - sles + - soci + - socidb + - sslws + - statsd + - STATSDCOLLECTOR + - stissue + - stnum + - stobj + - stobject + - stpath + - stpathset + - sttx + - stvar + - stvector + - stxchainattestations + - superpeer + - superpeers + - takergets + - takerpays + - ters + - tx + - txid + - txids + - txjson + - txn + - txns + - txs + - umant + - unacquired + - unambiguity + - unauthorizes + - unauthorizing + - unergonomic + - unfetched + - unflatten + - unfund + - unimpair + - unroutable + - unscalable + - unserviced + - unshareable + - unshares + - unsquelch + - unsquelched + - unsquelching + - unvalidated + - unveto + - unvetoed + - upvotes + - USDB + - variadics + - venv + - vfalco + - vinnie + - wextra + - wptr + - writeme + - wsrch + - wthread + - xbridge + - xchain + - ximinez + - XMACRO + - xrpkuwait + - xrpl + - xrpld + - xrplf + - xxhash + - xxhasher diff --git a/.github/scripts/levelization/README.md b/.github/scripts/levelization/README.md index 3b77a192b9..c8954b900e 100644 --- a/.github/scripts/levelization/README.md +++ b/.github/scripts/levelization/README.md @@ -81,7 +81,7 @@ It generates many files of [results](results): - `rawincludes.txt`: The raw dump of the `#includes` - `paths.txt`: A second dump grouping the source module - to the destination module, deduped, and with frequency counts. + to the destination module, de-duped, and with frequency counts. - `includes/`: A directory where each file represents a module and contains a list of modules and counts that the module _includes_. - `includedby/`: Similar to `includes/`, but the other way around. Each diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c85e0798f7..4a1dc159dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,21 @@ repos: hooks: - id: black + # - repo: https://github.com/streetsidesoftware/cspell-cli + # rev: v9.2.0 + # hooks: + # - id: cspell # Spell check changed files + # - id: cspell # Spell check the commit message + # name: check commit message spelling + # args: + # - --no-must-find-files + # - --no-progress + # - --no-summary + # - --files + # - .git/COMMIT_EDITMSG + # stages: [commit-msg] + # always_run: true # This might not be necessary. + exclude: | (?x)^( external/.*| diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b578b7f13..4f99972713 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -555,16 +555,16 @@ Rippled uses a linear workflow model that can be summarized as: git fetch --multiple upstreams user1 user2 user3 [...] git checkout -B release-next --no-track upstream/develop -# Only do an ff-only merge if prbranch1 is either already +# Only do an ff-only merge if pr-branch1 is either already # squashed, or needs to be merged with separate commits, # and has no merge commits. -# Use -S on the ff-only merge if prbranch1 isn't signed. -git merge [-S] --ff-only user1/prbranch1 +# Use -S on the ff-only merge if pr-branch1 isn't signed. +git merge [-S] --ff-only user1/pr-branch1 -git merge --squash user2/prbranch2 +git merge --squash user2/pr-branch2 git commit -S # Use the commit message provided on the PR -git merge --squash user3/prbranch3 +git merge --squash user3/pr-branch3 git commit -S # Use the commit message provided on the PR [...] @@ -876,7 +876,7 @@ git push --delete upstream-push master-next #### Special cases: point releases, hotfixes, etc. -On occassion, a bug or issue is discovered in a version that already +On occasion, a bug or issue is discovered in a version that already had a final release. Most of the time, development will have started on the next version, and will usually have changes in `develop` and often in `release`. diff --git a/SECURITY.md b/SECURITY.md index 3fd85bad0a..18eec312ed 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -42,7 +42,7 @@ For more information on responsible disclosure, please read this [Wikipedia arti ## Report Handling Process -Please report the bug directly to us and limit further disclosure. If you want to prove that you knew the bug as of a given time, consider using a cryptographic precommitment: hash the content of your report and publish the hash on a medium of your choice (e.g. on Twitter or as a memo in a transaction) as "proof" that you had written the text at a given point in time. +Please report the bug directly to us and limit further disclosure. If you want to prove that you knew the bug as of a given time, consider using a cryptographic pre-commitment: hash the content of your report and publish the hash on a medium of your choice (e.g. on Twitter or as a memo in a transaction) as "proof" that you had written the text at a given point in time. Once we receive a report, we: diff --git a/cfg/xrpld-example.cfg b/cfg/xrpld-example.cfg index b5180dce52..93fab4a9ba 100644 --- a/cfg/xrpld-example.cfg +++ b/cfg/xrpld-example.cfg @@ -218,7 +218,7 @@ # administrative commands. # # NOTE A common configuration value for the admin field is "localhost". -# If you are listening on all IPv4/IPv6 addresses by specifing +# If you are listening on all IPv4/IPv6 addresses by specifying # ip = :: then you can use admin = ::ffff:127.0.0.1,::1 to allow # administrative access from both IPv4 and IPv6 localhost # connections. diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 12ba58d499..0689fbe7b6 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -206,7 +206,7 @@ if(xrpld) ) exclude_if_included(xrpld) # define a macro for tests that might need to - # be exluded or run differently in CI environment + # be excluded or run differently in CI environment if(is_ci) target_compile_definitions(xrpld PRIVATE XRPL_RUNNING_IN_CI) endif () diff --git a/docs/0001-negative-unl/README.md b/docs/0001-negative-unl/README.md index f28ff63c6f..c863cab9da 100644 --- a/docs/0001-negative-unl/README.md +++ b/docs/0001-negative-unl/README.md @@ -134,7 +134,7 @@ validation messages (_PAV_) received from each validator on the node's UNL. Note that the node will only count the validation messages that agree with its own validations. -We define the **PAV** as the **P**ercentage of **A**greed **V**alidation +We define the **PAV** as the Percentage of Agreed Validation messages received for the last N ledgers, where N = 256 by default. When the PAV drops below the **_low-water mark_**, the validator is considered diff --git a/docs/0001-negative-unl/negativeUNLSqDiagram.puml b/docs/0001-negative-unl/negativeUNLSqDiagram.puml index 9f37d43903..d86b98c01f 100644 --- a/docs/0001-negative-unl/negativeUNLSqDiagram.puml +++ b/docs/0001-negative-unl/negativeUNLSqDiagram.puml @@ -43,14 +43,14 @@ alt phase == OPEN alt sqn%256==0 CA -[#green]> RM: getValidations CA -[#green]> CA: create UNLModify Tx - hnote over CA#lightgreen: use validatations of the last 256 ledgers\nto figure out UNLModify Tx candidates.\nIf any, create UNLModify Tx, and add to TxSet. + hnote over CA#lightgreen: use validations of the last 256 ledgers\nto figure out UNLModify Tx candidates.\nIf any, create UNLModify Tx, and add to TxSet. end CA -> GC GC -> CA: propose deactivate CA end else phase == ESTABLISH - hnote over GC: receive peer postions + hnote over GC: receive peer positions GC -> GC : update our position GC -> CA : propose \n(if position changed) GC -> GC : check if have consensus diff --git a/docs/consensus.md b/docs/consensus.md index 067e15d0c8..23e5e7d5be 100644 --- a/docs/consensus.md +++ b/docs/consensus.md @@ -189,7 +189,7 @@ validations. It checks this on every call to `timerEntry`. - _Wrong Ledger_ indicates the node is not working on the correct prior ledger and does not have it available. It requests that ledger from the network, but continues to work towards consensus this round while waiting. If it had been - _proposing_, it will send a special "bowout" proposal to its peers to indicate + _proposing_, it will send a special "bow-out" proposal to its peers to indicate its change in mode for the rest of this round. For the duration of the round, it defers to peer positions for determining the consensus outcome as if it were just _observing_. @@ -515,7 +515,7 @@ are excerpts of the generic consensus implementation and of helper types that wi interact with the concrete implementing class. ```{.cpp} -// Represents a transction under dispute this round +// Represents a transaction under dispute this round template class DisputedTx; // Represents how the node participates in Consensus this round diff --git a/include/xrpl/basics/IntrusiveRefCounts.h b/include/xrpl/basics/IntrusiveRefCounts.h index 630c08395d..440ecdd19c 100644 --- a/include/xrpl/basics/IntrusiveRefCounts.h +++ b/include/xrpl/basics/IntrusiveRefCounts.h @@ -301,7 +301,7 @@ IntrusiveRefCounts::addWeakReleaseStrongRef() const // change the counts and flags (the count could be atomically changed, but // the flags depend on the current value of the counts). // - // Note: If this becomes a perf bottleneck, the `partialDestoryStartedMask` + // Note: If this becomes a perf bottleneck, the `partialDestroyStartedMask` // may be able to be set non-atomically. But it is easier to reason about // the code if the flag is set atomically. while (1) diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index 9443e8afdf..f10f1ff64c 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -221,7 +221,8 @@ public: private: enum { // Maximum line length for log messages. - // If the message exceeds this length it will be truncated with elipses. + // If the message exceeds this length it will be truncated with + // ellipses. maximumMessageCharacters = 12 * 1024 }; diff --git a/include/xrpl/beast/core/LexicalCast.h b/include/xrpl/beast/core/LexicalCast.h index fea1c35f55..c5b7f5540a 100644 --- a/include/xrpl/beast/core/LexicalCast.h +++ b/include/xrpl/beast/core/LexicalCast.h @@ -18,7 +18,7 @@ namespace beast { namespace detail { -// These specializatons get called by the non-member functions to do the work +// These specializations get called by the non-member functions to do the work template struct LexicalCast; diff --git a/include/xrpl/json/json_reader.h b/include/xrpl/json/json_reader.h index a660d82e2a..963dc0f26e 100644 --- a/include/xrpl/json/json_reader.h +++ b/include/xrpl/json/json_reader.h @@ -1,8 +1,6 @@ #ifndef XRPL_JSON_JSON_READER_H_INCLUDED #define XRPL_JSON_JSON_READER_H_INCLUDED -#define CPPTL_JSON_READER_H_INCLUDED - #include #include @@ -231,4 +229,4 @@ operator>>(std::istream&, Value&); } // namespace Json -#endif // CPPTL_JSON_READER_H_INCLUDED +#endif // XRPL_JSON_JSON_READER_H_INCLUDED diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index 2e38f2e75e..3daf441592 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -682,4 +682,4 @@ public: } // namespace Json -#endif // CPPTL_JSON_H_INCLUDED +#endif // XRPL_JSON_JSON_VALUE_H_INCLUDED diff --git a/include/xrpl/ledger/CredentialHelpers.h b/include/xrpl/ledger/CredentialHelpers.h index 52ddfe33aa..b90aa44c0d 100644 --- a/include/xrpl/ledger/CredentialHelpers.h +++ b/include/xrpl/ledger/CredentialHelpers.h @@ -15,7 +15,7 @@ namespace xrpl { namespace credentials { // These function will be used by the code that use DepositPreauth / Credentials -// (and any future preauthorization modes) as part of authorization (all the +// (and any future pre-authorization modes) as part of authorization (all the // transfer funds transactions) // Check if credential sfExpiration field has passed ledger's parentCloseTime @@ -41,7 +41,8 @@ checkFields(STTx const& tx, beast::Journal j); // Accessing the ledger to check if provided credentials are valid. Do not use // in doApply (only in preclaim) since it does not remove expired credentials. -// If you call it in prelaim, you also must call verifyDepositPreauth in doApply +// If you call it in preclaim, you also must call verifyDepositPreauth in +// doApply TER valid( STTx const& tx, diff --git a/include/xrpl/nodestore/DummyScheduler.h b/include/xrpl/nodestore/DummyScheduler.h index 9ffe5ad80d..b31613480f 100644 --- a/include/xrpl/nodestore/DummyScheduler.h +++ b/include/xrpl/nodestore/DummyScheduler.h @@ -6,7 +6,7 @@ namespace xrpl { namespace NodeStore { -/** Simple NodeStore Scheduler that just peforms the tasks synchronously. */ +/** Simple NodeStore Scheduler that just performs the tasks synchronously. */ class DummyScheduler : public Scheduler { public: diff --git a/include/xrpl/nodestore/README.md b/include/xrpl/nodestore/README.md index 83da29d9ce..4b228bfc9a 100644 --- a/include/xrpl/nodestore/README.md +++ b/include/xrpl/nodestore/README.md @@ -96,7 +96,7 @@ Facebook's RocksDB database, builds on LevelDB. Use SQLite. -'path' speficies where the backend will store its data files. +'path' specifies where the backend will store its data files. Choices for 'compression' @@ -161,7 +161,7 @@ Through various executions and profiling some conclusions are presented below. - Multiple runs of the benchmarks can yield surprisingly different results. This can perhaps be attributed to the asynchronous nature of rocksdb's compaction - process. The benchmarks are artifical and create highly unlikely write load to + process. The benchmarks are artificial and create highly unlikely write load to create the dataset to measure different read access patterns. Therefore multiple runs of the benchmarks are required to get a feel for the effectiveness of the changes. This contrasts sharply with the keyvadb benchmarking were highly diff --git a/include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto b/include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto index 2b8dc471ce..942a4a2135 100644 --- a/include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto +++ b/include/xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.proto @@ -9,7 +9,7 @@ import "org/xrpl/rpc/v1/get_ledger_entry.proto"; import "org/xrpl/rpc/v1/get_ledger_data.proto"; import "org/xrpl/rpc/v1/get_ledger_diff.proto"; -// These methods are binary only methods for retrieiving arbitrary ledger state +// These methods are binary only methods for retrieving arbitrary ledger state // via gRPC. These methods are used by clio, but can also be // used by any client that wants to extract ledger state in an efficient manner. // They do not directly mimic the JSON equivalent methods. diff --git a/include/xrpl/protocol/Indexes.h b/include/xrpl/protocol/Indexes.h index 1cb22b4d6c..777c3b8aa9 100644 --- a/include/xrpl/protocol/Indexes.h +++ b/include/xrpl/protocol/Indexes.h @@ -18,7 +18,7 @@ namespace xrpl { class SeqProxy; -/** Keylet computation funclets. +/** Keylet computation functions. Entries in the ledger are located using 256-bit locators. The locators are calculated using a wide range of parameters specific to the entry whose diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index fb315eace4..0c72b80de4 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -179,7 +179,7 @@ static constexpr int loanPaymentsPerFeeIncrement = 5; * * This limit is enforced during the loan payment process, and thus is not * estimated. If the limit is hit, no further payments or overpayments will be - * processed, no matter how much of the transation Amount is left, but the + * processed, no matter how much of the transaction Amount is left, but the * transaction will succeed with the payments that have been processed up to * that point. * diff --git a/include/xrpl/protocol/Quality.h b/include/xrpl/protocol/Quality.h index 1fafa5e321..83a038490a 100644 --- a/include/xrpl/protocol/Quality.h +++ b/include/xrpl/protocol/Quality.h @@ -210,7 +210,7 @@ public: private: // The ceil_in and ceil_out methods that deal in TAmount all convert - // their arguments to STAoumout and convert the result back to TAmount. + // their arguments to STAmount and convert the result back to TAmount. // This helper function takes care of all the conversion operations. template < class In, diff --git a/include/xrpl/protocol/TxFlags.h b/include/xrpl/protocol/TxFlags.h index 194c4c6af1..5527a264e4 100644 --- a/include/xrpl/protocol/TxFlags.h +++ b/include/xrpl/protocol/TxFlags.h @@ -277,7 +277,7 @@ constexpr std::uint32_t const tfLoanOverpayment = 0x00010000; // interest and fees, or it will fail. False: Not a full payment. constexpr std::uint32_t const tfLoanFullPayment = 0x00020000; // tfLoanLatePayment: True, indicates that the payment is late, -// and includes late iterest and fees. If the loan is not late, +// and includes late interest and fees. If the loan is not late, // it will fail. False: not a late payment. If the current payment // is overdue, the transaction will fail. constexpr std::uint32_t const tfLoanLatePayment = 0x00040000; diff --git a/include/xrpl/protocol/XChainAttestations.h b/include/xrpl/protocol/XChainAttestations.h index 4dc9cfcf6a..bd76936b49 100644 --- a/include/xrpl/protocol/XChainAttestations.h +++ b/include/xrpl/protocol/XChainAttestations.h @@ -33,12 +33,12 @@ struct AttestationBase // Account on the sending chain that triggered the event (sent the // transaction) AccountID sendingAccount; - // Amount transfered on the sending chain + // Amount transferred on the sending chain STAmount sendingAmount; // Account on the destination chain that collects a share of the attestation // reward AccountID rewardAccount; - // Amount was transfered on the locking chain + // Amount was transferred on the locking chain bool wasLockingChainSend; explicit AttestationBase( @@ -354,7 +354,7 @@ struct XChainCreateAccountAttestation XChainCreateAccountAttestation const& rhs); }; -// Attestations from witness servers for a particular claimid and bridge. +// Attestations from witness servers for a particular claim ID and bridge. // Only one attestation per signature is allowed. template class XChainAttestationsBase diff --git a/include/xrpl/protocol/detail/STVar.h b/include/xrpl/protocol/detail/STVar.h index 540ba2bf77..219d1ed738 100644 --- a/include/xrpl/protocol/detail/STVar.h +++ b/include/xrpl/protocol/detail/STVar.h @@ -42,7 +42,7 @@ concept ValidConstructSTArgs = class STVar { private: - // The largest "small object" we can accomodate + // The largest "small object" we can accommodate static std::size_t constexpr max_size = 72; std::aligned_storage::type d_; diff --git a/include/xrpl/protocol/detail/ledger_entries.macro b/include/xrpl/protocol/detail/ledger_entries.macro index 1034c35895..de9c41bf52 100644 --- a/include/xrpl/protocol/detail/ledger_entries.macro +++ b/include/xrpl/protocol/detail/ledger_entries.macro @@ -237,7 +237,7 @@ LEDGER_ENTRY(ltOFFER, 0x006f, Offer, offer, ({ {sfAdditionalBooks, soeOPTIONAL}, })) -/** A ledger object which describes a deposit preauthorization. +/** A ledger object which describes a deposit pre-authorization. \sa keylet::depositPreauth */ @@ -577,7 +577,7 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({ // - TrueTotalLoanValue = PaymentRemaining * PeriodicPayment // The unrounded true total value of the loan. // - // - TrueTotalPrincialOutstanding can be computed using the algorithm + // - TrueTotalPrincipalOutstanding can be computed using the algorithm // in the ripple::detail::loanPrincipalFromPeriodicPayment function. // // - TrueTotalInterestOutstanding = TrueTotalLoanValue - diff --git a/include/xrpl/resource/README.md b/include/xrpl/resource/README.md index 253e3c7625..e525ce83e3 100644 --- a/include/xrpl/resource/README.md +++ b/include/xrpl/resource/README.md @@ -66,7 +66,7 @@ values over time: this is implemented by the DecayingSample class. Each server in a cluster creates a list of IP addresses of end points that are imposing a significant load. This list is called Gossip, which is passed to other nodes in that cluster. Gossip helps individual -servers in the cluster identify IP addreses that might be unduly loading +servers in the cluster identify IP addresses that might be unduly loading the entire cluster. Again the recourse of the individual servers is to drop connections to those IP addresses that occur commonly in the gossip. diff --git a/include/xrpl/resource/detail/Logic.h b/include/xrpl/resource/detail/Logic.h index b1f90e0282..5bcfa42f31 100644 --- a/include/xrpl/resource/detail/Logic.h +++ b/include/xrpl/resource/detail/Logic.h @@ -61,7 +61,7 @@ private: // List of all active admin entries EntryIntrusiveList admin_; - // List of all inactve entries + // List of all inactive entries EntryIntrusiveList inactive_; // All imported gossip data diff --git a/include/xrpl/server/detail/LowestLayer.h b/include/xrpl/server/detail/LowestLayer.h index 57647867e3..c45d948241 100644 --- a/include/xrpl/server/detail/LowestLayer.h +++ b/include/xrpl/server/detail/LowestLayer.h @@ -9,7 +9,7 @@ namespace xrpl { -// Before boost 1.70, get_lowest_layer required an explicit templat parameter +// Before boost 1.70, get_lowest_layer required an explicit template parameter template decltype(auto) get_lowest_layer(T& t) noexcept diff --git a/include/xrpl/shamap/README.md b/include/xrpl/shamap/README.md index 3bff74e67b..419918c0cb 100644 --- a/include/xrpl/shamap/README.md +++ b/include/xrpl/shamap/README.md @@ -226,7 +226,7 @@ The `fetchNodeNT()` method goes through three phases: Any SHAMapLeafNode that is immutable has a sequence number of zero (sharable). When a mutable `SHAMap` is created then its SHAMapTreeNodes are - given non-zero sequence numbers (unsharable). But all nodes in the + given non-zero sequence numbers (unshareable). But all nodes in the TreeNodeCache are immutable, so if one is found here, its sequence number will be 0. diff --git a/include/xrpl/shamap/SHAMapItem.h b/include/xrpl/shamap/SHAMapItem.h index a69f40113d..e8d95b0684 100644 --- a/include/xrpl/shamap/SHAMapItem.h +++ b/include/xrpl/shamap/SHAMapItem.h @@ -125,13 +125,13 @@ intrusive_ptr_release(SHAMapItem const* x) { auto p = reinterpret_cast(x); - // The SHAMapItem constuctor isn't trivial (because the destructor + // The SHAMapItem constructor isn't trivial (because the destructor // for CountedObject isn't) so we can't avoid calling it here, but // plan for a future where we might not need to. if constexpr (!std::is_trivially_destructible_v) std::destroy_at(x); - // If the slabber doens't claim this pointer, it was allocated + // If the slabber doesn't claim this pointer, it was allocated // manually, so we free it manually. if (!detail::slabber.deallocate(const_cast(p))) delete[] p; diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 96c13c9db8..9984b26ffe 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -38,8 +38,8 @@ Number::setround(rounding_mode mode) // Guard -// The Guard class is used to tempoarily add extra digits of -// preicision to an operation. This enables the final result +// The Guard class is used to temporarily add extra digits of +// precision to an operation. This enables the final result // to be correctly rounded to the internal precision of Number. class Number::Guard diff --git a/src/libxrpl/basics/make_SSLContext.cpp b/src/libxrpl/basics/make_SSLContext.cpp index 579edb0f71..ef5996e051 100644 --- a/src/libxrpl/basics/make_SSLContext.cpp +++ b/src/libxrpl/basics/make_SSLContext.cpp @@ -28,7 +28,7 @@ namespace xrpl { namespace openssl { namespace detail { -/** The default strength of self-signed RSA certifices. +/** The default strength of self-signed RSA certificates. Per NIST Special Publication 800-57 Part 3, 2048-bit RSA is still considered acceptably secure. Generally, we would want to go above @@ -131,7 +131,7 @@ initAnonymous(boost::asio::ssl::context& context) LogicError("X509_new failed"); // According to the standards (X.509 et al), the value should be one - // less than the actualy certificate version we want. Since we want + // less than the actually certificate version we want. Since we want // version 3, we must use a 2. X509_set_version(x509, 2); diff --git a/src/libxrpl/json/Writer.cpp b/src/libxrpl/json/Writer.cpp index fcdceb7253..6da29211ca 100644 --- a/src/libxrpl/json/Writer.cpp +++ b/src/libxrpl/json/Writer.cpp @@ -193,7 +193,7 @@ public: } private: - // JSON collections are either arrrays, or objects. + // JSON collections are either arrays, or objects. struct Collection { explicit Collection() = default; diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index c817a85b65..329d3cfcae 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -3244,7 +3244,7 @@ enforceMPTokenAuthorization( auto const maybeDomainID = sleIssuance->at(~sfDomainID); bool expired = false; bool const authorizedByDomain = [&]() -> bool { - // NOTE: defensive here, shuld be checked in preclaim + // NOTE: defensive here, should be checked in preclaim if (!maybeDomainID.has_value()) return false; // LCOV_EXCL_LINE diff --git a/src/libxrpl/protocol/IOUAmount.cpp b/src/libxrpl/protocol/IOUAmount.cpp index 01283886e1..5c9ab1febc 100644 --- a/src/libxrpl/protocol/IOUAmount.cpp +++ b/src/libxrpl/protocol/IOUAmount.cpp @@ -18,7 +18,7 @@ namespace xrpl { namespace { -// Use a static inside a function to help prevent order-of-initialzation issues +// Use a static inside a function to help prevent order-of-initialization issues LocalValue& getStaticSTNumberSwitchover() { diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index 824453a4d3..ebccfb3e64 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -662,7 +662,7 @@ STAmount::getFullText() const std::string STAmount::getText() const { - // keep full internal accuracy, but make more human friendly if posible + // keep full internal accuracy, but make more human friendly if possible if (*this == beast::zero) return "0"; diff --git a/src/libxrpl/protocol/tokens.cpp b/src/libxrpl/protocol/tokens.cpp index d4253a2df1..420eb56df0 100644 --- a/src/libxrpl/protocol/tokens.cpp +++ b/src/libxrpl/protocol/tokens.cpp @@ -649,7 +649,7 @@ encodeBase58Token( return detail::b256_to_b58_be(b58Span, out); } // Convert from base 58 to base 256, largest coefficients first -// The input is encoded in XPRL format, with the token in the first +// The input is encoded in XRPL format, with the token in the first // byte and the checksum in the last four bytes. // The decoded base 256 value does not include the token type or checksum. // It is an error if the token type or checksum does not match. diff --git a/src/test/app/AccountDelete_test.cpp b/src/test/app/AccountDelete_test.cpp index 749ed33e28..44d484ac7a 100644 --- a/src/test/app/AccountDelete_test.cpp +++ b/src/test/app/AccountDelete_test.cpp @@ -103,7 +103,7 @@ public: env(trust(becky, gw["USD"](1000))); env.close(); - // Give carol a deposit preauthorization, an offer, a ticket, + // Give carol a deposit pre-authorization, an offer, a ticket, // a signer list, and a DID. Even with all that she's still deletable. env(deposit::auth(carol, becky)); std::uint32_t const carolOfferSeq{env.seq(carol)}; @@ -176,7 +176,7 @@ public: auto const carolOldBalance{env.balance(carol)}; // Verify that Carol's account, directory, deposit - // preauthorization, offer, ticket, and signer list exist. + // pre-authorization, offer, ticket, and signer list exist. BEAST_EXPECT(env.closed()->exists(keylet::account(carol.id()))); BEAST_EXPECT(env.closed()->exists(keylet::ownerDir(carol.id()))); BEAST_EXPECT(env.closed()->exists( @@ -886,7 +886,7 @@ public: env, eaton, carol, credType)[jss::result][jss::index] .asString(); - // fred make preauthorization through authorized account + // fred make pre-authorization through authorized account env(fset(fred, asfDepositAuth)); env.close(); env(deposit::auth(fred, eaton)); diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index 9add892073..a320bccfe8 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -506,7 +506,7 @@ public: // Parameters: // table: Our table of known and vetoed amendments - // validators: The addreses of validators we trust + // validators: The addresses of validators we trust // votes: Amendments and the number of validators who vote for them // ourVotes: The amendments we vote for in our validation // enabled: In/out enabled amendments diff --git a/src/test/app/DepositAuth_test.cpp b/src/test/app/DepositAuth_test.cpp index 4235c8c9ca..775d7b1e81 100644 --- a/src/test/app/DepositAuth_test.cpp +++ b/src/test/app/DepositAuth_test.cpp @@ -15,7 +15,7 @@ reserve(jtx::Env& env, std::uint32_t count) return env.current()->fees().accountReserve(count); } -// Helper function that returns true if acct has the lsfDepostAuth flag set. +// Helper function that returns true if acct has the lsfDepositAuth flag set. static bool hasDepositAuth(jtx::Env const& env, jtx::Account const& acct) { @@ -512,7 +512,7 @@ struct DepositPreauth_test : public beast::unit_test::suite env.require(owners(carol, 1)); env.require(owners(becky, 0)); - // But carol can't meet the reserve for another preauthorization. + // But carol can't meet the reserve for another pre-authorization. env(deposit::auth(carol, alice), ter(tecINSUFFICIENT_RESERVE)); env.close(); env.require(owners(carol, 1)); @@ -724,7 +724,7 @@ struct DepositPreauth_test : public beast::unit_test::suite env.fund(XRP(5000), issuer, bob, alice); env.close(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); @@ -737,7 +737,7 @@ struct DepositPreauth_test : public beast::unit_test::suite env(deposit::auth(bob, alice)); env.close(); - // And alice can't pay with any credentials, amendement is not + // And alice can't pay with any credentials, amendment is not // enabled std::string const invalidIdx = "0E0B04ED60588A758B67E21FBBE95AC5A63598BA951761DC0EC9C08D7E" @@ -765,11 +765,11 @@ struct DepositPreauth_test : public beast::unit_test::suite credentials::ledgerEntry(env, alice, issuer, credType); std::string const credIdx = jv[jss::result][jss::index].asString(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); - // Bob will accept payements from accounts with credentials signed + // Bob will accept payments from accounts with credentials signed // by 'issuer' env(deposit::authCredentials(bob, {{issuer, credType}})); env.close(); @@ -838,12 +838,12 @@ struct DepositPreauth_test : public beast::unit_test::suite std::string const credIdx = jv[jss::result][jss::index].asString(); { - // Success as destination didn't enable preauthorization so + // Success as destination didn't enable pre-authorization so // valid credentials will not fail env(pay(alice, bob, XRP(100)), credentials::ids({credIdx})); } - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); @@ -1141,7 +1141,7 @@ struct DepositPreauth_test : public beast::unit_test::suite jv = credentials::ledgerEntry(env, alice, issuer, credType2); std::string const credIdx2 = jv[jss::result][jss::index].asString(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); // Bob setup DepositPreauth object @@ -1268,7 +1268,7 @@ struct DepositPreauth_test : public beast::unit_test::suite jv = credentials::ledgerEntry(env, zelda, issuer, credType); std::string const credIdx = jv[jss::result][jss::index].asString(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); // Bob setup DepositPreauth object diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index d4a9fc5b9d..25bb03858e 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1553,7 +1553,7 @@ struct Escrow_test : public beast::unit_test::suite escrow::finish_time(env.now() + 50s)); env.close(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); @@ -1635,7 +1635,7 @@ struct Escrow_test : public beast::unit_test::suite escrow::finish_time(env.now() + 1s)); env.close(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); env(deposit::authCredentials(bob, {{zelda, credType}})); diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index baa33b2dc5..ad457cc58b 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -135,7 +135,7 @@ class FixNFTokenPageLinks_test : public beast::unit_test::suite // Preflight { - // Fail preflight1. Can't combine AcccountTxnID and ticket. + // Fail preflight1. Can't combine AccountTxnID and ticket. Json::Value tx = ledgerStateFix::nftPageLinks(alice, alice); tx[sfAccountTxnID.jsonName] = "00000000000000000000000000000000" diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 8eb3047dc8..61b4e7ba76 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -888,7 +888,7 @@ class Invariants_test : public beast::unit_test::suite doInvariantCheck( {{"escrow specifies invalid amount"}}, [](Account const& A1, Account const&, ApplyContext& ac) { - // mpissuance outstanding is negative + // mptissuance outstanding is negative auto const sle = ac.view().peek(keylet::account(A1.id())); if (!sle) return false; @@ -906,7 +906,7 @@ class Invariants_test : public beast::unit_test::suite doInvariantCheck( {{"escrow specifies invalid amount"}}, [](Account const& A1, Account const&, ApplyContext& ac) { - // mpissuance locked is less than locked + // mptissuance locked is less than locked auto const sle = ac.view().peek(keylet::account(A1.id())); if (!sle) return false; @@ -924,7 +924,7 @@ class Invariants_test : public beast::unit_test::suite doInvariantCheck( {{"escrow specifies invalid amount"}}, [](Account const& A1, Account const&, ApplyContext& ac) { - // mpissuance outstanding is less than locked + // mptissuance outstanding is less than locked auto const sle = ac.view().peek(keylet::account(A1.id())); if (!sle) return false; @@ -3179,7 +3179,7 @@ class Invariants_test : public beast::unit_test::suite sleShares->at(sfSequence) = sequence; // sleVault->at(sfAccount) = pseudoId; - // Setting wrong pseudo acocunt ID + // Setting wrong pseudo account ID sleVault->at(sfAccount) = A2.id(); sleVault->at(sfFlags) = 0; sleVault->at(sfSequence) = sequence; @@ -3222,7 +3222,7 @@ class Invariants_test : public beast::unit_test::suite sleShares->setFieldU64(sfOwnerNode, *sharesPage); sleShares->at(sfFlags) = 0; - // Setting wrong pseudo acocunt ID + // Setting wrong pseudo account ID sleShares->at(sfIssuer) = AccountID(uint160(42)); sleShares->at(sfOutstandingAmount) = 0; sleShares->at(sfSequence) = sequence; diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 72a732d043..5915ebae91 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -974,7 +974,7 @@ class LoanBroker_test : public beast::unit_test::suite return coverWithdraw(alice, brokerKeylet.key, asset(10)); }); - // preclaim: tecWRONG_ASSSET + // preclaim: tecWRONG_ASSET env(coverWithdraw(alice, brokerKeylet.key, issuer["BAD"](10)), ter(tecWRONG_ASSET), THISLINE); diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 1de142c2ab..62531f2b8f 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -115,7 +115,7 @@ class MPToken_test : public beast::unit_test::suite .metadata = "", .err = temMALFORMED}); - // MaximumAmout of 0 returns error + // MaximumAmount of 0 returns error mptAlice.create( {.maxAmt = 0, .assetScale = 1, @@ -400,7 +400,7 @@ class MPToken_test : public beast::unit_test::suite // a mptoken yet mptAlice.authorize({.holder = bob, .err = tecOBJECT_NOT_FOUND}); - // alice specifys a holder acct that doesn't exist + // alice specifies a holder acct that doesn't exist mptAlice.authorize({.holder = cindy, .err = tecNO_DST}); // bob now holds a mptoken object @@ -1805,7 +1805,7 @@ class MPToken_test : public beast::unit_test::suite // alice authorizes bob to hold funds mptAlice.authorize({.account = alice, .holder = bob}); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); @@ -1884,7 +1884,7 @@ class MPToken_test : public beast::unit_test::suite // alice authorizes bob to hold funds mptAlice.authorize({.account = alice, .holder = bob}); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index 828539f4b1..a1c6ffb6de 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -165,7 +165,7 @@ class NFTokenBurn_test : public beast::unit_test::suite // prevent alice's and minter's NFTs from clustering together // in becky's directory. // - // Use a default initialized mercenne_twister because we want the + // Use a default initialized mersenne_twister because we want the // effect of random numbers, but we want the test to run the same // way each time. std::mt19937 engine; diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 75bf59e70d..59995a4078 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -429,7 +429,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite if (replacement->getFieldU32(sfMintedNFTokens) != 1) return false; // Unexpected test conditions. - // Wequence number is generated by sfFirstNFTokenSequence + + // Sequence number is generated by sfFirstNFTokenSequence + // sfMintedNFTokens. We can replace the two fields with any // numbers as long as they add up to the largest valid number. // In our case, sfFirstNFTokenSequence is set to the largest @@ -1423,7 +1423,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite env.close(); // minter1 is no longer alice's minter, so no longer has - // permisson to burn alice's nfts. + // permission to burn alice's nfts. env(token::burn(minter1, burnableID), token::owner(buyer), ter(tecNO_PERMISSION)); @@ -2003,7 +2003,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite BEAST_EXPECT(ownerCount(env, becky) == 1); BEAST_EXPECT(ownerCount(env, minter) == 0); - // Just for tidyness, becky burns the token before shutting + // Just for tidiness, becky burns the token before shutting // things down. env(token::burn(becky, nftAliceID)); env.close(); @@ -5853,7 +5853,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // alice tries to delete her account, but is unsuccessful. // Due to authorized minting, alice's account sequence does not // advance while minter mints NFTokens for her. - // The new account deletion retriction enabled by this amendment will enforce // alice to wait for more ledgers to close before she can // delete her account, to prevent duplicate NFTokenIDs @@ -5955,7 +5955,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // alice tries to delete her account, but is unsuccessful. // Due to authorized minting, alice's account sequence does not // advance while minter mints NFTokens for her using tickets. - // The new account deletion retriction enabled by this amendment will enforce // alice to wait for more ledgers to close before she can // delete her account, to prevent duplicate NFTokenIDs @@ -6061,7 +6061,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // alice tries to delete her account, but is unsuccessful. // Due to authorized minting, alice's account sequence does not // advance while minter mints NFTokens for her using tickets. - // The new account deletion retriction enabled by this amendment will enforce // alice to wait for more ledgers to close before she can delete her // account, to prevent duplicate NFTokenIDs @@ -6388,7 +6388,7 @@ class NFTokenBaseUtil_test : public beast::unit_test::suite // // The values of these fields are dependent on the NFTokenID/OfferID // changed in its corresponding transaction. We want to validate each - // transaction to make sure the synethic fields hold the right values. + // transaction to make sure the synthetic fields hold the right values. testcase("Test synthetic fields from JSON response"); diff --git a/src/test/app/PayChan_test.cpp b/src/test/app/PayChan_test.cpp index 20a433b5dd..ed8c3c507e 100644 --- a/src/test/app/PayChan_test.cpp +++ b/src/test/app/PayChan_test.cpp @@ -763,7 +763,7 @@ struct PayChan_test : public beast::unit_test::suite BEAST_EXPECT(env.balance(bob) == preBob + delta - baseFee); } { - // Explore the limits of deposit preauthorization. + // Explore the limits of deposit pre-authorization. auto const delta = XRP(600).value(); auto const sig = signClaimAuth(pk, alice.sk(), chan, delta); @@ -799,7 +799,7 @@ struct PayChan_test : public beast::unit_test::suite env.balance(bob) == preBob + delta - (3 * baseFee)); } { - // bob removes preauthorization of alice. Once again she + // bob removes pre-authorization of alice. Once again she // cannot submit a claim. auto const delta = XRP(800).value(); @@ -874,7 +874,7 @@ struct PayChan_test : public beast::unit_test::suite credentials::ledgerEntry(env, alice, carol, credType); std::string const credIdx = jv[jss::result][jss::index].asString(); - // Bob require preauthorization + // Bob require pre-authorization env(fset(bob, asfDepositAuth)); env.close(); diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index b5db131db6..c29b5344e2 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -1534,7 +1534,7 @@ public: { FeatureBitset const all{jtx::testable_amendments()}; - // Test domain offer (w/o hyrbid) + // Test domain offer (w/o hybrid) testOfferCreate(all); testPayment(all); testBookStep(all); diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index 71a5b7fa73..1118818d7a 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -422,7 +422,7 @@ public: 1, detail::default_expires, std::chrono::seconds{-90}}}); - // fetch single site with undending redirect (fails to load) + // fetch single site with unending redirect (fails to load) testFetchList( good, {{"/redirect_forever/301", @@ -443,7 +443,7 @@ public: ssl, true, true}}); - // one undending redirect, one not + // one unending redirect, one not testFetchList( good, {{"/validators", "", ssl}, @@ -452,7 +452,7 @@ public: ssl, true, true}}); - // one undending redirect, one not + // one unending redirect, one not testFetchList( good, {{"/validators2", "", ssl}, diff --git a/src/test/basics/IntrusiveShared_test.cpp b/src/test/basics/IntrusiveShared_test.cpp index d5d5d75048..b77325efa9 100644 --- a/src/test/basics/IntrusiveShared_test.cpp +++ b/src/test/basics/IntrusiveShared_test.cpp @@ -394,7 +394,7 @@ public: { // strong goes out of scope while weak is still in scope // This checks that partialDelete has run to completion - // before the desturctor is called. A sleep is inserted + // before the destructor is called. A sleep is inserted // inside the partial delete to make sure the destructor is // given an opportunity to run durring partial delete. BEAST_EXPECT(cur == partiallyDeleted); diff --git a/src/test/basics/XRPAmount_test.cpp b/src/test/basics/XRPAmount_test.cpp index da03a3533f..3f4e68de6e 100644 --- a/src/test/basics/XRPAmount_test.cpp +++ b/src/test/basics/XRPAmount_test.cpp @@ -218,7 +218,7 @@ public: // multiply and divide by values that would overflow if done // naively, and check that it gives the correct answer - big -= 0xf; // Subtract a little so it's divisable by 4 + big -= 0xf; // Subtract a little so it's divisible by 4 BEAST_EXPECT( mulRatio(big, 3, 4, false).value() == (big.value() / 4) * 3); BEAST_EXPECT( diff --git a/src/test/consensus/ByzantineFailureSim_test.cpp b/src/test/consensus/ByzantineFailureSim_test.cpp index 0a988f0473..210333e303 100644 --- a/src/test/consensus/ByzantineFailureSim_test.cpp +++ b/src/test/consensus/ByzantineFailureSim_test.cpp @@ -63,7 +63,7 @@ class ByzantineFailureSim_test : public beast::unit_test::suite { peer->submit(Tx{0}); // Peers 0,1,2,6 will close the next ledger differently by injecting - // a non-consensus approved transaciton + // a non-consensus approved transaction if (byzantineNodes.contains(peer)) { peer->txInjections.emplace( diff --git a/src/test/consensus/Consensus_test.cpp b/src/test/consensus/Consensus_test.cpp index 85dd5e3957..b7bfb302bc 100644 --- a/src/test/consensus/Consensus_test.cpp +++ b/src/test/consensus/Consensus_test.cpp @@ -63,7 +63,7 @@ public: using namespace std::chrono_literals; testcase("check consensus"); - // Use default parameterss + // Use default parameters ConsensusParms const p{}; /////////////// @@ -74,7 +74,7 @@ public: ConsensusState::No == checkConsensus(10, 2, 2, 0, 3s, 2s, false, p, true, journal_)); - // If not enough peers have propsed, ensure + // If not enough peers have proposed, ensure // more time for proposals BEAST_EXPECT( ConsensusState::No == @@ -119,7 +119,7 @@ public: ConsensusState::No == checkConsensus(10, 2, 2, 0, 3s, 2s, true, p, true, journal_)); - // If not enough peers have propsed, ensure + // If not enough peers have proposed, ensure // more time for proposals BEAST_EXPECT( ConsensusState::No == @@ -661,7 +661,7 @@ public: // Run to the ledger *prior* to decreasing the resolution sim.run(increaseLedgerTimeResolutionEvery - 2); - // In order to create the discrepency, we want a case where if + // In order to create the discrepancy, we want a case where if // X = effCloseTime(closeTime, resolution, parentCloseTime) // X != effCloseTime(X, resolution, parentCloseTime) // @@ -906,7 +906,7 @@ public: // for B. // - The network reconnects and the validations for generation 3 ledgers // are observed (D and the 8 C's) - // - In the old approach, 2 votes for D outweights 1 vote for each C' + // - In the old approach, 2 votes for D outweighs 1 vote for each C' // so the network would avalanche towards D and fully validate it // EVEN though C was fully validated by one node // - In the new approach, 2 votes for D are not enough to outweight the @@ -1029,7 +1029,7 @@ public: // The "ahead" validators run normal speed and run ahead validating the // upper chain of ledgers. // - // Due to the uncommited support definition of the preferred branch + // Due to the uncommitted support definition of the preferred branch // protocol, even if the "behind" validators are a majority, the "ahead" // validators cannot jump to the proper branch until the "behind" // validators catch up to the same sequence number. For this test to diff --git a/src/test/consensus/DistributedValidatorsSim_test.cpp b/src/test/consensus/DistributedValidatorsSim_test.cpp index 006c1aab4e..1a088576ce 100644 --- a/src/test/consensus/DistributedValidatorsSim_test.cpp +++ b/src/test/consensus/DistributedValidatorsSim_test.cpp @@ -59,7 +59,7 @@ class DistributedValidators_test : public beast::unit_test::suite // Initial round to set prior state sim.run(1); - // Run for 10 minues, submitting 100 tx/second + // Run for 10 minutes, submitting 100 tx/second std::chrono::nanoseconds const simDuration = 10min; std::chrono::nanoseconds const quiet = 10s; Rate const rate{100, 1000ms}; @@ -163,7 +163,7 @@ class DistributedValidators_test : public beast::unit_test::suite // Initial round to set prior state sim.run(1); - // Run for 10 minues, submitting 100 tx/second + // Run for 10 minutes, submitting 100 tx/second std::chrono::nanoseconds simDuration = 10min; std::chrono::nanoseconds quiet = 10s; Rate rate{100, 1000ms}; diff --git a/src/test/consensus/ScaleFreeSim_test.cpp b/src/test/consensus/ScaleFreeSim_test.cpp index 53c5030f29..dee4c77268 100644 --- a/src/test/consensus/ScaleFreeSim_test.cpp +++ b/src/test/consensus/ScaleFreeSim_test.cpp @@ -56,7 +56,7 @@ class ScaleFreeSim_test : public beast::unit_test::suite // Initialize timers HeartbeatTimer heart(sim.scheduler, seconds(10s)); - // Run for 10 minues, submitting 100 tx/second + // Run for 10 minutes, submitting 100 tx/second std::chrono::nanoseconds const simDuration = 10min; std::chrono::nanoseconds const quiet = 10s; Rate const rate{100, 1000ms}; diff --git a/src/test/csf/CollectorRef.h b/src/test/csf/CollectorRef.h index 3aa2c6495f..022db01008 100644 --- a/src/test/csf/CollectorRef.h +++ b/src/test/csf/CollectorRef.h @@ -8,7 +8,7 @@ namespace xrpl { namespace test { namespace csf { -/** Holds a type-erased reference to an arbitray collector. +/** Holds a type-erased reference to an arbitrary collector. A collector is any class that implements diff --git a/src/test/csf/Histogram.h b/src/test/csf/Histogram.h index e32fded2f2..61ec680939 100644 --- a/src/test/csf/Histogram.h +++ b/src/test/csf/Histogram.h @@ -26,7 +26,7 @@ template > class Histogram { // TODO: Consider logarithmic bins around expected median if this becomes - // unscaleable + // unscalable std::map counts_; std::size_t samples = 0; diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index f00b929967..3096a902b1 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -29,7 +29,7 @@ namespace xrpl { namespace test { namespace jtx { -/** Generic helper class for helper clases that set a field on a JTx. +/** Generic helper class for helper classes that set a field on a JTx. Not every helper will be able to use this because of conversions and other issues, but for classes where it's straightforward, this can simplify things. diff --git a/src/test/jtx/deposit.h b/src/test/jtx/deposit.h index 5ea1e5bf06..e378366563 100644 --- a/src/test/jtx/deposit.h +++ b/src/test/jtx/deposit.h @@ -15,7 +15,7 @@ namespace deposit { Json::Value auth(Account const& account, Account const& auth); -/** Remove preauthorization for deposit. Invoke as deposit::unauth. */ +/** Remove pre-authorization for deposit. Invoke as deposit::unauth. */ Json::Value unauth(Account const& account, Account const& unauth); diff --git a/src/test/jtx/rpc.h b/src/test/jtx/rpc.h index 5a7c205aac..ba3c71074d 100644 --- a/src/test/jtx/rpc.h +++ b/src/test/jtx/rpc.h @@ -49,7 +49,7 @@ public: // always obtained from the lookup into the ErrorInfo lookup table. // // Take advantage of that fact to populate jt.rpcException. The - // check will be aware of whether the rpcExcpetion can be safely + // check will be aware of whether the rpcException can be safely // ignored. jt.rpcCode = { *code_, diff --git a/src/test/protocol/Seed_test.cpp b/src/test/protocol/Seed_test.cpp index 65428295f8..d33f397921 100644 --- a/src/test/protocol/Seed_test.cpp +++ b/src/test/protocol/Seed_test.cpp @@ -292,7 +292,7 @@ public: testcase("Parsing"); // account IDs and node and account public and private - // keys should not be parseable as seeds. + // keys should not be parsable as seeds. auto const node1 = randomKeyPair(KeyType::secp256k1); diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index e438d50633..4f3e1817e1 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -667,7 +667,7 @@ public: env(deposit::auth(gw, alice)); env.close(); { - // Find the preauthorization. + // Find the pre-authorization. Json::Value const resp = acctObjs(gw, jss::deposit_preauth); BEAST_EXPECT(acctObjsIsSize(resp, 1)); diff --git a/src/test/rpc/ManifestRPC_test.cpp b/src/test/rpc/ManifestRPC_test.cpp index 5d4f4900eb..96326e010f 100644 --- a/src/test/rpc/ManifestRPC_test.cpp +++ b/src/test/rpc/ManifestRPC_test.cpp @@ -30,7 +30,7 @@ public: "Missing field 'public_key'."); } { - // manifest with manlformed public key + // manifest with malformed public key auto const info = env.rpc( "json", "manifest", diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 1637554f5c..5a58c27ea8 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -1362,7 +1362,7 @@ public: // // The values of these fields are dependent on the NFTokenID/OfferID // changed in its corresponding transaction. We want to validate each - // response to make sure the synethic fields hold the right values. + // response to make sure the synthetic fields hold the right values. testcase("Test synthetic fields from Subscribe response"); diff --git a/src/tests/libxrpl/basics/base64.cpp b/src/tests/libxrpl/basics/base64.cpp index e4581126b4..f6544105d8 100644 --- a/src/tests/libxrpl/basics/base64.cpp +++ b/src/tests/libxrpl/basics/base64.cpp @@ -16,6 +16,7 @@ check(std::string const& in, std::string const& out) TEST_CASE("base64") { + // cspell: disable check("", ""); check("f", "Zg=="); check("fo", "Zm8="); @@ -23,6 +24,7 @@ TEST_CASE("base64") check("foob", "Zm9vYg=="); check("fooba", "Zm9vYmE="); check("foobar", "Zm9vYmFy"); + // cspell: enable check( "Man is distinguished, not only by his reason, but by this " diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index e26cde9801..2e33bbae14 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -59,7 +59,7 @@ class RCLConsensus // The timestamp of the last validation we used NetClock::time_point lastValidationTime_; - // These members are queried via public accesors and are atomic for + // These members are queried via public accessors and are atomic for // thread safety. std::atomic validating_{false}; std::atomic prevProposers_{0}; diff --git a/src/xrpld/app/ledger/AbstractFetchPackContainer.h b/src/xrpld/app/ledger/AbstractFetchPackContainer.h index 85efe09e29..d2cdd1e920 100644 --- a/src/xrpld/app/ledger/AbstractFetchPackContainer.h +++ b/src/xrpld/app/ledger/AbstractFetchPackContainer.h @@ -16,7 +16,7 @@ class AbstractFetchPackContainer public: virtual ~AbstractFetchPackContainer() = default; - /** Retrieves partial ledger data of the coresponding hash from peers.` + /** Retrieves partial ledger data of the corresponding hash from peers.` @param nodeHash The 256-bit hash of the data to fetch. @return `std::nullopt` if the hash isn't cached, diff --git a/src/xrpld/app/ledger/BookListeners.cpp b/src/xrpld/app/ledger/BookListeners.cpp index 69d03058a9..ebd59c3fcc 100644 --- a/src/xrpld/app/ledger/BookListeners.cpp +++ b/src/xrpld/app/ledger/BookListeners.cpp @@ -30,7 +30,7 @@ BookListeners::publish( if (p) { - // Only publish jvObj if this is the first occurence + // Only publish jvObj if this is the first occurrence if (havePublished.emplace(p->getSeq()).second) { jvObj.visit( diff --git a/src/xrpld/app/ledger/README.md b/src/xrpld/app/ledger/README.md index d2afe01e71..cb935897b8 100644 --- a/src/xrpld/app/ledger/README.md +++ b/src/xrpld/app/ledger/README.md @@ -450,7 +450,7 @@ back as the database goes. If requested, it can additionally repair the SQLite entries for transactions in each checked ledger. This was primarily intended to repair incorrect -entries created by a bug (since fixed) that could cause transasctions from a +entries created by a bug (since fixed) that could cause transactions from a ledger other than the fully-validated ledger to appear in the SQLite databases in addition to the transactions from the correct ledger. diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index e415ee14cf..6ed902ec1e 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -413,7 +413,7 @@ GRPCServerImpl::handleRpcs() // tells us whether there is any kind of event or cq_ is shutting down. // When cq_.Next(...) returns false, all work has been completed and the // loop can exit. When the server is shutdown, each CallData object that is - // listening for a request is forceably cancelled, and is returned by + // listening for a request is forcibly cancelled, and is returned by // cq_->Next() with ok set to false. Then, each CallData object processing // a request must complete (by sending data to the client), each of which // will be returned from cq_->Next() with ok set to true. After all diff --git a/src/xrpld/app/main/GRPCServer.h b/src/xrpld/app/main/GRPCServer.h index dab71303c4..c2697e26c6 100644 --- a/src/xrpld/app/main/GRPCServer.h +++ b/src/xrpld/app/main/GRPCServer.h @@ -126,7 +126,7 @@ public: getEndpoint() const; private: - // Class encompasing the state and logic needed to serve a request. + // Class encompassing the state and logic needed to serve a request. template class CallData : public Processor, diff --git a/src/xrpld/app/misc/FeeEscalation.md b/src/xrpld/app/misc/FeeEscalation.md index 468ab2b528..7843620320 100644 --- a/src/xrpld/app/misc/FeeEscalation.md +++ b/src/xrpld/app/misc/FeeEscalation.md @@ -237,7 +237,7 @@ often coincides with new ledgers with zero transactions. recover if the problem is temporary. These exact values were chosen experimentally, and can easily change in the future. - _Minimum `lastLedgerMedianFeeLevel`_. The value of 500 was chosen to - ensure that the first escalated fee was more significant and noticable + ensure that the first escalated fee was more significant and noticeable than what the default would allow. This exact value was chosen experimentally, and can easily change in the future. - _Transaction queue size limit_. The limit is computed based on the @@ -291,7 +291,7 @@ single-singed reference transaction. It is up to the user to compute the necessary fees for other types of transactions. (E.g. multiply all drop values by 5 for a multi-signed transaction with 4 signatures.) -The `fee` result is always instantanteous, and relates to the open +The `fee` result is always instantaneous, and relates to the open ledger. It includes the sequence number of the current open ledger, but may not make sense if rippled is not synced to the network. diff --git a/src/xrpld/app/misc/HashRouter.cpp b/src/xrpld/app/misc/HashRouter.cpp index 0cad01c27e..a2ba41b361 100644 --- a/src/xrpld/app/misc/HashRouter.cpp +++ b/src/xrpld/app/misc/HashRouter.cpp @@ -14,7 +14,7 @@ HashRouter::emplace(uint256 const& key) -> std::pair return std::make_pair(std::ref(iter->second), false); } - // See if any supressions need to be expired + // See if any suppressions need to be expired expire(suppressionMap_, setup_.holdTime); return std::make_pair( diff --git a/src/xrpld/app/misc/HashRouter.h b/src/xrpld/app/misc/HashRouter.h index 1b59797b28..449097a387 100644 --- a/src/xrpld/app/misc/HashRouter.h +++ b/src/xrpld/app/misc/HashRouter.h @@ -193,7 +193,7 @@ public: virtual ~HashRouter() = default; - // VFALCO TODO Replace "Supression" terminology with something more + // VFALCO TODO Replace "Suppression" terminology with something more // semantically meaningful. void addSuppression(uint256 const& key); diff --git a/src/xrpld/app/misc/Manifest.h b/src/xrpld/app/misc/Manifest.h index 24e4f5f71f..c1a77be63b 100644 --- a/src/xrpld/app/misc/Manifest.h +++ b/src/xrpld/app/misc/Manifest.h @@ -303,7 +303,7 @@ public: std::optional getDomain(PublicKey const& pk) const; - /** Returns mainfest corresponding to a given public key + /** Returns manifest corresponding to a given public key @return manifest corresponding to Master public key if present, otherwise std::nullopt diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 084a584377..d0f93577da 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -290,7 +290,7 @@ public: * transactions and wait for this transaction to complete. * * @param transaction Transaction object. - * @param bUnliimited Whether a privileged client connection submitted it. + * @param bUnlimited Whether a privileged client connection submitted it. * @param failType fail_hard setting from transaction submission. */ void @@ -1260,7 +1260,7 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) return false; } - // NOTE eahennis - I think this check is redundant, + // NOTE ximinez - I think this check is redundant, // but I'm not 100% sure yet. // If so, only cost is looking up HashRouter flags. auto const [validity, reason] = @@ -2194,7 +2194,7 @@ NetworkOPsImp::endConsensus(std::unique_ptr const& clog) { // check if the ledger is good enough to go to FULL // Note: Do not go to FULL if we don't have the previous ledger - // check if the ledger is bad enough to go to CONNECTE D -- TODO + // check if the ledger is bad enough to go to CONNECTED -- TODO auto current = m_ledgerMaster.getCurrentLedger(); if (app_.timeKeeper().now() < (current->header().parentCloseTime + @@ -3638,7 +3638,7 @@ NetworkOPsImp::subAccount( auto simIterator = subMap.find(naAccountID); if (simIterator == subMap.end()) { - // Not found, note that account has a new single listner. + // Not found, note that account has a new single listener. SubMapType usisElement; usisElement[isrListener->getSeq()] = isrListener; // VFALCO NOTE This is making a needless copy of naAccountID @@ -4578,7 +4578,7 @@ NetworkOPsImp::getBookPage( Rate offerRate = parityRate; if (rate != parityRate - // Have a tranfer fee. + // Have a transfer fee. && uTakerID != book.out.account // Not taking offers of own IOUs. && book.out.account != uOfferOwnerID) @@ -4728,7 +4728,7 @@ NetworkOPsImp::getBookPage( Rate offerRate = parityRate; if (rate != parityRate - // Have a tranfer fee. + // Have a transfer fee. && uTakerID != book.out.account // Not taking offers of own IOUs. && book.out.account != uOfferOwnerID) @@ -4751,7 +4751,7 @@ NetworkOPsImp::getBookPage( saTakerGetsFunded.setJson(jvOffer[jss::taker_gets_funded]); - // TOOD(tom): The result of this expression is not used - what's + // TODO(tom): The result of this expression is not used - what's // going on here? std::min( saTakerPays, diff --git a/src/xrpld/app/misc/NetworkOPs.h b/src/xrpld/app/misc/NetworkOPs.h index 800f473959..5b92e4574b 100644 --- a/src/xrpld/app/misc/NetworkOPs.h +++ b/src/xrpld/app/misc/NetworkOPs.h @@ -31,9 +31,9 @@ class CanonicalTXSet; // should use this interface. The RPC code will primarily be a light wrapper // over this code. // -// Eventually, it will check the node's operating mode (synched, unsynched, -// etectera) and defer to the correct means of processing. The current -// code assumes this node is synched (and will continue to do so until +// Eventually, it will check the node's operating mode (synced, unsynced, +// etcetera) and defer to the correct means of processing. The current +// code assumes this node is synced (and will continue to do so until // there's a functional network. // diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 0e33a0bc10..98be038554 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -104,7 +104,7 @@ SHAMapStoreImp::SHAMapStoreImp( get_if_exists(section, "delete_batch", deleteBatch_); std::uint32_t temp; if (get_if_exists(section, "back_off_milliseconds", temp) || - // Included for backward compaibility with an undocumented setting + // Included for backward compatibility with an undocumented setting get_if_exists(section, "backOff", temp)) { backOff_ = std::chrono::milliseconds{temp}; diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index ac801a2cd0..9f75387744 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -221,7 +221,7 @@ public: } /** - * @brief setQueued Set this flag once was put into heldtxns queue + * @brief setQueued Set this flag once was put into held-txns queue */ void setQueued() diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index aff7fc89db..fb1b10e886 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -95,7 +95,7 @@ public: allowing more than `maximumTxnInLedger` "cheap" transactions into the open ledger. - @todo eahennis. This setting seems to go against our goals and + @todo ximinez. This setting seems to go against our goals and values. Can it be removed? */ std::optional maximumTxnInLedger; diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/xrpld/app/misc/detail/LendingHelpers.cpp index 51e0988bc4..37385583e7 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/xrpld/app/misc/detail/LendingHelpers.cpp @@ -1652,7 +1652,7 @@ computeLoanProperties( principalOutstanding = roundToAsset( asset, principalOutstanding, loanScale, Number::to_nearest); - // E diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/xrpld/app/tx/detail/CreateOffer.cpp index f81afecd55..848599943a 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/xrpld/app/tx/detail/CreateOffer.cpp @@ -814,11 +814,11 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) Book const book{saTakerPays.issue(), saTakerGets.issue(), domainID}; // Add offer to order book, using the original rate - // before any crossing occured. + // before any crossing occurred. // // Regular offer - BookDirectory points to open directory // - // Domain offer (w/o hyrbid) - BookDirectory points to domain + // Domain offer (w/o hybrid) - BookDirectory points to domain // directory // // Hybrid domain offer - BookDirectory points to domain directory, diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/src/xrpld/app/tx/detail/InvariantCheck.h index b7f91a1c46..ef9db373f5 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.h +++ b/src/xrpld/app/tx/detail/InvariantCheck.h @@ -613,7 +613,7 @@ public: }; /** - * @brief Invariants: Pseudo-accounts have valid and consisent properties + * @brief Invariants: Pseudo-accounts have valid and consistent properties * * Pseudo-accounts have certain properties, and some of those properties are * unique to pseudo-accounts. Check that all pseudo-accounts are following the diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.cpp b/src/xrpld/app/tx/detail/NFTokenUtils.cpp index c737855840..3a43cda6f0 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.cpp +++ b/src/xrpld/app/tx/detail/NFTokenUtils.cpp @@ -940,7 +940,7 @@ tokenOfferCreatePreclaim( { // If this is a sell offer, check that the account is allowed to // receive IOUs. If this is a buy offer, we have to check that trustline - // is authorized, even though we previosly checked it's balance via + // is authorized, even though we previously checked it's balance via // accountHolds. This is due to a possibility of existence of // unauthorized trustlines with balance auto const res = nft::checkTrustlineAuthorized( diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/xrpld/app/tx/detail/Payment.cpp index 7a14cecc2d..59c7431f4c 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/xrpld/app/tx/detail/Payment.cpp @@ -316,7 +316,7 @@ Payment::preclaim(PreclaimContext const& ctx) << "Delay transaction: Destination account does not exist. " << "Insufficent payment to create account."; - // TODO: dedupe + // TODO: de-dupe // Another transaction could create the account and then this // transaction would succeed. return tecNO_DST_INSUF_XRP; @@ -558,7 +558,7 @@ Payment::doApply() // If the actual amount delivered is different from the original // amount due to partial payment or transfer fee, we need to update - // DelieveredAmount using the actual delivered amount + // DeliveredAmount using the actual delivered amount if (view().rules().enabled(fixMPTDeliveredAmount) && amountDeliver != dstAmount) ctx_.deliver(amountDeliver); diff --git a/src/xrpld/conditions/detail/PreimageSha256.h b/src/xrpld/conditions/detail/PreimageSha256.h index 642a7afdc0..f495885794 100644 --- a/src/xrpld/conditions/detail/PreimageSha256.h +++ b/src/xrpld/conditions/detail/PreimageSha256.h @@ -37,7 +37,7 @@ public: static std::unique_ptr deserialize(Slice s, std::error_code& ec) { - // Per the RFC, a preimage fulfulliment is defined as + // Per the RFC, a preimage fulfillment is defined as // follows: // // PreimageFulfillment ::= SEQUENCE { diff --git a/src/xrpld/consensus/Consensus.cpp b/src/xrpld/consensus/Consensus.cpp index b71a36d538..46038e9d53 100644 --- a/src/xrpld/consensus/Consensus.cpp +++ b/src/xrpld/consensus/Consensus.cpp @@ -122,7 +122,7 @@ checkConsensusReached( // We only get stalled when there are disputed transactions and all of them // unequivocally have 80% (minConsensusPct) agreement, either for or - // against. That is: either under 20% or over 80% consensus (repectively + // against. That is: either under 20% or over 80% consensus (respectively // "nay" or "yay"). This prevents manipulation by a minority of byzantine // peers of which transactions make the cut to get into the ledger. if (stalled) diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index e25148aaa9..29d799bd62 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -137,7 +137,7 @@ public: // Network parameters uint32_t NETWORK_ID = 0; - // DEPRECATED - Fee units for a reference transction. + // DEPRECATED - Fee units for a reference transaction. // Only provided for backwards compatibility in a couple of places static constexpr std::uint32_t FEE_UNITS_DEPRECATED = 10; diff --git a/src/xrpld/core/detail/SociDB.cpp b/src/xrpld/core/detail/SociDB.cpp index a90e59beed..c04beaff29 100644 --- a/src/xrpld/core/detail/SociDB.cpp +++ b/src/xrpld/core/detail/SociDB.cpp @@ -279,7 +279,7 @@ public: protected: std::uintptr_t const id_; // session is owned by the DatabaseCon parent that holds the checkpointer. - // It is possible (tho rare) for the DatabaseCon class to be destoryed + // It is possible (though rare) for the DatabaseCon class to be destroyed // before the checkpointer. std::weak_ptr session_; std::mutex mutex_; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index c92a95149e..53237ed3ae 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -586,7 +586,7 @@ PeerImp::fail(std::string const& reason) if (!socket_.is_open()) return; - // Call to name() locks, log only if the message will be outputed + // Call to name() locks, log only if the message will be outputted if (journal_.active(beast::severities::kWarning)) { std::string const n = name(); diff --git a/src/xrpld/peerfinder/PeerfinderManager.h b/src/xrpld/peerfinder/PeerfinderManager.h index 7a25edcce5..fbb59eab0e 100644 --- a/src/xrpld/peerfinder/PeerfinderManager.h +++ b/src/xrpld/peerfinder/PeerfinderManager.h @@ -97,7 +97,7 @@ struct Config //------------------------------------------------------------------------------ -/** Describes a connectible peer address along with some metadata. */ +/** Describes a connectable peer address along with some metadata. */ struct Endpoint { Endpoint() = default; diff --git a/src/xrpld/peerfinder/README.md b/src/xrpld/peerfinder/README.md index a3f89fd446..806984035b 100644 --- a/src/xrpld/peerfinder/README.md +++ b/src/xrpld/peerfinder/README.md @@ -106,7 +106,7 @@ tuned heuristics. The fields are as follows: precision as an implementation defined percentage of `maxPeers` subject to an implementation defined floor. An instance of the PeerFinder rounds the fractional part up or down using a uniform random number generated at - program startup. This allows the outdegree of the overlay network to be + program startup. This allows the out-degree of the overlay network to be controlled with fractional precision, ensuring that all inbound network connection slots are not consumed (which would make it difficult for new participants to enter the network). @@ -138,7 +138,7 @@ connection test on that neighbor by initiating an outgoing connection to the remote IP address as seen on the connection combined with the port advertised in the Endpoint message. If the test fails, then the peer considers its neighbor firewalled (intentionally or due to misconfiguration) and not forward neighbor -endpoint in Endpoint messages. This prevents poor quality unconnectible +endpoint in Endpoint messages. This prevents poor quality un-connectable addresses from landing in the caches. If the incoming connection test passes, then the peer fills in the Endpoint message with the remote address as seen on the connection before storing it in its cache and forwarding it to other peers. @@ -150,7 +150,7 @@ it no longer has available inbound slots, its address will shortly after stop being handed out by other peers. Livecache entries are very likely to result in both a successful connection establishment and the acquisition of an active outbound slot. Compare this with Bootcache addresses, which are very likely to -be connectible but unlikely to have an open slot. +be connectable but unlikely to have an open slot. Because entries in the Livecache are ephemeral, they are not persisted across launches in the database. The Livecache is continually updated and expired as @@ -186,7 +186,7 @@ since they will have moved towards the core of the overlay over their high uptime. When a connected server is full it will return a handful of new addresses from its Livecache and gracefully close the connection. Addresses from the Livecache are highly likely to have inbound connection slots and be -connectible. +connectable. For security, all information that contributes to the ranking of Bootcache entries is observed locally. PeerFinder never trusts external sources of information. @@ -257,7 +257,7 @@ Slot properties may be combined and are not mutually exclusive. - **Superpeer** (forthcoming) A superpeer slot is a connection to a peer which can accept incoming - connections, meets certain resource availaibility requirements (such as + connections, meets certain resource availability requirements (such as bandwidth, CPU, and storage capacity), and operates full duplex in the overlay. Connections which are not superpeers are by definition leaves. A leaf slot is a connection to a peer which does not route overlay messages to @@ -321,7 +321,7 @@ stage remains active while: PeerFinder makes its best effort to exhaust addresses in the Livecache before moving on to the Bootcache, because Livecache addresses are highly likely -to be connectible (since they are known to have been online within the last +to be connectable (since they are known to have been online within the last minute), and highly likely to have an open slot for an incoming connection (because peers only advertise themselves in the Livecache when they have open slots). @@ -334,7 +334,7 @@ desired. The stage remains active while: - There are addresses in the cache that have not been tried recently. -Entries in the Bootcache are ranked, with highly connectible addresses preferred +Entries in the Bootcache are ranked, with highly connectable addresses preferred over others. Connection attempts to Bootcache addresses are very likely to succeed but unlikely to produce an active connection since the peers likely do not have open slots. Before the remote peer closes the connection it will send diff --git a/src/xrpld/peerfinder/detail/Checker.h b/src/xrpld/peerfinder/detail/Checker.h index 277ce8c74d..700768788a 100644 --- a/src/xrpld/peerfinder/detail/Checker.h +++ b/src/xrpld/peerfinder/detail/Checker.h @@ -14,7 +14,7 @@ namespace xrpl { namespace PeerFinder { -/** Tests remote listening sockets to make sure they are connectible. */ +/** Tests remote listening sockets to make sure they are connectable. */ template class Checker { diff --git a/src/xrpld/peerfinder/detail/Fixed.h b/src/xrpld/peerfinder/detail/Fixed.h index 4c89bc598e..4d4a407873 100644 --- a/src/xrpld/peerfinder/detail/Fixed.h +++ b/src/xrpld/peerfinder/detail/Fixed.h @@ -16,7 +16,7 @@ public: Fixed(Fixed const&) = default; - /** Returns the time after which we shoud allow a connection attempt. */ + /** Returns the time after which we should allow a connection attempt. */ clock_type::time_point const& when() const { diff --git a/src/xrpld/rpc/GRPCHandlers.h b/src/xrpld/rpc/GRPCHandlers.h index f3e8d74f9d..b98b3021a3 100644 --- a/src/xrpld/rpc/GRPCHandlers.h +++ b/src/xrpld/rpc/GRPCHandlers.h @@ -14,7 +14,7 @@ namespace xrpl { * nested inside RPC::GRPCContext, where T is the request type * The return value is the response type, as well as a status * If the status is not Status::OK (meaning an error occurred), then only - * the status will be sent to the client, and the response will be ommitted + * the status will be sent to the client, and the response will be omitted */ std::pair diff --git a/src/xrpld/rpc/detail/Handler.cpp b/src/xrpld/rpc/detail/Handler.cpp index 2000af5e81..1a60c137f7 100644 --- a/src/xrpld/rpc/detail/Handler.cpp +++ b/src/xrpld/rpc/detail/Handler.cpp @@ -173,7 +173,7 @@ Handler const handlerArray[]{ {"validator_info", byRef(&doValidatorInfo), Role::ADMIN, NO_CONDITION}, {"vault_info", byRef(&doVaultInfo), Role::USER, NO_CONDITION}, {"wallet_propose", byRef(&doWalletPropose), Role::ADMIN, NO_CONDITION}, - // Evented methods + // Event methods {"subscribe", byRef(&doSubscribe), Role::USER, NO_CONDITION}, {"unsubscribe", byRef(&doUnsubscribe), Role::USER, NO_CONDITION}, }; diff --git a/src/xrpld/rpc/detail/InfoSub.cpp b/src/xrpld/rpc/detail/InfoSub.cpp index a0869b9d96..c8917b3327 100644 --- a/src/xrpld/rpc/detail/InfoSub.cpp +++ b/src/xrpld/rpc/detail/InfoSub.cpp @@ -8,9 +8,9 @@ namespace xrpl { // should use this interface. The RPC code will primarily be a light wrapper // over this code. -// Eventually, it will check the node's operating mode (synched, unsynched, -// etectera) and defer to the correct means of processing. The current -// code assumes this node is synched (and will continue to do so until +// Eventually, it will check the node's operating mode (synced, unsynced, +// etcetera) and defer to the correct means of processing. The current +// code assumes this node is synced (and will continue to do so until // there's a functional network. InfoSub::InfoSub(Source& source) : m_source(source), mSeq(assign_id()) diff --git a/src/xrpld/rpc/detail/RPCCall.cpp b/src/xrpld/rpc/detail/RPCCall.cpp index fa1a089efb..5eb3943c28 100644 --- a/src/xrpld/rpc/detail/RPCCall.cpp +++ b/src/xrpld/rpc/detail/RPCCall.cpp @@ -1295,7 +1295,7 @@ public: {"wallet_propose", &RPCParser::parseWalletPropose, 0, 1}, {"internal", &RPCParser::parseInternal, 1, -1}, - // Evented methods + // Event methods {"path_find", &RPCParser::parseEvented, -1, -1}, {"subscribe", &RPCParser::parseEvented, -1, -1}, {"unsubscribe", &RPCParser::parseEvented, -1, -1}, diff --git a/src/xrpld/rpc/detail/RPCSub.cpp b/src/xrpld/rpc/detail/RPCSub.cpp index 5d008e4ee6..616911fdfa 100644 --- a/src/xrpld/rpc/detail/RPCSub.cpp +++ b/src/xrpld/rpc/detail/RPCSub.cpp @@ -171,7 +171,7 @@ private: int mSeq; // Next id to allocate. - bool mSending; // Sending threead is active. + bool mSending; // Sending thread is active. std::deque> mDeque; diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index a4ac32ee17..485765c133 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -1043,7 +1043,7 @@ transactionSubmit( // Finally, submit the transaction. try { - // FIXME: For performance, should use asynch interface + // FIXME: For performance, should use async interface processTransaction(txn.second, isUnlimited(role), true, failType); } catch (std::exception&) @@ -1439,7 +1439,7 @@ transactionSubmitMultiSigned( // Finally, submit the transaction. try { - // FIXME: For performance, should use asynch interface + // FIXME: For performance, should use async interface processTransaction(txn.second, isUnlimited(role), true, failType); } catch (std::exception&) diff --git a/src/xrpld/rpc/handlers/GatewayBalances.cpp b/src/xrpld/rpc/handlers/GatewayBalances.cpp index 55959d8641..57c73a53e0 100644 --- a/src/xrpld/rpc/handlers/GatewayBalances.cpp +++ b/src/xrpld/rpc/handlers/GatewayBalances.cpp @@ -29,7 +29,7 @@ namespace xrpl { // 3) Object of "assets" indicating accounts that owe the gateway. // (Gateways typically do not hold positive balances. This is unusual.) -// gateway_balances [] [ [] [ [ // limit: integer // optional, number of problems // role: gateway|user // account role to assume -// transactions: true // optional, reccommend transactions +// transactions: true // optional, recommend transactions // } Json::Value doNoRippleCheck(RPC::JsonContext& context) From 2c37ef7762f4b1948f8894bb3ce1541d33f8e05a Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 7 Jan 2026 14:26:14 -0500 Subject: [PATCH 21/62] refactor: Fix spelling issues in private/local variables and functions (#6182) This change fixes several typos in private/local variables and private functions. There is no functionality change. --- cmake/XrplCompiler.cmake | 2 +- include/xrpl/basics/IntrusivePointer.h | 2 +- include/xrpl/basics/Slice.h | 4 ++-- include/xrpl/basics/StringUtilities.h | 8 ++++---- .../detail/aged_unordered_container.h | 7 ++++--- include/xrpl/beast/hash/hash_append.h | 2 +- include/xrpl/beast/utility/PropertyStream.h | 2 +- include/xrpl/json/json_value.h | 2 +- include/xrpl/json/json_writer.h | 4 ++-- include/xrpl/nodestore/Manager.h | 2 +- include/xrpl/protocol/IOUAmount.h | 2 +- src/libxrpl/core/detail/LoadMonitor.cpp | 2 +- src/libxrpl/json/json_valueiterator.cpp | 18 +++++++++--------- src/libxrpl/json/json_writer.cpp | 8 ++++---- src/libxrpl/ledger/CredentialHelpers.cpp | 2 +- src/libxrpl/net/RegisterSSLCerts.cpp | 4 ++-- src/libxrpl/nodestore/Database.cpp | 2 +- src/libxrpl/protocol/BuildInfo.cpp | 2 +- src/libxrpl/protocol/Indexes.cpp | 4 ++-- src/xrpld/app/paths/Pathfinder.cpp | 2 +- 20 files changed, 41 insertions(+), 40 deletions(-) diff --git a/cmake/XrplCompiler.cmake b/cmake/XrplCompiler.cmake index 110478fadf..622b2d2f74 100644 --- a/cmake/XrplCompiler.cmake +++ b/cmake/XrplCompiler.cmake @@ -149,7 +149,7 @@ elseif (use_gold AND is_gcc) ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) #[=========================================================[ NOTE: THE gold linker inserts -rpath as DT_RUNPATH by - default intead of DT_RPATH, so you might have slightly + default instead of DT_RPATH, so you might have slightly unexpected runtime ld behavior if you were expecting DT_RPATH. Specify --disable-new-dtags to gold if you do not want the default DT_RUNPATH behavior. This rpath diff --git a/include/xrpl/basics/IntrusivePointer.h b/include/xrpl/basics/IntrusivePointer.h index 24521b95a7..101a4b6f16 100644 --- a/include/xrpl/basics/IntrusivePointer.h +++ b/include/xrpl/basics/IntrusivePointer.h @@ -58,7 +58,7 @@ concept CAdoptTag = std::is_same_v || When the strong pointer count goes to zero, the "partialDestructor" is called. This can be used to destroy as much of the object as possible while still retaining the reference counts. For example, for SHAMapInnerNodes the - children may be reset in that function. Note that std::shared_poiner WILL + children may be reset in that function. Note that std::shared_pointer WILL run the destructor when the strong count reaches zero, but may not free the memory used by the object until the weak count reaches zero. In rippled, we typically allocate shared pointers with the `make_shared` function. When diff --git a/include/xrpl/basics/Slice.h b/include/xrpl/basics/Slice.h index aa98b0a358..fba4b7733c 100644 --- a/include/xrpl/basics/Slice.h +++ b/include/xrpl/basics/Slice.h @@ -152,8 +152,8 @@ public: /** Return a "sub slice" of given length starting at the given position - Note that the subslice encompasses the range [pos, pos + rcount), - where rcount is the smaller of count and size() - pos. + Note that the subslice encompasses the range [pos, pos + rCount), + where rCount is the smaller of count and size() - pos. @param pos position of the first character @count requested length diff --git a/include/xrpl/basics/StringUtilities.h b/include/xrpl/basics/StringUtilities.h index ebe07e43bc..6314a56103 100644 --- a/include/xrpl/basics/StringUtilities.h +++ b/include/xrpl/basics/StringUtilities.h @@ -31,7 +31,7 @@ template std::optional strUnHex(std::size_t strSize, Iterator begin, Iterator end) { - static constexpr std::array const unxtab = []() { + static constexpr std::array const digitLookupTable = []() { std::array t{}; for (auto& x : t) @@ -57,7 +57,7 @@ strUnHex(std::size_t strSize, Iterator begin, Iterator end) if (strSize & 1) { - int c = unxtab[*iter++]; + int c = digitLookupTable[*iter++]; if (c < 0) return {}; @@ -67,12 +67,12 @@ strUnHex(std::size_t strSize, Iterator begin, Iterator end) while (iter != end) { - int cHigh = unxtab[*iter++]; + int cHigh = digitLookupTable[*iter++]; if (cHigh < 0) return {}; - int cLow = unxtab[*iter++]; + int cLow = digitLookupTable[*iter++]; if (cLow < 0) return {}; diff --git a/include/xrpl/beast/container/detail/aged_unordered_container.h b/include/xrpl/beast/container/detail/aged_unordered_container.h index 6807dad9f7..e2ee3b24e0 100644 --- a/include/xrpl/beast/container/detail/aged_unordered_container.h +++ b/include/xrpl/beast/container/detail/aged_unordered_container.h @@ -3189,11 +3189,12 @@ operator==(aged_unordered_container< { if (size() != other.size()) return false; - for (auto iter(cbegin()), last(cend()), olast(other.cend()); iter != last; + for (auto iter(cbegin()), last(cend()), otherLast(other.cend()); + iter != last; ++iter) { - auto oiter(other.find(extract(*iter))); - if (oiter == olast) + auto otherIter(other.find(extract(*iter))); + if (otherIter == otherLast) return false; } return true; diff --git a/include/xrpl/beast/hash/hash_append.h b/include/xrpl/beast/hash/hash_append.h index fdfedeb935..28444a1280 100644 --- a/include/xrpl/beast/hash/hash_append.h +++ b/include/xrpl/beast/hash/hash_append.h @@ -203,7 +203,7 @@ struct is_contiguously_hashable Throws: Never Effect: - Returns the reslting hash of all the input data. + Returns the resulting hash of all the input data. */ /** @{ */ diff --git a/include/xrpl/beast/utility/PropertyStream.h b/include/xrpl/beast/utility/PropertyStream.h index a5880fb8c6..de1fc567f3 100644 --- a/include/xrpl/beast/utility/PropertyStream.h +++ b/include/xrpl/beast/utility/PropertyStream.h @@ -376,7 +376,7 @@ public: print statement examples "parent.child" prints child and all of its children "parent.child." start at the parent and print down to child - "parent.grandchild" prints nothing- grandchild not direct discendent + "parent.grandchild" prints nothing- grandchild not direct descendent "parent.grandchild." starts at the parent and prints down to grandchild "parent.grandchild.*" starts at parent, print through grandchild children diff --git a/include/xrpl/json/json_value.h b/include/xrpl/json/json_value.h index 3daf441592..979e7fd788 100644 --- a/include/xrpl/json/json_value.h +++ b/include/xrpl/json/json_value.h @@ -44,7 +44,7 @@ enum ValueType { class StaticString { public: - constexpr explicit StaticString(char const* czstring) : str_(czstring) + constexpr explicit StaticString(char const* czString) : str_(czString) { } diff --git a/include/xrpl/json/json_writer.h b/include/xrpl/json/json_writer.h index 9512b17176..08e7b619b2 100644 --- a/include/xrpl/json/json_writer.h +++ b/include/xrpl/json/json_writer.h @@ -90,7 +90,7 @@ private: void writeArrayValue(Value const& value); bool - isMultineArray(Value const& value); + isMultilineArray(Value const& value); void pushValue(std::string const& value); void @@ -157,7 +157,7 @@ private: void writeArrayValue(Value const& value); bool - isMultineArray(Value const& value); + isMultilineArray(Value const& value); void pushValue(std::string const& value); void diff --git a/include/xrpl/nodestore/Manager.h b/include/xrpl/nodestore/Manager.h index fe4b1c614e..72edf2b47e 100644 --- a/include/xrpl/nodestore/Manager.h +++ b/include/xrpl/nodestore/Manager.h @@ -55,7 +55,7 @@ public: HyperLevelDB, LevelDBFactory, SQLite, MDB If the fastBackendParameter is omitted or empty, no ephemeral database - is used. If the scheduler parameter is omited or unspecified, a + is used. If the scheduler parameter is omitted or unspecified, a synchronous scheduler is used which performs all tasks immediately on the caller's thread. diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index 60a61a5825..c04cb5cf70 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -20,7 +20,7 @@ namespace xrpl { Arithmetic operations can throw std::overflow_error during normalization if the amount exceeds the largest representable amount, but underflows - will silently trunctate to zero. + will silently truncate to zero. */ class IOUAmount : private boost::totally_ordered, private boost::additive diff --git a/src/libxrpl/core/detail/LoadMonitor.cpp b/src/libxrpl/core/detail/LoadMonitor.cpp index fe2bb9e359..933fea5877 100644 --- a/src/libxrpl/core/detail/LoadMonitor.cpp +++ b/src/libxrpl/core/detail/LoadMonitor.cpp @@ -66,7 +66,7 @@ LoadMonitor::update() "Imagine if you add 10 to something every second. And you also reduce it by 1/4 every second. It will "idle" at 40, - correponding to 10 counts per second." + corresponding to 10 counts per second." */ do { diff --git a/src/libxrpl/json/json_valueiterator.cpp b/src/libxrpl/json/json_valueiterator.cpp index 7d20265af8..e9c22ac5f7 100644 --- a/src/libxrpl/json/json_valueiterator.cpp +++ b/src/libxrpl/json/json_valueiterator.cpp @@ -89,26 +89,26 @@ ValueIteratorBase::copy(SelfType const& other) Value ValueIteratorBase::key() const { - Value::CZString const czstring = (*current_).first; + Value::CZString const czString = (*current_).first; - if (czstring.c_str()) + if (czString.c_str()) { - if (czstring.isStaticString()) - return Value(StaticString(czstring.c_str())); + if (czString.isStaticString()) + return Value(StaticString(czString.c_str())); - return Value(czstring.c_str()); + return Value(czString.c_str()); } - return Value(czstring.index()); + return Value(czString.index()); } UInt ValueIteratorBase::index() const { - Value::CZString const czstring = (*current_).first; + Value::CZString const czString = (*current_).first; - if (!czstring.c_str()) - return czstring.index(); + if (!czString.c_str()) + return czString.index(); return Value::UInt(-1); } diff --git a/src/libxrpl/json/json_writer.cpp b/src/libxrpl/json/json_writer.cpp index 8983257003..25d09c511a 100644 --- a/src/libxrpl/json/json_writer.cpp +++ b/src/libxrpl/json/json_writer.cpp @@ -347,7 +347,7 @@ StyledWriter::writeArrayValue(Value const& value) pushValue("[]"); else { - bool isArrayMultiLine = isMultineArray(value); + bool isArrayMultiLine = isMultilineArray(value); if (isArrayMultiLine) { @@ -398,7 +398,7 @@ StyledWriter::writeArrayValue(Value const& value) } bool -StyledWriter::isMultineArray(Value const& value) +StyledWriter::isMultilineArray(Value const& value) { int size = value.size(); bool isMultiLine = size * 3 >= rightMargin_; @@ -573,7 +573,7 @@ StyledStreamWriter::writeArrayValue(Value const& value) pushValue("[]"); else { - bool isArrayMultiLine = isMultineArray(value); + bool isArrayMultiLine = isMultilineArray(value); if (isArrayMultiLine) { @@ -624,7 +624,7 @@ StyledStreamWriter::writeArrayValue(Value const& value) } bool -StyledStreamWriter::isMultineArray(Value const& value) +StyledStreamWriter::isMultilineArray(Value const& value) { int size = value.size(); bool isMultiLine = size * 3 >= rightMargin_; diff --git a/src/libxrpl/ledger/CredentialHelpers.cpp b/src/libxrpl/ledger/CredentialHelpers.cpp index a0f1dce7d8..82691238f9 100644 --- a/src/libxrpl/ledger/CredentialHelpers.cpp +++ b/src/libxrpl/ledger/CredentialHelpers.cpp @@ -290,7 +290,7 @@ checkArray(STArray const& credentials, unsigned maxSize, beast::Journal j) if (!ins) { JLOG(j.trace()) << "Malformed transaction: " - "duplicates in credenentials."; + "duplicates in credentials."; return temMALFORMED; } } diff --git a/src/libxrpl/net/RegisterSSLCerts.cpp b/src/libxrpl/net/RegisterSSLCerts.cpp index f489cf29a3..a1321e4c61 100644 --- a/src/libxrpl/net/RegisterSSLCerts.cpp +++ b/src/libxrpl/net/RegisterSSLCerts.cpp @@ -49,11 +49,11 @@ registerSSLCerts( return; } - auto warn = [&](std::string const& mesg) { + auto warn = [&](std::string const& msg) { // Buffer based on asio recommended size char buf[256]; ::ERR_error_string_n(ec.value(), buf, sizeof(buf)); - JLOG(j.warn()) << mesg << " " << buf; + JLOG(j.warn()) << msg << " " << buf; ::ERR_clear_error(); }; diff --git a/src/libxrpl/nodestore/Database.cpp b/src/libxrpl/nodestore/Database.cpp index 41e8ac8632..9ea25785ff 100644 --- a/src/libxrpl/nodestore/Database.cpp +++ b/src/libxrpl/nodestore/Database.cpp @@ -158,7 +158,7 @@ Database::stop() << duration_cast( steady_clock::now() - start) .count() - << " millseconds"; + << " milliseconds"; } void diff --git a/src/libxrpl/protocol/BuildInfo.cpp b/src/libxrpl/protocol/BuildInfo.cpp index 65caa9ecd3..dc56987f3a 100644 --- a/src/libxrpl/protocol/BuildInfo.cpp +++ b/src/libxrpl/protocol/BuildInfo.cpp @@ -34,7 +34,7 @@ char const* const versionString = "3.2.0-b0" #endif #ifdef SANITIZER - BOOST_PP_STRINGIZE(SANITIZER) + BOOST_PP_STRINGIZE(SANITIZER) // cspell: disable-line #endif #endif diff --git a/src/libxrpl/protocol/Indexes.cpp b/src/libxrpl/protocol/Indexes.cpp index 77fcd44a3e..0bdfeefc4d 100644 --- a/src/libxrpl/protocol/Indexes.cpp +++ b/src/libxrpl/protocol/Indexes.cpp @@ -122,9 +122,9 @@ getBookBase(Book const& book) uint256 getQualityNext(uint256 const& uBase) { - static constexpr uint256 nextq( + static constexpr uint256 nextQuality( "0000000000000000000000000000000000000000000000010000000000000000"); - return uBase + nextq; + return uBase + nextQuality; } std::uint64_t diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index 546f3d25d9..c99467dade 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -40,7 +40,7 @@ final paths and the estimated cost are returned. The engine permits the search depth to be selected and the paths table includes the depth at which each path type is found. A search depth of zero causes no searching to be done. Extra paths can also be injected, and this -should be used to preserve previously-found paths across invokations for the +should be used to preserve previously-found paths across invocations for the same path request (particularly if the search depth may change). */ From 07ff532d306cb79e16376c830fad6c041af01132 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 7 Jan 2026 16:30:35 -0500 Subject: [PATCH 22/62] refactor: Fix spelling issues in all variables/functions (#6184) This change fixes many typos in comments, variables, and public functions. There is no functionality change. --- include/xrpl/json/json_reader.h | 2 +- include/xrpl/protocol/Permissions.h | 5 +- src/libxrpl/beast/net/IPAddressV4.cpp | 2 +- src/libxrpl/json/json_reader.cpp | 6 +- src/libxrpl/json/json_writer.cpp | 4 +- src/libxrpl/protocol/Permissions.cpp | 10 +- src/libxrpl/protocol/STXChainBridge.cpp | 4 +- src/libxrpl/protocol/TxFormats.cpp | 4 +- src/libxrpl/shamap/SHAMap.cpp | 2 +- src/test/app/AMMClawback_test.cpp | 2 +- src/test/app/AMMExtended_test.cpp | 22 +-- src/test/app/AMM_test.cpp | 20 +-- src/test/app/Check_test.cpp | 6 +- src/test/app/Delegate_test.cpp | 8 +- src/test/app/DeliverMin_test.cpp | 20 +-- src/test/app/EscrowToken_test.cpp | 4 +- src/test/app/Escrow_test.cpp | 4 +- src/test/app/Flow_test.cpp | 6 +- src/test/app/Invariants_test.cpp | 4 +- src/test/app/Loan_test.cpp | 2 +- src/test/app/MPToken_test.cpp | 10 +- src/test/app/MultiSign_test.cpp | 2 +- src/test/app/NetworkOPs_test.cpp | 6 +- src/test/app/Offer_test.cpp | 2 +- src/test/app/TheoreticalQuality_test.cpp | 2 +- src/test/app/TxQ_test.cpp | 4 +- src/test/app/Vault_test.cpp | 6 +- src/test/app/XChain_test.cpp | 28 ++-- src/test/app/tx/apply_test.cpp | 2 +- src/test/beast/xxhasher_test.cpp | 8 +- src/test/consensus/NegativeUNL_test.cpp | 6 +- src/test/core/Config_test.cpp | 4 +- src/test/csf/Digraph.h | 2 +- src/test/csf/Peer.h | 10 +- src/test/csf/PeerGroup.h | 2 +- src/test/jtx/Env_test.cpp | 15 +- src/test/jtx/Oracle.h | 4 +- src/test/jtx/amount.h | 2 +- src/test/jtx/delivermin.h | 4 +- src/test/jtx/impl/AMMTest.cpp | 6 +- src/test/jtx/impl/delivermin.cpp | 2 +- src/test/jtx/impl/memo.cpp | 39 +---- src/test/jtx/memo.h | 60 +------- src/test/protocol/TER_test.cpp | 30 ++-- src/test/rpc/AccountTx_test.cpp | 22 +-- src/test/rpc/Book_test.cpp | 2 +- src/test/rpc/DepositAuthorized_test.cpp | 2 +- src/test/rpc/JSONRPC_test.cpp | 138 +++++++++--------- src/test/rpc/RPCCall_test.cpp | 2 +- src/test/rpc/Simulate_test.cpp | 8 +- src/test/server/ServerStatus_test.cpp | 4 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 2 +- src/xrpld/app/misc/FeeVoteImpl.cpp | 9 +- src/xrpld/app/misc/NetworkOPs.cpp | 8 +- src/xrpld/app/misc/SHAMapStoreImp.h | 2 +- src/xrpld/app/misc/TxQ.h | 14 +- src/xrpld/app/misc/ValidatorList.h | 4 +- src/xrpld/app/misc/detail/TxQ.cpp | 40 ++--- src/xrpld/app/misc/detail/ValidatorList.cpp | 6 +- src/xrpld/app/paths/AMMOffer.h | 8 +- src/xrpld/app/paths/PathRequest.h | 2 +- src/xrpld/app/paths/detail/AMMOffer.cpp | 10 +- src/xrpld/app/paths/detail/StrandFlow.h | 14 +- .../app/rdb/backend/detail/SQLiteDatabase.cpp | 17 ++- src/xrpld/app/tx/applySteps.h | 2 +- src/xrpld/app/tx/detail/DelegateSet.cpp | 2 +- src/xrpld/app/tx/detail/InvariantCheck.cpp | 4 +- src/xrpld/app/tx/detail/Offer.h | 18 ++- src/xrpld/app/tx/detail/OfferStream.cpp | 2 +- src/xrpld/app/tx/detail/Transactor.cpp | 2 +- src/xrpld/app/tx/detail/XChainBridge.cpp | 12 +- src/xrpld/app/tx/detail/applySteps.cpp | 16 +- src/xrpld/consensus/DisputedTx.h | 6 +- src/xrpld/consensus/Validations.h | 20 +-- src/xrpld/overlay/Message.h | 2 +- src/xrpld/overlay/Overlay.h | 2 +- src/xrpld/overlay/Slot.h | 6 +- src/xrpld/overlay/detail/OverlayImpl.cpp | 2 +- src/xrpld/overlay/detail/OverlayImpl.h | 2 +- src/xrpld/overlay/detail/PeerImp.h | 2 +- src/xrpld/overlay/detail/ProtocolMessage.h | 6 +- src/xrpld/overlay/detail/ProtocolVersion.h | 2 +- src/xrpld/overlay/detail/TxMetrics.cpp | 6 +- src/xrpld/overlay/detail/TxMetrics.h | 2 +- src/xrpld/peerfinder/detail/Livecache.h | 6 +- src/xrpld/peerfinder/detail/Logic.h | 6 +- src/xrpld/peerfinder/detail/iosformat.h | 8 +- src/xrpld/perflog/detail/PerfLogImp.cpp | 8 +- src/xrpld/rpc/detail/RPCCall.cpp | 8 +- src/xrpld/rpc/detail/RPCHelpers.cpp | 2 +- src/xrpld/rpc/detail/ServerHandler.cpp | 7 +- src/xrpld/rpc/detail/Tuning.h | 2 +- src/xrpld/rpc/handlers/AccountInfo.cpp | 6 +- src/xrpld/rpc/handlers/AccountTx.cpp | 2 +- src/xrpld/rpc/handlers/Subscribe.cpp | 2 +- 95 files changed, 400 insertions(+), 480 deletions(-) diff --git a/include/xrpl/json/json_reader.h b/include/xrpl/json/json_reader.h index 963dc0f26e..2a8ec5a3fe 100644 --- a/include/xrpl/json/json_reader.h +++ b/include/xrpl/json/json_reader.h @@ -66,7 +66,7 @@ public: * error occurred during parsing. */ std::string - getFormatedErrorMessages() const; + getFormattedErrorMessages() const; static constexpr unsigned nest_limit{25}; diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 252605e641..319aeb1c28 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -38,7 +38,7 @@ private: std::unordered_map txFeatureMap_; - std::unordered_map delegatableTx_; + std::unordered_map delegableTx_; std::unordered_map granularPermissionMap_; @@ -71,8 +71,7 @@ public: getTxFeature(TxType txType) const; bool - isDelegatable(std::uint32_t const& permissionValue, Rules const& rules) - const; + isDelegable(std::uint32_t const& permissionValue, Rules const& rules) const; // for tx level permission, permission value is equal to tx type plus one uint32_t diff --git a/src/libxrpl/beast/net/IPAddressV4.cpp b/src/libxrpl/beast/net/IPAddressV4.cpp index b4d7181c45..fcb782133e 100644 --- a/src/libxrpl/beast/net/IPAddressV4.cpp +++ b/src/libxrpl/beast/net/IPAddressV4.cpp @@ -24,7 +24,7 @@ is_public(AddressV4 const& addr) char get_class(AddressV4 const& addr) { - static char const* table = "AAAABBCD"; + static char const* table = "AAAABBCD"; // cspell:disable-line return table[(addr.to_uint() & 0xE0000000) >> 29]; } diff --git a/src/libxrpl/json/json_reader.cpp b/src/libxrpl/json/json_reader.cpp index c0843ca929..ca0b5e5eee 100644 --- a/src/libxrpl/json/json_reader.cpp +++ b/src/libxrpl/json/json_reader.cpp @@ -241,7 +241,7 @@ Reader::readToken(Token& token) case 'f': token.type_ = tokenFalse; - ok = match("alse", 4); + ok = match("alse", 4); // cspell:disable-line break; case 'n': @@ -912,7 +912,7 @@ Reader::getLocationLineAndColumn(Location location) const } std::string -Reader::getFormatedErrorMessages() const +Reader::getFormattedErrorMessages() const { std::string formattedMessage; @@ -941,7 +941,7 @@ operator>>(std::istream& sin, Value& root) // XRPL_ASSERT(ok, "Json::operator>>() : parse succeeded"); if (!ok) - xrpl::Throw(reader.getFormatedErrorMessages()); + xrpl::Throw(reader.getFormattedErrorMessages()); return sin; } diff --git a/src/libxrpl/json/json_writer.cpp b/src/libxrpl/json/json_writer.cpp index 25d09c511a..2d0756852f 100644 --- a/src/libxrpl/json/json_writer.cpp +++ b/src/libxrpl/json/json_writer.cpp @@ -79,7 +79,7 @@ valueToString(double value) // of precision requested below. char buffer[32]; // Print into the buffer. We need not request the alternative representation - // that always has a decimal point because JSON doesn't distingish the + // that always has a decimal point because JSON doesn't distinguish the // concepts of reals and integers. #if defined(_MSC_VER) && \ defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 @@ -108,7 +108,7 @@ valueToQuotedString(char const* value) // We have to walk value and escape any special characters. // Appending to std::string is not efficient, but this should be rare. // (Note: forward slashes are *not* rare, but I am not escaping them.) - unsigned maxsize = strlen(value) * 2 + 3; // allescaped+quotes+NULL + unsigned maxsize = strlen(value) * 2 + 3; // all-escaped+quotes+NULL std::string result; result.reserve(maxsize); // to avoid lots of mallocs result += "\""; diff --git a/src/libxrpl/protocol/Permissions.cpp b/src/libxrpl/protocol/Permissions.cpp index a5d447a23c..55b273e246 100644 --- a/src/libxrpl/protocol/Permissions.cpp +++ b/src/libxrpl/protocol/Permissions.cpp @@ -20,7 +20,7 @@ Permission::Permission() #pragma pop_macro("TRANSACTION") }; - delegatableTx_ = { + delegableTx_ = { #pragma push_macro("TRANSACTION") #undef TRANSACTION @@ -142,7 +142,7 @@ Permission::getTxFeature(TxType txType) const } bool -Permission::isDelegatable( +Permission::isDelegable( std::uint32_t const& permissionValue, Rules const& rules) const { @@ -153,15 +153,15 @@ Permission::isDelegatable( return true; auto const txType = permissionToTxType(permissionValue); - auto const it = delegatableTx_.find(txType); + auto const it = delegableTx_.find(txType); - if (it == delegatableTx_.end()) + if (it == delegableTx_.end()) return false; auto const txFeaturesIt = txFeatureMap_.find(txType); XRPL_ASSERT( txFeaturesIt != txFeatureMap_.end(), - "xrpl::Permissions::isDelegatable : tx exists in txFeatureMap_"); + "xrpl::Permissions::isDelegable : tx exists in txFeatureMap_"); // Delegation is only allowed if the required amendment for the transaction // is enabled. For transactions that do not require an amendment, delegation diff --git a/src/libxrpl/protocol/STXChainBridge.cpp b/src/libxrpl/protocol/STXChainBridge.cpp index 065b87558f..413094b0cd 100644 --- a/src/libxrpl/protocol/STXChainBridge.cpp +++ b/src/libxrpl/protocol/STXChainBridge.cpp @@ -65,12 +65,12 @@ STXChainBridge::STXChainBridge(SField const& name, Json::Value const& v) } auto checkExtra = [](Json::Value const& v) { - static auto const jbridge = + static auto const bridgeJson = xrpl::STXChainBridge().getJson(xrpl::JsonOptions::none); for (auto it = v.begin(); it != v.end(); ++it) { std::string const name = it.memberName(); - if (!jbridge.isMember(name)) + if (!bridgeJson.isMember(name)) { Throw( "STXChainBridge extra field detected: " + name); diff --git a/src/libxrpl/protocol/TxFormats.cpp b/src/libxrpl/protocol/TxFormats.cpp index 12f92615cd..c725c1da69 100644 --- a/src/libxrpl/protocol/TxFormats.cpp +++ b/src/libxrpl/protocol/TxFormats.cpp @@ -36,8 +36,8 @@ TxFormats::TxFormats() #undef TRANSACTION #define UNWRAP(...) __VA_ARGS__ -#define TRANSACTION( \ - tag, value, name, delegatable, amendment, privileges, fields) \ +#define TRANSACTION( \ + tag, value, name, delegable, amendment, privileges, fields) \ add(jss::name, tag, UNWRAP fields, commonFields); #include diff --git a/src/libxrpl/shamap/SHAMap.cpp b/src/libxrpl/shamap/SHAMap.cpp index 7cfa66b1ac..2a156dc2d4 100644 --- a/src/libxrpl/shamap/SHAMap.cpp +++ b/src/libxrpl/shamap/SHAMap.cpp @@ -186,7 +186,7 @@ SHAMap::finishFetch( catch (...) { JLOG(journal_.warn()) - << "finishFetch exception: unknonw exception: " << hash; + << "finishFetch exception: unknown exception: " << hash; } return {}; diff --git a/src/test/app/AMMClawback_test.cpp b/src/test/app/AMMClawback_test.cpp index e9882ef174..93fda8fe34 100644 --- a/src/test/app/AMMClawback_test.cpp +++ b/src/test/app/AMMClawback_test.cpp @@ -2043,7 +2043,7 @@ class AMMClawback_test : public beast::unit_test::suite void testSingleDepositAndClawback(FeatureBitset features) { - testcase("test single depoit and clawback"); + testcase("test single deposit and clawback"); using namespace jtx; std::string logs; diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index c3bfb46043..317f6cb63d 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -2922,29 +2922,29 @@ private: fund(env, gw, {alice, bob, carol}, XRP(10'000)); env.trust(USD(100), alice, bob, carol); env(pay(alice, bob, USD(10)), - delivermin(USD(10)), + deliver_min(USD(10)), ter(temBAD_AMOUNT)); env(pay(alice, bob, USD(10)), - delivermin(USD(-5)), + deliver_min(USD(-5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay(alice, bob, USD(10)), - delivermin(XRP(5)), + deliver_min(XRP(5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay(alice, bob, USD(10)), - delivermin(Account(carol)["USD"](5)), + deliver_min(Account(carol)["USD"](5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay(alice, bob, USD(10)), - delivermin(USD(15)), + deliver_min(USD(15)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay(gw, carol, USD(50))); AMM ammCarol(env, carol, XRP(10), USD(15)); env(pay(alice, bob, USD(10)), paths(XRP), - delivermin(USD(7)), + deliver_min(USD(7)), txflags(tfPartialPayment), sendmax(XRP(5)), ter(tecPATH_PARTIAL)); @@ -2962,7 +2962,7 @@ private: AMM ammBob(env, bob, XRP(1'000), USD(1'100)); env(pay(alice, alice, USD(10'000)), paths(XRP), - delivermin(USD(100)), + deliver_min(USD(100)), txflags(tfPartialPayment), sendmax(XRP(100))); env.require(balance(alice, USD(100))); @@ -2976,13 +2976,13 @@ private: AMM ammBob(env, bob, XRP(5'500), USD(1'200)); env(pay(alice, carol, USD(10'000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(1'000)), ter(tecPATH_PARTIAL)); env(pay(alice, carol, USD(10'000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(1'100))); BEAST_EXPECT( @@ -3005,7 +3005,7 @@ private: { env(pay(alice, carol, USD(10'000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(200))); env.require(balance(bob, USD(0))); @@ -3017,7 +3017,7 @@ private: { env(pay(alice, carol, USD(10'000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRPAmount(200'000'001))); env.require(balance(bob, USD(0))); diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 8d64dfed2a..468d5b3ffd 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -831,10 +831,10 @@ private: // Tiny deposit testAMM( [&](AMM& ammAlice, Env& env) { - auto const enabledv1_3 = + auto const enabledV1_3 = env.current()->rules().enabled(fixAMMv1_3); auto const err = - !enabledv1_3 ? ter(temBAD_AMOUNT) : ter(tesSUCCESS); + !enabledV1_3 ? ter(temBAD_AMOUNT) : ter(tesSUCCESS); // Pre-amendment XRP deposit side is rounded to 0 // and deposit fails. // Post-amendment XRP deposit side is rounded to 1 @@ -2818,7 +2818,7 @@ private: BEAST_EXPECT(amm.expectAuctionSlot(100, 0, IOUAmount{0})); // gw burns all but one of its LPTokens through a bid transaction - // this transaction suceeds because the bid price is less than + // this transaction succeeds because the bid price is less than // the total outstanding LPToken balance env(amm.bid({ .account = gw, @@ -2872,7 +2872,7 @@ private: ter(temBAD_AMOUNT)); } - // Invlaid Min/Max combination + // Invalid Min/Max combination env(ammAlice.bid({ .account = carol, .bidMin = 200, @@ -3547,13 +3547,13 @@ private: { auto jtx = env.jt(tx, seq(1), fee(baseFee)); env.app().config().features.erase(featureAMM); - PreflightContext pfctx( + PreflightContext pfCtx( env.app(), *jtx.stx, env.current()->rules(), tapNONE, env.journal); - auto pf = Transactor::invokePreflight(pfctx); + auto pf = Transactor::invokePreflight(pfCtx); BEAST_EXPECT(pf == temDISABLED); env.app().config().features.insert(featureAMM); } @@ -3562,13 +3562,13 @@ private: auto jtx = env.jt(tx, seq(1), fee(baseFee)); jtx.jv["TxnSignature"] = "deadbeef"; jtx.stx = env.ust(jtx); - PreflightContext pfctx( + PreflightContext pfCtx( env.app(), *jtx.stx, env.current()->rules(), tapNONE, env.journal); - auto pf = Transactor::invokePreflight(pfctx); + auto pf = Transactor::invokePreflight(pfCtx); BEAST_EXPECT(pf != tesSUCCESS); } @@ -3577,13 +3577,13 @@ private: jtx.jv["Asset2"]["currency"] = "XRP"; jtx.jv["Asset2"].removeMember("issuer"); jtx.stx = env.ust(jtx); - PreflightContext pfctx( + PreflightContext pfCtx( env.app(), *jtx.stx, env.current()->rules(), tapNONE, env.journal); - auto pf = Transactor::invokePreflight(pfctx); + auto pf = Transactor::invokePreflight(pfCtx); BEAST_EXPECT(pf == temBAD_AMM_TOKENS); } } diff --git a/src/test/app/Check_test.cpp b/src/test/app/Check_test.cpp index b3d8249dd0..8eccdc4824 100644 --- a/src/test/app/Check_test.cpp +++ b/src/test/app/Check_test.cpp @@ -11,18 +11,18 @@ namespace jtx { class expiration { private: - std::uint32_t const expry_; + std::uint32_t const expiry_; public: explicit expiration(NetClock::time_point const& expiry) - : expry_{expiry.time_since_epoch().count()} + : expiry_{expiry.time_since_epoch().count()} { } void operator()(Env&, JTx& jt) const { - jt[sfExpiration.jsonName] = expry_; + jt[sfExpiration.jsonName] = expiry_; } }; diff --git a/src/test/app/Delegate_test.cpp b/src/test/app/Delegate_test.cpp index 7d58093e43..4039f60ef0 100644 --- a/src/test/app/Delegate_test.cpp +++ b/src/test/app/Delegate_test.cpp @@ -203,7 +203,7 @@ class Delegate_test : public beast::unit_test::suite ter(tecNO_TARGET)); } - // non-delegatable transaction + // non-delegable transaction { env(delegate::set(gw, alice, {"SetRegularKey"}), ter(temMALFORMED)); env(delegate::set(gw, alice, {"AccountSet"}), ter(temMALFORMED)); @@ -1693,13 +1693,13 @@ class Delegate_test : public beast::unit_test::suite } void - testTxReqireFeatures(FeatureBitset features) + testTxRequireFeatures(FeatureBitset features) { testcase("test delegate disabled tx"); using namespace jtx; // map of tx and required feature. - // non-delegatable tx are not included. + // non-delegable tx are not included. // NFTokenMint, NFTokenBurn, NFTokenCreateOffer, NFTokenCancelOffer, // NFTokenAcceptOffer are not included, they are tested separately. std::unordered_map txRequiredFeatures{ @@ -1803,7 +1803,7 @@ class Delegate_test : public beast::unit_test::suite testMultiSign(); testMultiSignQuorumNotMet(); testPermissionValue(all); - testTxReqireFeatures(all); + testTxRequireFeatures(all); } }; BEAST_DEFINE_TESTSUITE(Delegate, app, xrpl); diff --git a/src/test/app/DeliverMin_test.cpp b/src/test/app/DeliverMin_test.cpp index 4d643dfae1..c49f83b518 100644 --- a/src/test/app/DeliverMin_test.cpp +++ b/src/test/app/DeliverMin_test.cpp @@ -25,29 +25,29 @@ public: env.trust(USD(100), "alice", "bob", "carol"); env.close(); env(pay("alice", "bob", USD(10)), - delivermin(USD(10)), + deliver_min(USD(10)), ter(temBAD_AMOUNT)); env(pay("alice", "bob", USD(10)), - delivermin(USD(-5)), + deliver_min(USD(-5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay("alice", "bob", USD(10)), - delivermin(XRP(5)), + deliver_min(XRP(5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay("alice", "bob", USD(10)), - delivermin(Account("carol")["USD"](5)), + deliver_min(Account("carol")["USD"](5)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay("alice", "bob", USD(10)), - delivermin(USD(15)), + deliver_min(USD(15)), txflags(tfPartialPayment), ter(temBAD_AMOUNT)); env(pay(gw, "carol", USD(50))); env(offer("carol", XRP(5), USD(5))); env(pay("alice", "bob", USD(10)), paths(XRP), - delivermin(USD(7)), + deliver_min(USD(7)), txflags(tfPartialPayment), sendmax(XRP(5)), ter(tecPATH_PARTIAL)); @@ -66,7 +66,7 @@ public: env(offer("bob", XRP(100), USD(100))); env(pay("alice", "alice", USD(10000)), paths(XRP), - delivermin(USD(100)), + deliver_min(USD(100)), txflags(tfPartialPayment), sendmax(XRP(100))); env.require(balance("alice", USD(100))); @@ -84,13 +84,13 @@ public: env(offer("bob", XRP(10000), USD(100))); env(pay("alice", "carol", USD(10000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(1000)), ter(tecPATH_PARTIAL)); env(pay("alice", "carol", USD(10000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(1100))); env.require(balance("bob", USD(0))); @@ -110,7 +110,7 @@ public: env(offer("dan", XRP(100), USD(100))); env(pay("alice", "carol", USD(10000)), paths(XRP), - delivermin(USD(200)), + deliver_min(USD(200)), txflags(tfPartialPayment), sendmax(XRP(200))); env.require(balance("bob", USD(0))); diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index ff8b2cfb49..955ca8f449 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -1591,7 +1591,7 @@ struct EscrowToken_test : public beast::unit_test::suite BEAST_EXPECT(env.balance(bob, USD) == USD(10125)); } - // test cancel doesnt charge rate + // test cancel doesn't charge rate { Env env{*this, features}; auto const baseFee = env.current()->fees().base; @@ -1986,7 +1986,7 @@ struct EscrowToken_test : public beast::unit_test::suite void testIOUINSF(FeatureBitset features) { - testcase("IOU Insuficient Funds"); + testcase("IOU Insufficient Funds"); using namespace test::jtx; using namespace std::literals; diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 25bb03858e..2b7297009a 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1614,12 +1614,12 @@ struct Escrow_test : public beast::unit_test::suite env.close(); env.close(); - // Succeed, Bob doesn't require preauthorization + // Succeed, Bob doesn't require pre-authorization env(escrow::finish(carol, alice, seq), credentials::ids({credIdx})); env.close(); { - char const credType2[] = "fghijk"; + char const credType2[] = "random"; env(credentials::create(bob, zelda, credType2)); env.close(); diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index e16a48e02f..8c5a9615fa 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -952,9 +952,9 @@ struct Flow_test : public beast::unit_test::suite } void - testReexecuteDirectStep(FeatureBitset features) + testReExecuteDirectStep(FeatureBitset features) { - testcase("ReexecuteDirectStep"); + testcase("ReExecuteDirectStep"); using namespace jtx; Env env(*this, features); @@ -1291,7 +1291,7 @@ struct Flow_test : public beast::unit_test::suite testSelfFundedXRPEndpoint(false, features); testSelfFundedXRPEndpoint(true, features); testUnfundedOffer(features); - testReexecuteDirectStep(features); + testReExecuteDirectStep(features); testSelfPayLowQualityOffer(features); testTicketPay(features); } diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 61b4e7ba76..9f70538778 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -1862,7 +1862,7 @@ class Invariants_test : public beast::unit_test::suite for (auto const& mod : mods) { doInvariantCheck( - {{"changed an unchangable field"}}, + {{"changed an unchangeable field"}}, [&](Account const& A1, Account const&, ApplyContext& ac) { auto sle = ac.view().peek(loanBrokerKeylet); if (!sle) @@ -1892,7 +1892,7 @@ class Invariants_test : public beast::unit_test::suite for (auto const& mod : mods) { doInvariantCheck( - {{"changed an unchangable field"}}, + {{"changed an unchangeable field"}}, [&](Account const& A1, Account const&, ApplyContext& ac) { auto sle = ac.view().peek(keylet::account(A1.id())); if (!sle) diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index 22159ba4bb..7c2e83aa19 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -2913,7 +2913,7 @@ protected: /* LoanPay fails with tecINVARIANT_FAILED error when loan_broker(also - borrower) tries to do the payment. Here's the sceanrio: Create a XRP + borrower) tries to do the payment. Here's the scenario: Create a XRP loan with loan broker as borrower, loan origination fee and loan service fee. Loan broker makes the first payment with periodic payment and loan service fee. diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 62531f2b8f..ed6d861ffb 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -975,7 +975,7 @@ class MPToken_test : public beast::unit_test::suite sendmax(XRP(100)), ter(temMALFORMED)); env(pay(alice, carol, MPT(100)), - delivermin(XRP(100)), + deliver_min(XRP(100)), ter(temBAD_AMOUNT)); // sendMax MPT is invalid with IOU or XRP auto const USD = alice["USD"]; @@ -986,10 +986,10 @@ class MPToken_test : public beast::unit_test::suite sendmax(MPT(100)), ter(temMALFORMED)); env(pay(alice, carol, USD(100)), - delivermin(MPT(100)), + deliver_min(MPT(100)), ter(temBAD_AMOUNT)); env(pay(alice, carol, XRP(100)), - delivermin(MPT(100)), + deliver_min(MPT(100)), ter(temBAD_AMOUNT)); // sendmax and amount are different MPT issue test::jtx::MPT const MPT1( @@ -1535,13 +1535,13 @@ class MPToken_test : public beast::unit_test::suite // deliver amount < deliverMin env(pay(bob, alice, MPT(100)), sendmax(MPT(99)), - delivermin(MPT(100)), + deliver_min(MPT(100)), txflags(tfPartialPayment), ter(tecPATH_PARTIAL)); // Payment succeeds if deliver amount >= deliverMin env(pay(bob, alice, MPT(100)), sendmax(MPT(99)), - delivermin(MPT(99)), + deliver_min(MPT(99)), txflags(tfPartialPayment)); } diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 6e30ed9c13..6950286b52 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -708,7 +708,7 @@ public: void testHeterogeneousSigners(FeatureBitset features) { - testcase("Heterogenious Signers"); + testcase("Heterogenous Signers"); using namespace jtx; Env env{*this, features}; diff --git a/src/test/app/NetworkOPs_test.cpp b/src/test/app/NetworkOPs_test.cpp index d5616009fa..582f9a8084 100644 --- a/src/test/app/NetworkOPs_test.cpp +++ b/src/test/app/NetworkOPs_test.cpp @@ -38,14 +38,14 @@ public: auto const jtx = env.jt(ticket::create(alice, 1), seq(1), fee(10)); - auto transacionId = jtx.stx->getTransactionID(); + auto transactionId = jtx.stx->getTransactionID(); env.app().getHashRouter().setFlags( - transacionId, HashRouterFlags::HELD); + transactionId, HashRouterFlags::HELD); env(jtx, json(jss::Sequence, 1), ter(terNO_ACCOUNT)); env.app().getHashRouter().setFlags( - transacionId, HashRouterFlags::BAD); + transactionId, HashRouterFlags::BAD); env.close(); } diff --git a/src/test/app/Offer_test.cpp b/src/test/app/Offer_test.cpp index 46a2cabec1..f1d68ece1e 100644 --- a/src/test/app/Offer_test.cpp +++ b/src/test/app/Offer_test.cpp @@ -2290,7 +2290,7 @@ public: // clang-format off TestData const tests[]{ - // acct fundXrp bookAmt preTrust offerAmt tec spentXrp balanceUSD offers owners + // acct fundXrp bookAmt preTrust offerAmount tec spentXrp balanceUSD offers owners {"ann", reserve(env, 0) + 0 * f, 1, noPreTrust, 1000, tecUNFUNDED_OFFER, f, USD( 0), 0, 0}, // Account is at the reserve, and will dip below once fees are subtracted. {"bev", reserve(env, 0) + 1 * f, 1, noPreTrust, 1000, tecUNFUNDED_OFFER, f, USD( 0), 0, 0}, // Account has just enough for the reserve and the fee. {"cam", reserve(env, 0) + 2 * f, 0, noPreTrust, 1000, tecINSUF_RESERVE_OFFER, f, USD( 0), 0, 0}, // Account has enough for the reserve, the fee and the offer, and a bit more, but not enough for the reserve after the offer is placed. diff --git a/src/test/app/TheoreticalQuality_test.cpp b/src/test/app/TheoreticalQuality_test.cpp index 5cc03247ae..ed4a62c4b0 100644 --- a/src/test/app/TheoreticalQuality_test.cpp +++ b/src/test/app/TheoreticalQuality_test.cpp @@ -277,7 +277,7 @@ class TheoreticalQuality_test : public beast::unit_test::suite if (actualQ != theoreticalQ && !compareClose(actualQ, theoreticalQ)) { BEAST_EXPECT(actualQ == theoreticalQ); // get the failure - log << "\nAcutal != Theoretical\n"; + log << "\nActual != Theoretical\n"; log << "\nTQ: " << prettyQuality(theoreticalQ) << "\n"; log << "AQ: " << prettyQuality(actualQ) << "\n"; logStrand(log, strand); diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index f6ab13e04f..9489bb7f04 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -4311,7 +4311,7 @@ public: } void - testReexecutePreflight() + testReExecutePreflight() { // The TxQ caches preflight results. But there are situations where // that cache must become invalidated, like if amendments change. @@ -5036,7 +5036,7 @@ public: testScaling(); testInLedgerSeq(); testInLedgerTicket(); - testReexecutePreflight(); + testReExecutePreflight(); testQueueFullDropPenalty(); testCancelQueuedOffers(); testZeroReferenceFee(); diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index fbe87ccb5d..f8d76623fd 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -1517,7 +1517,7 @@ class Vault_test : public beast::unit_test::suite auto const [asset1, asset2] = std::pair(XRP(10000), USD(10000)); - auto tofund = [&](STAmount const& a) -> STAmount { + auto toFund = [&](STAmount const& a) -> STAmount { if (a.native()) { auto const defXRP = XRP(30000); @@ -1530,8 +1530,8 @@ class Vault_test : public beast::unit_test::suite return defIOU; return a + STAmount{a.issue(), 1000}; }; - auto const toFund1 = tofund(asset1); - auto const toFund2 = tofund(asset2); + auto const toFund1 = toFund(asset1); + auto const toFund2 = toFund(asset2); BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2); if (!asset1.native() && !asset2.native()) diff --git a/src/test/app/XChain_test.cpp b/src/test/app/XChain_test.cpp index 619054b078..3b09845723 100644 --- a/src/test/app/XChain_test.cpp +++ b/src/test/app/XChain_test.cpp @@ -247,7 +247,7 @@ struct BalanceTransfer balance from_; balance to_; - balance payor_; // pays the rewards + balance payer_; // pays the rewards std::vector reward_accounts; // receives the reward XRPAmount txFees_; @@ -255,13 +255,13 @@ struct BalanceTransfer T& env, jtx::Account const& from_acct, jtx::Account const& to_acct, - jtx::Account const& payor, + jtx::Account const& payer, jtx::Account const* payees, size_t num_payees, bool withClaim) : from_(env, from_acct) , to_(env, to_acct) - , payor_(env, payor) + , payer_(env, payer) , reward_accounts([&]() { std::vector r; r.reserve(num_payees); @@ -277,14 +277,14 @@ struct BalanceTransfer T& env, jtx::Account const& from_acct, jtx::Account const& to_acct, - jtx::Account const& payor, + jtx::Account const& payer, std::vector const& payees, bool withClaim) : BalanceTransfer( env, from_acct, to_acct, - payor, + payer, &payees[0], payees.size(), withClaim) @@ -316,14 +316,14 @@ struct BalanceTransfer auto reward_cost = multiply(reward, STAmount(reward_accounts.size()), reward.issue()); return check_most_balances(amt, reward) && - (!check_payer || payor_.diff() == -(reward_cost + txFees_)); + (!check_payer || payer_.diff() == -(reward_cost + txFees_)); } bool has_not_happened() { return check_most_balances(STAmount(0), STAmount(0)) && - payor_.diff() <= txFees_; // could have paid fee for failed claim + payer_.diff() <= txFees_; // could have paid fee for failed claim } }; @@ -592,7 +592,7 @@ struct XChain_test : public beast::unit_test::suite, auto CEUR = C["EUR"]; auto GEUR = scGw["EUR"]; - // Accounts to own single brdiges + // Accounts to own single bridges Account const a1("a1"); Account const a2("a2"); Account const a3("a3"); @@ -2566,7 +2566,7 @@ struct XChain_test : public beast::unit_test::suite, } { // --B5: missing sfAttestationSignerAccount field - // Then submit the one with the field. Should rearch quorum. + // Then submit the one with the field. Should reach quorum. auto att = claim_attestation( scAttester, jvb, @@ -3825,7 +3825,7 @@ struct XChain_test : public beast::unit_test::suite, } // this also checks that only 3 * split_reward was deducted from - // scAlice (the payor account), since we passed alt_payees to + // scAlice (the payer account), since we passed alt_payees to // BalanceTransfer BEAST_EXPECT(transfer.has_happened(amt, split_reward_quorum)); } @@ -3884,7 +3884,7 @@ struct XChain_test : public beast::unit_test::suite, } // this also checks that only 3 * split_reward was deducted from - // scAlice (the payor account), since we passed payees.size() - + // scAlice (the payer account), since we passed payees.size() - // 1 to BalanceTransfer BEAST_EXPECT(transfer.has_happened(amt, split_reward_quorum)); @@ -4548,7 +4548,7 @@ private: enum SmState { st_initial, - st_claimid_created, + st_claim_id_created, st_attesting, st_attested, st_completed, @@ -4864,10 +4864,10 @@ private: { case st_initial: xfer.claim_id = create_claim_id(); - sm_state = st_claimid_created; + sm_state = st_claim_id_created; break; - case st_claimid_created: + case st_claim_id_created: commit(); sm_state = st_attesting; break; diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index 0b198dcd22..6f9473ce69 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -15,7 +15,7 @@ public: void run() override { - testcase("Require Fully Canonicial Signature"); + testcase("Require Fully Canonical Signature"); testFullyCanonicalSigs(); } diff --git a/src/test/beast/xxhasher_test.cpp b/src/test/beast/xxhasher_test.cpp index 7456fc73c4..f740bf0821 100644 --- a/src/test/beast/xxhasher_test.cpp +++ b/src/test/beast/xxhasher_test.cpp @@ -52,7 +52,7 @@ public: } void - testBigObjectWithMultiupleSmallUpdatesWithoutSeed() + testBigObjectWithMultipleSmallUpdatesWithoutSeed() { testcase("Big object with multiple small updates without seed"); xxhasher hasher{}; @@ -69,7 +69,7 @@ public: } void - testBigObjectWithMultiupleSmallUpdatesWithSeed() + testBigObjectWithMultipleSmallUpdatesWithSeed() { testcase("Big object with multiple small updates with seed"); xxhasher hasher{static_cast(103)}; @@ -199,8 +199,8 @@ public: testWithoutSeed(); testWithSeed(); testWithTwoSeeds(); - testBigObjectWithMultiupleSmallUpdatesWithoutSeed(); - testBigObjectWithMultiupleSmallUpdatesWithSeed(); + testBigObjectWithMultipleSmallUpdatesWithoutSeed(); + testBigObjectWithMultipleSmallUpdatesWithSeed(); testBigObjectWithSmallAndBigUpdatesWithoutSeed(); testBigObjectWithSmallAndBigUpdatesWithSeed(); testBigObjectWithOneUpdateWithoutSeed(); diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index e10d6cbdd0..535aec03bf 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -25,7 +25,7 @@ namespace test { /** * Test the size of the negative UNL in a ledger, - * also test if the ledger has ToDisalbe and/or ToReEnable + * also test if the ledger has ToDisable and/or ToReEnable * * @param l the ledger * @param size the expected negative UNL size @@ -553,11 +553,11 @@ struct NetworkHistory bool createLedgerHistory() { - static uint256 fake_amemdment; // So we have different genesis ledgers + static uint256 fake_amendment; // So we have different genesis ledgers auto l = std::make_shared( create_genesis, env.app().config(), - std::vector{fake_amemdment++}, + std::vector{fake_amendment++}, env.app().getNodeFamily()); history.push_back(l); diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 139e8702eb..d6ec875982 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -206,8 +206,8 @@ nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8 nHUPDdcdb2Y5DZAJne4c2iabFuAP3F34xZUgYQT2NH7qfkdapgnz [validator_list_sites] -recommendedxrplvalidators.com -morexrplvalidators.net +recommended-xrpl-validators.com +more-xrpl-validators.net [validator_list_keys] 03E74EE14CB525AFBB9F1B7D86CD58ECC4B91452294B42AB4E78F260BD905C091D diff --git a/src/test/csf/Digraph.h b/src/test/csf/Digraph.h index 688d0528d3..a283f2f7cc 100644 --- a/src/test/csf/Digraph.h +++ b/src/test/csf/Digraph.h @@ -199,7 +199,7 @@ public: Save a GraphViz dot description of the graph @param fileName The output file (creates) - @param vertexName A invokable T vertexName(Vertex const &) that + @param vertexName A invocable T vertexName(Vertex const &) that returns the name target use for the vertex in the file T must be ostream-able */ diff --git a/src/test/csf/Peer.h b/src/test/csf/Peer.h index b2a0c3b3ed..b86991ba5f 100644 --- a/src/test/csf/Peer.h +++ b/src/test/csf/Peer.h @@ -722,7 +722,7 @@ struct Peer template struct BroadcastMesg { - M mesg; + M msg; std::size_t seq; PeerID origin; }; @@ -748,7 +748,7 @@ struct Peer // used on the other end if (link.target->router.lastObservedSeq[bm.origin] < bm.seq) { - issue(Relay{link.target->id, bm.mesg}); + issue(Relay{link.target->id, bm.msg}); net.send( this, link.target, @@ -765,12 +765,12 @@ struct Peer void receive(BroadcastMesg const& bm, PeerID from) { - issue(Receive{from, bm.mesg}); + issue(Receive{from, bm.msg}); if (router.lastObservedSeq[bm.origin] < bm.seq) { router.lastObservedSeq[bm.origin] = bm.seq; - schedule(delays.onReceive(bm.mesg), [this, bm, from] { - if (handle(bm.mesg)) + schedule(delays.onReceive(bm.msg), [this, bm, from] { + if (handle(bm.msg)) send(bm, from); }); } diff --git a/src/test/csf/PeerGroup.h b/src/test/csf/PeerGroup.h index e674581546..8a215eaf8d 100644 --- a/src/test/csf/PeerGroup.h +++ b/src/test/csf/PeerGroup.h @@ -193,7 +193,7 @@ public: /** Establish network connections based on trust relations For each peers in this group, create outbound network connection - to the set of peers it trusts. If a coonnection already exists, it is + to the set of peers it trusts. If a connection already exists, it is not recreated. @param delay The fixed messaging delay for all established connections diff --git a/src/test/jtx/Env_test.cpp b/src/test/jtx/Env_test.cpp index ba5a2ee8c5..fbe51c2a8d 100644 --- a/src/test/jtx/Env_test.cpp +++ b/src/test/jtx/Env_test.cpp @@ -33,7 +33,7 @@ public: { using namespace jtx; { - Account a("chenna"); + Account a("chad"); Account b(a); a = b; a = std::move(b); @@ -162,8 +162,8 @@ public: // flags env.fund(n, noripple("xavier")); env.require(nflags("xavier", asfDefaultRipple)); - env.fund(n, "yana"); - env.require(flags("yana", asfDefaultRipple)); + env.fund(n, "zachary"); + env.require(flags("zachary", asfDefaultRipple)); } // trust @@ -596,12 +596,9 @@ public: using namespace jtx; Env env(*this); env.fund(XRP(10000), "alice"); - env(noop("alice"), memodata("data")); - env(noop("alice"), memoformat("format")); - env(noop("alice"), memotype("type")); - env(noop("alice"), memondata("format", "type")); - env(noop("alice"), memonformat("data", "type")); - env(noop("alice"), memontype("data", "format")); + env(noop("alice"), memo_data("data")); + env(noop("alice"), memo_format("format")); + env(noop("alice"), memo_type("type")); env(noop("alice"), memo("data", "format", "type")); env(noop("alice"), memo("data1", "format1", "type1"), diff --git a/src/test/jtx/Oracle.h b/src/test/jtx/Oracle.h index fc7dc89cd1..17d72384f6 100644 --- a/src/test/jtx/Oracle.h +++ b/src/test/jtx/Oracle.h @@ -132,7 +132,7 @@ public: std::optional const& quoteAsset, std::optional const& oracles = std::nullopt, std::optional const& trim = std::nullopt, - std::optional const& timeTreshold = std::nullopt); + std::optional const& timeThreshold = std::nullopt); std::uint32_t documentID() const @@ -150,7 +150,7 @@ public: exists(Env& env, AccountID const& account, std::uint32_t documentID); [[nodiscard]] bool - expectPrice(DataSeries const& pricess) const; + expectPrice(DataSeries const& prices) const; [[nodiscard]] bool expectLastUpdateTime(std::uint32_t lastUpdateTime) const; diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index faf70921be..a310fc5b44 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -277,7 +277,7 @@ struct XRP_t } /** Returns an amount of XRP as PrettyAmount, - which is trivially convertable to STAmount + which is trivially convertible to STAmount @param v The Number of XRP (not drops). May be fractional. */ diff --git a/src/test/jtx/delivermin.h b/src/test/jtx/delivermin.h index 70f092c9dc..033b3f20b8 100644 --- a/src/test/jtx/delivermin.h +++ b/src/test/jtx/delivermin.h @@ -10,13 +10,13 @@ namespace test { namespace jtx { /** Sets the DeliverMin on a JTx. */ -class delivermin +class deliver_min { private: STAmount amount_; public: - delivermin(STAmount const& amount) : amount_(amount) + deliver_min(STAmount const& amount) : amount_(amount) { } diff --git a/src/test/jtx/impl/AMMTest.cpp b/src/test/jtx/impl/AMMTest.cpp index 790762d3df..de7ce5504b 100644 --- a/src/test/jtx/impl/AMMTest.cpp +++ b/src/test/jtx/impl/AMMTest.cpp @@ -112,7 +112,7 @@ AMMTestBase::testAMM( auto const [asset1, asset2] = arg.pool ? *arg.pool : std::make_pair(XRP(10000), USD(10000)); - auto tofund = [&](STAmount const& a) -> STAmount { + auto toFund = [&](STAmount const& a) -> STAmount { if (a.native()) { auto const defXRP = XRP(30000); @@ -125,8 +125,8 @@ AMMTestBase::testAMM( return defIOU; return a + STAmount{a.issue(), 1000}; }; - auto const toFund1 = tofund(asset1); - auto const toFund2 = tofund(asset2); + auto const toFund1 = toFund(asset1); + auto const toFund2 = toFund(asset2); BEAST_EXPECT(asset1 <= toFund1 && asset2 <= toFund2); if (!asset1.native() && !asset2.native()) diff --git a/src/test/jtx/impl/delivermin.cpp b/src/test/jtx/impl/delivermin.cpp index 5ad98edd09..a5c1414525 100644 --- a/src/test/jtx/impl/delivermin.cpp +++ b/src/test/jtx/impl/delivermin.cpp @@ -7,7 +7,7 @@ namespace test { namespace jtx { void -delivermin::operator()(Env& env, JTx& jt) const +deliver_min::operator()(Env& env, JTx& jt) const { jt.jv[jss::DeliverMin] = amount_.getJson(JsonOptions::none); } diff --git a/src/test/jtx/impl/memo.cpp b/src/test/jtx/impl/memo.cpp index c815b916d7..e503b9a073 100644 --- a/src/test/jtx/impl/memo.cpp +++ b/src/test/jtx/impl/memo.cpp @@ -17,7 +17,7 @@ memo::operator()(Env&, JTx& jt) const } void -memodata::operator()(Env&, JTx& jt) const +memo_data::operator()(Env&, JTx& jt) const { auto& jv = jt.jv; auto& ma = jv["Memos"]; @@ -27,7 +27,7 @@ memodata::operator()(Env&, JTx& jt) const } void -memoformat::operator()(Env&, JTx& jt) const +memo_format::operator()(Env&, JTx& jt) const { auto& jv = jt.jv; auto& ma = jv["Memos"]; @@ -37,7 +37,7 @@ memoformat::operator()(Env&, JTx& jt) const } void -memotype::operator()(Env&, JTx& jt) const +memo_type::operator()(Env&, JTx& jt) const { auto& jv = jt.jv; auto& ma = jv["Memos"]; @@ -46,39 +46,6 @@ memotype::operator()(Env&, JTx& jt) const m["MemoType"] = strHex(s_); } -void -memondata::operator()(Env&, JTx& jt) const -{ - auto& jv = jt.jv; - auto& ma = jv["Memos"]; - auto& mi = ma[ma.size()]; - auto& m = mi["Memo"]; - m["MemoFormat"] = strHex(format_); - m["MemoType"] = strHex(type_); -} - -void -memonformat::operator()(Env&, JTx& jt) const -{ - auto& jv = jt.jv; - auto& ma = jv["Memos"]; - auto& mi = ma[ma.size()]; - auto& m = mi["Memo"]; - m["MemoData"] = strHex(data_); - m["MemoType"] = strHex(type_); -} - -void -memontype::operator()(Env&, JTx& jt) const -{ - auto& jv = jt.jv; - auto& ma = jv["Memos"]; - auto& mi = ma[ma.size()]; - auto& m = mi["Memo"]; - m["MemoData"] = strHex(data_); - m["MemoFormat"] = strHex(format_); -} - } // namespace jtx } // namespace test } // namespace xrpl diff --git a/src/test/jtx/memo.h b/src/test/jtx/memo.h index 377dcbec4e..2506f063fc 100644 --- a/src/test/jtx/memo.h +++ b/src/test/jtx/memo.h @@ -32,13 +32,13 @@ public: operator()(Env&, JTx& jt) const; }; -class memodata +class memo_data { private: std::string s_; public: - memodata(std::string const& s) : s_(s) + memo_data(std::string const& s) : s_(s) { } @@ -46,13 +46,13 @@ public: operator()(Env&, JTx& jt) const; }; -class memoformat +class memo_format { private: std::string s_; public: - memoformat(std::string const& s) : s_(s) + memo_format(std::string const& s) : s_(s) { } @@ -60,61 +60,13 @@ public: operator()(Env&, JTx& jt) const; }; -class memotype +class memo_type { private: std::string s_; public: - memotype(std::string const& s) : s_(s) - { - } - - void - operator()(Env&, JTx& jt) const; -}; - -class memondata -{ -private: - std::string format_; - std::string type_; - -public: - memondata(std::string const& format, std::string const& type) - : format_(format), type_(type) - { - } - - void - operator()(Env&, JTx& jt) const; -}; - -class memonformat -{ -private: - std::string data_; - std::string type_; - -public: - memonformat(std::string const& data, std::string const& type) - : data_(data), type_(type) - { - } - - void - operator()(Env&, JTx& jt) const; -}; - -class memontype -{ -private: - std::string data_; - std::string format_; - -public: - memontype(std::string const& data, std::string const& format) - : data_(data), format_(format) + memo_type(std::string const& s) : s_(s) { } diff --git a/src/test/protocol/TER_test.cpp b/src/test/protocol/TER_test.cpp index 0d9c6cb96d..56b3b08051 100644 --- a/src/test/protocol/TER_test.cpp +++ b/src/test/protocol/TER_test.cpp @@ -137,7 +137,7 @@ struct TER_test : public beast::unit_test::suite testIterate(terEnums, *this); // Lambda that verifies assignability and convertibility. - auto isConvertable = [](auto from, auto to) { + auto isConvertible = [](auto from, auto to) { using From_t = std::decay_t; using To_t = std::decay_t; static_assert( @@ -150,12 +150,12 @@ struct TER_test : public beast::unit_test::suite // Verify the right types convert to NotTEC. NotTEC const notTec; - isConvertable(telLOCAL_ERROR, notTec); - isConvertable(temMALFORMED, notTec); - isConvertable(tefFAILURE, notTec); - isConvertable(terRETRY, notTec); - isConvertable(tesSUCCESS, notTec); - isConvertable(notTec, notTec); + isConvertible(telLOCAL_ERROR, notTec); + isConvertible(temMALFORMED, notTec); + isConvertible(tefFAILURE, notTec); + isConvertible(terRETRY, notTec); + isConvertible(tesSUCCESS, notTec); + isConvertible(notTec, notTec); // Lambda that verifies types and not assignable or convertible. auto notConvertible = [](auto from, auto to) { @@ -176,14 +176,14 @@ struct TER_test : public beast::unit_test::suite notConvertible(4, notTec); // Verify the right types convert to TER. - isConvertable(telLOCAL_ERROR, ter); - isConvertable(temMALFORMED, ter); - isConvertable(tefFAILURE, ter); - isConvertable(terRETRY, ter); - isConvertable(tesSUCCESS, ter); - isConvertable(tecCLAIM, ter); - isConvertable(notTec, ter); - isConvertable(ter, ter); + isConvertible(telLOCAL_ERROR, ter); + isConvertible(temMALFORMED, ter); + isConvertible(tefFAILURE, ter); + isConvertible(terRETRY, ter); + isConvertible(tesSUCCESS, ter); + isConvertible(tecCLAIM, ter); + isConvertible(notTec, ter); + isConvertible(ter, ter); // Verify that you can't convert from int to ter. notConvertible(4, ter); diff --git a/src/test/rpc/AccountTx_test.cpp b/src/test/rpc/AccountTx_test.cpp index e387e1bc4c..36d29236d1 100644 --- a/src/test/rpc/AccountTx_test.cpp +++ b/src/test/rpc/AccountTx_test.cpp @@ -551,12 +551,12 @@ class AccountTx_test : public beast::unit_test::suite auto escrow = [](Account const& account, Account const& to, STAmount const& amount) { - Json::Value escro; - escro[jss::TransactionType] = jss::EscrowCreate; - escro[jss::Account] = account.human(); - escro[jss::Destination] = to.human(); - escro[jss::Amount] = amount.getJson(JsonOptions::none); - return escro; + Json::Value escrow; + escrow[jss::TransactionType] = jss::EscrowCreate; + escrow[jss::Account] = account.human(); + escrow[jss::Destination] = to.human(); + escrow[jss::Amount] = amount.getJson(JsonOptions::none); + return escrow; }; NetClock::time_point const nextTime{env.now() + 2s}; @@ -651,7 +651,7 @@ class AccountTx_test : public beast::unit_test::suite env.close(); } { - // Deposit preauthorization with a Ticket. + // Deposit pre-authorization with a Ticket. std::uint32_t const tktSeq{env.seq(alice) + 1}; env(ticket::create(alice, 1), sig(alie)); env.close(); @@ -788,19 +788,19 @@ class AccountTx_test : public beast::unit_test::suite BEAST_EXPECT(result[jss::result][jss::transactions].isArray()); // The first two transactions listed in sanity haven't happened yet. - constexpr unsigned int beckyDeletedOffest = 2; + constexpr unsigned int beckyDeletedOffset = 2; BEAST_EXPECT( std::size(sanity) == result[jss::result][jss::transactions].size() + - beckyDeletedOffest); + beckyDeletedOffset); Json::Value const& txs{result[jss::result][jss::transactions]}; - for (unsigned int index = beckyDeletedOffest; + for (unsigned int index = beckyDeletedOffset; index < std::size(sanity); ++index) { - checkSanity(txs[index - beckyDeletedOffest], sanity[index]); + checkSanity(txs[index - beckyDeletedOffset], sanity[index]); } } diff --git a/src/test/rpc/Book_test.cpp b/src/test/rpc/Book_test.cpp index 3c7477745b..ae2aff689d 100644 --- a/src/test/rpc/Book_test.cpp +++ b/src/test/rpc/Book_test.cpp @@ -1719,7 +1719,7 @@ public: BEAST_EXPECT(jrr[jss::offers].isArray()); BEAST_EXPECT( jrr[jss::offers].size() == - (asAdmin ? RPC::Tuning::bookOffers.rdefault : 0u)); + (asAdmin ? RPC::Tuning::bookOffers.rDefault : 0u)); } void diff --git a/src/test/rpc/DepositAuthorized_test.cpp b/src/test/rpc/DepositAuthorized_test.cpp index 968a3fd4dc..3e082a70a1 100644 --- a/src/test/rpc/DepositAuthorized_test.cpp +++ b/src/test/rpc/DepositAuthorized_test.cpp @@ -555,7 +555,7 @@ public: testcase("deposit_authorized with expired credentials"); // check expired credentials - char const credType2[] = "fghijk"; + char const credType2[] = "random"; std::uint32_t const x = env.current() ->header() .parentCloseTime.time_since_epoch() diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index 4d3f0a5098..6a9fae74a5 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -54,7 +54,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Minimal payment, no Amount only DeliverMax", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "secret": "masterpassphrase", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -71,7 +71,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Pass in Fee with minimal payment, both Amount and DeliverMax.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -91,7 +91,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Pass in Sequence, no Amount only DeliverMax", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -111,7 +111,7 @@ static constexpr TxnTestData txnTestArray[] = { "DeliverMax.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -133,7 +133,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Add 'fee_mult_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 7, @@ -153,7 +153,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Add 'fee_mult_max' and 'fee_div_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 7, @@ -174,7 +174,7 @@ static constexpr TxnTestData txnTestArray[] = { {"fee_mult_max is ignored if 'Fee' is present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 0, @@ -196,7 +196,7 @@ static constexpr TxnTestData txnTestArray[] = { {"fee_div_max is ignored if 'Fee' is present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 100, @@ -219,7 +219,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid 'fee_mult_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": "NotAFeeMultiplier", @@ -239,7 +239,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid 'fee_div_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 5, @@ -260,7 +260,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid value for 'fee_mult_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 0, @@ -280,7 +280,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid value for 'fee_div_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 4, @@ -301,7 +301,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid zero value for 'fee_div_max' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "fee_mult_max": 4, @@ -322,7 +322,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Amount'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -339,7 +339,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid 'Amount'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -357,7 +357,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Destination'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -374,7 +374,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid 'Destination'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -392,7 +392,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Cannot create XRP to XRP paths.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "build_path": 1, @@ -411,7 +411,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Successful 'build_path'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "build_path": 1, @@ -434,7 +434,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Not valid to include both 'Paths' and 'build_path'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "build_path": 1, @@ -458,7 +458,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Successful 'SendMax'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "build_path": 1, @@ -486,7 +486,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'Amount' may not be XRP for pathfinding, but 'SendMax' may be XRP.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "build_path": 1, @@ -510,7 +510,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'secret' must be present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -527,7 +527,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'secret' must be non-empty.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "", "tx_json": { @@ -545,7 +545,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Use 'seed' instead of 'secret'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", "key_type": "ed25519", "seed": "sh1yJfwoi98zCygwijUzuHmJDeVKd", @@ -564,7 +564,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Malformed 'seed'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", "key_type": "ed25519", "seed": "not a seed", @@ -583,7 +583,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'tx_json' must be present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "rx_json": { @@ -601,7 +601,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'TransactionType' must be present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -618,7 +618,7 @@ static constexpr TxnTestData txnTestArray[] = { {"The 'TransactionType' must be a pre-established transaction type.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -636,7 +636,7 @@ static constexpr TxnTestData txnTestArray[] = { {"The 'TransactionType' may be represented with an integer.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -654,7 +654,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'Account' must be present.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -671,7 +671,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'Account' must be well formed.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -689,7 +689,7 @@ static constexpr TxnTestData txnTestArray[] = { {"The 'offline' tag may be added to the transaction.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 0, @@ -708,7 +708,7 @@ static constexpr TxnTestData txnTestArray[] = { {"If 'offline' is true then a 'Sequence' field must be supplied.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 1, @@ -728,7 +728,7 @@ static constexpr TxnTestData txnTestArray[] = { {"If 'offline' is true then a 'Fee' field must be supplied.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 1, @@ -748,7 +748,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Valid transaction if 'offline' is true.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 1, @@ -770,7 +770,7 @@ static constexpr TxnTestData txnTestArray[] = { {"'offline' and 'build_path' are mutually exclusive.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 1, @@ -792,7 +792,7 @@ static constexpr TxnTestData txnTestArray[] = { {"A 'Flags' field may be specified.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -811,7 +811,7 @@ static constexpr TxnTestData txnTestArray[] = { {"The 'Flags' field must be numeric.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -830,7 +830,7 @@ static constexpr TxnTestData txnTestArray[] = { {"It's okay to add a 'debug_signing' field.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "debug_signing": 0, @@ -849,7 +849,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Single-sign a multisigned transaction.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", "secret": "a", "tx_json": { @@ -879,7 +879,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Minimal sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -900,7 +900,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Minimal offline sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "offline": 1, @@ -919,7 +919,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Offline sign_for using 'seed' instead of 'secret'.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", "key_type": "ed25519", "seed": "sh1yJfwoi98zCygwijUzuHmJDeVKd", @@ -939,7 +939,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Malformed seed in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi", "key_type": "ed25519", "seed": "sh1yJfwoi98zCygwjUzuHmJDeVKd", @@ -962,7 +962,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Account' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -982,7 +982,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Amount' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1002,7 +1002,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Destination' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1022,7 +1022,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Destination' in sign_for, use DeliverMax", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1042,7 +1042,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Fee' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1062,7 +1062,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'Sequence' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1082,7 +1082,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'SigningPubKey' in sign_for is automatically filled in.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1102,7 +1102,7 @@ static constexpr TxnTestData txnTestArray[] = { {"In sign_for, an account may not sign for itself.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA", "secret": "a", "tx_json": { @@ -1123,7 +1123,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Cannot put duplicate accounts in Signers array", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1154,7 +1154,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Correctly append to pre-established Signers array", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", "secret": "c", "tx_json": { @@ -1181,7 +1181,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Append to pre-established Signers array with bad signature", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", "secret": "c", "tx_json": { @@ -1211,7 +1211,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Non-empty 'SigningPubKey' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1232,7 +1232,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Missing 'TransactionType' in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": { @@ -1252,7 +1252,7 @@ static constexpr TxnTestData txnTestArray[] = { {"TxnSignature in sign_for.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rPcNzota6B8YBokhYtcTNqQVCngtbnWfux", "secret": "c", "tx_json": { @@ -1283,7 +1283,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid field 'tx_json': string instead of object", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": "" @@ -1296,7 +1296,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid field 'tx_json': integer instead of object", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": 20160331 @@ -1309,7 +1309,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Invalid field 'tx_json': array instead of object", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "tx_json": [ "hello", "world" ] @@ -1322,7 +1322,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Pass in Fee with minimal payment, both Amount and DeliverMax.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "r9zN9x52FiCFAcicCLMQKbj1nxYhxJbbSy", "secret": "ssgN6zTvtM1q9XV8DvJpWm8LBYWiY", "tx_json": { @@ -2003,7 +2003,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Payment cannot specify different DeliverMax and Amount.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "debug_signing": 0, @@ -2025,7 +2025,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Payment cannot specify bad DomainID.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "secret": "masterpassphrase", "debug_signing": 0, @@ -2048,7 +2048,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Minimal delegated transaction.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "secret": "a", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -2066,7 +2066,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Delegate not well formed.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "secret": "a", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -2084,7 +2084,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Delegate not in ledger.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "secret": "a", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", @@ -2102,7 +2102,7 @@ static constexpr TxnTestData txnTestArray[] = { {"Delegate and secret not match.", __LINE__, R"({ - "command": "doesnt_matter", + "command": "dummy_command", "secret": "aa", "tx_json": { "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", diff --git a/src/test/rpc/RPCCall_test.cpp b/src/test/rpc/RPCCall_test.cpp index 682584f40b..85402ff024 100644 --- a/src/test/rpc/RPCCall_test.cpp +++ b/src/test/rpc/RPCCall_test.cpp @@ -3921,7 +3921,7 @@ static RPCCallTestData const rpcCallTestArray[] = { } ] })"}, - {"log_level: partiton_name.", + {"log_level: partition_name.", __LINE__, {"log_level", "partition_name", "fatal"}, RPCCallTestData::no_exception, diff --git a/src/test/rpc/Simulate_test.cpp b/src/test/rpc/Simulate_test.cpp index 2a85e2a928..7fe90fb9a1 100644 --- a/src/test/rpc/Simulate_test.cpp +++ b/src/test/rpc/Simulate_test.cpp @@ -261,7 +261,7 @@ class Simulate_test : public beast::unit_test::suite { // `seed` field included Json::Value params = Json::objectValue; - params[jss::seed] = "doesnt_matter"; + params[jss::seed] = "random_data"; Json::Value tx_json = Json::objectValue; tx_json[jss::TransactionType] = jss::AccountSet; tx_json[jss::Account] = env.master.human(); @@ -274,7 +274,7 @@ class Simulate_test : public beast::unit_test::suite { // `secret` field included Json::Value params = Json::objectValue; - params[jss::secret] = "doesnt_matter"; + params[jss::secret] = "random_data"; Json::Value tx_json = Json::objectValue; tx_json[jss::TransactionType] = jss::AccountSet; tx_json[jss::Account] = env.master.human(); @@ -287,7 +287,7 @@ class Simulate_test : public beast::unit_test::suite { // `seed_hex` field included Json::Value params = Json::objectValue; - params[jss::seed_hex] = "doesnt_matter"; + params[jss::seed_hex] = "random_data"; Json::Value tx_json = Json::objectValue; tx_json[jss::TransactionType] = jss::AccountSet; tx_json[jss::Account] = env.master.human(); @@ -300,7 +300,7 @@ class Simulate_test : public beast::unit_test::suite { // `passphrase` field included Json::Value params = Json::objectValue; - params[jss::passphrase] = "doesnt_matter"; + params[jss::passphrase] = "random_data"; Json::Value tx_json = Json::objectValue; tx_json[jss::TransactionType] = jss::AccountSet; tx_json[jss::Account] = env.master.human(); diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index 9f35a9162d..a2516126de 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -1149,7 +1149,7 @@ class ServerStatus_test : public beast::unit_test::suite, doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); BEAST_EXPECT( resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "params unparseable\r\n"); + BEAST_EXPECT(resp.body() == "params unparsable\r\n"); } { @@ -1159,7 +1159,7 @@ class ServerStatus_test : public beast::unit_test::suite, doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); BEAST_EXPECT( resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "params unparseable\r\n"); + BEAST_EXPECT(resp.body() == "params unparsable\r\n"); } } diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 2a2424995e..d176e85645 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -2204,7 +2204,7 @@ LedgerMaster::makeFetchPack( catch (std::exception const& ex) { JLOG(m_journal.warn()) - << "Exception building fetch pach. Exception: " << ex.what(); + << "Exception building fetch pack. Exception: " << ex.what(); } } diff --git a/src/xrpld/app/misc/FeeVoteImpl.cpp b/src/xrpld/app/misc/FeeVoteImpl.cpp index a6b140f691..08a9abf2db 100644 --- a/src/xrpld/app/misc/FeeVoteImpl.cpp +++ b/src/xrpld/app/misc/FeeVoteImpl.cpp @@ -230,12 +230,11 @@ FeeVoteImpl::doVoting( auto const& valueField) { if (auto const field = val->at(~valueField)) { - using xrptype = XRPAmount::value_type; + using XRPType = XRPAmount::value_type; auto const vote = *field; - if (vote <= std::numeric_limits::max() && - isLegalAmountSigned(XRPAmount{unsafe_cast(vote)})) - value.addVote( - XRPAmount{unsafe_cast(vote)}); + if (vote <= std::numeric_limits::max() && + isLegalAmountSigned(XRPAmount{unsafe_cast(vote)})) + value.addVote(XRPAmount{unsafe_cast(vote)}); else // Invalid amounts will be treated as if they're // not provided. Don't throw because this value is diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index d0f93577da..6a00354b15 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -3461,10 +3461,10 @@ NetworkOPsImp::pubAccountTransaction( } } - if (auto histoIt = mSubAccountHistory.find(affectedAccount); - histoIt != mSubAccountHistory.end()) + if (auto historyIt = mSubAccountHistory.find(affectedAccount); + historyIt != mSubAccountHistory.end()) { - auto& subs = histoIt->second; + auto& subs = historyIt->second; auto it = subs.begin(); while (it != subs.end()) { @@ -3487,7 +3487,7 @@ NetworkOPsImp::pubAccountTransaction( } } if (subs.empty()) - mSubAccountHistory.erase(histoIt); + mSubAccountHistory.erase(historyIt); } } } diff --git a/src/xrpld/app/misc/SHAMapStoreImp.h b/src/xrpld/app/misc/SHAMapStoreImp.h index aed2343a49..38997c2997 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.h +++ b/src/xrpld/app/misc/SHAMapStoreImp.h @@ -54,7 +54,7 @@ private: // name of state database std::string const dbName_ = "state"; // prefix of on-disk nodestore backend instances - std::string const dbPrefix_ = "rippledb"; + std::string const dbPrefix_ = "rippledb"; // cspell: disable-line // check health/stop status as records are copied std::uint64_t const checkHealthInterval_ = 1000; // minimum # of ledgers to maintain for health of network diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index fb1b10e886..10ed4adeea 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -537,12 +537,12 @@ private: /** Cached result of the `preflight` operation. Because `preflight` is expensive, minimize the number of times it needs to be done. - @invariant `pfresult` is never allowed to be empty. The + @invariant `pfResult` is never allowed to be empty. The `std::optional` is leveraged to allow `emplace`d construction and replacement without a copy assignment operation. */ - std::optional pfresult; + std::optional pfResult; /** Starting retry count for newly queued transactions. @@ -577,7 +577,7 @@ private: TxID const& txID, FeeLevel64 feeLevel, ApplyFlags const flags, - PreflightResult const& pfresult); + PreflightResult const& pfResult); /// Attempt to apply the queued transaction to the open ledger. ApplyResult @@ -588,7 +588,7 @@ private: TxConsequences const& consequences() const { - return pfresult->consequences; + return pfResult->consequences; } /// Return a TxDetails based on contained information. @@ -603,7 +603,7 @@ private: seqProxy, txn, retriesRemaining, - pfresult->ter, + pfResult->ter, lastResult}; } }; @@ -802,7 +802,7 @@ private: FeeMultiSet::iterator_type erase(FeeMultiSet::const_iterator_type); /** Erase and return the next entry for the account (if fee level is higher), or next entry in byFee_ (lower fee level). - Used to get the next "applyable" MaybeTx for accept(). + Used to get the next "applicable" MaybeTx for accept(). */ FeeMultiSet::iterator_type eraseAndAdvance( FeeMultiSet::const_iterator_type); @@ -826,7 +826,7 @@ private: AccountMap::iterator const& accountIter, TxQAccount::TxMap::iterator, FeeLevel64 feeLevelPaid, - PreflightResult const& pfresult, + PreflightResult const& pfResult, std::size_t const txExtraCount, ApplyFlags flags, FeeMetrics::Snapshot const& metricsSnapshot, diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index d6758f8877..45b24e8609 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -237,7 +237,7 @@ class ValidatorList // config file under the title of SECTION_VALIDATORS or [validators]. // This list is not associated with the masterKey of any publisher. - // Appropos PublisherListCollection fields, localPublisherList does not + // Apropos PublisherListCollection fields, localPublisherList does not // have any "remaining" manifests. It is assumed to be perennially // "available". The "validUntil" field is set to the highest possible // value of the field, hence this list is always valid. @@ -365,7 +365,7 @@ public: std::string const& rawManifest, std::map const& blobInfos, std::vector& messages, - std::size_t maxSize = maximiumMessageSize); + std::size_t maxSize = maximumMessageSize); /** Apply multiple published lists of public keys, then broadcast it to all peers that have not seen it or sent it. diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 9f260e5f48..01abcc9c7d 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -263,7 +263,7 @@ TxQ::MaybeTx::MaybeTx( TxID const& txID_, FeeLevel64 feeLevel_, ApplyFlags const flags_, - PreflightResult const& pfresult_) + PreflightResult const& pfResult_) : txn(txn_) , feeLevel(feeLevel_) , txID(txID_) @@ -272,7 +272,7 @@ TxQ::MaybeTx::MaybeTx( , seqProxy(txn_->getSeqProxy()) , retriesRemaining(retriesAllowed) , flags(flags_) - , pfresult(pfresult_) + , pfResult(pfResult_) { } @@ -281,20 +281,20 @@ TxQ::MaybeTx::apply(Application& app, OpenView& view, beast::Journal j) { // If the rules or flags change, preflight again XRPL_ASSERT( - pfresult, "xrpl::TxQ::MaybeTx::apply : preflight result is set"); + pfResult, "xrpl::TxQ::MaybeTx::apply : preflight result is set"); NumberSO stNumberSO{view.rules().enabled(fixUniversalNumber)}; - if (pfresult->rules != view.rules() || pfresult->flags != flags) + if (pfResult->rules != view.rules() || pfResult->flags != flags) { JLOG(j.debug()) << "Queued transaction " << txID << " rules or flags have changed. Flags from " - << pfresult->flags << " to " << flags; + << pfResult->flags << " to " << flags; - pfresult.emplace( - preflight(app, view.rules(), pfresult->tx, flags, pfresult->j)); + pfResult.emplace( + preflight(app, view.rules(), pfResult->tx, flags, pfResult->j)); } - auto pcresult = preclaim(*pfresult, app, view); + auto pcresult = preclaim(*pfResult, app, view); return doApply(pcresult, app, view); } @@ -503,7 +503,7 @@ TxQ::tryClearAccountQueueUpThruTx( TxQ::AccountMap::iterator const& accountIter, TxQAccount::TxMap::iterator beginTxIter, FeeLevel64 feeLevelPaid, - PreflightResult const& pfresult, + PreflightResult const& pfResult, std::size_t const txExtraCount, ApplyFlags flags, FeeMetrics::Snapshot const& metricsSnapshot, @@ -578,7 +578,7 @@ TxQ::tryClearAccountQueueUpThruTx( } // Apply the current tx. Because the state of the view has been changed // by the queued txs, we also need to preclaim again. - auto const txResult = doApply(preclaim(pfresult, app, view), app, view); + auto const txResult = doApply(preclaim(pfResult, app, view), app, view); if (txResult.applied) { @@ -720,9 +720,9 @@ TxQ::apply( // See if the transaction is valid, properly formed, // etc. before doing potentially expensive queue // replace and multi-transaction operations. - auto const pfresult = preflight(app, view.rules(), *tx, flags, j); - if (pfresult.ter != tesSUCCESS) - return {pfresult.ter, false}; + auto const pfResult = preflight(app, view.rules(), *tx, flags, j); + if (pfResult.ter != tesSUCCESS) + return {pfResult.ter, false}; // See if the transaction paid a high enough fee that it can go straight // into the ledger. @@ -814,7 +814,7 @@ TxQ::apply( // 1. If the account's queue is empty or // 2. If the blocker replaces the only entry in the account's queue. auto const transactionID = tx->getTransactionID(); - if (pfresult.consequences.isBlocker()) + if (pfResult.consequences.isBlocker()) { if (acctTxCount > 1) { @@ -1040,8 +1040,8 @@ TxQ::apply( // The fee for the candidate transaction _should_ be // counted if it's replacing a transaction in the middle // of the queue. - totalFee += pfresult.consequences.fee(); - potentialSpend += pfresult.consequences.potentialSpend(); + totalFee += pfResult.consequences.fee(); + potentialSpend += pfResult.consequences.potentialSpend(); } } @@ -1144,7 +1144,7 @@ TxQ::apply( // is valid. So we use a special entry point that runs all of the // preclaim checks with the exception of the sequence check. auto const pcresult = - preclaim(pfresult, app, multiTxn ? multiTxn->openView : view); + preclaim(pfResult, app, multiTxn ? multiTxn->openView : view); if (!pcresult.likelyToClaimFee) return {pcresult.ter, false}; @@ -1187,7 +1187,7 @@ TxQ::apply( accountIter, txIter->first, feeLevelPaid, - pfresult, + pfResult, view.txCount(), flags, metricsSnapshot, @@ -1316,12 +1316,12 @@ TxQ::apply( flags &= ~tapRETRY; auto& candidate = accountIter->second.add( - {tx, transactionID, feeLevelPaid, flags, pfresult}); + {tx, transactionID, feeLevelPaid, flags, pfResult}); // Then index it into the byFee lookup. byFee_.insert(candidate); JLOG(j_.debug()) << "Added transaction " << candidate.txID - << " with result " << transToken(pfresult.ter) << " from " + << " with result " << transToken(pfResult.ter) << " from " << (accountIsInQueue ? "existing" : "new") << " account " << candidate.account << " to queue." << " Flags: " << flags; diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index db2ee980b8..12ba52fa36 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -524,7 +524,7 @@ splitMessageParts( smallMsg.set_manifest(blob.manifest()); XRPL_ASSERT( - Message::totalSize(smallMsg) <= maximiumMessageSize, + Message::totalSize(smallMsg) <= maximumMessageSize, "xrpl::splitMessageParts : maximum message size"); messages.emplace_back( @@ -588,7 +588,7 @@ buildValidatorListMessage( msg.set_version(version); XRPL_ASSERT( - Message::totalSize(msg) <= maximiumMessageSize, + Message::totalSize(msg) <= maximumMessageSize, "xrpl::buildValidatorListMessage(ValidatorBlobInfo) : maximum " "message size"); messages.emplace_back( @@ -658,7 +658,7 @@ ValidatorList::buildValidatorListMessages( std::string const& rawManifest, std::map const& blobInfos, std::vector& messages, - std::size_t maxSize /*= maximiumMessageSize*/) + std::size_t maxSize /*= maximumMessageSize*/) { XRPL_ASSERT( !blobInfos.empty(), diff --git a/src/xrpld/app/paths/AMMOffer.h b/src/xrpld/app/paths/AMMOffer.h index 07defc16b1..7a81e53176 100644 --- a/src/xrpld/app/paths/AMMOffer.h +++ b/src/xrpld/app/paths/AMMOffer.h @@ -82,7 +82,7 @@ public: */ TAmounts limitOut( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TOut const& limit, bool roundUp) const; @@ -91,8 +91,10 @@ public: * current quality. */ TAmounts - limitIn(TAmounts const& offrAmt, TIn const& limit, bool roundUp) - const; + limitIn( + TAmounts const& offerAmount, + TIn const& limit, + bool roundUp) const; QualityFunction getQualityFunc() const; diff --git a/src/xrpld/app/paths/PathRequest.h b/src/xrpld/app/paths/PathRequest.h index 3d5564c069..8f63cfa9a9 100644 --- a/src/xrpld/app/paths/PathRequest.h +++ b/src/xrpld/app/paths/PathRequest.h @@ -103,7 +103,7 @@ private: std::function const&); /** Finds and sets a PathSet in the JSON argument. - Returns false if the source currencies are inavlid. + Returns false if the source currencies are invalid. */ bool findPaths( diff --git a/src/xrpld/app/paths/detail/AMMOffer.cpp b/src/xrpld/app/paths/detail/AMMOffer.cpp index a58eafbdbf..1152b673da 100644 --- a/src/xrpld/app/paths/detail/AMMOffer.cpp +++ b/src/xrpld/app/paths/detail/AMMOffer.cpp @@ -61,7 +61,7 @@ AMMOffer::consume( template TAmounts AMMOffer::limitOut( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TOut const& limit, bool roundUp) const { @@ -75,7 +75,7 @@ AMMOffer::limitOut( { // It turns out that the ceil_out implementation has some slop in // it, which ceil_out_strict removes. - return quality().ceil_out_strict(offrAmt, limit, roundUp); + return quality().ceil_out_strict(offerAmount, limit, roundUp); } // Change the offer size according to the conservation function. The offer // quality is increased in this case, but it doesn't matter since there is @@ -86,7 +86,7 @@ AMMOffer::limitOut( template TAmounts AMMOffer::limitIn( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TIn const& limit, bool roundUp) const { @@ -95,9 +95,9 @@ AMMOffer::limitIn( { if (auto const& rules = getCurrentTransactionRules(); rules && rules->enabled(fixReducedOffersV2)) - return quality().ceil_in_strict(offrAmt, limit, roundUp); + return quality().ceil_in_strict(offerAmount, limit, roundUp); - return quality().ceil_in(offrAmt, limit); + return quality().ceil_in(offerAmount, limit); } return {limit, swapAssetIn(balances_, limit, ammLiquidity_.tradingFee())}; } diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index 5e0a637858..fab92dca35 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -435,8 +435,8 @@ public: cur_.clear(); if (!next_.empty()) { - std::vector> strandQuals; - strandQuals.reserve(next_.size()); + std::vector> strandQualities; + strandQualities.reserve(next_.size()); if (next_.size() > 1) // no need to sort one strand { for (Strand const* strand : next_) @@ -458,21 +458,21 @@ public: // an unusual corner case. continue; } - strandQuals.push_back({*qual, strand}); + strandQualities.push_back({*qual, strand}); } } // must stable sort for deterministic order across different c++ // standard library implementations std::stable_sort( - strandQuals.begin(), - strandQuals.end(), + strandQualities.begin(), + strandQualities.end(), [](auto const& lhs, auto const& rhs) { // higher qualities first return std::get(lhs) > std::get(rhs); }); next_.clear(); - next_.reserve(strandQuals.size()); - for (auto const& sq : strandQuals) + next_.reserve(strandQualities.size()); + for (auto const& sq : strandQualities) { next_.push_back(std::get(sq)); } diff --git a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp index 796b030a99..77757419dc 100644 --- a/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp +++ b/src/xrpld/app/rdb/backend/detail/SQLiteDatabase.cpp @@ -155,7 +155,7 @@ private: Application& app_; bool const useTxTables_; beast::Journal j_; - std::unique_ptr lgrdb_, txdb_; + std::unique_ptr ledgerDb_, txdb_; /** * @brief makeLedgerDBs Opens ledger and transaction databases for the node @@ -178,7 +178,7 @@ private: bool existsLedger() { - return static_cast(lgrdb_); + return static_cast(ledgerDb_); } /** @@ -200,7 +200,7 @@ private: auto checkoutLedger() { - return lgrdb_->checkoutDb(); + return ledgerDb_->checkoutDb(); } /** @@ -224,7 +224,7 @@ SQLiteDatabaseImp::makeLedgerDBs( auto [lgr, tx, res] = detail::makeLedgerDBs(config, setup, checkpointerSetup, j_); txdb_ = std::move(tx); - lgrdb_ = std::move(lgr); + ledgerDb_ = std::move(lgr); return res; } @@ -392,7 +392,8 @@ SQLiteDatabaseImp::saveValidatedLedger( { if (existsLedger()) { - if (!detail::saveValidatedLedger(*lgrdb_, txdb_, app_, ledger, current)) + if (!detail::saveValidatedLedger( + *ledgerDb_, txdb_, app_, ledger, current)) return false; } @@ -789,7 +790,7 @@ SQLiteDatabaseImp::getKBUsedAll() { if (existsLedger()) { - return xrpl::getKBUsedAll(lgrdb_->getSession()); + return xrpl::getKBUsedAll(ledgerDb_->getSession()); } return 0; @@ -800,7 +801,7 @@ SQLiteDatabaseImp::getKBUsedLedger() { if (existsLedger()) { - return xrpl::getKBUsedDB(lgrdb_->getSession()); + return xrpl::getKBUsedDB(ledgerDb_->getSession()); } return 0; @@ -823,7 +824,7 @@ SQLiteDatabaseImp::getKBUsedTransaction() void SQLiteDatabaseImp::closeLedgerDB() { - lgrdb_.reset(); + ledgerDb_.reset(); } void diff --git a/src/xrpld/app/tx/applySteps.h b/src/xrpld/app/tx/applySteps.h index c0c530f3ac..0ae3d8790e 100644 --- a/src/xrpld/app/tx/applySteps.h +++ b/src/xrpld/app/tx/applySteps.h @@ -64,7 +64,7 @@ private: public: // Constructor if preflight returns a value other than tesSUCCESS. // Asserts if tesSUCCESS is passed. - explicit TxConsequences(NotTEC pfresult); + explicit TxConsequences(NotTEC pfResult); /// Constructor if the STTx has no notable consequences for the TxQ. explicit TxConsequences(STTx const& tx); diff --git a/src/xrpld/app/tx/detail/DelegateSet.cpp b/src/xrpld/app/tx/detail/DelegateSet.cpp index 8c64547ae1..96d02bf2bc 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.cpp +++ b/src/xrpld/app/tx/detail/DelegateSet.cpp @@ -26,7 +26,7 @@ DelegateSet::preflight(PreflightContext const& ctx) if (!permissionSet.insert(permission[sfPermissionValue]).second) return temMALFORMED; - if (!Permission::getInstance().isDelegatable( + if (!Permission::getInstance().isDelegable( permission[sfPermissionValue], ctx.rules)) return temMALFORMED; } diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index dadc5a7d74..eb751c817f 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -567,7 +567,7 @@ AccountRootsDeletedClean::finalize( } { - // NFT pages. ntfpage_min and nftpage_max were already explicitly + // NFT pages. nftpage_min and nftpage_max were already explicitly // checked above as entries in directAccountKeylets. This uses // view.succ() to check for any NFT pages in between the two // endpoints. @@ -2321,7 +2321,7 @@ NoModifiedUnmodifiableFields::finalize( if (bad) { JLOG(j.fatal()) - << "Invariant failed: changed an unchangable field for " + << "Invariant failed: changed an unchangeable field for " << tx.getTransactionID(); if (enforce) return false; diff --git a/src/xrpld/app/tx/detail/Offer.h b/src/xrpld/app/tx/detail/Offer.h index b04049b657..75e78e5758 100644 --- a/src/xrpld/app/tx/detail/Offer.h +++ b/src/xrpld/app/tx/detail/Offer.h @@ -121,13 +121,15 @@ public: TAmounts limitOut( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TOut const& limit, bool roundUp) const; TAmounts - limitIn(TAmounts const& offrAmt, TIn const& limit, bool roundUp) - const; + limitIn( + TAmounts const& offerAmount, + TIn const& limit, + bool roundUp) const; template static TER @@ -218,19 +220,19 @@ TOffer::setFieldAmounts() template TAmounts TOffer::limitOut( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TOut const& limit, bool roundUp) const { // It turns out that the ceil_out implementation has some slop in // it, which ceil_out_strict removes. - return quality().ceil_out_strict(offrAmt, limit, roundUp); + return quality().ceil_out_strict(offerAmount, limit, roundUp); } template TAmounts TOffer::limitIn( - TAmounts const& offrAmt, + TAmounts const& offerAmount, TIn const& limit, bool roundUp) const { @@ -240,8 +242,8 @@ TOffer::limitIn( // it. ceil_in_strict removes that slop. But removing that slop // affects transaction outcomes, so the change must be made using // an amendment. - return quality().ceil_in_strict(offrAmt, limit, roundUp); - return m_quality.ceil_in(offrAmt, limit); + return quality().ceil_in_strict(offerAmount, limit, roundUp); + return m_quality.ceil_in(offerAmount, limit); } template diff --git a/src/xrpld/app/tx/detail/OfferStream.cpp b/src/xrpld/app/tx/detail/OfferStream.cpp index 49e45976eb..587badf31a 100644 --- a/src/xrpld/app/tx/detail/OfferStream.cpp +++ b/src/xrpld/app/tx/detail/OfferStream.cpp @@ -341,7 +341,7 @@ TOfferStreamBase::step() } // LCOV_EXCL_START UNREACHABLE( - "rippls::TOfferStreamBase::step::rmSmallIncreasedQOffer : XRP " + "xrpl::TOfferStreamBase::step::rmSmallIncreasedQOffer : XRP " "vs XRP offer"); return false; // LCOV_EXCL_STOP diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 7b0cbbbdd4..851712fe90 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -1133,7 +1133,7 @@ Transactor::operator()() // raii classes for the current ledger rules. // fixUniversalNumber predate the rulesGuard and should be replaced. NumberSO stNumberSO{view().rules().enabled(fixUniversalNumber)}; - CurrentTransactionRulesGuard currentTransctionRulesGuard(view().rules()); + CurrentTransactionRulesGuard currentTransactionRulesGuard(view().rules()); #ifdef DEBUG { diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/xrpld/app/tx/detail/XChainBridge.cpp index 88cc236e0b..ebfcc8a769 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/xrpld/app/tx/detail/XChainBridge.cpp @@ -324,7 +324,7 @@ onNewAttestations( return {std::move(r.value()), changed}; }; -// Check if there is a quorurm of attestations for the given amount and +// Check if there is a quorum of attestations for the given amount and // chain. If so return the reward accounts, if not return the tec code (most // likely tecXCHAIN_CLAIM_NO_QUORUM) Expected, TER> @@ -434,7 +434,7 @@ transferHelper( auto const availableBalance = [&]() -> STAmount { STAmount const curBal = (*sleSrc)[sfBalance]; // Checking that account == src and postFeeBalance == curBal is - // not strictly nessisary, but helps protect against future + // not strictly necessary, but helps protect against future // changes if (!submittingAccountInfo || submittingAccountInfo->account != src || @@ -622,7 +622,7 @@ finalizeClaimHelper( // If distributing the reward pool fails, the mainFunds transfer should // be rolled back // - // If the claimid is removed, the rewards should be distributed + // If the claim ID is removed, the rewards should be distributed // even if the mainFunds fails. // // If OnTransferFail::removeClaim, the claim should be removed even if @@ -1190,7 +1190,7 @@ toClaim(STTx const& tx) template NotTEC -attestationpreflight(PreflightContext const& ctx) +attestationPreflight(PreflightContext const& ctx) { if (!publicKeyType(ctx.tx[sfPublicKey])) return temMALFORMED; @@ -2076,7 +2076,7 @@ XChainCreateClaimID::doApply() NotTEC XChainAddClaimAttestation::preflight(PreflightContext const& ctx) { - return attestationpreflight(ctx); + return attestationPreflight(ctx); } TER @@ -2096,7 +2096,7 @@ XChainAddClaimAttestation::doApply() NotTEC XChainAddAccountCreateAttestation::preflight(PreflightContext const& ctx) { - return attestationpreflight(ctx); + return attestationPreflight(ctx); } TER diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/xrpld/app/tx/detail/applySteps.cpp index 7f0d971fdc..e0bd9d0d2d 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/xrpld/app/tx/detail/applySteps.cpp @@ -217,7 +217,7 @@ invoke_calculateBaseFee(ReadView const& view, STTx const& tx) } } -TxConsequences::TxConsequences(NotTEC pfresult) +TxConsequences::TxConsequences(NotTEC pfResult) : isBlocker_(false) , fee_(beast::zero) , potentialSpend_(beast::zero) @@ -225,7 +225,7 @@ TxConsequences::TxConsequences(NotTEC pfresult) , sequencesConsumed_(0) { XRPL_ASSERT( - !isTesSuccess(pfresult), + !isTesSuccess(pfResult), "xrpl::TxConsequences::TxConsequences : is not tesSUCCESS"); } @@ -288,15 +288,15 @@ preflight( ApplyFlags flags, beast::Journal j) { - PreflightContext const pfctx(app, tx, rules, flags, j); + PreflightContext const pfCtx(app, tx, rules, flags, j); try { - return {pfctx, invoke_preflight(pfctx)}; + return {pfCtx, invoke_preflight(pfCtx)}; } catch (std::exception const& e) { JLOG(j.fatal()) << "apply (preflight): " << e.what(); - return {pfctx, {tefEXCEPTION, TxConsequences{tx}}}; + return {pfCtx, {tefEXCEPTION, TxConsequences{tx}}}; } } @@ -309,15 +309,15 @@ preflight( ApplyFlags flags, beast::Journal j) { - PreflightContext const pfctx(app, tx, parentBatchId, rules, flags, j); + PreflightContext const pfCtx(app, tx, parentBatchId, rules, flags, j); try { - return {pfctx, invoke_preflight(pfctx)}; + return {pfCtx, invoke_preflight(pfCtx)}; } catch (std::exception const& e) { JLOG(j.fatal()) << "apply (preflight): " << e.what(); - return {pfctx, {tefEXCEPTION, TxConsequences{tx}}}; + return {pfCtx, {tefEXCEPTION, TxConsequences{tx}}}; } } diff --git a/src/xrpld/consensus/DisputedTx.h b/src/xrpld/consensus/DisputedTx.h index f4b841c795..5207f9750e 100644 --- a/src/xrpld/consensus/DisputedTx.h +++ b/src/xrpld/consensus/DisputedTx.h @@ -332,10 +332,10 @@ DisputedTx::getJson() const if (!votes_.empty()) { - Json::Value votesj(Json::objectValue); + Json::Value votes(Json::objectValue); for (auto const& [nodeId, vote] : votes_) - votesj[to_string(nodeId)] = vote; - ret["votes"] = std::move(votesj); + votes[to_string(nodeId)] = vote; + ret["votes"] = std::move(votes); } return ret; diff --git a/src/xrpld/consensus/Validations.h b/src/xrpld/consensus/Validations.h index 15b33c89c4..339612cfe0 100644 --- a/src/xrpld/consensus/Validations.h +++ b/src/xrpld/consensus/Validations.h @@ -455,9 +455,9 @@ private: are checked and any stale validations are flushed from the trie. @param lock Existing lock of mutex_ - @param f Invokable with signature (LedgerTrie &) + @param f Invocable with signature (LedgerTrie &) - @warning The invokable `f` is expected to be a simple transformation of + @warning The invocable `f` is expected to be a simple transformation of its arguments and will be called with mutex_ under lock. */ @@ -476,14 +476,14 @@ private: Iterate current validations, flushing any which are stale. @param lock Existing lock of mutex_ - @param pre Invokable with signature (std::size_t) called prior to + @param pre Invocable with signature (std::size_t) called prior to looping. - @param f Invokable with signature (NodeID const &, Validations const &) + @param f Invocable with signature (NodeID const &, Validations const &) for each current validation. - @note The invokable `pre` is called _prior_ to checking for staleness + @note The invocable `pre` is called _prior_ to checking for staleness and reflects an upper-bound on the number of calls to `f. - @warning The invokable `f` is expected to be a simple transformation of + @warning The invocable `f` is expected to be a simple transformation of its arguments and will be called with mutex_ under lock. */ @@ -517,12 +517,12 @@ private: @param lock Existing lock on mutex_ @param ledgerID The identifier of the ledger - @param pre Invokable with signature(std::size_t) - @param f Invokable with signature (NodeID const &, Validation const &) + @param pre Invocable with signature(std::size_t) + @param f Invocable with signature (NodeID const &, Validation const &) - @note The invokable `pre` is called prior to iterating validations. The + @note The invocable `pre` is called prior to iterating validations. The argument is the number of times `f` will be called. - @warning The invokable f is expected to be a simple transformation of + @warning The invocable f is expected to be a simple transformation of its arguments and will be called with mutex_ under lock. */ template diff --git a/src/xrpld/overlay/Message.h b/src/xrpld/overlay/Message.h index f2b021840d..550c24eef3 100644 --- a/src/xrpld/overlay/Message.h +++ b/src/xrpld/overlay/Message.h @@ -12,7 +12,7 @@ namespace xrpl { -constexpr std::size_t maximiumMessageSize = megabytes(64); +constexpr std::size_t maximumMessageSize = megabytes(64); // VFALCO NOTE If we forward declare Message and write out shared_ptr // instead of using the in-class type alias, we can remove the diff --git a/src/xrpld/overlay/Overlay.h b/src/xrpld/overlay/Overlay.h index c30d0f5205..aaecd50eb6 100644 --- a/src/xrpld/overlay/Overlay.h +++ b/src/xrpld/overlay/Overlay.h @@ -94,7 +94,7 @@ public: size() const = 0; /** Return diagnostics on the status of all peers. - @deprecated This is superceded by PropertyStream + @deprecated This is superseded by PropertyStream */ virtual Json::Value json() = 0; diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index 9e717fef9c..66368b60b9 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -345,14 +345,14 @@ Slot::update( auto it = std::next(considered_.begin(), i); auto id = *it; considered_.erase(it); - auto const& itpeers = peers_.find(id); - if (itpeers == peers_.end()) + auto const& itPeers = peers_.find(id); + if (itPeers == peers_.end()) { JLOG(journal_.error()) << "update: peer not found " << Slice(validator) << " " << id; continue; } - if (now - itpeers->second.lastMessage < IDLED) + if (now - itPeers->second.lastMessage < IDLED) selected.insert(id); } diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 7cd02c72e0..d1d2467b1e 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -620,7 +620,7 @@ OverlayImpl::onManifests( std::shared_ptr const& from) { auto const n = m->list_size(); - auto const& journal = from->pjournal(); + auto const& journal = from->pJournal(); protocol::TMManifests relay; diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index dc7e4975a3..786f42184e 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -461,7 +461,7 @@ private: /** Handles validator list requests. Using a /vl/ URL, will retrieve the - latest valdiator list (or UNL) that this node has for that + latest validator list (or UNL) that this node has for that public key, if the node trusts that public key. @return true if the request was handled. diff --git a/src/xrpld/overlay/detail/PeerImp.h b/src/xrpld/overlay/detail/PeerImp.h index 565c3f9d0f..1e28de0c31 100644 --- a/src/xrpld/overlay/detail/PeerImp.h +++ b/src/xrpld/overlay/detail/PeerImp.h @@ -323,7 +323,7 @@ public: virtual ~PeerImp(); beast::Journal const& - pjournal() const + pJournal() const { return p_journal_; } diff --git a/src/xrpld/overlay/detail/ProtocolMessage.h b/src/xrpld/overlay/detail/ProtocolMessage.h index 1a35deb6f0..51dfc1ac7c 100644 --- a/src/xrpld/overlay/detail/ProtocolMessage.h +++ b/src/xrpld/overlay/detail/ProtocolMessage.h @@ -114,7 +114,7 @@ struct MessageHeader std::uint16_t message_type = 0; /** Indicates which compression algorithm the payload is compressed with. - * Currenly only lz4 is supported. If None then the message is not + * Currently only lz4 is supported. If None then the message is not * compressed. */ compression::Algorithm algorithm = compression::Algorithm::None; @@ -340,8 +340,8 @@ invokeProtocolMessage( // whose size exceeds this may result in the connection being dropped. A // larger message size may be supported in the future or negotiated as // part of a protocol upgrade. - if (header->payload_wire_size > maximiumMessageSize || - header->uncompressed_size > maximiumMessageSize) + if (header->payload_wire_size > maximumMessageSize || + header->uncompressed_size > maximumMessageSize) { result.second = make_error_code(boost::system::errc::message_size); return result; diff --git a/src/xrpld/overlay/detail/ProtocolVersion.h b/src/xrpld/overlay/detail/ProtocolVersion.h index ff49c89f1a..9499cd1c1b 100644 --- a/src/xrpld/overlay/detail/ProtocolVersion.h +++ b/src/xrpld/overlay/detail/ProtocolVersion.h @@ -32,7 +32,7 @@ to_string(ProtocolVersion const& p); Given a comma-separated string, extract and return all those that look like valid protocol versions (i.e. XRPL/2.0 and later). Strings that are - not parseable as valid protocol strings are excluded from the result set. + not parsable as valid protocol strings are excluded from the result set. @return A list of all apparently valid protocol versions. diff --git a/src/xrpld/overlay/detail/TxMetrics.cpp b/src/xrpld/overlay/detail/TxMetrics.cpp index 10f14183a3..ba3e7e8ae0 100644 --- a/src/xrpld/overlay/detail/TxMetrics.cpp +++ b/src/xrpld/overlay/detail/TxMetrics.cpp @@ -83,11 +83,11 @@ SingleMetrics::addMetrics(std::uint32_t val) if (timeElapsedInSecs >= 1s) { auto const avg = accum / (perTimeUnit ? timeElapsedInSecs.count() : N); - rollingAvgAggreg.push_back(avg); + rollingAvgAggregate.push_back(avg); auto const total = std::accumulate( - rollingAvgAggreg.begin(), rollingAvgAggreg.end(), 0ull); - rollingAvg = total / rollingAvgAggreg.size(); + rollingAvgAggregate.begin(), rollingAvgAggregate.end(), 0ull); + rollingAvg = total / rollingAvgAggregate.size(); intervalStart = clock_type::now(); accum = 0; diff --git a/src/xrpld/overlay/detail/TxMetrics.h b/src/xrpld/overlay/detail/TxMetrics.h index 3c34aaf9f9..265c9251d7 100644 --- a/src/xrpld/overlay/detail/TxMetrics.h +++ b/src/xrpld/overlay/detail/TxMetrics.h @@ -34,7 +34,7 @@ struct SingleMetrics std::uint64_t rollingAvg{0}; std::uint32_t N{0}; bool perTimeUnit{true}; - boost::circular_buffer rollingAvgAggreg{30, 0ull}; + boost::circular_buffer rollingAvgAggregate{30, 0ull}; /** Add metrics value * @param val metrics value, either bytes or count */ diff --git a/src/xrpld/peerfinder/detail/Livecache.h b/src/xrpld/peerfinder/detail/Livecache.h index 0927593ed1..c04b46dc6d 100644 --- a/src/xrpld/peerfinder/detail/Livecache.h +++ b/src/xrpld/peerfinder/detail/Livecache.h @@ -165,14 +165,14 @@ protected: /** The Livecache holds the short-lived relayed Endpoint messages. Since peers only advertise themselves when they have open slots, - we want these messags to expire rather quickly after the peer becomes + we want these messages to expire rather quickly after the peer becomes full. Addresses added to the cache are not connection-tested to see if - they are connectible (with one small exception regarding neighbors). + they are connectable (with one small exception regarding neighbors). Therefore, these addresses are not suitable for persisting across launches or for bootstrapping, because they do not have verifiable - and locally observed uptime and connectibility information. + and locally observed uptime and connectability information. */ template > class Livecache : protected detail::LivecacheBase diff --git a/src/xrpld/peerfinder/detail/Logic.h b/src/xrpld/peerfinder/detail/Logic.h index 50026cc886..aa56c8098c 100644 --- a/src/xrpld/peerfinder/detail/Logic.h +++ b/src/xrpld/peerfinder/detail/Logic.h @@ -628,7 +628,7 @@ public: This is a temporary measure. Once we know our own IP address, the correct solution is to put it into the Livecache at hops 0, and go through the regular handout path. This way - we avoid handing our address out too frequenty, which this code + we avoid handing our address out too frequently, which this code suffers from. */ // Add an entry for ourselves if: @@ -903,7 +903,7 @@ public: // Address must exist if (iter == connectedAddresses_.end()) LogicError( - "PeerFinder::Logic::remove(): remote_endpont " + "PeerFinder::Logic::remove(): remote_endpoint " "address missing from connectedAddresses_"); connectedAddresses_.erase(iter); @@ -929,7 +929,7 @@ public: auto iter(fixed_.find(slot->remote_endpoint())); if (iter == fixed_.end()) LogicError( - "PeerFinder::Logic::on_closed(): remote_endpont " + "PeerFinder::Logic::on_closed(): remote_endpoint " "missing from fixed_"); iter->second.failure(m_clock.now()); diff --git a/src/xrpld/peerfinder/detail/iosformat.h b/src/xrpld/peerfinder/detail/iosformat.h index 323665c016..a1117f0935 100644 --- a/src/xrpld/peerfinder/detail/iosformat.h +++ b/src/xrpld/peerfinder/detail/iosformat.h @@ -60,7 +60,7 @@ struct divider } }; -/** Creates a padded field with an optiona fill character. */ +/** Creates a padded field with an optional fill character. */ struct fpad { explicit fpad(int width_, int pad_ = 0, char fill_ = ' ') @@ -172,7 +172,7 @@ field(T const& t, int width = 8, int pad = 0, bool right = false) template field_t -rfield( +rField( std::basic_string const& text, int width = 8, int pad = 0) @@ -182,7 +182,7 @@ rfield( template field_t -rfield(CharT const* text, int width = 8, int pad = 0) +rField(CharT const* text, int width = 8, int pad = 0) { return field_t, std::allocator>( std:: @@ -195,7 +195,7 @@ rfield(CharT const* text, int width = 8, int pad = 0) template field_t -rfield(T const& t, int width = 8, int pad = 0) +rField(T const& t, int width = 8, int pad = 0) { std::string const text(detail::to_string(t)); return field(text, width, pad, true); diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index 4c0c4d2f6f..ceacb41223 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -103,7 +103,7 @@ PerfLogImp::Counters::countersJson() const rpcobj[jss::total] = totalRpcJson; } - Json::Value jqobj(Json::objectValue); + Json::Value jobQueueObj(Json::objectValue); // totalJq represents all jobs. All enqueued, started, finished, etc. Jq totalJq; for (auto const& proc : jq_) @@ -132,7 +132,7 @@ PerfLogImp::Counters::countersJson() const j[jss::running_duration_us] = std::to_string(value.runningDuration.count()); totalJq.runningDuration += value.runningDuration; - jqobj[JobTypes::name(proc.first)] = j; + jobQueueObj[JobTypes::name(proc.first)] = j; } if (totalJq.queued) @@ -145,14 +145,14 @@ PerfLogImp::Counters::countersJson() const std::to_string(totalJq.queuedDuration.count()); totalJqJson[jss::running_duration_us] = std::to_string(totalJq.runningDuration.count()); - jqobj[jss::total] = totalJqJson; + jobQueueObj[jss::total] = totalJqJson; } Json::Value counters(Json::objectValue); // Be kind to reporting tools and let them expect rpc and jq objects // even if empty. counters[jss::rpc] = rpcobj; - counters[jss::job_queue] = jqobj; + counters[jss::job_queue] = jobQueueObj; return counters; } diff --git a/src/xrpld/rpc/detail/RPCCall.cpp b/src/xrpld/rpc/detail/RPCCall.cpp index 5eb3943c28..30dae16e29 100644 --- a/src/xrpld/rpc/detail/RPCCall.cpp +++ b/src/xrpld/rpc/detail/RPCCall.cpp @@ -434,7 +434,7 @@ private: return jvRequest; } - // Return an error for attemping to subscribe/unsubscribe via RPC. + // Return an error for attempting to subscribe/unsubscribe via RPC. Json::Value parseEvented(Json::Value const& jvParams) { @@ -1357,7 +1357,7 @@ JSONRPCRequest( namespace { // Special local exception type thrown when request can't be parsed. -class RequestNotParseable : public std::runtime_error +class RequestNotParsable : public std::runtime_error { using std::runtime_error::runtime_error; // Inherit constructors }; @@ -1399,7 +1399,7 @@ struct RPCCallImp JLOG(j.debug()) << "RPC reply: " << strData << std::endl; if (strData.find("Unable to parse request") == 0 || strData.find(jss::invalid_API_version.c_str()) == 0) - Throw(strData); + Throw(strData); Json::Reader reader; Json::Value jvReply; if (!reader.parse(strData, jvReply)) @@ -1618,7 +1618,7 @@ rpcClient( // YYY We could have a command line flag for single line output for // scripts. YYY We would intercept output here and simplify it. } - catch (RequestNotParseable& e) + catch (RequestNotParsable& e) { jvOutput = rpcError(rpcINVALID_PARAMS); jvOutput["error_what"] = e.what(); diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index d10f4f9a5a..187f06a78e 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -95,7 +95,7 @@ readLimitField( Tuning::LimitRange const& range, JsonContext const& context) { - limit = range.rdefault; + limit = range.rDefault; if (!context.params.isMember(jss::limit) || context.params[jss::limit].isNull()) return std::nullopt; diff --git a/src/xrpld/rpc/detail/ServerHandler.cpp b/src/xrpld/rpc/detail/ServerHandler.cpp index 91b709bc06..bb84b81566 100644 --- a/src/xrpld/rpc/detail/ServerHandler.cpp +++ b/src/xrpld/rpc/detail/ServerHandler.cpp @@ -619,7 +619,8 @@ ServerHandler::processRequest( { HTTPReply( 400, - "Unable to parse request: " + reader.getFormatedErrorMessages(), + "Unable to parse request: " + + reader.getFormattedErrorMessages(), output, rpcJ); return; @@ -814,7 +815,7 @@ ServerHandler::processRequest( else if (!params.isArray() || params.size() != 1) { usage.charge(Resource::feeMalformedRPC); - HTTPReply(400, "params unparseable", output, rpcJ); + HTTPReply(400, "params unparsable", output, rpcJ); return; } else @@ -823,7 +824,7 @@ ServerHandler::processRequest( if (!params.isObjectOrNull()) { usage.charge(Resource::feeMalformedRPC); - HTTPReply(400, "params unparseable", output, rpcJ); + HTTPReply(400, "params unparsable", output, rpcJ); return; } } diff --git a/src/xrpld/rpc/detail/Tuning.h b/src/xrpld/rpc/detail/Tuning.h index 5837146b02..c0b939a4fe 100644 --- a/src/xrpld/rpc/detail/Tuning.h +++ b/src/xrpld/rpc/detail/Tuning.h @@ -11,7 +11,7 @@ namespace Tuning { /** Represents RPC limit parameter values that have a min, default and max. */ struct LimitRange { - unsigned int rmin, rdefault, rmax; + unsigned int rmin, rDefault, rmax; }; /** Limits for the account_lines command. */ diff --git a/src/xrpld/rpc/handlers/AccountInfo.cpp b/src/xrpld/rpc/handlers/AccountInfo.cpp index 30d16e3099..61d0658b4a 100644 --- a/src/xrpld/rpc/handlers/AccountInfo.cpp +++ b/src/xrpld/rpc/handlers/AccountInfo.cpp @@ -216,7 +216,7 @@ doAccountInfo(RPC::JsonContext& context) // Documentation states this is returned as part of the account_info // response, but previously the code put it under account_data. We - // can move this to the documentated location from apiVersion 2 + // can move this to the documented location from apiVersion 2 // onwards. if (context.apiVersion == 1) { @@ -262,7 +262,7 @@ doAccountInfo(RPC::JsonContext& context) { XRPL_ASSERT( prevSeqProxy < tx.seqProxy, - "rpple::doAccountInfo : first sorted proxy"); + "doAccountInfo : first sorted proxy"); prevSeqProxy = tx.seqProxy; jvTx[jss::seq] = tx.seqProxy.value(); ++seqCount; @@ -274,7 +274,7 @@ doAccountInfo(RPC::JsonContext& context) { XRPL_ASSERT( prevSeqProxy < tx.seqProxy, - "rpple::doAccountInfo : second sorted proxy"); + "doAccountInfo : second sorted proxy"); prevSeqProxy = tx.seqProxy; jvTx[jss::ticket] = tx.seqProxy.value(); ++ticketCount; diff --git a/src/xrpld/rpc/handlers/AccountTx.cpp b/src/xrpld/rpc/handlers/AccountTx.cpp index 362bdd0eaa..77d388c190 100644 --- a/src/xrpld/rpc/handlers/AccountTx.cpp +++ b/src/xrpld/rpc/handlers/AccountTx.cpp @@ -340,7 +340,7 @@ populateJsonResponse( // LCOV_EXCL_START UNREACHABLE( "xrpl::populateJsonResponse : missing " - "transaction medatata"); + "transaction metadata"); // LCOV_EXCL_STOP } } diff --git a/src/xrpld/rpc/handlers/Subscribe.cpp b/src/xrpld/rpc/handlers/Subscribe.cpp index 018268defb..09d4a54e55 100644 --- a/src/xrpld/rpc/handlers/Subscribe.cpp +++ b/src/xrpld/rpc/handlers/Subscribe.cpp @@ -334,7 +334,7 @@ doSubscribe(RPC::JsonContext& context) field == jss::asks ? reversed(book) : book, takerID ? *takerID : noAccount(), false, - RPC::Tuning::bookOffers.rdefault, + RPC::Tuning::bookOffers.rDefault, jvMarker, jvOffers); From 17565d21d4836a5673cb5ec20c68aa0a376706ed Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Thu, 8 Jan 2026 08:29:59 -0500 Subject: [PATCH 23/62] refactor: Remove unused credentials signature hash prefix (#6186) This change removes the unused credentials signature hash prefix from `HashPrefix.h`. --- include/xrpl/protocol/HashPrefix.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/xrpl/protocol/HashPrefix.h b/include/xrpl/protocol/HashPrefix.h index 77529e9212..39e03bf94f 100644 --- a/include/xrpl/protocol/HashPrefix.h +++ b/include/xrpl/protocol/HashPrefix.h @@ -67,9 +67,6 @@ enum class HashPrefix : std::uint32_t { /** Payment Channel Claim */ paymentChannelClaim = detail::make_hash_prefix('C', 'L', 'M'), - /** Credentials signature */ - credential = detail::make_hash_prefix('C', 'R', 'D'), - /** Batch */ batch = detail::make_hash_prefix('B', 'C', 'H'), }; From 510c0d82e9b3f1a4ba1a455bece99502b52613d5 Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Thu, 8 Jan 2026 08:48:39 -0500 Subject: [PATCH 24/62] fix: Reorder Batch Preflight Errors (#6176) This change fixes https://github.com/XRPLF/rippled/issues/6058. --- src/test/app/Batch_test.cpp | 32 +++++++++++++++++++++++++++++++ src/xrpld/app/tx/detail/Batch.cpp | 20 +++++++++---------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 06cf5dee0c..6fbec52a93 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -402,6 +402,38 @@ class Batch_test : public beast::unit_test::suite env.close(); } + // temBAD_FEE: Inner txn with negative fee + { + auto const seq = env.seq(alice); + auto const batchFee = batch::calcBatchFee(env, 0, 2); + auto tx1 = batch::inner(pay(alice, bob, XRP(1)), seq + 1); + tx1[jss::Fee] = "-1"; + env(batch::outer(alice, seq, batchFee, tfAllOrNothing), + tx1, + batch::inner(pay(alice, bob, XRP(2)), seq + 2), + ter(temBAD_FEE)); + env.close(); + } + + // temBAD_FEE: Inner txn with non-integer fee + { + auto const seq = env.seq(alice); + auto const batchFee = batch::calcBatchFee(env, 0, 2); + auto tx1 = batch::inner(pay(alice, bob, XRP(1)), seq + 1); + tx1[jss::Fee] = "1.5"; + try + { + env(batch::outer(alice, seq, batchFee, tfAllOrNothing), + tx1, + batch::inner(pay(alice, bob, XRP(2)), seq + 2)); + fail("Expected parse_error for fractional fee"); + } + catch (jtx::parse_error const&) + { + BEAST_EXPECT(true); + } + } + // temSEQ_AND_TICKET: Batch: inner txn cannot have both Sequence // and TicketSequence. { diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/xrpld/app/tx/detail/Batch.cpp index 277bd4e3b7..a26bc52880 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/xrpld/app/tx/detail/Batch.cpp @@ -305,6 +305,16 @@ Batch::preflight(PreflightContext const& ctx) } } + // Check that the Fee is native asset (XRP) and zero + if (auto const fee = stx.getFieldAmount(sfFee); + !fee.native() || fee.xrp() != beast::zero) + { + JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: " + << "inner txn must have a fee of 0. " + << "txID: " << hash; + return temBAD_FEE; + } + auto const innerAccount = stx.getAccountID(sfAccount); if (auto const preflightResult = xrpl::preflight( ctx.app, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); @@ -317,16 +327,6 @@ Batch::preflight(PreflightContext const& ctx) return temINVALID_INNER_BATCH; } - // Check that the fee is zero - if (auto const fee = stx.getFieldAmount(sfFee); - !fee.native() || fee.xrp() != beast::zero) - { - JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: " - << "inner txn must have a fee of 0. " - << "txID: " << hash; - return temBAD_FEE; - } - // Check that Sequence and TicketSequence are not both present if (stx.isFieldPresent(sfTicketSequence) && stx.getFieldU32(sfSequence) != 0) From 53aa5ca90314b6a6ba7ebb43e20a40c09b6ffe60 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Thu, 8 Jan 2026 10:34:49 -0500 Subject: [PATCH 25/62] refactor: Fix typos, enable cspell pre-commit (#5719) This change fixes the last of the spelling issues, and enables the pre-commit (and CI) check for spelling. There are no functionality changes, but it does rename some enum values. --- .config/cspell.config.yaml | 4 +- .gitattributes | 1 + .github/scripts/levelization/README.md | 2 +- .github/scripts/levelization/generate.sh | 6 +- .github/scripts/rename/README.md | 2 +- .github/scripts/rename/config.sh | 2 +- .github/scripts/rename/copyright.sh | 12 +- .gitignore | 1 + .pre-commit-config.yaml | 28 ++-- include/xrpl/proto/xrpl.proto | 6 +- include/xrpl/protocol/Permissions.h | 2 +- .../xrpl/protocol/detail/transactions.macro | 152 +++++++++--------- src/libxrpl/protocol/Permissions.cpp | 6 +- src/test/app/ValidatorList_test.cpp | 5 +- src/test/overlay/compression_test.cpp | 4 +- .../ledger/detail/LedgerReplayMsgHandler.cpp | 2 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 9 +- src/xrpld/app/tx/detail/InvariantCheck.cpp | 6 +- src/xrpld/overlay/detail/Message.cpp | 4 +- src/xrpld/overlay/detail/ProtocolMessage.h | 8 +- src/xrpld/overlay/detail/TrafficCount.cpp | 4 +- 21 files changed, 136 insertions(+), 130 deletions(-) diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index 969720a11d..0cac82807d 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -83,7 +83,6 @@ words: - doxyfile - dxrpl - endmacro - - endpointv - exceptioned - Falco - finalizers @@ -92,6 +91,7 @@ words: - funclets - gcov - gcovr + - ghead - Gnutella - gpgcheck - gpgkey @@ -221,6 +221,8 @@ words: - takergets - takerpays - ters + - TMEndpointv2 + - trixie - tx - txid - txids diff --git a/.gitattributes b/.gitattributes index bdfc989327..7a066d0967 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ # Set default behaviour, in case users don't have core.autocrlf set. #* text=auto +# cspell: disable # Visual Studio *.sln text eol=crlf diff --git a/.github/scripts/levelization/README.md b/.github/scripts/levelization/README.md index c8954b900e..c3e6ffa4a8 100644 --- a/.github/scripts/levelization/README.md +++ b/.github/scripts/levelization/README.md @@ -84,7 +84,7 @@ It generates many files of [results](results): to the destination module, de-duped, and with frequency counts. - `includes/`: A directory where each file represents a module and contains a list of modules and counts that the module _includes_. -- `includedby/`: Similar to `includes/`, but the other way around. Each +- `included_by/`: Similar to `includes/`, but the other way around. Each file represents a module and contains a list of modules and counts that _include_ the module. - [`loops.txt`](results/loops.txt): A list of direct loops detected diff --git a/.github/scripts/levelization/generate.sh b/.github/scripts/levelization/generate.sh index 775ddf789f..d700c7a206 100755 --- a/.github/scripts/levelization/generate.sh +++ b/.github/scripts/levelization/generate.sh @@ -29,7 +29,7 @@ pushd results oldifs=${IFS} IFS=: mkdir includes -mkdir includedby +mkdir included_by echo Build levelization paths exec 3< ${includes} # open rawincludes.txt for input while read -r -u 3 file include @@ -59,7 +59,7 @@ do echo $level $includelevel | tee -a paths.txt fi done -echo Sort and dedup paths +echo Sort and deduplicate paths sort -ds paths.txt | uniq -c | tee sortedpaths.txt mv sortedpaths.txt paths.txt exec 3>&- #close fd 3 @@ -71,7 +71,7 @@ exec 4&- #close fd 4 diff --git a/.github/scripts/rename/README.md b/.github/scripts/rename/README.md index 8336f23bec..cc004a335f 100644 --- a/.github/scripts/rename/README.md +++ b/.github/scripts/rename/README.md @@ -19,7 +19,7 @@ run from the repository root. 1. `.github/scripts/rename/definitions.sh`: This script will rename all definitions, such as include guards, from `RIPPLE_XXX` and `RIPPLED_XXX` to `XRPL_XXX`. -2. `.github/scripts/rename/copyright.sh`: This script will remove superflous +2. `.github/scripts/rename/copyright.sh`: This script will remove superfluous copyright notices. 3. `.github/scripts/rename/cmake.sh`: This script will rename all CMake files from `RippleXXX.cmake` or `RippledXXX.cmake` to `XrplXXX.cmake`, and any diff --git a/.github/scripts/rename/config.sh b/.github/scripts/rename/config.sh index 7f36e8fd21..f6e914f502 100755 --- a/.github/scripts/rename/config.sh +++ b/.github/scripts/rename/config.sh @@ -56,7 +56,7 @@ for DIRECTORY in "${DIRECTORIES[@]}"; do done ${SED_COMMAND} -i 's/rippled/xrpld/g' cfg/xrpld-example.cfg ${SED_COMMAND} -i 's/rippled/xrpld/g' src/test/core/Config_test.cpp -${SED_COMMAND} -i 's/ripplevalidators/xrplvalidators/g' src/test/core/Config_test.cpp +${SED_COMMAND} -i 's/ripplevalidators/xrplvalidators/g' src/test/core/Config_test.cpp # cspell: disable-line ${SED_COMMAND} -i 's/rippleConfig/xrpldConfig/g' src/test/core/Config_test.cpp ${SED_COMMAND} -i 's@ripple/@xrpld/@g' src/test/core/Config_test.cpp ${SED_COMMAND} -i 's/Rippled/File/g' src/test/core/Config_test.cpp diff --git a/.github/scripts/rename/copyright.sh b/.github/scripts/rename/copyright.sh index 41dbdc1f94..c5a9fb2cd3 100755 --- a/.github/scripts/rename/copyright.sh +++ b/.github/scripts/rename/copyright.sh @@ -50,11 +50,11 @@ for DIRECTORY in "${DIRECTORIES[@]}"; do # Handle the cases where the copyright notice is enclosed in /* ... */ # and usually surrounded by //---- and //======. ${SED_COMMAND} -z -i -E 's@^//-------+\n+@@' "${FILE}" - ${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" + ${SED_COMMAND} -z -i -E 's@^.*Copyright.+(Ripple|Bougalis|Falco|Hinnant|Null|Ritchford|XRPLF).+PERFORMANCE OF THIS SOFTWARE\.\n\*/\n+@@' "${FILE}" # cspell: ignore Bougalis Falco Hinnant Ritchford ${SED_COMMAND} -z -i -E 's@^//=======+\n+@@' "${FILE}" # Handle the cases where the copyright notice is commented out with //. - ${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" + ${SED_COMMAND} -z -i -E 's@^//\n// Copyright.+Falco \(vinnie dot falco at gmail dot com\)\n//\n+@@' "${FILE}" # cspell: ignore Vinnie Falco done done @@ -83,16 +83,16 @@ if ! grep -q 'Dev Null' src/xrpld/rpc/handlers/ValidatorInfo.cpp; then echo -e "// Copyright (c) 2019 Dev Null Productions\n\n$(cat src/xrpld/rpc/handlers/ValidatorInfo.cpp)" > src/xrpld/rpc/handlers/ValidatorInfo.cpp fi if ! grep -q 'Bougalis' include/xrpl/basics/SlabAllocator.h; then - echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h + echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/SlabAllocator.h)" > include/xrpl/basics/SlabAllocator.h # cspell: ignore Nikolaos Bougalis nikb fi if ! grep -q 'Bougalis' include/xrpl/basics/spinlock.h; then - echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h + echo -e "// Copyright (c) 2022, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/spinlock.h)" > include/xrpl/basics/spinlock.h # cspell: ignore Nikolaos Bougalis nikb fi if ! grep -q 'Bougalis' include/xrpl/basics/tagged_integer.h; then - echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h + echo -e "// Copyright (c) 2014, Nikolaos D. Bougalis \n\n$(cat include/xrpl/basics/tagged_integer.h)" > include/xrpl/basics/tagged_integer.h # cspell: ignore Nikolaos Bougalis nikb fi if ! grep -q 'Ritchford' include/xrpl/beast/utility/Zero.h; then - echo -e "// Copyright (c) 2014, Tom Ritchford \n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h + echo -e "// Copyright (c) 2014, Tom Ritchford \n\n$(cat include/xrpl/beast/utility/Zero.h)" > include/xrpl/beast/utility/Zero.h # cspell: ignore Ritchford fi # Restore newlines and tabs in string literals in the affected file. diff --git a/.gitignore b/.gitignore index c4e81408bb..b899cf8436 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # .gitignore +# cspell: disable # Macintosh Desktop Services Store files. .DS_Store diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4a1dc159dc..00bec32ed6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,20 +36,20 @@ repos: hooks: - id: black - # - repo: https://github.com/streetsidesoftware/cspell-cli - # rev: v9.2.0 - # hooks: - # - id: cspell # Spell check changed files - # - id: cspell # Spell check the commit message - # name: check commit message spelling - # args: - # - --no-must-find-files - # - --no-progress - # - --no-summary - # - --files - # - .git/COMMIT_EDITMSG - # stages: [commit-msg] - # always_run: true # This might not be necessary. + - repo: https://github.com/streetsidesoftware/cspell-cli + rev: v9.2.0 + hooks: + - id: cspell # Spell check changed files + exclude: .config/cspell.config.yaml + - id: cspell # Spell check the commit message + name: check commit message spelling + args: + - --no-must-find-files + - --no-progress + - --no-summary + - --files + - .git/COMMIT_EDITMSG + stages: [commit-msg] exclude: | (?x)^( diff --git a/include/xrpl/proto/xrpl.proto b/include/xrpl/proto/xrpl.proto index f93ebbc72c..613ef70a1f 100644 --- a/include/xrpl/proto/xrpl.proto +++ b/include/xrpl/proto/xrpl.proto @@ -17,9 +17,9 @@ enum MessageType { mtHAVE_SET = 35; mtVALIDATION = 41; mtGET_OBJECTS = 42; - mtVALIDATORLIST = 54; + mtVALIDATOR_LIST = 54; mtSQUELCH = 55; - mtVALIDATORLISTCOLLECTION = 56; + mtVALIDATOR_LIST_COLLECTION = 56; mtPROOF_PATH_REQ = 57; mtPROOF_PATH_RESPONSE = 58; mtREPLAY_DELTA_REQ = 59; @@ -308,7 +308,7 @@ message TMSquelch { } enum TMLedgerMapType { - lmTRANASCTION = 1; // transaction map + lmTRANSACTION = 1; // transaction map lmACCOUNT_STATE = 2; // account state map } diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 319aeb1c28..74f539a3bf 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -29,7 +29,7 @@ enum GranularPermissionType : std::uint32_t { #pragma pop_macro("PERMISSION") }; -enum Delegation { delegatable, notDelegatable }; +enum Delegation { delegable, notDelegable }; class Permission { diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index 6d2d833440..bc7eefedb5 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -3,7 +3,7 @@ #endif /** - * TRANSACTION(tag, value, name, delegatable, amendments, privileges, fields) + * TRANSACTION(tag, value, name, delegable, amendments, privileges, fields) * * To ease maintenance, you may replace any unneeded values with "..." * e.g. #define TRANSACTION(tag, value, name, ...) @@ -25,7 +25,7 @@ # include #endif TRANSACTION(ttPAYMENT, 0, Payment, - Delegation::delegatable, + Delegation::delegable, uint256{}, createAcct, ({ @@ -45,7 +45,7 @@ TRANSACTION(ttPAYMENT, 0, Payment, # include #endif TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -59,7 +59,7 @@ TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, /** This transaction type completes an existing escrow. */ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -76,7 +76,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, # include #endif TRANSACTION(ttACCOUNT_SET, 3, AccountSet, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ @@ -97,7 +97,7 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, # include #endif TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -110,7 +110,7 @@ TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, # include #endif TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ @@ -124,7 +124,7 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, # include #endif TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -140,7 +140,7 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, # include #endif TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -154,7 +154,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, # include #endif TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -170,7 +170,7 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, # include #endif TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ @@ -183,7 +183,7 @@ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, # include #endif TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -197,7 +197,7 @@ TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, /** This transaction type funds an existing unidirectional XRP payment channel. */ TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -208,7 +208,7 @@ TRANSACTION(ttPAYCHAN_FUND, 14, PaymentChannelFund, /** This transaction type submits a claim against an existing unidirectional payment channel. */ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -225,7 +225,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, # include #endif TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -241,7 +241,7 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, # include #endif TRANSACTION(ttCHECK_CASH, 17, CheckCash, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -255,7 +255,7 @@ TRANSACTION(ttCHECK_CASH, 17, CheckCash, # include #endif TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -267,7 +267,7 @@ TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, # include #endif TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -282,7 +282,7 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, # include #endif TRANSACTION(ttTRUST_SET, 20, TrustSet, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -296,7 +296,7 @@ TRANSACTION(ttTRUST_SET, 20, TrustSet, # include #endif TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, mustDeleteAcct, ({ @@ -312,7 +312,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, # include #endif TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, - Delegation::delegatable, + Delegation::delegable, uint256{}, changeNFTCounts, ({ @@ -330,7 +330,7 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, # include #endif TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, - Delegation::delegatable, + Delegation::delegable, uint256{}, changeNFTCounts, ({ @@ -343,7 +343,7 @@ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, # include #endif TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -359,7 +359,7 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, # include #endif TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -371,7 +371,7 @@ TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, # include #endif TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, - Delegation::delegatable, + Delegation::delegable, uint256{}, noPriv, ({ @@ -385,7 +385,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, # include #endif TRANSACTION(ttCLAWBACK, 30, Clawback, - Delegation::delegatable, + Delegation::delegable, featureClawback, noPriv, ({ @@ -398,7 +398,7 @@ TRANSACTION(ttCLAWBACK, 30, Clawback, # include #endif TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, - Delegation::delegatable, + Delegation::delegable, featureAMMClawback, mayDeleteAcct | overrideFreeze, ({ @@ -413,7 +413,7 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, # include #endif TRANSACTION(ttAMM_CREATE, 35, AMMCreate, - Delegation::delegatable, + Delegation::delegable, featureAMM, createPseudoAcct, ({ @@ -427,7 +427,7 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate, # include #endif TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, - Delegation::delegatable, + Delegation::delegable, featureAMM, noPriv, ({ @@ -445,7 +445,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, # include #endif TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, - Delegation::delegatable, + Delegation::delegable, featureAMM, mayDeleteAcct, ({ @@ -462,7 +462,7 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, # include #endif TRANSACTION(ttAMM_VOTE, 38, AMMVote, - Delegation::delegatable, + Delegation::delegable, featureAMM, noPriv, ({ @@ -476,7 +476,7 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote, # include #endif TRANSACTION(ttAMM_BID, 39, AMMBid, - Delegation::delegatable, + Delegation::delegable, featureAMM, noPriv, ({ @@ -492,7 +492,7 @@ TRANSACTION(ttAMM_BID, 39, AMMBid, # include #endif TRANSACTION(ttAMM_DELETE, 40, AMMDelete, - Delegation::delegatable, + Delegation::delegable, featureAMM, mustDeleteAcct, ({ @@ -505,7 +505,7 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete, # include #endif TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -516,7 +516,7 @@ TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, /** This transactions initiates a crosschain transaction */ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -528,7 +528,7 @@ TRANSACTION(ttXCHAIN_COMMIT, 42, XChainCommit, /** This transaction completes a crosschain transaction */ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -541,7 +541,7 @@ TRANSACTION(ttXCHAIN_CLAIM, 43, XChainClaim, /** This transaction initiates a crosschain account create transaction */ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -553,7 +553,7 @@ TRANSACTION(ttXCHAIN_ACCOUNT_CREATE_COMMIT, 44, XChainAccountCreateCommit, /** This transaction adds an attestation to a claim */ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, createAcct, ({ @@ -574,7 +574,7 @@ TRANSACTION(ttXCHAIN_ADD_CLAIM_ATTESTATION, 45, XChainAddClaimAttestation, /** This transaction adds an attestation to an account */ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, XChainAddAccountCreateAttestation, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, createAcct, ({ @@ -595,7 +595,7 @@ TRANSACTION(ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION, 46, /** This transaction modifies a sidechain */ TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -606,7 +606,7 @@ TRANSACTION(ttXCHAIN_MODIFY_BRIDGE, 47, XChainModifyBridge, /** This transactions creates a sidechain */ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, - Delegation::delegatable, + Delegation::delegable, featureXChainBridge, noPriv, ({ @@ -620,7 +620,7 @@ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, # include #endif TRANSACTION(ttDID_SET, 49, DIDSet, - Delegation::delegatable, + Delegation::delegable, featureDID, noPriv, ({ @@ -631,7 +631,7 @@ TRANSACTION(ttDID_SET, 49, DIDSet, /** This transaction type deletes a DID */ TRANSACTION(ttDID_DELETE, 50, DIDDelete, - Delegation::delegatable, + Delegation::delegable, featureDID, noPriv, ({})) @@ -641,7 +641,7 @@ TRANSACTION(ttDID_DELETE, 50, DIDDelete, # include #endif TRANSACTION(ttORACLE_SET, 51, OracleSet, - Delegation::delegatable, + Delegation::delegable, featurePriceOracle, noPriv, ({ @@ -658,7 +658,7 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet, # include #endif TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, - Delegation::delegatable, + Delegation::delegable, featurePriceOracle, noPriv, ({ @@ -670,7 +670,7 @@ TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, # include #endif TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, - Delegation::delegatable, + Delegation::delegable, fixNFTokenPageLinks, noPriv, ({ @@ -683,7 +683,7 @@ TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, # include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, - Delegation::delegatable, + Delegation::delegable, featureMPTokensV1, createMPTIssuance, ({ @@ -700,7 +700,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, # include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, - Delegation::delegatable, + Delegation::delegable, featureMPTokensV1, destroyMPTIssuance, ({ @@ -712,7 +712,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, # include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, - Delegation::delegatable, + Delegation::delegable, featureMPTokensV1, noPriv, ({ @@ -729,7 +729,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, # include #endif TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, - Delegation::delegatable, + Delegation::delegable, featureMPTokensV1, mustAuthorizeMPT, ({ @@ -742,7 +742,7 @@ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, # include #endif TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, - Delegation::delegatable, + Delegation::delegable, featureCredentials, noPriv, ({ @@ -754,7 +754,7 @@ TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, /** This transaction type accept an Credential object */ TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, - Delegation::delegatable, + Delegation::delegable, featureCredentials, noPriv, ({ @@ -764,7 +764,7 @@ TRANSACTION(ttCREDENTIAL_ACCEPT, 59, CredentialAccept, /** This transaction type delete an Credential object */ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, - Delegation::delegatable, + Delegation::delegable, featureCredentials, noPriv, ({ @@ -778,7 +778,7 @@ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, # include #endif TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, - Delegation::delegatable, + Delegation::delegable, featureDynamicNFT, noPriv, ({ @@ -792,7 +792,7 @@ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, # include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, - Delegation::delegatable, + Delegation::delegable, featurePermissionedDomains, noPriv, ({ @@ -805,7 +805,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, # include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, - Delegation::delegatable, + Delegation::delegable, featurePermissionedDomains, noPriv, ({ @@ -817,7 +817,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, # include #endif TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, - Delegation::notDelegatable, + Delegation::notDelegable, featurePermissionDelegationV1_1, noPriv, ({ @@ -830,7 +830,7 @@ TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, # include #endif TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, createPseudoAcct | createMPTIssuance | mustModifyVault, ({ @@ -848,7 +848,7 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, # include #endif TRANSACTION(ttVAULT_SET, 66, VaultSet, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, mustModifyVault, ({ @@ -863,7 +863,7 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet, # include #endif TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, mustDeleteAcct | destroyMPTIssuance | mustModifyVault, ({ @@ -875,7 +875,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, # include #endif TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, mayAuthorizeMPT | mustModifyVault, ({ @@ -888,7 +888,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, # include #endif TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, mayDeleteMPT | mayAuthorizeMPT | mustModifyVault, ({ @@ -903,7 +903,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, # include #endif TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, - Delegation::delegatable, + Delegation::delegable, featureSingleAssetVault, mayDeleteMPT | mustModifyVault, ({ @@ -917,7 +917,7 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, # include #endif TRANSACTION(ttBATCH, 71, Batch, - Delegation::notDelegatable, + Delegation::notDelegable, featureBatch, noPriv, ({ @@ -932,7 +932,7 @@ TRANSACTION(ttBATCH, 71, Batch, # include #endif TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, createPseudoAcct | mayAuthorizeMPT, ({ {sfVaultID, soeREQUIRED}, @@ -949,7 +949,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, # include #endif TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, mustDeleteAcct | mayAuthorizeMPT, ({ {sfLoanBrokerID, soeREQUIRED}, @@ -960,7 +960,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, # include #endif TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, noPriv, ({ {sfLoanBrokerID, soeREQUIRED}, @@ -972,7 +972,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, # include #endif TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, mayAuthorizeMPT, ({ {sfLoanBrokerID, soeREQUIRED}, @@ -987,7 +987,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, # include #endif TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, noPriv, ({ {sfLoanBrokerID, soeOPTIONAL}, @@ -999,7 +999,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, # include #endif TRANSACTION(ttLOAN_SET, 80, LoanSet, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, mayAuthorizeMPT | mustModifyVault, ({ {sfLoanBrokerID, soeREQUIRED}, @@ -1026,7 +1026,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet, # include #endif TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, noPriv, ({ {sfLoanID, soeREQUIRED}, @@ -1037,7 +1037,7 @@ TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, # include #endif TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, // All of the LoanManage options will modify the vault, but the // transaction can succeed without options, essentially making it @@ -1051,7 +1051,7 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, # include #endif TRANSACTION(ttLOAN_PAY, 84, LoanPay, - Delegation::delegatable, + Delegation::delegable, featureLendingProtocol, mayAuthorizeMPT | mustModifyVault, ({ {sfLoanID, soeREQUIRED}, @@ -1066,7 +1066,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay, # include #endif TRANSACTION(ttAMENDMENT, 100, EnableAmendment, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ @@ -1078,7 +1078,7 @@ TRANSACTION(ttAMENDMENT, 100, EnableAmendment, For details, see: https://xrpl.org/fee-voting.html */ TRANSACTION(ttFEE, 101, SetFee, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ @@ -1099,7 +1099,7 @@ TRANSACTION(ttFEE, 101, SetFee, For details, see: https://xrpl.org/negative-unl.html */ TRANSACTION(ttUNL_MODIFY, 102, UNLModify, - Delegation::notDelegatable, + Delegation::notDelegable, uint256{}, noPriv, ({ diff --git a/src/libxrpl/protocol/Permissions.cpp b/src/libxrpl/protocol/Permissions.cpp index 55b273e246..082a1792a4 100644 --- a/src/libxrpl/protocol/Permissions.cpp +++ b/src/libxrpl/protocol/Permissions.cpp @@ -11,7 +11,7 @@ Permission::Permission() #pragma push_macro("TRANSACTION") #undef TRANSACTION -#define TRANSACTION(tag, value, name, delegatable, amendment, ...) \ +#define TRANSACTION(tag, value, name, delegable, amendment, ...) \ {value, amendment}, #include @@ -24,7 +24,7 @@ Permission::Permission() #pragma push_macro("TRANSACTION") #undef TRANSACTION -#define TRANSACTION(tag, value, name, delegatable, ...) {value, delegatable}, +#define TRANSACTION(tag, value, name, delegable, ...) {value, delegable}, #include @@ -170,7 +170,7 @@ Permission::isDelegable( !rules.enabled(txFeaturesIt->second)) return false; - if (it->second == Delegation::notDelegatable) + if (it->second == Delegation::notDelegable) return false; return true; diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index 163e4f632c..fa3c836cca 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -2370,7 +2370,8 @@ private: &extractHeader](Message& message) { auto [header, buffers] = extractHeader(message); if (BEAST_EXPECT(header) && - BEAST_EXPECT(header->message_type == protocol::mtVALIDATORLIST)) + BEAST_EXPECT( + header->message_type == protocol::mtVALIDATOR_LIST)) { auto const msg = detail::parseMessageContent( @@ -2386,7 +2387,7 @@ private: if (BEAST_EXPECT(header) && BEAST_EXPECT( header->message_type == - protocol::mtVALIDATORLISTCOLLECTION)) + protocol::mtVALIDATOR_LIST_COLLECTION)) { auto const msg = detail::parseMessageContent< protocol::TMValidatorListCollection>( diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 2be69a74c9..f2fe07cb33 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -436,12 +436,12 @@ public: // 895B doTest( buildValidatorList(), - protocol::mtVALIDATORLIST, + protocol::mtVALIDATOR_LIST, 4, "TMValidatorList"); doTest( buildValidatorListCollection(), - protocol::mtVALIDATORLISTCOLLECTION, + protocol::mtVALIDATOR_LIST_COLLECTION, 4, "TMValidatorListCollection"); } diff --git a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp index e1eb51fda7..9356f17af0 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayMsgHandler.cpp @@ -53,7 +53,7 @@ LedgerReplayMsgHandler::processProofPathRequest( { case protocol::lmACCOUNT_STATE: return ledger->stateMap().getProofPath(key); - case protocol::lmTRANASCTION: + case protocol::lmTRANSACTION: return ledger->txMap().getProofPath(key); default: // should not be here diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 12ba52fa36..5c1c5e80a1 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -528,7 +528,7 @@ splitMessageParts( "xrpl::splitMessageParts : maximum message size"); messages.emplace_back( - std::make_shared(smallMsg, protocol::mtVALIDATORLIST), + std::make_shared(smallMsg, protocol::mtVALIDATOR_LIST), sha512Half(smallMsg), 1); return messages.back().numVLs; @@ -555,7 +555,7 @@ splitMessageParts( { messages.emplace_back( std::make_shared( - *smallMsg, protocol::mtVALIDATORLISTCOLLECTION), + *smallMsg, protocol::mtVALIDATOR_LIST_COLLECTION), sha512Half(*smallMsg), smallMsg->blobs_size()); return messages.back().numVLs; @@ -592,7 +592,7 @@ buildValidatorListMessage( "xrpl::buildValidatorListMessage(ValidatorBlobInfo) : maximum " "message size"); messages.emplace_back( - std::make_shared(msg, protocol::mtVALIDATORLIST), + std::make_shared(msg, protocol::mtVALIDATOR_LIST), sha512Half(msg), 1); return 1; @@ -640,7 +640,8 @@ buildValidatorListMessage( else { messages.emplace_back( - std::make_shared(msg, protocol::mtVALIDATORLISTCOLLECTION), + std::make_shared( + msg, protocol::mtVALIDATOR_LIST_COLLECTION), sha512Half(msg), msg.blobs_size()); return messages.back().numVLs; diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index eb751c817f..0b237905e8 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -84,9 +84,9 @@ operator|(Privilege lhs, Privilege rhs) #pragma push_macro("TRANSACTION") #undef TRANSACTION -#define TRANSACTION(tag, value, name, delegatable, amendment, privileges, ...) \ - case tag: { \ - return (privileges) & priv; \ +#define TRANSACTION(tag, value, name, delegable, amendment, privileges, ...) \ + case tag: { \ + return (privileges) & priv; \ } bool diff --git a/src/xrpld/overlay/detail/Message.cpp b/src/xrpld/overlay/detail/Message.cpp index eb7b88894a..d03cd5e0da 100644 --- a/src/xrpld/overlay/detail/Message.cpp +++ b/src/xrpld/overlay/detail/Message.cpp @@ -68,8 +68,8 @@ Message::compress() case protocol::mtGET_LEDGER: case protocol::mtLEDGER_DATA: case protocol::mtGET_OBJECTS: - case protocol::mtVALIDATORLIST: - case protocol::mtVALIDATORLISTCOLLECTION: + case protocol::mtVALIDATOR_LIST: + case protocol::mtVALIDATOR_LIST_COLLECTION: case protocol::mtREPLAY_DELTA_RESPONSE: case protocol::mtTRANSACTIONS: return true; diff --git a/src/xrpld/overlay/detail/ProtocolMessage.h b/src/xrpld/overlay/detail/ProtocolMessage.h index 51dfc1ac7c..77ad368ccd 100644 --- a/src/xrpld/overlay/detail/ProtocolMessage.h +++ b/src/xrpld/overlay/detail/ProtocolMessage.h @@ -63,9 +63,9 @@ protocolMessageName(int type) return "status"; case protocol::mtHAVE_SET: return "have_set"; - case protocol::mtVALIDATORLIST: + case protocol::mtVALIDATOR_LIST: return "validator_list"; - case protocol::mtVALIDATORLISTCOLLECTION: + case protocol::mtVALIDATOR_LIST_COLLECTION: return "validator_list_collection"; case protocol::mtVALIDATION: return "validation"; @@ -411,11 +411,11 @@ invokeProtocolMessage( success = detail::invoke( *header, buffers, handler); break; - case protocol::mtVALIDATORLIST: + case protocol::mtVALIDATOR_LIST: success = detail::invoke( *header, buffers, handler); break; - case protocol::mtVALIDATORLISTCOLLECTION: + case protocol::mtVALIDATOR_LIST_COLLECTION: success = detail::invoke( *header, buffers, handler); break; diff --git a/src/xrpld/overlay/detail/TrafficCount.cpp b/src/xrpld/overlay/detail/TrafficCount.cpp index 6fb397ea71..21b4ba78a4 100644 --- a/src/xrpld/overlay/detail/TrafficCount.cpp +++ b/src/xrpld/overlay/detail/TrafficCount.cpp @@ -9,8 +9,8 @@ std::unordered_map const {protocol::mtMANIFESTS, TrafficCount::category::manifests}, {protocol::mtENDPOINTS, TrafficCount::category::overlay}, {protocol::mtTRANSACTION, TrafficCount::category::transaction}, - {protocol::mtVALIDATORLIST, TrafficCount::category::validatorlist}, - {protocol::mtVALIDATORLISTCOLLECTION, + {protocol::mtVALIDATOR_LIST, TrafficCount::category::validatorlist}, + {protocol::mtVALIDATOR_LIST_COLLECTION, TrafficCount::category::validatorlist}, {protocol::mtVALIDATION, TrafficCount::category::validation}, {protocol::mtPROPOSE_LEDGER, TrafficCount::category::proposal}, From e1d97bea12c6ebc3dc5cda19985c3c28987fb1fe Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 8 Jan 2026 15:02:59 -0500 Subject: [PATCH 26/62] ci: Use updated prepare-runner in actions and worfklows (#6188) This change updates the XRPLF pre-commit workflow and prepare-runner action to their latest versions. For naming consistency the prepare-runner action changed the disable_ccache variable into enable_ccache, which matches our naming. --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/reusable-build-test-config.yml | 4 ++-- .github/workflows/upload-conan-deps.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d0a657dd7e..41e82fb6bb 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -9,7 +9,7 @@ on: jobs: # Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks. run-hooks: - uses: XRPLF/actions/.github/workflows/pre-commit.yml@34790936fae4c6c751f62ec8c06696f9c1a5753a + uses: XRPLF/actions/.github/workflows/pre-commit.yml@5ca417783f0312ab26d6f48b85c78edf1de99bbd with: runs_on: ubuntu-latest container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-a8c7be1" }' diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index 575984162e..fc80bbd216 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -100,9 +100,9 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 + uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925 with: - disable_ccache: ${{ !inputs.ccache_enabled }} + enable_ccache: ${{ inputs.ccache_enabled }} - name: Set ccache log file if: ${{ inputs.ccache_enabled && runner.debug == '1' }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 8a9993d37a..55a9ab8864 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -70,9 +70,9 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@2ece4ec6ab7de266859a6f053571425b2bd684b6 + uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925 with: - disable_ccache: true + enable_ccache: false - name: Print build environment uses: ./.github/actions/print-env From c24a6041f7fa8509a584de0c82c439b43197eddf Mon Sep 17 00:00:00 2001 From: oncecelll Date: Sat, 10 Jan 2026 02:15:05 +0800 Subject: [PATCH 27/62] docs: Fix minor spelling issues in comments (#6194) --- src/libxrpl/protocol/SecretKey.cpp | 4 ++-- src/test/app/HashRouter_test.cpp | 2 +- src/test/app/MPToken_test.cpp | 4 ++-- src/test/app/MultiSign_test.cpp | 2 +- src/test/basics/IntrusiveShared_test.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libxrpl/protocol/SecretKey.cpp b/src/libxrpl/protocol/SecretKey.cpp index 88404a88a5..2507269407 100644 --- a/src/libxrpl/protocol/SecretKey.cpp +++ b/src/libxrpl/protocol/SecretKey.cpp @@ -77,7 +77,7 @@ deriveDeterministicRootKey(Seed const& seed) std::array buf; std::copy(seed.begin(), seed.end(), buf.begin()); - // The odds that this loop executes more than once are neglible + // The odds that this loop executes more than once are negligible // but *just* in case someone managed to generate a key that required // more iterations loop a few times. for (std::uint32_t seq = 0; seq != 128; ++seq) @@ -137,7 +137,7 @@ private: std::copy(generator_.begin(), generator_.end(), buf.begin()); copy_uint32(buf.data() + 33, seq); - // The odds that this loop executes more than once are neglible + // The odds that this loop executes more than once are negligible // but we impose a maximum limit just in case. for (std::uint32_t subseq = 0; subseq != 128; ++subseq) { diff --git a/src/test/app/HashRouter_test.cpp b/src/test/app/HashRouter_test.cpp index c428917fdc..2d1d37c3e3 100644 --- a/src/test/app/HashRouter_test.cpp +++ b/src/test/app/HashRouter_test.cpp @@ -349,7 +349,7 @@ class HashRouter_test : public beast::unit_test::suite h.set("hold_time", "alice"); h.set("relay_time", "bob"); auto const setup = setup_HashRouter(cfg); - // The set function ignores values that don't covert, so the + // The set function ignores values that don't convert, so the // defaults are left unchanged BEAST_EXPECT(setup.holdTime == 300s); BEAST_EXPECT(setup.relayTime == 30s); diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index ed6d861ffb..747f78ef6b 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -2651,7 +2651,7 @@ class MPToken_test : public beast::unit_test::suite STAmount const amt3{asset3, 10'000}; { - testcase("Test STAmount MPT arithmetics"); + testcase("Test STAmount MPT arithmetic"); using namespace std::string_literals; STAmount res = multiply(amt1, amt2, asset3); BEAST_EXPECT(res == amt3); @@ -2688,7 +2688,7 @@ class MPToken_test : public beast::unit_test::suite } { - testcase("Test MPTAmount arithmetics"); + testcase("Test MPTAmount arithmetic"); MPTAmount mptAmt1{100}; MPTAmount const mptAmt2{100}; BEAST_EXPECT((mptAmt1 += mptAmt2) == MPTAmount{200}); diff --git a/src/test/app/MultiSign_test.cpp b/src/test/app/MultiSign_test.cpp index 6950286b52..5c5404c17e 100644 --- a/src/test/app/MultiSign_test.cpp +++ b/src/test/app/MultiSign_test.cpp @@ -708,7 +708,7 @@ public: void testHeterogeneousSigners(FeatureBitset features) { - testcase("Heterogenous Signers"); + testcase("Heterogeneous Signers"); using namespace jtx; Env env{*this, features}; diff --git a/src/test/basics/IntrusiveShared_test.cpp b/src/test/basics/IntrusiveShared_test.cpp index b77325efa9..500b6e7e39 100644 --- a/src/test/basics/IntrusiveShared_test.cpp +++ b/src/test/basics/IntrusiveShared_test.cpp @@ -396,7 +396,7 @@ public: // This checks that partialDelete has run to completion // before the destructor is called. A sleep is inserted // inside the partial delete to make sure the destructor is - // given an opportunity to run durring partial delete. + // given an opportunity to run during partial delete. BEAST_EXPECT(cur == partiallyDeleted); } if (next == partiallyDeletedStarted) From fc0072383699cf9718af35a22e46df1bad7799bb Mon Sep 17 00:00:00 2001 From: Zhanibek Bakin <50952098+janibakin@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:37:55 +0500 Subject: [PATCH 28/62] fix: Truncate thread name to 15 chars on Linux (#5758) This change: * Truncates thread names if more than 15 chars with `snprintf`. * Adds warnings for truncated thread names if `-DTRUNCATED_THREAD_NAME_LOGS=ON`. * Add a static assert for string literals to stop compiling if > 15 chars. * Shortens `Resource::Manager` to `Resource::Mngr` to fix the static assert failure. * Updates `CurrentThreadName_test` unit test specifically for Linux to verify truncation. --- cmake/XrplSettings.cmake | 15 ++++ include/xrpl/beast/core/CurrentThreadName.h | 27 +++++++ src/libxrpl/beast/core/CurrentThreadName.cpp | 24 +++++- src/libxrpl/resource/ResourceManager.cpp | 2 +- .../beast/beast_CurrentThreadName_test.cpp | 74 ++++++++++++++----- 5 files changed, 121 insertions(+), 21 deletions(-) diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index a16513afc5..c3f013c575 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -68,6 +68,21 @@ if(is_linux) option(perf "Enables flags that assist with perf recording" OFF) option(use_gold "enables detection of gold (binutils) linker" ON) option(use_mold "enables detection of mold (binutils) linker" ON) + # Set a default value for the log flag based on the build type. + # This provides a sensible default (on for debug, off for release) + # while still allowing the user to override it for any build. + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(TRUNCATED_LOGS_DEFAULT ON) + else() + set(TRUNCATED_LOGS_DEFAULT OFF) + endif() + option(TRUNCATED_THREAD_NAME_LOGS + "Show warnings about truncated thread names on Linux." + ${TRUNCATED_LOGS_DEFAULT} + ) + if(TRUNCATED_THREAD_NAME_LOGS) + add_compile_definitions(TRUNCATED_THREAD_NAME_LOGS) + endif() else() # we are not ready to allow shared-libs on windows because it would require # export declarations. On macos it's more feasible, but static openssl diff --git a/include/xrpl/beast/core/CurrentThreadName.h b/include/xrpl/beast/core/CurrentThreadName.h index 8e9d58b649..703246a76a 100644 --- a/include/xrpl/beast/core/CurrentThreadName.h +++ b/include/xrpl/beast/core/CurrentThreadName.h @@ -5,6 +5,8 @@ #ifndef BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED #define BEAST_CORE_CURRENT_THREAD_NAME_H_INCLUDED +#include + #include #include @@ -16,6 +18,31 @@ namespace beast { void setCurrentThreadName(std::string_view newThreadName); +#if BOOST_OS_LINUX + +// On Linux, thread names are limited to 16 bytes including the null terminator. +// Maximum number of characters is therefore 15. +constexpr std::size_t maxThreadNameLength = 15; + +/** Sets the name of the caller thread with compile-time size checking. + @tparam N The size of the string literal including null terminator + @param newThreadName A string literal to set as the thread name + + This template overload enforces that thread names are at most 16 characters + (including null terminator) at compile time, matching Linux's limit. +*/ +template +void +setCurrentThreadName(char const (&newThreadName)[N]) +{ + static_assert( + N <= maxThreadNameLength + 1, + "Thread name cannot exceed 15 characters"); + + setCurrentThreadName(std::string_view(newThreadName, N - 1)); +} +#endif + /** Returns the name of the caller thread. The name returned is the name as set by a call to setCurrentThreadName(). diff --git a/src/libxrpl/beast/core/CurrentThreadName.cpp b/src/libxrpl/beast/core/CurrentThreadName.cpp index 42dbb062b4..e8f7b629a7 100644 --- a/src/libxrpl/beast/core/CurrentThreadName.cpp +++ b/src/libxrpl/beast/core/CurrentThreadName.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include @@ -73,12 +71,32 @@ setCurrentThreadNameImpl(std::string_view name) #if BOOST_OS_LINUX #include +#include + namespace beast::detail { inline void setCurrentThreadNameImpl(std::string_view name) { - pthread_setname_np(pthread_self(), name.data()); + // truncate and set the thread name. + char boundedName[maxThreadNameLength + 1]; + std::snprintf( + boundedName, + sizeof(boundedName), + "%.*s", + static_cast(maxThreadNameLength), + name.data()); + + pthread_setname_np(pthread_self(), boundedName); + +#ifdef TRUNCATED_THREAD_NAME_LOGS + if (name.size() > maxThreadNameLength) + { + std::cerr << "WARNING: Thread name \"" << name << "\" (length " + << name.size() << ") exceeds maximum of " + << maxThreadNameLength << " characters on Linux.\n"; + } +#endif } } // namespace beast::detail diff --git a/src/libxrpl/resource/ResourceManager.cpp b/src/libxrpl/resource/ResourceManager.cpp index 8582836611..15d31a558e 100644 --- a/src/libxrpl/resource/ResourceManager.cpp +++ b/src/libxrpl/resource/ResourceManager.cpp @@ -140,7 +140,7 @@ private: void run() { - beast::setCurrentThreadName("Resource::Manager"); + beast::setCurrentThreadName("Resource::Mngr"); for (;;) { logic_.periodicActivity(); diff --git a/src/test/beast/beast_CurrentThreadName_test.cpp b/src/test/beast/beast_CurrentThreadName_test.cpp index 3d33ecb602..dc12883a63 100644 --- a/src/test/beast/beast_CurrentThreadName_test.cpp +++ b/src/test/beast/beast_CurrentThreadName_test.cpp @@ -1,6 +1,8 @@ #include #include +#include + #include namespace xrpl { @@ -37,33 +39,71 @@ private: if (beast::getCurrentThreadName() == myName) *state = 2; } +#if BOOST_OS_LINUX + // Helper function to test a specific name. + // It creates a thread, sets the name, and checks if the OS-level + // name matches the expected (potentially truncated) name. + void + testName(std::string const& nameToSet, std::string const& expectedName) + { + std::thread t([&] { + beast::setCurrentThreadName(nameToSet); + + // Initialize buffer to be safe. + char actualName[beast::maxThreadNameLength + 1] = {}; + pthread_getname_np(pthread_self(), actualName, sizeof(actualName)); + + BEAST_EXPECT(std::string(actualName) == expectedName); + }); + t.join(); + } +#endif public: void run() override { - // Make two different threads with two different names. Make sure - // that the expected thread names are still there when the thread - // exits. - std::atomic stop{false}; + // Make two different threads with two different names. + // Make sure that the expected thread names are still there + // when the thread exits. + { + std::atomic stop{false}; - std::atomic stateA{0}; - std::thread tA(exerciseName, "tA", &stop, &stateA); + std::atomic stateA{0}; + std::thread tA(exerciseName, "tA", &stop, &stateA); - std::atomic stateB{0}; - std::thread tB(exerciseName, "tB", &stop, &stateB); + std::atomic stateB{0}; + std::thread tB(exerciseName, "tB", &stop, &stateB); - // Wait until both threads have set their names. - while (stateA == 0 || stateB == 0) - ; + // Wait until both threads have set their names. + while (stateA == 0 || stateB == 0) + ; - stop = true; - tA.join(); - tB.join(); + stop = true; + tA.join(); + tB.join(); - // Both threads should still have the expected name when they exit. - BEAST_EXPECT(stateA == 2); - BEAST_EXPECT(stateB == 2); + // Both threads should still have the expected name when they exit. + BEAST_EXPECT(stateA == 2); + BEAST_EXPECT(stateB == 2); + } +#if BOOST_OS_LINUX + // On Linux, verify that thread names longer than 15 characters + // are truncated to 15 characters (the 16th character is reserved for + // the null terminator). + { + testName( + "123456789012345", + "123456789012345"); // 15 chars, no truncation + testName( + "1234567890123456", "123456789012345"); // 16 chars, truncated + testName( + "ThisIsAVeryLongThreadNameExceedingLimit", + "ThisIsAVeryLong"); // 39 chars, truncated + testName("", ""); // empty name + testName("short", "short"); // short name, no truncation + } +#endif } }; From 14467fba5e5652d4976fdea0d312d64e6fb61242 Mon Sep 17 00:00:00 2001 From: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Date: Fri, 9 Jan 2026 20:58:02 +0100 Subject: [PATCH 29/62] VaultClawback: Burn shares of an empty vault (#6120) - Adds a mechanism for the vault owner to burn user shares when the vault is stuck. If the Vault has 0 AssetsAvailable and Total, the owner may submit a VaultClawback to reclaim the worthless fees, and thus allow the Vault to be deleted. The Amount must be left off (unless the owner is the asset issuer), specified as 0 Shares, or specified as the number of Shares held. --- src/test/app/Vault_test.cpp | 589 ++++++++++++++++++++- src/xrpld/app/tx/detail/InvariantCheck.cpp | 77 +-- src/xrpld/app/tx/detail/InvariantCheck.h | 1 + src/xrpld/app/tx/detail/VaultClawback.cpp | 473 +++++++++++------ src/xrpld/app/tx/detail/VaultClawback.h | 8 + 5 files changed, 931 insertions(+), 217 deletions(-) diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index f8d76623fd..d0a1450d6c 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -940,25 +939,6 @@ class Vault_test : public beast::unit_test::suite } }); - testCase([&](Env& env, - Account const& issuer, - Account const& owner, - Asset const& asset, - Vault& vault) { - testcase("clawback from self"); - - auto [tx, keylet] = vault.create({.owner = owner, .asset = asset}); - - { - auto tx = vault.clawback( - {.issuer = issuer, - .id = keylet.key, - .holder = issuer, - .amount = asset(10)}); - env(tx, ter{temMALFORMED}); - } - }); - testCase([&](Env& env, Account const&, Account const& owner, @@ -1197,11 +1177,13 @@ class Vault_test : public beast::unit_test::suite auto [tx, keylet] = vault.create({.owner = owner, .asset = asset}); + // Preclaim only checks for native assets. + if (asset.native()) { auto tx = vault.clawback( - {.issuer = owner, + {.issuer = issuer, .id = keylet.key, - .holder = issuer, + .holder = owner, .amount = asset(50)}); env(tx, ter(temMALFORMED)); } @@ -1924,8 +1906,20 @@ class Vault_test : public beast::unit_test::suite env.close(); { - auto tx = vault.clawback( - {.issuer = owner, .id = keylet.key, .holder = depositor}); + auto tx = vault.clawback({ + .issuer = depositor, + .id = keylet.key, + .holder = depositor, + }); + env(tx, ter(tecNO_PERMISSION)); + } + + { + auto tx = vault.clawback({ + .issuer = owner, + .id = keylet.key, + .holder = depositor, + }); env(tx, ter(tecNO_PERMISSION)); } }); @@ -2377,6 +2371,15 @@ class Vault_test : public beast::unit_test::suite env(tx, ter(tecNO_AUTH)); } + { + // Cannot clawback if issuer is the holder + tx = vault.clawback( + {.issuer = issuer, + .id = keylet.key, + .holder = issuer, + .amount = asset(800)}); + env(tx, ter(tecNO_PERMISSION)); + } // Clawback works tx = vault.clawback( {.issuer = issuer, @@ -5243,6 +5246,542 @@ class Vault_test : public beast::unit_test::suite }); } + void + testVaultClawbackBurnShares() + { + using namespace test::jtx; + using namespace loanBroker; + using namespace loan; + Env env(*this, beast::severities::kWarning); + + auto const vaultAssetBalance = [&](Keylet const& vaultKeylet) { + auto const sleVault = env.le(vaultKeylet); + BEAST_EXPECT(sleVault != nullptr); + + return std::make_pair( + sleVault->at(sfAssetsAvailable), sleVault->at(sfAssetsTotal)); + }; + + auto const vaultShareBalance = [&](Keylet const& vaultKeylet) { + auto const sleVault = env.le(vaultKeylet); + BEAST_EXPECT(sleVault != nullptr); + + auto const sleIssuance = + env.le(keylet::mptIssuance(sleVault->at(sfShareMPTID))); + BEAST_EXPECT(sleIssuance != nullptr); + + return sleIssuance->at(sfOutstandingAmount); + }; + + auto const setupVault = + [&](PrettyAsset const& asset, + Account const& owner, + Account const& depositor) -> std::pair { + Vault vault{env}; + + auto const& [tx, vaultKeylet] = + vault.create({.owner = owner, .asset = asset}); + env(tx, ter(tesSUCCESS), THISLINE); + env.close(); + + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + + Asset share = vaultSle->at(sfShareMPTID); + + env(vault.deposit( + {.depositor = depositor, + .id = vaultKeylet.key, + .amount = asset(100)}), + ter(tesSUCCESS), + THISLINE); + env.close(); + + auto const& [availablePreDefault, totalPreDefault] = + vaultAssetBalance(vaultKeylet); + BEAST_EXPECT(availablePreDefault == totalPreDefault); + BEAST_EXPECT(availablePreDefault == asset(100).value()); + + // attempt to clawback shares while there are assets fails + env(vault.clawback( + {.issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = share(0).value()}), + ter(tecNO_PERMISSION), + THISLINE); + env.close(); + + auto const& sharesAvailable = vaultShareBalance(vaultKeylet); + auto const& brokerKeylet = + keylet::loanbroker(owner.id(), env.seq(owner)); + + env(set(owner, vaultKeylet.key), THISLINE); + env.close(); + + auto const& loanKeylet = keylet::loan(brokerKeylet.key, 1); + + // Create a simple Loan for the full amount of Vault assets + env(set(depositor, brokerKeylet.key, asset(100).value()), + loan::interestRate(TenthBips32(0)), + gracePeriod(10), + paymentInterval(120), + paymentTotal(10), + sig(sfCounterpartySignature, owner), + fee(env.current()->fees().base * 2), + ter(tesSUCCESS), + THISLINE); + env.close(); + + // attempt to clawback shares while there assetsAvailable == 0 and + // assetsTotal > 0 fails + env(vault.clawback( + {.issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = share(0).value()}), + ter(tecNO_PERMISSION), + THISLINE); + env.close(); + + env.close(std::chrono::seconds{120 + 10}); + + env(manage(owner, loanKeylet.key, tfLoanDefault), + ter(tesSUCCESS), + THISLINE); + + auto const& [availablePostDefault, totalPostDefault] = + vaultAssetBalance(vaultKeylet); + + BEAST_EXPECT(availablePostDefault == totalPostDefault); + BEAST_EXPECT(availablePostDefault == asset(0).value()); + BEAST_EXPECT(vaultShareBalance(vaultKeylet) == sharesAvailable); + + return std::make_pair(vault, vaultKeylet); + }; + + auto const testCase = [&](PrettyAsset const& asset, + std::string const& prefix, + Account const& owner, + Account const& depositor) { + { + testcase( + "VaultClawback (share) - " + prefix + + " owner asset clawback fails"); + auto [vault, vaultKeylet] = setupVault(asset, owner, depositor); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = asset(100).value(), + }), + // when asset is XRP or owner is not issuer clawback fail + // when owner is issuer precision loss occurs as vault is + // empty + asset.native() ? ter(temMALFORMED) + : asset.raw().getIssuer() != owner.id() + ? ter(tecNO_PERMISSION) + : ter(tecPRECISION_LOSS), + THISLINE); + env.close(); + } + + { + testcase( + "VaultClawback (share) - " + prefix + + " owner incomplete share clawback fails"); + auto [vault, vaultKeylet] = setupVault(asset, owner, depositor); + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + if (!vaultSle) + return; + Asset share = vaultSle->at(sfShareMPTID); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = share(1).value(), + }), + ter(tecLIMIT_EXCEEDED), + THISLINE); + env.close(); + } + + { + testcase( + "VaultClawback (share) - " + prefix + + " owner implicit complete share clawback"); + auto [vault, vaultKeylet] = setupVault(asset, owner, depositor); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + }), + // when owner is issuer implicit clawback fails + asset.native() || asset.raw().getIssuer() != owner.id() + ? ter(tesSUCCESS) + : ter(tecWRONG_ASSET), + THISLINE); + env.close(); + } + + { + testcase( + "VaultClawback (share) - " + prefix + + " owner explicit complete share clawback succeeds"); + auto [vault, vaultKeylet] = setupVault(asset, owner, depositor); + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + if (!vaultSle) + return; + Asset share = vaultSle->at(sfShareMPTID); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = share(vaultShareBalance(vaultKeylet)).value(), + }), + ter(tesSUCCESS), + THISLINE); + env.close(); + } + { + testcase( + "VaultClawback (share) - " + prefix + + " owner can clawback own shares"); + auto [vault, vaultKeylet] = setupVault(asset, owner, owner); + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + if (!vaultSle) + return; + Asset share = vaultSle->at(sfShareMPTID); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = owner, + .amount = share(vaultShareBalance(vaultKeylet)).value(), + }), + ter(tesSUCCESS), + THISLINE); + env.close(); + } + + { + testcase( + "VaultClawback (share) - " + prefix + + " empty vault share clawback fails"); + auto [vault, vaultKeylet] = setupVault(asset, owner, owner); + auto const& vaultSle = env.le(vaultKeylet); + if (BEAST_EXPECT(vaultSle != nullptr)) + return; + Asset share = vaultSle->at(sfShareMPTID); + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = owner, + .amount = share(vaultShareBalance(vaultKeylet)).value(), + }), + ter(tesSUCCESS), + THISLINE); + + // Now the vault is empty, clawback again fails + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = owner, + }), + ter(tecNO_PERMISSION), + THISLINE); + env.close(); + } + }; + + Account owner{"alice"}; + Account depositor{"bob"}; + Account issuer{"issuer"}; + + env.fund(XRP(10000), issuer, owner, depositor); + env.close(); + + // Test XRP + PrettyAsset xrp = xrpIssue(); + testCase(xrp, "XRP", owner, depositor); + testCase(xrp, "XRP (depositor is owner)", owner, owner); + + // Test IOU + PrettyAsset IOU = issuer["IOU"]; + env(fset(issuer, asfAllowTrustLineClawback)); + env.close(); + + env.trust(IOU(1000), owner); + env.trust(IOU(1000), depositor); + env(pay(issuer, owner, IOU(100))); + env(pay(issuer, depositor, IOU(100))); + env.close(); + testCase(IOU, "IOU", owner, depositor); + testCase(IOU, "IOU (owner is issuer)", issuer, depositor); + + // Test MPT + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create( + {.flags = tfMPTCanClawback | tfMPTCanTransfer | tfMPTCanLock}); + PrettyAsset MPT = mptt.issuanceID(); + mptt.authorize({.account = owner}); + mptt.authorize({.account = depositor}); + env(pay(issuer, owner, MPT(1000))); + env(pay(issuer, depositor, MPT(1000))); + env.close(); + testCase(MPT, "MPT", owner, depositor); + testCase(MPT, "MPT (owner is issuer)", issuer, depositor); + } + + void + testVaultClawbackAssets() + { + using namespace test::jtx; + using namespace loanBroker; + using namespace loan; + Env env(*this); + + auto const setupVault = + [&](PrettyAsset const& asset, + Account const& owner, + Account const& depositor, + Account const& issuer) -> std::pair { + Vault vault{env}; + + auto const& [tx, vaultKeylet] = + vault.create({.owner = owner, .asset = asset}); + env(tx, ter(tesSUCCESS), THISLINE); + env.close(); + + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + env(vault.deposit( + {.depositor = depositor, + .id = vaultKeylet.key, + .amount = asset(100)}), + ter(tesSUCCESS), + THISLINE); + env.close(); + + return std::make_pair(vault, vaultKeylet); + }; + + auto const testCase = [&](PrettyAsset const& asset, + std::string const& prefix, + Account const& owner, + Account const& depositor, + Account const& issuer) { + if (asset.native()) + { + testcase( + "VaultClawback (asset) - " + prefix + + " issuer XRP clawback fails"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + // If the asset is XRP, clawback with amount fails as malfored + // when asset is specified. + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = issuer, + .amount = asset(1).value(), + }), + ter(temMALFORMED), + THISLINE); + // When asset is implicit, clawback fails as no permission. + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = issuer, + }), + ter(tecNO_PERMISSION), + THISLINE); + return; + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " clawback for different asset fails"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + + Account issuer2{"issuer2"}; + PrettyAsset asset2 = issuer2["FOO"]; + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = depositor, + .amount = asset2(1).value(), + }), + ter(tecWRONG_ASSET), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " ambiguous owner/issuer asset clawback fails"); + auto [vault, vaultKeylet] = + setupVault(asset, issuer, depositor, issuer); + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = issuer, + }), + ter(tecWRONG_ASSET), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " non-issuer asset clawback fails"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + }), + ter(tecNO_PERMISSION), + THISLINE); + + env(vault.clawback({ + .issuer = owner, + .id = vaultKeylet.key, + .holder = depositor, + .amount = asset(1).value(), + }), + ter(tecNO_PERMISSION), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " issuer clawback from self fails"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, issuer, issuer); + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = issuer, + }), + ter(tecNO_PERMISSION), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " issuer share clawback fails"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + auto const& vaultSle = env.le(vaultKeylet); + BEAST_EXPECT(vaultSle != nullptr); + if (!vaultSle) + return; + Asset share = vaultSle->at(sfShareMPTID); + + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = depositor, + .amount = share(1).value(), + }), + ter(tecNO_PERMISSION), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " partial issuer asset clawback succeeds"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = depositor, + .amount = asset(1).value(), + }), + ter(tesSUCCESS), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " full issuer asset clawback succeeds"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = depositor, + .amount = asset(100).value(), + }), + ter(tesSUCCESS), + THISLINE); + } + + { + testcase( + "VaultClawback (asset) - " + prefix + + " implicit full issuer asset clawback succeeds"); + auto [vault, vaultKeylet] = + setupVault(asset, owner, depositor, issuer); + + env(vault.clawback({ + .issuer = issuer, + .id = vaultKeylet.key, + .holder = depositor, + }), + ter(tesSUCCESS), + THISLINE); + } + }; + + Account owner{"alice"}; + Account depositor{"bob"}; + Account issuer{"issuer"}; + + env.fund(XRP(10000), issuer, owner, depositor); + env.close(); + + // Test XRP + PrettyAsset xrp = xrpIssue(); + testCase(xrp, "XRP", owner, depositor, issuer); + + // Test IOU + PrettyAsset IOU = issuer["IOU"]; + env(fset(issuer, asfAllowTrustLineClawback)); + env.close(); + env.trust(IOU(1000), owner); + env.trust(IOU(1000), depositor); + env(pay(issuer, owner, IOU(1000))); + env(pay(issuer, depositor, IOU(1000))); + env.close(); + testCase(IOU, "IOU", owner, depositor, issuer); + + // Test MPT + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create( + {.flags = tfMPTCanClawback | tfMPTCanTransfer | tfMPTCanLock}); + PrettyAsset MPT = mptt.issuanceID(); + mptt.authorize({.account = owner}); + mptt.authorize({.account = depositor}); + env(pay(issuer, depositor, MPT(1000))); + env.close(); + testCase(MPT, "MPT", owner, depositor, issuer); + } + public: void run() override @@ -5261,6 +5800,8 @@ public: testScaleIOU(); testRPC(); testDelegate(); + testVaultClawbackBurnShares(); + testVaultClawbackAssets(); } }; diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/xrpld/app/tx/detail/InvariantCheck.cpp index 0b237905e8..2e0b3cbfab 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/xrpld/app/tx/detail/InvariantCheck.cpp @@ -95,6 +95,7 @@ hasPrivilege(STTx const& tx, Privilege priv) switch (tx.getTxnType()) { #include + // Deprecated types default: return false; @@ -2622,6 +2623,7 @@ ValidVault::Vault::make(SLE const& from) self.key = from.key(); self.asset = from.at(sfAsset); self.pseudoId = from.getAccountID(sfAccount); + self.owner = from.at(sfOwner); self.shareMPTID = from.getFieldH192(sfShareMPTID); self.assetsTotal = from.at(sfAssetsTotal); self.assetsAvailable = from.at(sfAssetsAvailable); @@ -3066,6 +3068,10 @@ ValidVault::finalize( : std::nullopt; }; + auto const vaultHoldsNoAssets = [&](Vault const& vault) { + return vault.assetsAvailable == 0 && vault.assetsTotal == 0; + }; + // Technically this does not need to be a lambda, but it's more // convenient thanks to early "return false"; the not-so-nice // alternatives are several layers of nested if/else or more complex @@ -3448,29 +3454,56 @@ ValidVault::finalize( if (vaultAsset.native() || vaultAsset.getIssuer() != tx[sfAccount]) { - JLOG(j.fatal()) << // - "Invariant failed: clawback may only be performed by " - "the asset issuer"; - return false; // That's all we can do + // The owner can use clawback to force-burn shares when the + // vault is empty but there are outstanding shares + if (!(beforeShares && beforeShares->sharesTotal > 0 && + vaultHoldsNoAssets(beforeVault) && + beforeVault.owner == tx[sfAccount])) + { + JLOG(j.fatal()) << // + "Invariant failed: clawback may only be performed " + "by the asset issuer, or by the vault owner of an " + "empty vault"; + return false; // That's all we can do + } } auto const vaultDeltaAssets = deltaAssets(afterVault.pseudoId); + if (vaultDeltaAssets) + { + if (*vaultDeltaAssets >= zero) + { + JLOG(j.fatal()) << // + "Invariant failed: clawback must decrease vault " + "balance"; + result = false; + } - if (!vaultDeltaAssets) + if (beforeVault.assetsTotal + *vaultDeltaAssets != + afterVault.assetsTotal) + { + JLOG(j.fatal()) << // + "Invariant failed: clawback and assets outstanding " + "must add up"; + result = false; + } + + if (beforeVault.assetsAvailable + *vaultDeltaAssets != + afterVault.assetsAvailable) + { + JLOG(j.fatal()) << // + "Invariant failed: clawback and assets available " + "must add up"; + result = false; + } + } + else if (!vaultHoldsNoAssets(beforeVault)) { JLOG(j.fatal()) << // "Invariant failed: clawback must change vault balance"; return false; // That's all we can do } - if (*vaultDeltaAssets >= zero) - { - JLOG(j.fatal()) << // - "Invariant failed: clawback must decrease vault " - "balance"; - result = false; - } - auto const accountDeltaShares = deltaShares(tx[sfHolder]); if (!accountDeltaShares) { @@ -3503,24 +3536,6 @@ ValidVault::finalize( result = false; } - if (beforeVault.assetsTotal + *vaultDeltaAssets != - afterVault.assetsTotal) - { - JLOG(j.fatal()) << // - "Invariant failed: clawback and assets outstanding " - "must add up"; - result = false; - } - - if (beforeVault.assetsAvailable + *vaultDeltaAssets != - afterVault.assetsAvailable) - { - JLOG(j.fatal()) << // - "Invariant failed: clawback and assets available must " - "add up"; - result = false; - } - return result; } diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/src/xrpld/app/tx/detail/InvariantCheck.h index ef9db373f5..87a1afb623 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.h +++ b/src/xrpld/app/tx/detail/InvariantCheck.h @@ -861,6 +861,7 @@ class ValidVault uint256 key = beast::zero; Asset asset = {}; AccountID pseudoId = {}; + AccountID owner = {}; uint192 shareMPTID = beast::zero; Number assetsTotal = 0; Number assetsAvailable = 0; diff --git a/src/xrpld/app/tx/detail/VaultClawback.cpp b/src/xrpld/app/tx/detail/VaultClawback.cpp index cc7dec993a..2552e8c1ff 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.cpp +++ b/src/xrpld/app/tx/detail/VaultClawback.cpp @@ -1,18 +1,17 @@ #include - +// #include #include #include -#include #include #include #include #include #include -#include + +#include namespace xrpl { - NotTEC VaultClawback::preflight(PreflightContext const& ctx) { @@ -22,15 +21,6 @@ VaultClawback::preflight(PreflightContext const& ctx) return temMALFORMED; } - AccountID const issuer = ctx.tx[sfAccount]; - AccountID const holder = ctx.tx[sfHolder]; - - if (issuer == holder) - { - JLOG(ctx.j.debug()) << "VaultClawback: issuer cannot be holder."; - return temMALFORMED; - } - auto const amount = ctx.tx[~sfAmount]; if (amount) { @@ -42,17 +32,27 @@ VaultClawback::preflight(PreflightContext const& ctx) JLOG(ctx.j.debug()) << "VaultClawback: cannot clawback XRP."; return temMALFORMED; } - else if (amount->asset().getIssuer() != issuer) - { - JLOG(ctx.j.debug()) - << "VaultClawback: only asset issuer can clawback."; - return temMALFORMED; - } } return tesSUCCESS; } +[[nodiscard]] STAmount +clawbackAmount( + std::shared_ptr const& vault, + std::optional const& maybeAmount, + AccountID const& account) +{ + if (maybeAmount) + return *maybeAmount; + + Asset const share = MPTIssue{vault->at(sfShareMPTID)}; + if (account == vault->at(sfOwner)) + return STAmount{share}; + + return STAmount{vault->at(sfAsset)}; +} + TER VaultClawback::preclaim(PreclaimContext const& ctx) { @@ -60,61 +60,264 @@ VaultClawback::preclaim(PreclaimContext const& ctx) if (!vault) return tecNO_ENTRY; - auto account = ctx.tx[sfAccount]; - auto const issuer = ctx.view.read(keylet::account(account)); - if (!issuer) + Asset const vaultAsset = vault->at(sfAsset); + auto const account = ctx.tx[sfAccount]; + auto const holder = ctx.tx[sfHolder]; + auto const maybeAmount = ctx.tx[~sfAmount]; + auto const mptIssuanceID = vault->at(sfShareMPTID); + auto const sleShareIssuance = + ctx.view.read(keylet::mptIssuance(mptIssuanceID)); + if (!sleShareIssuance) { // LCOV_EXCL_START - JLOG(ctx.j.error()) << "VaultClawback: missing issuer account."; + JLOG(ctx.j.error()) + << "VaultClawback: missing issuance of vault shares."; return tefINTERNAL; // LCOV_EXCL_STOP } - Asset const vaultAsset = vault->at(sfAsset); - if (auto const amount = ctx.tx[~sfAmount]; - amount && vaultAsset != amount->asset()) + Asset const share = MPTIssue{mptIssuanceID}; + + // Ambiguous case: If Issuer is Owner they must specify the asset + if (!maybeAmount && !vaultAsset.native() && + vaultAsset.getIssuer() == vault->at(sfOwner)) + { + JLOG(ctx.j.debug()) + << "VaultClawback: must specify amount when issuer is owner."; return tecWRONG_ASSET; - - if (vaultAsset.native()) - { - JLOG(ctx.j.debug()) << "VaultClawback: cannot clawback XRP."; - return tecNO_PERMISSION; // Cannot clawback XRP. - } - else if (vaultAsset.getIssuer() != account) - { - JLOG(ctx.j.debug()) << "VaultClawback: only asset issuer can clawback."; - return tecNO_PERMISSION; // Only issuers can clawback. } - if (vaultAsset.holds()) - { - auto const mpt = vaultAsset.get(); - auto const mptIssue = - ctx.view.read(keylet::mptIssuance(mpt.getMptID())); - if (mptIssue == nullptr) - return tecOBJECT_NOT_FOUND; + auto const amount = clawbackAmount(vault, maybeAmount, account); - std::uint32_t const issueFlags = mptIssue->getFieldU32(sfFlags); - if (!(issueFlags & lsfMPTCanClawback)) + // There is a special case that allows the VaultOwner to use clawback to + // burn shares when Vault assets total and available are zero, but + // shares remain. However, that case is handled in doApply() directly, + // so here we just enforce checks. + if (amount.asset() == share) + { + // Only the Vault Owner may clawback shares + if (account != vault->at(sfOwner)) { JLOG(ctx.j.debug()) - << "VaultClawback: cannot clawback MPT vault asset."; + << "VaultClawback: only vault owner can clawback shares."; return tecNO_PERMISSION; } - } - else if (vaultAsset.holds()) - { - std::uint32_t const issuerFlags = issuer->getFieldU32(sfFlags); - if (!(issuerFlags & lsfAllowTrustLineClawback) || - (issuerFlags & lsfNoFreeze)) + + auto const assetsTotal = vault->at(sfAssetsTotal); + auto const assetsAvailable = vault->at(sfAssetsAvailable); + auto const sharesTotal = sleShareIssuance->at(sfOutstandingAmount); + + // Owner can clawback funds when the vault has shares but no assets + if (sharesTotal == 0 || (assetsTotal != 0 || assetsAvailable != 0)) { JLOG(ctx.j.debug()) - << "VaultClawback: cannot clawback IOU vault asset."; + << "VaultClawback: vault owner can clawback shares only" + " when vault has no assets."; return tecNO_PERMISSION; } + + // If amount is non-zero, the VaultOwner must burn all shares + if (amount != beast::zero) + { + Number const& sharesHeld = accountHolds( + ctx.view, + holder, + share, + FreezeHandling::fhIGNORE_FREEZE, + AuthHandling::ahIGNORE_AUTH, + ctx.j); + + // The VaultOwner must burn all shares + if (amount != sharesHeld) + { + JLOG(ctx.j.debug()) + << "VaultClawback: vault owner must clawback all " + "shares."; + return tecLIMIT_EXCEEDED; + } + } + + return tesSUCCESS; } - return tesSUCCESS; + // The asset that is being clawed back is the vault asset + if (amount.asset() == vaultAsset) + { + // XRP cannot be clawed back + if (vaultAsset.native()) + { + JLOG(ctx.j.debug()) << "VaultClawback: cannot clawback XRP."; + return tecNO_PERMISSION; + } + + // Only the Asset Issuer may clawback the asset + if (account != vaultAsset.getIssuer()) + { + JLOG(ctx.j.debug()) + << "VaultClawback: only asset issuer can clawback asset."; + return tecNO_PERMISSION; + } + + // The issuer cannot clawback from itself + if (account == holder) + { + JLOG(ctx.j.debug()) + << "VaultClawback: issuer cannot be the holder."; + return tecNO_PERMISSION; + } + + return std::visit( + [&](TIss const& issue) -> TER { + if constexpr (std::is_same_v) + { + auto const mptIssue = + ctx.view.read(keylet::mptIssuance(issue.getMptID())); + if (mptIssue == nullptr) + return tecOBJECT_NOT_FOUND; + + std::uint32_t const issueFlags = + mptIssue->getFieldU32(sfFlags); + if (!(issueFlags & lsfMPTCanClawback)) + { + JLOG(ctx.j.debug()) << "VaultClawback: cannot clawback " + "MPT vault asset."; + return tecNO_PERMISSION; + } + } + else if constexpr (std::is_same_v) + { + auto const issuerSle = + ctx.view.read(keylet::account(account)); + if (!issuerSle) + { + // LCOV_EXCL_START + JLOG(ctx.j.error()) + << "VaultClawback: missing submitter account."; + return tefINTERNAL; + // LCOV_EXCL_STOP + } + + std::uint32_t const issuerFlags = + issuerSle->getFieldU32(sfFlags); + if (!(issuerFlags & lsfAllowTrustLineClawback) || + (issuerFlags & lsfNoFreeze)) + { + JLOG(ctx.j.debug()) << "VaultClawback: cannot clawback " + "IOU vault asset."; + return tecNO_PERMISSION; + } + } + return tesSUCCESS; + }, + vaultAsset.value()); + } + + // Invalid asset + return tecWRONG_ASSET; +} + +Expected, TER> +VaultClawback::assetsToClawback( + std::shared_ptr const& vault, + std::shared_ptr const& sleShareIssuance, + AccountID const& holder, + STAmount const& clawbackAmount) +{ + if (clawbackAmount.asset() != vault->at(sfAsset)) + { + // preclaim should have blocked this , now it's an internal error + // LCOV_EXCL_START + JLOG(j_.error()) << "VaultClawback: asset mismatch in clawback."; + return Unexpected(tecINTERNAL); + // LCOV_EXCL_STOP + } + + auto const assetsAvailable = vault->at(sfAssetsAvailable); + auto const mptIssuanceID = *vault->at(sfShareMPTID); + MPTIssue const share{mptIssuanceID}; + + if (clawbackAmount == beast::zero) + { + auto const sharesDestroyed = accountHolds( + view(), + holder, + share, + FreezeHandling::fhIGNORE_FREEZE, + AuthHandling::ahIGNORE_AUTH, + j_); + auto const maybeAssets = + sharesToAssetsWithdraw(vault, sleShareIssuance, sharesDestroyed); + if (!maybeAssets) + return Unexpected(tecINTERNAL); // LCOV_EXCL_LINE + + return std::make_pair(*maybeAssets, sharesDestroyed); + } + + STAmount sharesDestroyed; + STAmount assetsRecovered = clawbackAmount; + try + { + { + auto const maybeShares = assetsToSharesWithdraw( + vault, sleShareIssuance, assetsRecovered); + if (!maybeShares) + return Unexpected(tecINTERNAL); // LCOV_EXCL_LINE + sharesDestroyed = *maybeShares; + } + + auto const maybeAssets = + sharesToAssetsWithdraw(vault, sleShareIssuance, sharesDestroyed); + if (!maybeAssets) + return Unexpected(tecINTERNAL); // LCOV_EXCL_LINE + assetsRecovered = *maybeAssets; + + // Clamp to maximum. + if (assetsRecovered > *assetsAvailable) + { + assetsRecovered = *assetsAvailable; + // Note, it is important to truncate the number of shares, + // otherwise the corresponding assets might breach the + // AssetsAvailable + { + auto const maybeShares = assetsToSharesWithdraw( + vault, + sleShareIssuance, + assetsRecovered, + TruncateShares::yes); + if (!maybeShares) + return Unexpected(tecINTERNAL); // LCOV_EXCL_LINE + sharesDestroyed = *maybeShares; + } + + auto const maybeAssets = sharesToAssetsWithdraw( + vault, sleShareIssuance, sharesDestroyed); + if (!maybeAssets) + return Unexpected(tecINTERNAL); // LCOV_EXCL_LINE + assetsRecovered = *maybeAssets; + if (assetsRecovered > *assetsAvailable) + { + // LCOV_EXCL_START + JLOG(j_.error()) + << "VaultClawback: invalid rounding of shares."; + return Unexpected(tecINTERNAL); + // LCOV_EXCL_STOP + } + } + } + catch (std::overflow_error const&) + { + // It's easy to hit this exception from Number with large enough + // Scale so we avoid spamming the log and only use debug here. + JLOG(j_.debug()) // + << "VaultClawback: overflow error with" + << " scale=" << (int)vault->at(sfScale).value() // + << ", assetsTotal=" << vault->at(sfAssetsTotal).value() + << ", sharesTotal=" << sleShareIssuance->at(sfOutstandingAmount) + << ", amount=" << clawbackAmount.value(); + return Unexpected(tecPATH_DRY); + } + + return std::make_pair(assetsRecovered, sharesDestroyed); } TER @@ -125,7 +328,7 @@ VaultClawback::doApply() if (!vault) return tefINTERNAL; // LCOV_EXCL_LINE - auto const mptIssuanceID = *((*vault)[sfShareMPTID]); + auto const mptIssuanceID = *vault->at(sfShareMPTID); auto const sleIssuance = view().read(keylet::mptIssuance(mptIssuanceID)); if (!sleIssuance) { @@ -134,105 +337,47 @@ VaultClawback::doApply() return tefINTERNAL; // LCOV_EXCL_STOP } + MPTIssue const share{mptIssuanceID}; Asset const vaultAsset = vault->at(sfAsset); - STAmount const amount = [&]() -> STAmount { - auto const maybeAmount = tx[~sfAmount]; - if (maybeAmount) - return *maybeAmount; - return {sfAmount, vaultAsset, 0}; - }(); - XRPL_ASSERT( - amount.asset() == vaultAsset, - "xrpl::VaultClawback::doApply : matching asset"); + STAmount const amount = clawbackAmount(vault, tx[~sfAmount], account_); auto assetsAvailable = vault->at(sfAssetsAvailable); auto assetsTotal = vault->at(sfAssetsTotal); + [[maybe_unused]] auto const lossUnrealized = vault->at(sfLossUnrealized); XRPL_ASSERT( lossUnrealized <= (assetsTotal - assetsAvailable), "xrpl::VaultClawback::doApply : loss and assets do balance"); AccountID holder = tx[sfHolder]; - MPTIssue const share{mptIssuanceID}; STAmount sharesDestroyed = {share}; - STAmount assetsRecovered; - try + STAmount assetsRecovered = {vault->at(sfAsset)}; + + // The Owner is burning shares + if (account_ == vault->at(sfOwner) && amount.asset() == share) { - if (amount == beast::zero) - { - sharesDestroyed = accountHolds( - view(), - holder, - share, - FreezeHandling::fhIGNORE_FREEZE, - AuthHandling::ahIGNORE_AUTH, - j_); - - auto const maybeAssets = - sharesToAssetsWithdraw(vault, sleIssuance, sharesDestroyed); - if (!maybeAssets) - return tecINTERNAL; // LCOV_EXCL_LINE - assetsRecovered = *maybeAssets; - } - else - { - assetsRecovered = amount; - { - auto const maybeShares = - assetsToSharesWithdraw(vault, sleIssuance, assetsRecovered); - if (!maybeShares) - return tecINTERNAL; // LCOV_EXCL_LINE - sharesDestroyed = *maybeShares; - } - - auto const maybeAssets = - sharesToAssetsWithdraw(vault, sleIssuance, sharesDestroyed); - if (!maybeAssets) - return tecINTERNAL; // LCOV_EXCL_LINE - assetsRecovered = *maybeAssets; - } - - // Clamp to maximum. - if (assetsRecovered > *assetsAvailable) - { - assetsRecovered = *assetsAvailable; - // Note, it is important to truncate the number of shares, otherwise - // the corresponding assets might breach the AssetsAvailable - { - auto const maybeShares = assetsToSharesWithdraw( - vault, sleIssuance, assetsRecovered, TruncateShares::yes); - if (!maybeShares) - return tecINTERNAL; // LCOV_EXCL_LINE - sharesDestroyed = *maybeShares; - } - - auto const maybeAssets = - sharesToAssetsWithdraw(vault, sleIssuance, sharesDestroyed); - if (!maybeAssets) - return tecINTERNAL; // LCOV_EXCL_LINE - assetsRecovered = *maybeAssets; - if (assetsRecovered > *assetsAvailable) - { - // LCOV_EXCL_START - JLOG(j_.error()) - << "VaultClawback: invalid rounding of shares."; - return tecINTERNAL; - // LCOV_EXCL_STOP - } - } + sharesDestroyed = accountHolds( + view(), + holder, + share, + FreezeHandling::fhIGNORE_FREEZE, + AuthHandling::ahIGNORE_AUTH, + j_); } - catch (std::overflow_error const&) + else // The Issuer is clawbacking vault assets { - // It's easy to hit this exception from Number with large enough Scale - // so we avoid spamming the log and only use debug here. - JLOG(j_.debug()) // - << "VaultClawback: overflow error with" - << " scale=" << (int)vault->at(sfScale).value() // - << ", assetsTotal=" << vault->at(sfAssetsTotal).value() - << ", sharesTotal=" << sleIssuance->at(sfOutstandingAmount) - << ", amount=" << amount.value(); - return tecPATH_DRY; + XRPL_ASSERT( + amount.asset() == vaultAsset, + "xrpl::VaultClawback::doApply : matching asset"); + + auto const clawbackParts = + assetsToClawback(vault, sleIssuance, holder, amount); + if (!clawbackParts) + return clawbackParts.error(); + + assetsRecovered = clawbackParts->first; + sharesDestroyed = clawbackParts->second; } if (sharesDestroyed == beast::zero) @@ -282,30 +427,34 @@ VaultClawback::doApply() // else quietly ignore, holder balance is not zero } - // Transfer assets from vault to issuer. - if (auto const ter = accountSend( - view(), - vaultAccount, - account_, - assetsRecovered, - j_, - WaiveTransferFee::Yes); - !isTesSuccess(ter)) - return ter; - - // Sanity check - if (accountHolds( - view(), - vaultAccount, - assetsRecovered.asset(), - FreezeHandling::fhIGNORE_FREEZE, - AuthHandling::ahIGNORE_AUTH, - j_) < beast::zero) + if (assetsRecovered > beast::zero) { - // LCOV_EXCL_START - JLOG(j_.error()) << "VaultClawback: negative balance of vault assets."; - return tefINTERNAL; - // LCOV_EXCL_STOP + // Transfer assets from vault to issuer. + if (auto const ter = accountSend( + view(), + vaultAccount, + account_, + assetsRecovered, + j_, + WaiveTransferFee::Yes); + !isTesSuccess(ter)) + return ter; + + // Sanity check + if (accountHolds( + view(), + vaultAccount, + assetsRecovered.asset(), + FreezeHandling::fhIGNORE_FREEZE, + AuthHandling::ahIGNORE_AUTH, + j_) < beast::zero) + { + // LCOV_EXCL_START + JLOG(j_.error()) + << "VaultClawback: negative balance of vault assets."; + return tefINTERNAL; + // LCOV_EXCL_STOP + } } return tesSUCCESS; diff --git a/src/xrpld/app/tx/detail/VaultClawback.h b/src/xrpld/app/tx/detail/VaultClawback.h index 80a5f73ad0..d05f280e75 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.h +++ b/src/xrpld/app/tx/detail/VaultClawback.h @@ -22,6 +22,14 @@ public: TER doApply() override; + +private: + Expected, TER> + assetsToClawback( + std::shared_ptr const& vault, + std::shared_ptr const& sleShareIssuance, + AccountID const& holder, + STAmount const& clawbackAmount); }; } // namespace xrpl From 7c1183547abb054878b24dd06fc2aab4e01ca350 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 9 Jan 2026 16:44:43 -0500 Subject: [PATCH 30/62] chore: Change `/Zi` to `/Z7` for ccache, remove debug symbols in CI (#6198) As the `/Zi` compiler flag is unsupported by ccache, this change switches it to `/Z7` instead. For CI runs all debug info is omitted. --- .config/cspell.config.yaml | 1 + .github/workflows/reusable-build-test-config.yml | 2 +- cmake/Ccache.cmake | 12 +++++++++--- cmake/XrplCompiler.cmake | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index 0cac82807d..edcdcc92ba 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -51,6 +51,7 @@ words: - Btrfs - canonicality - checkme + - choco - chrono - citardauq - clawback diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index fc80bbd216..ae91a8bf20 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -100,7 +100,7 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925 + uses: XRPLF/actions/prepare-runner@121d1de2775d486d46140b9a91b32d5002c08153 with: enable_ccache: ${{ inputs.ccache_enabled }} diff --git a/cmake/Ccache.cmake b/cmake/Ccache.cmake index 092212075c..aa8d3ac59d 100644 --- a/cmake/Ccache.cmake +++ b/cmake/Ccache.cmake @@ -46,6 +46,12 @@ set(CMAKE_VS_GLOBALS "TrackFileAccess=false" "UseMultiToolTask=true") -# By default Visual Studio generators will use /Zi, which is not compatible with -# ccache, so tell it to use /Z7 instead. -set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$:Embedded>") +# By default Visual Studio generators will use /Zi to capture debug information, +# which is not compatible with ccache, so tell it to use /Z7 instead. +if (MSVC) + foreach (var_ + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE) + string (REPLACE "/Zi" "/Z7" ${var_} "${${var_}}") + endforeach () +endif () diff --git a/cmake/XrplCompiler.cmake b/cmake/XrplCompiler.cmake index 622b2d2f74..0777bf948c 100644 --- a/cmake/XrplCompiler.cmake +++ b/cmake/XrplCompiler.cmake @@ -44,6 +44,7 @@ if (MSVC) # omit debug info completely under CI (not needed) if (is_ci) string (REPLACE "/Zi" " " ${var_} "${${var_}}") + string (REPLACE "/Z7" " " ${var_} "${${var_}}") endif () endforeach () From b2c5927b488fa0c306117de971f336c8d49317de Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Fri, 9 Jan 2026 23:10:04 -0400 Subject: [PATCH 31/62] fix: Inner batch transactions never have valid signatures (#6069) - Introduces amendment `fixBatchInnerSigs` - Update Batch unit tests - Fix all the Env instantiations to _use_ the "features" parameter. - testInnerSubmitRPC runs with Batch enabled and disabled. - Add a test to testInnerSubmitRPC for a correctly signed tx incorrectly using the tfInnerBatchTxn flag. - Generalize the submitAndValidate lambda in testInnerSubmitRPC. - With the fix amendment, a transaction never reaches the transaction engine (Transactor and derived classes.) - Test submitting a pseudo-transaction. Stopped before reaching the transaction engine, but with different errors. - The tests verify that without the amendment, a transaction with tfInnerBatchTxn is immediately rejected. Without the amendment, things are safe. The amendment just makes things safer and more future-proof. --- include/xrpl/protocol/detail/features.macro | 1 + src/test/app/Batch_test.cpp | 281 ++++++++++++++------ src/xrpld/app/misc/NetworkOPs.cpp | 2 +- src/xrpld/app/tx/detail/Transactor.cpp | 8 +- src/xrpld/app/tx/detail/apply.cpp | 21 +- 5 files changed, 221 insertions(+), 92 deletions(-) diff --git a/include/xrpl/protocol/detail/features.macro b/include/xrpl/protocol/detail/features.macro index 5c8d2aa198..932668c16f 100644 --- a/include/xrpl/protocol/detail/features.macro +++ b/include/xrpl/protocol/detail/features.macro @@ -16,6 +16,7 @@ // Add new amendments to the top of this list. // Keep it sorted in reverse chronological order. +XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(LendingProtocol, Supported::no, VoteBehavior::DefaultNo) XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo) XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo) diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 6fbec52a93..68bf7e833b 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -148,15 +148,21 @@ class Batch_test : public beast::unit_test::suite void testEnable(FeatureBitset features) { - testcase("enabled"); - using namespace test::jtx; using namespace std::literals; + bool const withInnerSigFix = features[fixBatchInnerSigs]; + for (bool const withBatch : {true, false}) { + testcase << "enabled: Batch " + << (withBatch ? "enabled" : "disabled") + << ", Inner Sig Fix: " + << (withInnerSigFix ? "enabled" : "disabled"); + auto const amend = withBatch ? features : features - featureBatch; - test::jtx::Env env{*this, envconfig(), amend}; + + test::jtx::Env env{*this, amend}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -179,7 +185,7 @@ class Batch_test : public beast::unit_test::suite // tfInnerBatchTxn // If the feature is disabled, the transaction fails with - // temINVALID_FLAG If the feature is enabled, the transaction fails + // temINVALID_FLAG. If the feature is enabled, the transaction fails // early in checkValidity() { auto const txResult = @@ -205,7 +211,7 @@ class Batch_test : public beast::unit_test::suite //---------------------------------------------------------------------- // preflight - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -617,7 +623,7 @@ class Batch_test : public beast::unit_test::suite //---------------------------------------------------------------------- // preclaim - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -858,7 +864,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -949,7 +955,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1187,7 +1193,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee Without Signer { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1209,7 +1215,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee With MultiSign { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1236,7 +1242,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee With MultiSign + BatchSigners { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1265,7 +1271,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee With MultiSign + BatchSigners.Signers { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1297,7 +1303,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee With BatchSigners { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1321,7 +1327,7 @@ class Batch_test : public beast::unit_test::suite // Bad Fee Dynamic Fee Calculation { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1361,7 +1367,7 @@ class Batch_test : public beast::unit_test::suite // telENV_RPC_FAILED: Batch: txns array exceeds 8 entries. { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1386,7 +1392,7 @@ class Batch_test : public beast::unit_test::suite // temARRAY_TOO_LARGE: Batch: txns array exceeds 8 entries. { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1419,7 +1425,7 @@ class Batch_test : public beast::unit_test::suite // telENV_RPC_FAILED: Batch: signers array exceeds 8 entries. { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1438,7 +1444,7 @@ class Batch_test : public beast::unit_test::suite // temARRAY_TOO_LARGE: Batch: signers array exceeds 8 entries. { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1472,7 +1478,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1608,7 +1614,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -1840,7 +1846,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2062,7 +2068,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2248,14 +2254,26 @@ class Batch_test : public beast::unit_test::suite } void - testInnerSubmitRPC(FeatureBitset features) + doTestInnerSubmitRPC(FeatureBitset features, bool withBatch) { - testcase("inner submit rpc"); + bool const withInnerSigFix = features[fixBatchInnerSigs]; + + std::string const testName = [&]() { + std::stringstream ss; + ss << "inner submit rpc: batch " + << (withBatch ? "enabled" : "disabled") << ", inner sig fix: " + << (withInnerSigFix ? "enabled" : "disabled") << ": "; + return ss.str(); + }(); + + auto const amend = withBatch ? features : features - featureBatch; using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, amend}; + if (!BEAST_EXPECT(amend[featureBatch] == withBatch)) + return; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2263,75 +2281,170 @@ class Batch_test : public beast::unit_test::suite env.fund(XRP(10000), alice, bob); env.close(); - auto submitAndValidate = [&](Slice const& slice) { - auto const jrr = env.rpc("submit", strHex(slice))[jss::result]; - BEAST_EXPECT( - jrr[jss::status] == "error" && - jrr[jss::error] == "invalidTransaction" && - jrr[jss::error_exception] == - "fails local checks: Malformed: Invalid inner batch " - "transaction."); - env.close(); - }; + auto submitAndValidate = + [&](std::string caseName, + Slice const& slice, + int line, + std::optional expectedEnabled = std::nullopt, + std::optional expectedDisabled = std::nullopt, + bool expectInvalidFlag = false) { + testcase << testName << caseName + << (expectInvalidFlag + ? " - Expected to reach tx engine!" + : ""); + auto const jrr = env.rpc("submit", strHex(slice))[jss::result]; + auto const expected = withBatch + ? expectedEnabled.value_or( + "fails local checks: Malformed: Invalid inner batch " + "transaction.") + : expectedDisabled.value_or( + "fails local checks: Empty SigningPubKey."); + if (expectInvalidFlag) + { + expect( + jrr[jss::status] == "success" && + jrr[jss::engine_result] == "temINVALID_FLAG", + pretty(jrr), + __FILE__, + line); + } + else + { + expect( + jrr[jss::status] == "error" && + jrr[jss::error] == "invalidTransaction" && + jrr[jss::error_exception] == expected, + pretty(jrr), + __FILE__, + line); + } + env.close(); + }; // Invalid RPC Submission: TxnSignature - // - has `TxnSignature` field + // + has `TxnSignature` field // - has no `SigningPubKey` field // - has no `Signers` field - // - has `tfInnerBatchTxn` flag + // + has `tfInnerBatchTxn` flag { auto txn = batch::inner(pay(alice, bob, XRP(1)), env.seq(alice)); txn[sfTxnSignature] = "DEADBEEF"; STParsedJSONObject parsed("test", txn.getTxn()); Serializer s; parsed.object->add(s); - submitAndValidate(s.slice()); + submitAndValidate("TxnSignature set", s.slice(), __LINE__); } // Invalid RPC Submission: SigningPubKey // - has no `TxnSignature` field - // - has `SigningPubKey` field + // + has `SigningPubKey` field // - has no `Signers` field - // - has `tfInnerBatchTxn` flag + // + has `tfInnerBatchTxn` flag { auto txn = batch::inner(pay(alice, bob, XRP(1)), env.seq(alice)); txn[sfSigningPubKey] = strHex(alice.pk()); STParsedJSONObject parsed("test", txn.getTxn()); Serializer s; parsed.object->add(s); - submitAndValidate(s.slice()); + submitAndValidate( + "SigningPubKey set", + s.slice(), + __LINE__, + std::nullopt, + "fails local checks: Invalid signature."); } // Invalid RPC Submission: Signers // - has no `TxnSignature` field - // - has empty `SigningPubKey` field - // - has `Signers` field - // - has `tfInnerBatchTxn` flag + // + has empty `SigningPubKey` field + // + has `Signers` field + // + has `tfInnerBatchTxn` flag { auto txn = batch::inner(pay(alice, bob, XRP(1)), env.seq(alice)); txn[sfSigners] = Json::arrayValue; STParsedJSONObject parsed("test", txn.getTxn()); Serializer s; parsed.object->add(s); - submitAndValidate(s.slice()); + submitAndValidate( + "Signers set", + s.slice(), + __LINE__, + std::nullopt, + "fails local checks: Invalid Signers array size."); + } + + { + // Fully signed inner batch transaction + auto const txn = + batch::inner(pay(alice, bob, XRP(1)), env.seq(alice)); + auto const jt = env.jt(txn.getTxn()); + + STParsedJSONObject parsed("test", jt.jv); + Serializer s; + parsed.object->add(s); + submitAndValidate( + "Fully signed", + s.slice(), + __LINE__, + std::nullopt, + std::nullopt, + !withBatch); } // Invalid RPC Submission: tfInnerBatchTxn // - has no `TxnSignature` field - // - has empty `SigningPubKey` field + // + has empty `SigningPubKey` field // - has no `Signers` field - // - has `tfInnerBatchTxn` flag + // + has `tfInnerBatchTxn` flag { auto txn = batch::inner(pay(alice, bob, XRP(1)), env.seq(alice)); STParsedJSONObject parsed("test", txn.getTxn()); Serializer s; parsed.object->add(s); - auto const jrr = env.rpc("submit", strHex(s.slice()))[jss::result]; - BEAST_EXPECT( - jrr[jss::status] == "success" && - jrr[jss::engine_result] == "temINVALID_FLAG"); + submitAndValidate( + "No signing fields set", + s.slice(), + __LINE__, + "fails local checks: Empty SigningPubKey.", + "fails local checks: Empty SigningPubKey.", + withBatch && !withInnerSigFix); + } - env.close(); + // Invalid RPC Submission: tfInnerBatchTxn pseudo-transaction + // - has no `TxnSignature` field + // + has empty `SigningPubKey` field + // - has no `Signers` field + // + has `tfInnerBatchTxn` flag + { + STTx amendTx( + ttAMENDMENT, [seq = env.closed()->header().seq + 1](auto& obj) { + obj.setAccountID(sfAccount, AccountID()); + obj.setFieldH256(sfAmendment, fixBatchInnerSigs); + obj.setFieldU32(sfLedgerSequence, seq); + obj.setFieldU32(sfFlags, tfInnerBatchTxn); + }); + auto txn = batch::inner( + amendTx.getJson(JsonOptions::none), env.seq(alice)); + STParsedJSONObject parsed("test", txn.getTxn()); + Serializer s; + parsed.object->add(s); + submitAndValidate( + "Pseudo-transaction", + s.slice(), + __LINE__, + withInnerSigFix + ? "fails local checks: Empty SigningPubKey." + : "fails local checks: Cannot submit pseudo transactions.", + "fails local checks: Empty SigningPubKey."); + } + } + + void + testInnerSubmitRPC(FeatureBitset features) + { + for (bool const withBatch : {true, false}) + { + doTestInnerSubmitRPC(features, withBatch); } } @@ -2343,7 +2456,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2390,7 +2503,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2443,7 +2556,7 @@ class Batch_test : public beast::unit_test::suite // tfIndependent: account delete success { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2484,7 +2597,7 @@ class Batch_test : public beast::unit_test::suite // tfIndependent: account delete fails { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2529,7 +2642,7 @@ class Batch_test : public beast::unit_test::suite // tfAllOrNothing: account delete fails { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2581,7 +2694,6 @@ class Batch_test : public beast::unit_test::suite test::jtx::Env env{ *this, - envconfig(), features | featureSingleAssetVault | featureLendingProtocol | featureMPTokensV1}; @@ -2776,7 +2888,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2889,7 +3001,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -2947,7 +3059,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3009,7 +3121,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3058,7 +3170,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3106,7 +3218,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3169,7 +3281,7 @@ class Batch_test : public beast::unit_test::suite // overwritten by the payment in the batch transaction. Because the // terPRE_SEQ is outside of the batch this noop transaction will ge // reapplied in the following ledger - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob, carol); env.close(); @@ -3216,7 +3328,7 @@ class Batch_test : public beast::unit_test::suite // IMPORTANT: The batch txn is applied first, then the noop txn. // Because of this ordering, the noop txn is not applied and is // overwritten by the payment in the batch transaction. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3258,7 +3370,7 @@ class Batch_test : public beast::unit_test::suite // IMPORTANT: The batch txn is applied first, then the noop txn. // Because of this ordering, the noop txn is not applied and is // overwritten by the payment in the batch transaction. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3295,7 +3407,7 @@ class Batch_test : public beast::unit_test::suite // Outer Batch terPRE_SEQ { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob, carol); env.close(); @@ -3353,7 +3465,7 @@ class Batch_test : public beast::unit_test::suite // IMPORTANT: The batch txn is applied first, then the noop txn. // Because of this ordering, the noop txn is not applied and is // overwritten by the payment in the batch transaction. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3402,7 +3514,7 @@ class Batch_test : public beast::unit_test::suite // IMPORTANT: The batch txn is applied first, then the noop txn. // Because of this ordering, the noop txn is not applied and is // overwritten by the payment in the batch transaction. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3464,7 +3576,7 @@ class Batch_test : public beast::unit_test::suite // batch will run in the close ledger process. The batch will be // allied and then retry this transaction in the current ledger. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3511,7 +3623,7 @@ class Batch_test : public beast::unit_test::suite // Create Object Before Batch Txn { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3558,7 +3670,7 @@ class Batch_test : public beast::unit_test::suite // batch will run in the close ledger process. The batch will be // applied and then retry this transaction in the current ledger. - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; env.fund(XRP(10000), alice, bob); env.close(); @@ -3605,7 +3717,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3644,7 +3756,7 @@ class Batch_test : public beast::unit_test::suite using namespace test::jtx; using namespace std::literals; - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; XRPAmount const baseFee = env.current()->fees().base; auto const alice = Account("alice"); @@ -3725,6 +3837,7 @@ class Batch_test : public beast::unit_test::suite *this, makeSmallQueueConfig( {{"minimum_txn_in_ledger_standalone", "2"}}), + features, nullptr, beast::severities::kError}; @@ -3785,6 +3898,7 @@ class Batch_test : public beast::unit_test::suite *this, makeSmallQueueConfig( {{"minimum_txn_in_ledger_standalone", "2"}}), + features, nullptr, beast::severities::kError}; @@ -3892,7 +4006,7 @@ class Batch_test : public beast::unit_test::suite // delegated non atomic inner { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3937,7 +4051,7 @@ class Batch_test : public beast::unit_test::suite // delegated atomic inner { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -3989,7 +4103,7 @@ class Batch_test : public beast::unit_test::suite // this also makes sure tfInnerBatchTxn won't block delegated AccountSet // with granular permission { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -4038,7 +4152,7 @@ class Batch_test : public beast::unit_test::suite // this also makes sure tfInnerBatchTxn won't block delegated // MPTokenIssuanceSet with granular permission { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; Account alice{"alice"}; Account bob{"bob"}; env.fund(XRP(100000), alice, bob); @@ -4094,7 +4208,7 @@ class Batch_test : public beast::unit_test::suite // this also makes sure tfInnerBatchTxn won't block delegated TrustSet // with granular permission { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; Account gw{"gw"}; Account alice{"alice"}; Account bob{"bob"}; @@ -4134,7 +4248,7 @@ class Batch_test : public beast::unit_test::suite // inner transaction not authorized by the delegating account. { - test::jtx::Env env{*this, envconfig()}; + test::jtx::Env env{*this, features}; Account gw{"gw"}; Account alice{"alice"}; Account bob{"bob"}; @@ -4182,7 +4296,7 @@ class Batch_test : public beast::unit_test::suite testcase("Validate RPC response"); using namespace jtx; - Env env(*this); + Env env(*this, features); Account const alice("alice"); Account const bob("bob"); env.fund(XRP(10000), alice, bob); @@ -4259,7 +4373,7 @@ class Batch_test : public beast::unit_test::suite testBatchCalculateBaseFee(FeatureBitset features) { using namespace jtx; - Env env(*this); + Env env(*this, features); Account const alice("alice"); Account const bob("bob"); Account const carol("carol"); @@ -4384,6 +4498,7 @@ public: { using namespace test::jtx; auto const sa = testable_amendments(); + testWithFeats(sa - fixBatchInnerSigs); testWithFeats(sa); } }; diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 6a00354b15..2422ec4ae6 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -1681,7 +1681,7 @@ NetworkOPsImp::apply(std::unique_lock& batchLock) // only be set if the Batch feature is enabled. If Batch is // not enabled, the flag is always invalid, so don't relay // it regardless. - !sttx.isFlag(tfInnerBatchTxn)) + !(sttx.isFlag(tfInnerBatchTxn))) { protocol::TMTransaction tx; Serializer s; diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index 851712fe90..a834f7c6c3 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -204,8 +204,14 @@ Transactor::preflight2(PreflightContext const& ctx) // regardless of success or failure return *ret; + // It should be impossible for the InnerBatchTxn flag to be set without + // featureBatch being enabled + XRPL_ASSERT_PARTS( + !ctx.tx.isFlag(tfInnerBatchTxn) || ctx.rules.enabled(featureBatch), + "xrpl::Transactor::preflight2", + "InnerBatch flag only set if feature enabled"); // Skip signature check on batch inner transactions - if (ctx.tx.isFlag(tfInnerBatchTxn) && !ctx.rules.enabled(featureBatch)) + if (ctx.tx.isFlag(tfInnerBatchTxn) && ctx.rules.enabled(featureBatch)) return tesSUCCESS; // Do not add any checks after this point that are relevant for // batch inner transactions. They will be skipped. diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/xrpld/app/tx/detail/apply.cpp index 5209c46f8f..a75f0cc967 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/xrpld/app/tx/detail/apply.cpp @@ -41,15 +41,22 @@ checkValidity( Validity::SigBad, "Malformed: Invalid inner batch transaction."}; - std::string reason; - if (!passesLocalChecks(tx, reason)) + // This block should probably have never been included in the + // original `Batch` implementation. An inner transaction never + // has a valid signature. + bool const neverValid = rules.enabled(fixBatchInnerSigs); + if (!neverValid) { - router.setFlags(id, SF_LOCALBAD); - return {Validity::SigGoodOnly, reason}; - } + std::string reason; + if (!passesLocalChecks(tx, reason)) + { + router.setFlags(id, SF_LOCALBAD); + return {Validity::SigGoodOnly, reason}; + } - router.setFlags(id, SF_SIGGOOD); - return {Validity::Valid, ""}; + router.setFlags(id, SF_SIGGOOD); + return {Validity::Valid, ""}; + } } if (any(flags & SF_SIGBAD)) From 92d40de4cbb787474f90d6aa6a959963f8299992 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 12 Jan 2026 12:53:46 -0500 Subject: [PATCH 32/62] chore: Pin pre-commit hooks to commit hashes (#6205) This change updates and pins the Black and CSpell pre-commit hooks. --- .config/cspell.config.yaml | 4 ++++ .pre-commit-config.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index edcdcc92ba..8f782d9960 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -69,6 +69,7 @@ words: - cryptoconditional - cryptoconditions - csprng + - ctest - ctid - currenttxhash - daria @@ -104,6 +105,7 @@ words: - iou - ious - isrdc + - itype - jemalloc - jlog - keylet @@ -192,10 +194,12 @@ words: - roundings - sahyadri - Satoshi + - scons - secp - sendq - seqit - sf + - SFIELD - shamap - shamapitem - sidechain diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 00bec32ed6..603cf39375 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,12 +32,12 @@ repos: - id: prettier - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.11.0 + rev: 831207fd435b47aeffdf6af853097e64322b4d44 # frozen: v25.12.0 hooks: - id: black - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v9.2.0 + rev: 1cfa010f078c354f3ffb8413616280cc28f5ba21 # frozen: v9.4.0 hooks: - id: cspell # Spell check changed files exclude: .config/cspell.config.yaml From 4755bb86068d056258d643274f8e75c878560685 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 12 Jan 2026 19:14:39 -0500 Subject: [PATCH 33/62] refactor: Remove unnecessary version number and options in cmake find_package (#6169) This change removes unnecessary version numbers in the OpenSSL and Boost `find_package` CMake statements. An unnecessary OpenSSL definition is removed, while Conan options for SSL are updated to disable insecure ciphers. Moreover, the statements are now ordered alphabetically and more logically. --- BUILD.md | 19 ++++++++----- CMakeLists.txt | 37 ++++++++++--------------- cmake/deps/Boost.cmake | 2 +- conan.lock | 62 +++++++++++++++++++++--------------------- conanfile.py | 6 ++++ 5 files changed, 65 insertions(+), 61 deletions(-) diff --git a/BUILD.md b/BUILD.md index 85b3e3ea74..2d1ac9b134 100644 --- a/BUILD.md +++ b/BUILD.md @@ -148,7 +148,8 @@ function extract_version { } # Define which recipes to export. -recipes=(ed25519 grpc secp256k1 snappy soci) +recipes=('ed25519' 'grpc' 'openssl' 'secp256k1' 'snappy' 'soci') +folders=('all' 'all' '3.x.x' 'all' 'all' 'all') # Selectively check out the recipes from our CCI fork. cd external @@ -157,20 +158,24 @@ cd conan-center-index git init git remote add origin git@github.com:XRPLF/conan-center-index.git git sparse-checkout init -for recipe in ${recipes[@]}; do - echo "Checking out ${recipe}..." - git sparse-checkout add recipes/${recipe}/all +for ((index = 1; index <= ${#recipes[@]}; index++)); do + recipe=${recipes[index]} + folder=${folders[index]} + echo "Checking out recipe '${recipe}' from folder '${folder}'..." + git sparse-checkout add recipes/${recipe}/${folder} done git fetch origin master git checkout master cd ../.. # Export the recipes into the local cache. -for recipe in ${recipes[@]}; do +for ((index = 1; index <= ${#recipes[@]}; index++)); do + recipe=${recipes[index]} + folder=${folders[index]} version=$(extract_version ${recipe}) - echo "Exporting ${recipe}/${version}..." + echo "Exporting '${recipe}/${version}' from '${recipe}/${folder}'..." conan export --version $(extract_version ${recipe}) \ - external/conan-center-index/recipes/${recipe}/all + external/conan-center-index/recipes/${recipe}/${folder} done ``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 70bc02c66d..26fc310d39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,34 +88,18 @@ endif() ### include(deps/Boost) -find_package(OpenSSL 1.1.1 REQUIRED) -set_target_properties(OpenSSL::SSL PROPERTIES - INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2 -) add_subdirectory(external/antithesis-sdk) -find_package(gRPC REQUIRED) -find_package(lz4 REQUIRED) -# Target names with :: are not allowed in a generator expression. -# We need to pull the include directories and imported location properties -# from separate targets. -find_package(LibArchive REQUIRED) -find_package(SOCI REQUIRED) -find_package(SQLite3 REQUIRED) - -option(rocksdb "Enable RocksDB" ON) -if(rocksdb) - find_package(RocksDB REQUIRED) - set_target_properties(RocksDB::rocksdb PROPERTIES - INTERFACE_COMPILE_DEFINITIONS XRPL_ROCKSDB_AVAILABLE=1 - ) - target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb) -endif() - find_package(date REQUIRED) find_package(ed25519 REQUIRED) +find_package(gRPC REQUIRED) +find_package(LibArchive REQUIRED) +find_package(lz4 REQUIRED) find_package(nudb REQUIRED) +find_package(OpenSSL REQUIRED) find_package(secp256k1 REQUIRED) +find_package(SOCI REQUIRED) +find_package(SQLite3 REQUIRED) find_package(xxHash REQUIRED) target_link_libraries(xrpl_libs INTERFACE @@ -128,6 +112,15 @@ target_link_libraries(xrpl_libs INTERFACE SQLite::SQLite3 ) +option(rocksdb "Enable RocksDB" ON) +if(rocksdb) + find_package(RocksDB REQUIRED) + set_target_properties(RocksDB::rocksdb PROPERTIES + INTERFACE_COMPILE_DEFINITIONS XRPL_ROCKSDB_AVAILABLE=1 + ) + target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb) +endif() + # Work around changes to Conan recipe for now. if(TARGET nudb::core) set(nudb nudb::core) diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 475c1033b2..19263e0ac9 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -1,4 +1,4 @@ -find_package(Boost 1.82 REQUIRED +find_package(Boost REQUIRED COMPONENTS chrono container diff --git a/conan.lock b/conan.lock index 1385ad05bd..99522e79b2 100644 --- a/conan.lock +++ b/conan.lock @@ -1,44 +1,44 @@ { "version": "0.5", "requires": [ - "zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497", - "xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1756234289.683", - "sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1756234266.869", - "soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1756234262.318", - "snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1756234314.246", - "secp256k1/0.7.0#9c4ab67bdc3860c16ea5b36aed8f74ea%1765202256.763", - "rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1762797952.535", - "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1764175362.029", - "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1764863245.83", - "openssl/3.5.4#a1d5835cc6ed5c5b8f3cd5b9b5d24205%1760106486.594", - "nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1763150366.909", - "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1756234228.999", - "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1756223727.64", - "libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1756230911.03", - "libarchive/3.8.1#ffee18995c706e02bf96e7a2f7042e0d%1764175360.142", + "zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1765850150.075", + "xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987", + "sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926", + "soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46", + "snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878", + "secp256k1/0.7.0#9c4ab67bdc3860c16ea5b36aed8f74ea%1765850147.928", + "rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86", + "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", + "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", + "openssl/3.5.4#58f5173c2ee51d6fc0f0c61b4eddadbb%1768259092.666", + "nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1765850143.957", + "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914", + "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492", + "libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03", + "libarchive/3.8.1#ffee18995c706e02bf96e7a2f7042e0d%1765850144.736", "jemalloc/5.3.0#e951da9cf599e956cebc117880d2d9f8%1729241615.244", - "grpc/1.72.0#f244a57bff01e708c55a1100b12e1589%1763158050.628", - "ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1764270189.893", - "doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1762797941.757", - "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1763584497.32", - "c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1764175359.429", - "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1764175359.429", - "boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1756223752.326", - "abseil/20250127.0#9e8e8cfc89a1324139fc0ee3bd4d8c8c%1753819045.301" + "grpc/1.72.0#f244a57bff01e708c55a1100b12e1589%1765850193.734", + "ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772", + "doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1765850143.95", + "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772", + "c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336", + "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837", + "boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1765850172.862", + "abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993" ], "build_requires": [ - "zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1756234269.497", - "strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1756234281.733", - "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1764863245.83", - "nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1756234232.901", + "zlib/1.3.1#b8bc2603263cf7eccbd6e17e66b0ed76%1765850150.075", + "strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41%1765850165.196", + "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", + "nasm/2.16.01#31e26f2ee3c4346ecd347911bd126904%1765850144.707", "msys2/cci.latest#1996656c3c98e5765b25b60ff5cf77b4%1764840888.758", "m4/1.4.19#70dc8bbb33e981d119d2acc0175cf381%1763158052.846", - "cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1764175359.44", - "cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1764175359.429", - "b2/5.3.3#107c15377719889654eb9a162a673975%1756234226.28", + "cmake/4.2.0#ae0a44f44a1ef9ab68fd4b3e9a1f8671%1765850153.937", + "cmake/3.31.10#313d16a1aa16bbdb2ca0792467214b76%1765850153.479", + "b2/5.3.3#107c15377719889654eb9a162a673975%1765850144.355", "automake/1.16.5#b91b7c384c3deaa9d535be02da14d04f%1755524470.56", "autoconf/2.71#51077f068e61700d65bb05541ea1e4b0%1731054366.86", - "abseil/20250127.0#9e8e8cfc89a1324139fc0ee3bd4d8c8c%1753819045.301" + "abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993" ], "python_requires": [], "overrides": { diff --git a/conanfile.py b/conanfile.py index 48e28cb275..96e3384979 100644 --- a/conanfile.py +++ b/conanfile.py @@ -87,7 +87,13 @@ class Xrpl(ConanFile): "libarchive/*:with_xattr": False, "libarchive/*:with_zlib": False, "lz4/*:shared": False, + "openssl/*:no_dtls": True, + "openssl/*:no_ssl": True, + "openssl/*:no_ssl3": True, + "openssl/*:no_tls1": True, + "openssl/*:no_tls1_1": True, "openssl/*:shared": False, + "openssl/*:tls_security_level": 2, "protobuf/*:shared": False, "protobuf/*:with_zlib": True, "rocksdb/*:enable_sse": False, From 0efae5d16e433d504064ff6f6174ed02a37c61ea Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 13 Jan 2026 16:52:10 +0000 Subject: [PATCH 34/62] ci: Update actions/images to use cmake 4.2.1 and conan 2.24.0 (#6209) --- .github/scripts/strategy-matrix/linux.json | 56 +++++++++---------- .github/workflows/pre-commit.yml | 4 +- .../workflows/reusable-build-test-config.yml | 2 +- .github/workflows/upload-conan-deps.yml | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/scripts/strategy-matrix/linux.json b/.github/scripts/strategy-matrix/linux.json index 669754554c..e64a05f925 100644 --- a/.github/scripts/strategy-matrix/linux.json +++ b/.github/scripts/strategy-matrix/linux.json @@ -15,196 +15,196 @@ "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "gcc", "compiler_version": "15", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "16", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "17", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "18", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "19", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "bookworm", "compiler_name": "clang", "compiler_version": "20", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "gcc", "compiler_version": "15", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "clang", "compiler_version": "20", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "debian", "distro_version": "trixie", "compiler_name": "clang", "compiler_version": "21", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "8", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "8", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "9", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "10", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "rhel", "distro_version": "10", "compiler_name": "clang", "compiler_version": "any", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "jammy", "compiler_name": "gcc", "compiler_version": "12", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "gcc", "compiler_version": "13", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "gcc", "compiler_version": "14", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "16", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "17", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "18", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" }, { "distro_name": "ubuntu", "distro_version": "noble", "compiler_name": "clang", "compiler_version": "19", - "image_sha": "cc09fd3" + "image_sha": "ab4d1f0" } ], "build_type": ["Debug", "Release"], diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 41e82fb6bb..00754e5eae 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -9,7 +9,7 @@ on: jobs: # Call the workflow in the XRPLF/actions repo that runs the pre-commit hooks. run-hooks: - uses: XRPLF/actions/.github/workflows/pre-commit.yml@5ca417783f0312ab26d6f48b85c78edf1de99bbd + uses: XRPLF/actions/.github/workflows/pre-commit.yml@282890f46d6921249d5659dd38babcb0bd8aef48 with: runs_on: ubuntu-latest - container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-a8c7be1" }' + container: '{ "image": "ghcr.io/xrplf/ci/tools-rippled-pre-commit:sha-ab4d1f0" }' diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index ae91a8bf20..bc0717e1a5 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -100,7 +100,7 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@121d1de2775d486d46140b9a91b32d5002c08153 + uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 with: enable_ccache: ${{ inputs.ccache_enabled }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 55a9ab8864..29ae95fce5 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -70,7 +70,7 @@ jobs: uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - name: Prepare runner - uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925 + uses: XRPLF/actions/prepare-runner@f05cab7b8541eee6473aa42beb9d2fe35608a190 with: enable_ccache: false From 96866049632f9691372ab3cce2a877664db7c056 Mon Sep 17 00:00:00 2001 From: Bart Date: Tue, 13 Jan 2026 12:29:04 -0500 Subject: [PATCH 35/62] fix: Update Conan lock file with changed OpenSSL recipe (#6211) This change updates the `conan.lock` file with a changed OpenSSL recipe that contains a fix regarding options passed to the compiler --- conan.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan.lock b/conan.lock index 99522e79b2..44dc9031d2 100644 --- a/conan.lock +++ b/conan.lock @@ -10,7 +10,7 @@ "rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86", "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", - "openssl/3.5.4#58f5173c2ee51d6fc0f0c61b4eddadbb%1768259092.666", + "openssl/3.5.4#1b986e61b38fdfda3b40bebc1b234393%1768312656.257", "nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1765850143.957", "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914", "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492", From 2601442e16c11b8b174d154758abb8ac4a9a6564 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Tue, 13 Jan 2026 15:42:58 -0400 Subject: [PATCH 36/62] Improve and fix bugs in Lending Protocol (#6102) - Spec: XLS-66 Fix overpayment asserts (#6084) MPTTester::operator() parameter should be std::int64_t - Originally defined as uint64_t, but the testIssuerLoan() test called it with a negative number, causing an overflow to a very large number that in some circumstances could be silently cast back to an int64_t, but might not be. I believe this is UB, and we don't want to rely on that. Review feedback from @Tapanito: overpayment value change - In overpayment results, the management fee was being calculated twice: once as part of the value change, and as part of the fees paid. Exclude it from the value change. Fix Overpayment Calculation (#6087) - Adds additional unit tests to cover math calculations. - Removes unused methods. Review feedback from @shawnxie999: even more rounding - Round the initial total value computation upward, unless there is 0-interest. - Rename getVaultScale to getAssetsTotalScale, and convert one incorrect computation to use it. - Use adjustImpreciseNumber for LossUnrealized. - Add some logging to computeLoanProperties. Fix LoanBrokerSet debtMaximum limits (#6116) Fix some minor bugs in Lending Protocol (#6101) - add nodiscard to unimpairLoan, and check result in LoanPay - add a check to verify that issuer exists - improve LoanManage error code for dust amounts Check permissions in LoanSet and LoanPay (#6108) Disallow pseudo accounts to be Destination for LoanBrokerCoverWithdraw (#6106) Ensure vault asset cap is not exceeded (#6124) Fix Overpayment ValueChange calculation in Lending Protocol (#6114) - Adds loan state to LoanProperties. - Cleans up computeLoanProperties. - Fixes missing management fee from overpayment. fix: Enable LP Deposits when the broker is the asset issuer (#6119) * Replace accountHolds with accountSpendable when checking for account funds in VaultDeposit and LoanBrokerCoverDeposit Add a few minor changes (#6158) - Updates or fixes a couple of things I noticed while reviewing changes to the spec. - Rename sfPreviousPaymentDate to sfPreviousPaymentDueDate. - Make the vault asset cap check added in #6124 a little more robust: 1. Check in preflight if the vault is _already_ over the limit. 2. Prevent overflow when checking with the loan value. (Subtract instead of adding, in case the values are near maxint. Both return the same result. Also add a unit test so each case is covered. Add minimum grace period validation (#6133) Fix bugs: frozen pseudo-account, and FLC cutoff (#6170) refactor: Rename raw state to theoretical state (#6187) Check if a withdrawal amount exceeds any applicable receiving limit. (#6117) Fix overpayment result calculation (#6195) Address review feedback from Lending Protocol re-review (#6161) --------- Co-authored-by: Gregory Tsipenyuk Co-authored-by: Bronek Kozicki Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com> Co-authored-by: Shawn Xie <35279399+shawnxie999@users.noreply.github.com> Co-authored-by: Jingchen --- .../paths => include/xrpl/ledger}/Credit.h | 4 +- include/xrpl/ledger/View.h | 86 +- .../xrpl/protocol/detail/ledger_entries.macro | 2 +- include/xrpl/protocol/detail/sfields.macro | 2 +- .../app/paths => libxrpl/ledger}/Credit.cpp | 0 src/libxrpl/ledger/View.cpp | 219 +-- src/test/app/LendingHelpers_test.cpp | 1351 +++++++++++++++++ src/test/app/LoanBroker_test.cpp | 468 ++++++ src/test/app/Loan_test.cpp | 765 ++++++++-- src/test/app/Vault_test.cpp | 4 +- src/test/jtx/impl/mpt.cpp | 2 +- src/test/jtx/mpt.h | 2 +- src/xrpld/app/misc/LendingHelpers.h | 180 ++- src/xrpld/app/misc/detail/LendingHelpers.cpp | 526 +++---- src/xrpld/app/paths/Flow.cpp | 2 +- src/xrpld/app/paths/detail/DirectStep.cpp | 2 +- src/xrpld/app/paths/detail/StrandFlow.h | 2 +- .../app/paths/detail/XRPEndpointStep.cpp | 2 +- .../app/tx/detail/LoanBrokerCoverClawback.cpp | 12 +- .../app/tx/detail/LoanBrokerCoverDeposit.cpp | 3 +- .../app/tx/detail/LoanBrokerCoverWithdraw.cpp | 5 + src/xrpld/app/tx/detail/LoanBrokerDelete.cpp | 44 +- src/xrpld/app/tx/detail/LoanBrokerSet.cpp | 19 + src/xrpld/app/tx/detail/LoanDelete.cpp | 2 +- src/xrpld/app/tx/detail/LoanManage.cpp | 78 +- src/xrpld/app/tx/detail/LoanManage.h | 4 +- src/xrpld/app/tx/detail/LoanPay.cpp | 128 +- src/xrpld/app/tx/detail/LoanSet.cpp | 69 +- src/xrpld/app/tx/detail/VaultDeposit.cpp | 8 +- src/xrpld/rpc/handlers/LedgerEntry.cpp | 2 +- 30 files changed, 3242 insertions(+), 751 deletions(-) rename {src/xrpld/app/paths => include/xrpl/ledger}/Credit.h (93%) rename src/{xrpld/app/paths => libxrpl/ledger}/Credit.cpp (100%) create mode 100644 src/test/app/LendingHelpers_test.cpp diff --git a/src/xrpld/app/paths/Credit.h b/include/xrpl/ledger/Credit.h similarity index 93% rename from src/xrpld/app/paths/Credit.h rename to include/xrpl/ledger/Credit.h index 5bdcd70e74..09b65b3dde 100644 --- a/src/xrpld/app/paths/Credit.h +++ b/include/xrpl/ledger/Credit.h @@ -1,5 +1,5 @@ -#ifndef XRPL_APP_PATHS_CREDIT_H_INCLUDED -#define XRPL_APP_PATHS_CREDIT_H_INCLUDED +#ifndef XRPL_LEDGER_CREDIT_H_INCLUDED +#define XRPL_LEDGER_CREDIT_H_INCLUDED #include #include diff --git a/include/xrpl/ledger/View.h b/include/xrpl/ledger/View.h index 767622596b..707a08b890 100644 --- a/include/xrpl/ledger/View.h +++ b/include/xrpl/ledger/View.h @@ -61,6 +61,9 @@ enum FreezeHandling { fhIGNORE_FREEZE, fhZERO_IF_FROZEN }; /** Controls the treatment of unauthorized MPT balances */ enum AuthHandling { ahIGNORE_AUTH, ahZERO_IF_UNAUTHORIZED }; +/** Controls whether to include the account's full spendable balance */ +enum SpendableHandling { shSIMPLE_BALANCE, shFULL_BALANCE }; + [[nodiscard]] bool isGlobalFrozen(ReadView const& view, AccountID const& issuer); @@ -305,86 +308,57 @@ isLPTokenFrozen( Issue const& asset, Issue const& asset2); -// Returns the amount an account can spend without going into debt. +// Returns the amount an account can spend. // -// <-- saAmount: amount of currency held by account. May be negative. -[[nodiscard]] STAmount -accountHolds( - ReadView const& view, - AccountID const& account, - Currency const& currency, - AccountID const& issuer, - FreezeHandling zeroIfFrozen, - beast::Journal j); - -[[nodiscard]] STAmount -accountHolds( - ReadView const& view, - AccountID const& account, - Issue const& issue, - FreezeHandling zeroIfFrozen, - beast::Journal j); - -[[nodiscard]] STAmount -accountHolds( - ReadView const& view, - AccountID const& account, - MPTIssue const& mptIssue, - FreezeHandling zeroIfFrozen, - AuthHandling zeroIfUnauthorized, - beast::Journal j); - -[[nodiscard]] STAmount -accountHolds( - ReadView const& view, - AccountID const& account, - Asset const& asset, - FreezeHandling zeroIfFrozen, - AuthHandling zeroIfUnauthorized, - beast::Journal j); - -// Returns the amount an account can spend total. +// If shSIMPLE_BALANCE is specified, this is the amount the account can spend +// without going into debt. // -// These functions use accountHolds, but unlike accountHolds: -// * The account can go into debt. -// * If the account is the asset issuer the only limit is defined by the asset / +// If shFULL_BALANCE is specified, this is the amount the account can spend +// total. Specifically: +// * The account can go into debt if using a trust line, and the other side has +// a non-zero limit. +// * If the account is the asset issuer the limit is defined by the asset / // issuance. // // <-- saAmount: amount of currency held by account. May be negative. [[nodiscard]] STAmount -accountSpendable( +accountHolds( ReadView const& view, AccountID const& account, Currency const& currency, AccountID const& issuer, FreezeHandling zeroIfFrozen, - beast::Journal j); + beast::Journal j, + SpendableHandling includeFullBalance = shSIMPLE_BALANCE); [[nodiscard]] STAmount -accountSpendable( +accountHolds( ReadView const& view, AccountID const& account, Issue const& issue, FreezeHandling zeroIfFrozen, - beast::Journal j); + beast::Journal j, + SpendableHandling includeFullBalance = shSIMPLE_BALANCE); [[nodiscard]] STAmount -accountSpendable( +accountHolds( ReadView const& view, AccountID const& account, MPTIssue const& mptIssue, FreezeHandling zeroIfFrozen, AuthHandling zeroIfUnauthorized, - beast::Journal j); + beast::Journal j, + SpendableHandling includeFullBalance = shSIMPLE_BALANCE); [[nodiscard]] STAmount -accountSpendable( +accountHolds( ReadView const& view, AccountID const& account, Asset const& asset, FreezeHandling zeroIfFrozen, AuthHandling zeroIfUnauthorized, - beast::Journal j); + beast::Journal j, + SpendableHandling includeFullBalance = shSIMPLE_BALANCE); // Returns the amount an account can spend of the currency type saDefault, or // returns saDefault if this account is the issuer of the currency in @@ -655,7 +629,7 @@ createPseudoAccount( uint256 const& pseudoOwnerKey, SField const& ownerField); -// Returns true iff sleAcct is a pseudo-account or specific +// Returns true if and only if sleAcct is a pseudo-account or specific // pseudo-accounts in pseudoFieldFilter. // // Returns false if sleAcct is @@ -710,13 +684,16 @@ checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag); * - If withdrawing to self, succeed. * - If not, checks if the receiver requires deposit authorization, and if * the sender has it. + * - Checks that the receiver will not exceed the limit (IOU trustline limit + * or MPT MaximumAmount). */ [[nodiscard]] TER canWithdraw( - AccountID const& from, ReadView const& view, + AccountID const& from, AccountID const& to, SLE::const_ref toSle, + STAmount const& amount, bool hasDestinationTag); /** Checks that can withdraw funds from an object to itself or a destination. @@ -730,12 +707,15 @@ canWithdraw( * - If withdrawing to self, succeed. * - If not, checks if the receiver requires deposit authorization, and if * the sender has it. + * - Checks that the receiver will not exceed the limit (IOU trustline limit + * or MPT MaximumAmount). */ [[nodiscard]] TER canWithdraw( - AccountID const& from, ReadView const& view, + AccountID const& from, AccountID const& to, + STAmount const& amount, bool hasDestinationTag); /** Checks that can withdraw funds from an object to itself or a destination. @@ -749,6 +729,8 @@ canWithdraw( * - If withdrawing to self, succeed. * - If not, checks if the receiver requires deposit authorization, and if * the sender has it. + * - Checks that the receiver will not exceed the limit (IOU trustline limit + * or MPT MaximumAmount). */ [[nodiscard]] TER canWithdraw(ReadView const& view, STTx const& tx); diff --git a/include/xrpl/protocol/detail/ledger_entries.macro b/include/xrpl/protocol/detail/ledger_entries.macro index de9c41bf52..216f404bec 100644 --- a/include/xrpl/protocol/detail/ledger_entries.macro +++ b/include/xrpl/protocol/detail/ledger_entries.macro @@ -541,7 +541,7 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({ {sfStartDate, soeREQUIRED}, {sfPaymentInterval, soeREQUIRED}, {sfGracePeriod, soeDEFAULT}, - {sfPreviousPaymentDate, soeDEFAULT}, + {sfPreviousPaymentDueDate, soeDEFAULT}, {sfNextPaymentDueDate, soeDEFAULT}, // The loan object tracks these values: // diff --git a/include/xrpl/protocol/detail/sfields.macro b/include/xrpl/protocol/detail/sfields.macro index d5c5d9447f..d0736469e4 100644 --- a/include/xrpl/protocol/detail/sfields.macro +++ b/include/xrpl/protocol/detail/sfields.macro @@ -102,7 +102,7 @@ TYPED_SFIELD(sfMutableFlags, UINT32, 53) TYPED_SFIELD(sfStartDate, UINT32, 54) TYPED_SFIELD(sfPaymentInterval, UINT32, 55) TYPED_SFIELD(sfGracePeriod, UINT32, 56) -TYPED_SFIELD(sfPreviousPaymentDate, UINT32, 57) +TYPED_SFIELD(sfPreviousPaymentDueDate, UINT32, 57) TYPED_SFIELD(sfNextPaymentDueDate, UINT32, 58) TYPED_SFIELD(sfPaymentRemaining, UINT32, 59) TYPED_SFIELD(sfPaymentTotal, UINT32, 60) diff --git a/src/xrpld/app/paths/Credit.cpp b/src/libxrpl/ledger/Credit.cpp similarity index 100% rename from src/xrpld/app/paths/Credit.cpp rename to src/libxrpl/ledger/Credit.cpp diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index 329d3cfcae..14246baf17 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -464,7 +465,8 @@ accountHolds( Currency const& currency, AccountID const& issuer, FreezeHandling zeroIfFrozen, - beast::Journal j) + beast::Journal j, + SpendableHandling includeFullBalance) { STAmount amount; if (isXRP(currency)) @@ -472,11 +474,19 @@ accountHolds( return {xrpLiquid(view, account, 0, j)}; } + bool const returnSpendable = (includeFullBalance == shFULL_BALANCE); + if (returnSpendable && account == issuer) + // If the account is the issuer, then their limit is effectively + // infinite + return STAmount{ + Issue{currency, issuer}, STAmount::cMaxValue, STAmount::cMaxOffset}; + // IOU: Return balance on trust line modulo freeze SLE::const_pointer const sle = getLineIfUsable(view, account, currency, issuer, zeroIfFrozen, j); - return getTrustLineBalance(view, sle, account, currency, issuer, false, j); + return getTrustLineBalance( + view, sle, account, currency, issuer, returnSpendable, j); } STAmount @@ -485,10 +495,17 @@ accountHolds( AccountID const& account, Issue const& issue, FreezeHandling zeroIfFrozen, - beast::Journal j) + beast::Journal j, + SpendableHandling includeFullBalance) { return accountHolds( - view, account, issue.currency, issue.account, zeroIfFrozen, j); + view, + account, + issue.currency, + issue.account, + zeroIfFrozen, + j, + includeFullBalance); } STAmount @@ -498,8 +515,28 @@ accountHolds( MPTIssue const& mptIssue, FreezeHandling zeroIfFrozen, AuthHandling zeroIfUnauthorized, - beast::Journal j) + beast::Journal j, + SpendableHandling includeFullBalance) { + bool const returnSpendable = (includeFullBalance == shFULL_BALANCE); + + if (returnSpendable && account == mptIssue.getIssuer()) + { + // if the account is the issuer, and the issuance exists, their limit is + // the issuance limit minus the outstanding value + auto const issuance = + view.read(keylet::mptIssuance(mptIssue.getMptID())); + + if (!issuance) + { + return STAmount{mptIssue}; + } + return STAmount{ + mptIssue, + issuance->at(~sfMaximumAmount).value_or(maxMPTokenAmount) - + issuance->at(sfOutstandingAmount)}; + } + STAmount amount; auto const sleMpt = @@ -547,108 +584,27 @@ accountHolds( Asset const& asset, FreezeHandling zeroIfFrozen, AuthHandling zeroIfUnauthorized, - beast::Journal j) + beast::Journal j, + SpendableHandling includeFullBalance) { return std::visit( - [&](auto const& value) { - if constexpr (std::is_same_v< - std::remove_cvref_t, - Issue>) + [&](TIss const& value) { + if constexpr (std::is_same_v) { - return accountHolds(view, account, value, zeroIfFrozen, j); + return accountHolds( + view, account, value, zeroIfFrozen, j, includeFullBalance); } - return accountHolds( - view, account, value, zeroIfFrozen, zeroIfUnauthorized, j); - }, - asset.value()); -} - -STAmount -accountSpendable( - ReadView const& view, - AccountID const& account, - Currency const& currency, - AccountID const& issuer, - FreezeHandling zeroIfFrozen, - beast::Journal j) -{ - if (isXRP(currency)) - return accountHolds(view, account, currency, issuer, zeroIfFrozen, j); - - if (account == issuer) - // If the account is the issuer, then their limit is effectively - // infinite - return STAmount{ - Issue{currency, issuer}, STAmount::cMaxValue, STAmount::cMaxOffset}; - - // IOU: Return balance on trust line modulo freeze - SLE::const_pointer const sle = - getLineIfUsable(view, account, currency, issuer, zeroIfFrozen, j); - - return getTrustLineBalance(view, sle, account, currency, issuer, true, j); -} - -STAmount -accountSpendable( - ReadView const& view, - AccountID const& account, - Issue const& issue, - FreezeHandling zeroIfFrozen, - beast::Journal j) -{ - return accountSpendable( - view, account, issue.currency, issue.account, zeroIfFrozen, j); -} - -STAmount -accountSpendable( - ReadView const& view, - AccountID const& account, - MPTIssue const& mptIssue, - FreezeHandling zeroIfFrozen, - AuthHandling zeroIfUnauthorized, - beast::Journal j) -{ - if (account == mptIssue.getIssuer()) - { - // if the account is the issuer, and the issuance exists, their limit is - // the issuance limit minus the outstanding value - auto const issuance = - view.read(keylet::mptIssuance(mptIssue.getMptID())); - - if (!issuance) - { - return STAmount{mptIssue}; - } - return STAmount{ - mptIssue, - issuance->at(~sfMaximumAmount).value_or(maxMPTokenAmount) - - issuance->at(sfOutstandingAmount)}; - } - - return accountHolds( - view, account, mptIssue, zeroIfFrozen, zeroIfUnauthorized, j); -} - -[[nodiscard]] STAmount -accountSpendable( - ReadView const& view, - AccountID const& account, - Asset const& asset, - FreezeHandling zeroIfFrozen, - AuthHandling zeroIfUnauthorized, - beast::Journal j) -{ - return std::visit( - [&](auto const& value) { - if constexpr (std::is_same_v< - std::remove_cvref_t, - Issue>) + else if constexpr (std::is_same_v) { - return accountSpendable(view, account, value, zeroIfFrozen, j); + return accountHolds( + view, + account, + value, + zeroIfFrozen, + zeroIfUnauthorized, + j, + includeFullBalance); } - return accountSpendable( - view, account, value, zeroIfFrozen, zeroIfUnauthorized, j); }, asset.value()); } @@ -1205,8 +1161,7 @@ getPseudoAccountFields() // LCOV_EXCL_START LogicError( "xrpl::getPseudoAccountFields : unable to find account root " - "ledger " - "format"); + "ledger format"); // LCOV_EXCL_STOP } auto const& soTemplate = ar->getSOTemplate(); @@ -1342,12 +1297,58 @@ checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag) return tesSUCCESS; } +/* + * Checks if a withdrawal amount into the destination account exceeds + * any applicable receiving limit. + * Called by VaultWithdraw and LoanBrokerCoverWithdraw. + * + * IOU : Performs the trustline check against the destination account's + * credit limit to ensure the account's trust maximum is not exceeded. + * + * MPT: The limit check is effectively skipped (returns true). This is + * because MPT MaximumAmount relates to token supply, and withdrawal does not + * involve minting new tokens that could exceed the global cap. + * On withdrawal, tokens are simply transferred from the vault's pseudo-account + * to the destination account. Since no new MPT tokens are minted during this + * transfer, the withdrawal cannot violate the MPT MaximumAmount/supply cap + * even if `from` is the issuer. + */ +static TER +withdrawToDestExceedsLimit( + ReadView const& view, + AccountID const& from, + AccountID const& to, + STAmount const& amount) +{ + auto const& issuer = amount.getIssuer(); + if (from == to || to == issuer || isXRP(issuer)) + return tesSUCCESS; + + return std::visit( + [&](TIss const& issue) -> TER { + if constexpr (std::is_same_v) + { + auto const& currency = issue.currency; + auto const owed = creditBalance(view, to, issuer, currency); + if (owed <= beast::zero) + { + auto const limit = creditLimit(view, to, issuer, currency); + if (-owed >= limit || amount > (limit + owed)) + return tecNO_LINE; + } + } + return tesSUCCESS; + }, + amount.asset().value()); +} + [[nodiscard]] TER canWithdraw( - AccountID const& from, ReadView const& view, + AccountID const& from, AccountID const& to, SLE::const_ref toSle, + STAmount const& amount, bool hasDestinationTag) { if (auto const ret = checkDestinationAndTag(toSle, hasDestinationTag)) @@ -1362,19 +1363,20 @@ canWithdraw( return tecNO_PERMISSION; } - return tesSUCCESS; + return withdrawToDestExceedsLimit(view, from, to, amount); } [[nodiscard]] TER canWithdraw( - AccountID const& from, ReadView const& view, + AccountID const& from, AccountID const& to, + STAmount const& amount, bool hasDestinationTag) { auto const toSle = view.read(keylet::account(to)); - return canWithdraw(from, view, to, toSle, hasDestinationTag); + return canWithdraw(view, from, to, toSle, amount, hasDestinationTag); } [[nodiscard]] TER @@ -1383,7 +1385,8 @@ canWithdraw(ReadView const& view, STTx const& tx) auto const from = tx[sfAccount]; auto const to = tx[~sfDestination].value_or(from); - return canWithdraw(from, view, to, tx.isFieldPresent(sfDestinationTag)); + return canWithdraw( + view, from, to, tx[sfAmount], tx.isFieldPresent(sfDestinationTag)); } TER diff --git a/src/test/app/LendingHelpers_test.cpp b/src/test/app/LendingHelpers_test.cpp new file mode 100644 index 0000000000..50efe0ebe3 --- /dev/null +++ b/src/test/app/LendingHelpers_test.cpp @@ -0,0 +1,1351 @@ +#include +// DO NOT REMOVE +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace xrpl { +namespace test { + +class LendingHelpers_test : public beast::unit_test::suite +{ + void + testComputeRaisedRate() + { + using namespace jtx; + using namespace xrpl::detail; + struct TestCase + { + std::string name; + Number periodicRate; + std::uint32_t paymentsRemaining; + Number expectedRaisedRate; + }; + + auto const testCases = std::vector{ + { + .name = "Zero payments remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 0, + .expectedRaisedRate = Number{1}, // (1 + r)^0 = 1 + }, + { + .name = "One payment remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 1, + .expectedRaisedRate = Number{105, -2}, + }, // 1.05^1 + { + .name = "Multiple payments remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 3, + .expectedRaisedRate = Number{1157625, -6}, + }, // 1.05^3 + { + .name = "Zero periodic rate", + .periodicRate = Number{0}, + .paymentsRemaining = 5, + .expectedRaisedRate = Number{1}, // (1 + 0)^5 = 1 + }}; + + for (auto const& tc : testCases) + { + testcase("computeRaisedRate: " + tc.name); + + auto const computedRaisedRate = + computeRaisedRate(tc.periodicRate, tc.paymentsRemaining); + BEAST_EXPECTS( + computedRaisedRate == tc.expectedRaisedRate, + "Raised rate mismatch: expected " + + to_string(tc.expectedRaisedRate) + ", got " + + to_string(computedRaisedRate)); + } + } + + void + testComputePaymentFactor() + { + using namespace jtx; + using namespace xrpl::detail; + struct TestCase + { + std::string name; + Number periodicRate; + std::uint32_t paymentsRemaining; + Number expectedPaymentFactor; + }; + + auto const testCases = std::vector{ + { + .name = "Zero periodic rate", + .periodicRate = Number{0}, + .paymentsRemaining = 4, + .expectedPaymentFactor = Number{25, -2}, + }, // 1/4 = 0.25 + { + .name = "One payment remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 1, + .expectedPaymentFactor = Number{105, -2}, + }, // 0.05/1 = 1.05 + { + .name = "Multiple payments remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 3, + .expectedPaymentFactor = Number{367208564631245, -15}, + }, // from calc + { + .name = "Zero payments remaining", + .periodicRate = Number{5, -2}, + .paymentsRemaining = 0, + .expectedPaymentFactor = Number{0}, + } // edge case + }; + + for (auto const& tc : testCases) + { + testcase("computePaymentFactor: " + tc.name); + + auto const computedPaymentFactor = + computePaymentFactor(tc.periodicRate, tc.paymentsRemaining); + BEAST_EXPECTS( + computedPaymentFactor == tc.expectedPaymentFactor, + "Payment factor mismatch: expected " + + to_string(tc.expectedPaymentFactor) + ", got " + + to_string(computedPaymentFactor)); + } + } + + void + testLoanPeriodicPayment() + { + using namespace jtx; + using namespace xrpl::detail; + + struct TestCase + { + std::string name; + Number principalOutstanding; + Number periodicRate; + std::uint32_t paymentsRemaining; + Number expectedPeriodicPayment; + }; + + auto const testCases = std::vector{ + { + .name = "Zero principal outstanding", + .principalOutstanding = Number{0}, + .periodicRate = Number{5, -2}, + .paymentsRemaining = 5, + .expectedPeriodicPayment = Number{0}, + }, + { + .name = "Zero payments remaining", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .paymentsRemaining = 0, + .expectedPeriodicPayment = Number{0}, + }, + { + .name = "Zero periodic rate", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{0}, + .paymentsRemaining = 4, + .expectedPeriodicPayment = Number{250}, + }, + { + .name = "Standard case", + .principalOutstanding = Number{1'000}, + .periodicRate = + loanPeriodicRate(TenthBips32(100'000), 30 * 24 * 60 * 60), + .paymentsRemaining = 3, + .expectedPeriodicPayment = + Number{3895690663961231, -13}, // from calc + }, + }; + + for (auto const& tc : testCases) + { + testcase("loanPeriodicPayment: " + tc.name); + + auto const computedPeriodicPayment = loanPeriodicPayment( + tc.principalOutstanding, tc.periodicRate, tc.paymentsRemaining); + BEAST_EXPECTS( + computedPeriodicPayment == tc.expectedPeriodicPayment, + "Periodic payment mismatch: expected " + + to_string(tc.expectedPeriodicPayment) + ", got " + + to_string(computedPeriodicPayment)); + } + } + + void + testLoanPrincipalFromPeriodicPayment() + { + using namespace jtx; + using namespace xrpl::detail; + + struct TestCase + { + std::string name; + Number periodicPayment; + Number periodicRate; + std::uint32_t paymentsRemaining; + Number expectedPrincipalOutstanding; + }; + + auto const testCases = std::vector{ + { + .name = "Zero periodic payment", + .periodicPayment = Number{0}, + .periodicRate = Number{5, -2}, + .paymentsRemaining = 5, + .expectedPrincipalOutstanding = Number{0}, + }, + { + .name = "Zero payments remaining", + .periodicPayment = Number{1'000}, + .periodicRate = Number{5, -2}, + .paymentsRemaining = 0, + .expectedPrincipalOutstanding = Number{0}, + }, + { + .name = "Zero periodic rate", + .periodicPayment = Number{250}, + .periodicRate = Number{0}, + .paymentsRemaining = 4, + .expectedPrincipalOutstanding = Number{1'000}, + }, + { + .name = "Standard case", + .periodicPayment = Number{3895690663961231, -13}, // from calc + .periodicRate = + loanPeriodicRate(TenthBips32(100'000), 30 * 24 * 60 * 60), + .paymentsRemaining = 3, + .expectedPrincipalOutstanding = Number{1'000}, + }, + }; + + for (auto const& tc : testCases) + { + testcase("loanPrincipalFromPeriodicPayment: " + tc.name); + + auto const computedPrincipalOutstanding = + loanPrincipalFromPeriodicPayment( + tc.periodicPayment, tc.periodicRate, tc.paymentsRemaining); + BEAST_EXPECTS( + computedPrincipalOutstanding == tc.expectedPrincipalOutstanding, + "Principal outstanding mismatch: expected " + + to_string(tc.expectedPrincipalOutstanding) + ", got " + + to_string(computedPrincipalOutstanding)); + } + } + + void + testComputeOverpaymentComponents() + { + testcase("computeOverpaymentComponents"); + using namespace jtx; + using namespace xrpl::detail; + + Account const issuer{"issuer"}; + PrettyAsset const IOU = issuer["IOU"]; + int32_t const loanScale = 1; + auto const overpayment = Number{1'000}; + auto const overpaymentInterestRate = TenthBips32{10'000}; // 10% + auto const overpaymentFeeRate = TenthBips32{50'000}; // 50% + auto const managementFeeRate = TenthBips16{10'000}; // 10% + + auto const expectedOverpaymentFee = Number{500}; // 50% of 1,000 + auto const expectedOverpaymentInterestGross = + Number{100}; // 10% of 1,000 + auto const expectedOverpaymentInterestNet = + Number{90}; // 100 - 10% of 100 + auto const expectedOverpaymentManagementFee = Number{10}; // 10% of 100 + auto const expectedPrincipalPortion = Number{400}; // 1,000 - 100 - 500 + + auto const components = detail::computeOverpaymentComponents( + IOU, + loanScale, + overpayment, + overpaymentInterestRate, + overpaymentFeeRate, + managementFeeRate); + + BEAST_EXPECT( + components.untrackedManagementFee == expectedOverpaymentFee); + + BEAST_EXPECT( + components.untrackedInterest == expectedOverpaymentInterestNet); + + BEAST_EXPECT( + components.trackedInterestPart() == expectedOverpaymentInterestNet); + + BEAST_EXPECT( + components.trackedManagementFeeDelta == + expectedOverpaymentManagementFee); + BEAST_EXPECT( + components.trackedPrincipalDelta == expectedPrincipalPortion); + BEAST_EXPECT( + components.trackedManagementFeeDelta + + components.untrackedInterest == + expectedOverpaymentInterestGross); + + BEAST_EXPECT( + components.trackedManagementFeeDelta + + components.untrackedInterest + + components.trackedPrincipalDelta + + components.untrackedManagementFee == + overpayment); + } + + void + testComputeInterestAndFeeParts() + { + using namespace jtx; + using namespace xrpl::detail; + + struct TestCase + { + std::string name; + Number interest; + TenthBips16 managementFeeRate; + Number expectedInterestPart; + Number expectedFeePart; + }; + + Account const issuer{"issuer"}; + PrettyAsset const IOU = issuer["IOU"]; + std::int32_t const loanScale = 1; + + auto const testCases = std::vector{ + {.name = "Zero interest", + .interest = Number{0}, + .managementFeeRate = TenthBips16{10'000}, + .expectedInterestPart = Number{0}, + .expectedFeePart = Number{0}}, + {.name = "Zero fee rate", + .interest = Number{1'000}, + .managementFeeRate = TenthBips16{0}, + .expectedInterestPart = Number{1'000}, + .expectedFeePart = Number{0}}, + {.name = "10% fee rate", + .interest = Number{1'000}, + .managementFeeRate = TenthBips16{10'000}, + .expectedInterestPart = Number{900}, + .expectedFeePart = Number{100}}, + }; + + for (auto const& tc : testCases) + { + testcase("computeInterestAndFeeParts: " + tc.name); + + auto const [computedInterestPart, computedFeePart] = + computeInterestAndFeeParts( + IOU, tc.interest, tc.managementFeeRate, loanScale); + BEAST_EXPECTS( + computedInterestPart == tc.expectedInterestPart, + "Interest part mismatch: expected " + + to_string(tc.expectedInterestPart) + ", got " + + to_string(computedInterestPart)); + BEAST_EXPECTS( + computedFeePart == tc.expectedFeePart, + "Fee part mismatch: expected " + to_string(tc.expectedFeePart) + + ", got " + to_string(computedFeePart)); + } + } + + void + testLoanLatePaymentInterest() + { + using namespace jtx; + using namespace xrpl::detail; + struct TestCase + { + std::string name; + Number principalOutstanding; + TenthBips32 lateInterestRate; + NetClock::time_point parentCloseTime; + std::uint32_t nextPaymentDueDate; + Number expectedLateInterest; + }; + + auto const testCases = std::vector{ + { + .name = "On-time payment", + .principalOutstanding = Number{1'000}, + .lateInterestRate = TenthBips32{10'000}, // 10% + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .nextPaymentDueDate = 3'000, + .expectedLateInterest = Number{0}, + }, + { + .name = "Early payment", + .principalOutstanding = Number{1'000}, + .lateInterestRate = TenthBips32{10'000}, // 10% + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .nextPaymentDueDate = 4'000, + .expectedLateInterest = Number{0}, + }, + { + .name = "No principal outstanding", + .principalOutstanding = Number{0}, + .lateInterestRate = TenthBips32{10'000}, // 10% + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .nextPaymentDueDate = 2'000, + .expectedLateInterest = Number{0}, + }, + { + .name = "No late interest rate", + .principalOutstanding = Number{1'000}, + .lateInterestRate = TenthBips32{0}, // 0% + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .nextPaymentDueDate = 2'000, + .expectedLateInterest = Number{0}, + }, + { + .name = "Late payment", + .principalOutstanding = Number{1'000}, + .lateInterestRate = TenthBips32{100'000}, // 100% + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .nextPaymentDueDate = 2'000, + .expectedLateInterest = + Number{3170979198376459, -17}, // from calc + }, + }; + + for (auto const& tc : testCases) + { + testcase("loanLatePaymentInterest: " + tc.name); + + auto const computedLateInterest = loanLatePaymentInterest( + tc.principalOutstanding, + tc.lateInterestRate, + tc.parentCloseTime, + tc.nextPaymentDueDate); + BEAST_EXPECTS( + computedLateInterest == tc.expectedLateInterest, + "Late interest mismatch: expected " + + to_string(tc.expectedLateInterest) + ", got " + + to_string(computedLateInterest)); + } + } + + void + testLoanAccruedInterest() + { + using namespace jtx; + using namespace xrpl::detail; + struct TestCase + { + std::string name; + Number principalOutstanding; + Number periodicRate; + NetClock::time_point parentCloseTime; + std::uint32_t startDate; + std::uint32_t prevPaymentDate; + std::uint32_t paymentInterval; + Number expectedAccruedInterest; + }; + + auto const testCases = std::vector{ + { + .name = "Zero principal outstanding", + .principalOutstanding = Number{0}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .startDate = 2'000, + .prevPaymentDate = 2'500, + .paymentInterval = 30 * 24 * 60 * 60, + .expectedAccruedInterest = Number{0}, + }, + { + .name = "Before start date", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{1'000}}, + .startDate = 2'000, + .prevPaymentDate = 1'500, + .paymentInterval = 30 * 24 * 60 * 60, + .expectedAccruedInterest = Number{0}, + }, + { + .name = "Zero periodic rate", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{0}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .startDate = 2'000, + .prevPaymentDate = 2'500, + .paymentInterval = 30 * 24 * 60 * 60, + .expectedAccruedInterest = Number{0}, + }, + { + .name = "Zero payment interval", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .startDate = 2'000, + .prevPaymentDate = 2'500, + .paymentInterval = 0, + .expectedAccruedInterest = Number{0}, + }, + { + .name = "Standard case", + .principalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .startDate = 1'000, + .prevPaymentDate = 2'000, + .paymentInterval = 30 * 24 * 60 * 60, + .expectedAccruedInterest = + Number{1929012345679012, -17}, // from calc + }, + }; + + for (auto const& tc : testCases) + { + testcase("loanAccruedInterest: " + tc.name); + + auto const computedAccruedInterest = loanAccruedInterest( + tc.principalOutstanding, + tc.periodicRate, + tc.parentCloseTime, + tc.startDate, + tc.prevPaymentDate, + tc.paymentInterval); + BEAST_EXPECTS( + computedAccruedInterest == tc.expectedAccruedInterest, + "Accrued interest mismatch: expected " + + to_string(tc.expectedAccruedInterest) + ", got " + + to_string(computedAccruedInterest)); + } + } + + // This test overlaps with testLoanAccruedInterest, the test cases only + // exercise the computeFullPaymentInterest parts unique to it. + void + testComputeFullPaymentInterest() + { + using namespace jtx; + using namespace xrpl::detail; + + struct TestCase + { + std::string name; + Number rawPrincipalOutstanding; + Number periodicRate; + NetClock::time_point parentCloseTime; + std::uint32_t paymentInterval; + std::uint32_t prevPaymentDate; + std::uint32_t startDate; + TenthBips32 closeInterestRate; + Number expectedFullPaymentInterest; + }; + + auto const testCases = std::vector{ + { + .name = "Zero principal outstanding", + .rawPrincipalOutstanding = Number{0}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .paymentInterval = 30 * 24 * 60 * 60, + .prevPaymentDate = 2'000, + .startDate = 1'000, + .closeInterestRate = TenthBips32{10'000}, + .expectedFullPaymentInterest = Number{0}, + }, + { + .name = "Zero close interest rate", + .rawPrincipalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .paymentInterval = 30 * 24 * 60 * 60, + .prevPaymentDate = 2'000, + .startDate = 1'000, + .closeInterestRate = TenthBips32{0}, + .expectedFullPaymentInterest = + Number{1929012345679012, -17}, // from calc + }, + { + .name = "Standard case", + .rawPrincipalOutstanding = Number{1'000}, + .periodicRate = Number{5, -2}, + .parentCloseTime = + NetClock::time_point{NetClock::duration{3'000}}, + .paymentInterval = 30 * 24 * 60 * 60, + .prevPaymentDate = 2'000, + .startDate = 1'000, + .closeInterestRate = TenthBips32{10'000}, + .expectedFullPaymentInterest = + Number{1000192901234568, -13}, // from calc + }, + }; + + for (auto const& tc : testCases) + { + testcase("computeFullPaymentInterest: " + tc.name); + + auto const computedFullPaymentInterest = computeFullPaymentInterest( + tc.rawPrincipalOutstanding, + tc.periodicRate, + tc.parentCloseTime, + tc.paymentInterval, + tc.prevPaymentDate, + tc.startDate, + tc.closeInterestRate); + BEAST_EXPECTS( + computedFullPaymentInterest == tc.expectedFullPaymentInterest, + "Full payment interest mismatch: expected " + + to_string(tc.expectedFullPaymentInterest) + ", got " + + to_string(computedFullPaymentInterest)); + } + } + + void + testTryOverpaymentNoInterestNoFee() + { + // This test ensures that overpayment with no interest works correctly. + testcase("tryOverpayment - No Interest No Fee"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{0}; // 0% + TenthBips32 const loanInterestRate{0}; // 0% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + Number const overpaymentAmount{50}; + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + overpaymentAmount, + TenthBips32(0), + TenthBips32(0), + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + BEAST_EXPECTS( + actualPaymentParts.valueChange == 0, + " valueChange mismatch: expected 0, got " + + to_string(actualPaymentParts.valueChange)); + + BEAST_EXPECTS( + actualPaymentParts.feePaid == 0, + " feePaid mismatch: expected 0, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.interestPaid == 0, + " interestPaid mismatch: expected 0, got " + + to_string(actualPaymentParts.interestPaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == overpaymentAmount, + " principalPaid mismatch: expected " + + to_string(overpaymentAmount) + ", got " + + to_string(actualPaymentParts.principalPaid)); + + // =========== VALIDATE STATE CHANGES =========== + BEAST_EXPECTS( + loanProperites.loanState.interestDue - newState.interestDue == 0, + " interest change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.interestDue - + newState.interestDue)); + + BEAST_EXPECTS( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue == + 0, + " management fee change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + } + + void + testTryOverpaymentNoInterestOverpaymentFee() + { + testcase("tryOverpayment - No Interest With Overpayment Fee"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{0}; // 0% + TenthBips32 const loanInterestRate{0}; // 0% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + Number{50, 0}, + TenthBips32(0), + TenthBips32(10'000), // 10% overpayment fee + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + BEAST_EXPECTS( + actualPaymentParts.valueChange == 0, + " valueChange mismatch: expected 0, got " + + to_string(actualPaymentParts.valueChange)); + + BEAST_EXPECTS( + actualPaymentParts.feePaid == 5, + " feePaid mismatch: expected 5, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == 45, + " principalPaid mismatch: expected 45, got `" + + to_string(actualPaymentParts.principalPaid)); + + BEAST_EXPECTS( + actualPaymentParts.interestPaid == 0, + " interestPaid mismatch: expected 0, got " + + to_string(actualPaymentParts.interestPaid)); + + // =========== VALIDATE STATE CHANGES =========== + // With no Loan interest, interest outstanding should not change + BEAST_EXPECTS( + loanProperites.loanState.interestDue - newState.interestDue == 0, + " interest change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.interestDue - + newState.interestDue)); + + // With no Loan management fee, management fee due should not change + BEAST_EXPECTS( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue == + 0, + " management fee change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + } + + void + testTryOverpaymentLoanInterestNoOverpaymentFees() + { + testcase("tryOverpayment - Loan Interest, No Overpayment Fees"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{0}; // 0% + TenthBips32 const loanInterestRate{10'000}; // 10% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + Number{50, 0}, + TenthBips32(0), // no overpayment interest + TenthBips32(0), // 0% overpayment fee + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + // with no overpayment interest portion, value change should equal + // interest decrease + BEAST_EXPECTS( + (actualPaymentParts.valueChange == Number{-228802, -5}), + " valueChange mismatch: expected " + + to_string(Number{-228802, -5}) + ", got " + + to_string(actualPaymentParts.valueChange)); + + // with no fee portion, fee paid should be zero + BEAST_EXPECTS( + actualPaymentParts.feePaid == 0, + " feePaid mismatch: expected 0, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == 50, + " principalPaid mismatch: expected 50, got `" + + to_string(actualPaymentParts.principalPaid)); + + // with no interest portion, interest paid should be zero + BEAST_EXPECTS( + actualPaymentParts.interestPaid == 0, + " interestPaid mismatch: expected 0, got " + + to_string(actualPaymentParts.interestPaid)); + + // =========== VALIDATE STATE CHANGES =========== + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + + BEAST_EXPECTS( + actualPaymentParts.valueChange == + newState.interestDue - loanProperites.loanState.interestDue, + " valueChange mismatch: expected " + + to_string( + newState.interestDue - + loanProperites.loanState.interestDue) + + ", got " + to_string(actualPaymentParts.valueChange)); + + // With no Loan management fee, management fee due should not change + BEAST_EXPECTS( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue == + 0, + " management fee change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue)); + } + + void + testTryOverpaymentLoanInterestOverpaymentInterest() + { + testcase( + "tryOverpayment - Loan Interest, Overpayment Interest, No Fee"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{0}; // 0% + TenthBips32 const loanInterestRate{10'000}; // 10% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + Number{50, 0}, + TenthBips32(10'000), // 10% overpayment interest + TenthBips32(0), // 0% overpayment fee + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + // with overpayment interest portion, interest paid should be 5 + BEAST_EXPECTS( + actualPaymentParts.interestPaid == 5, + " interestPaid mismatch: expected 5, got " + + to_string(actualPaymentParts.interestPaid)); + + // With overpayment interest portion, value change should equal the + // interest decrease plus overpayment interest portion + BEAST_EXPECTS( + (actualPaymentParts.valueChange == + Number{-205922, -5} + actualPaymentParts.interestPaid), + " valueChange mismatch: expected " + + to_string( + actualPaymentParts.valueChange - + actualPaymentParts.interestPaid) + + ", got " + to_string(actualPaymentParts.valueChange)); + + // with no fee portion, fee paid should be zero + BEAST_EXPECTS( + actualPaymentParts.feePaid == 0, + " feePaid mismatch: expected 0, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == 45, + " principalPaid mismatch: expected 45, got `" + + to_string(actualPaymentParts.principalPaid)); + + // =========== VALIDATE STATE CHANGES =========== + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + + // The change in interest is equal to the value change sans the + // overpayment interest + BEAST_EXPECTS( + actualPaymentParts.valueChange - actualPaymentParts.interestPaid == + newState.interestDue - loanProperites.loanState.interestDue, + " valueChange mismatch: expected " + + to_string( + newState.interestDue - + loanProperites.loanState.interestDue + + actualPaymentParts.interestPaid) + + ", got " + to_string(actualPaymentParts.valueChange)); + + // With no Loan management fee, management fee due should not change + BEAST_EXPECTS( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue == + 0, + " management fee change mismatch: expected 0, got " + + to_string( + loanProperites.loanState.managementFeeDue - + newState.managementFeeDue)); + } + + void + testTryOverpaymentLoanInterestFeeOverpaymentInterestNoFee() + { + testcase( + "tryOverpayment - Loan Interest and Fee, Overpayment Interest, No " + "Fee"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{10'000}; // 10% + TenthBips32 const loanInterestRate{10'000}; // 10% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + Number{50, 0}, + TenthBips32(10'000), // 10% overpayment interest + TenthBips32(0), // 0% overpayment fee + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + + // Since there is loan management fee, the fee is charged against + // overpayment interest portion first, so interest paid remains 4.5 + BEAST_EXPECTS( + (actualPaymentParts.interestPaid == Number{45, -1}), + " interestPaid mismatch: expected 4.5, got " + + to_string(actualPaymentParts.interestPaid)); + + // With overpayment interest portion, value change should equal the + // interest decrease plus overpayment interest portion + BEAST_EXPECTS( + (actualPaymentParts.valueChange == + Number{-18533, -4} + actualPaymentParts.interestPaid), + " valueChange mismatch: expected " + + to_string( + Number{-18533, -4} + actualPaymentParts.interestPaid) + + ", got " + to_string(actualPaymentParts.valueChange)); + + // While there is no overpayment fee, fee paid should equal the + // management fee charged against the overpayment interest portion + BEAST_EXPECTS( + (actualPaymentParts.feePaid == Number{5, -1}), + " feePaid mismatch: expected 0.5, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == 45, + " principalPaid mismatch: expected 45, got `" + + to_string(actualPaymentParts.principalPaid)); + + // =========== VALIDATE STATE CHANGES =========== + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + + // Note that the management fee value change is not captured, as this + // value is not needed to correctly update the Vault state. + BEAST_EXPECTS( + (newState.managementFeeDue - + loanProperites.loanState.managementFeeDue == + Number{-20592, -5}), + " management fee change mismatch: expected " + + to_string(Number{-20592, -5}) + ", got " + + to_string( + newState.managementFeeDue - + loanProperites.loanState.managementFeeDue)); + + BEAST_EXPECTS( + actualPaymentParts.valueChange - actualPaymentParts.interestPaid == + newState.interestDue - loanProperites.loanState.interestDue, + " valueChange mismatch: expected " + + to_string( + newState.interestDue - + loanProperites.loanState.interestDue) + + ", got " + + to_string( + actualPaymentParts.valueChange - + actualPaymentParts.interestPaid)); + } + + void + testTryOverpaymentLoanInterestFeeOverpaymentInterestFee() + { + testcase( + "tryOverpayment - Loan Interest, Fee, Overpayment Interest, Fee"); + + using namespace jtx; + using namespace xrpl::detail; + + Env env{*this}; + Account const issuer{"issuer"}; + PrettyAsset const asset = issuer["USD"]; + std::int32_t const loanScale = -5; + TenthBips16 const managementFeeRate{10'000}; // 10% + TenthBips32 const loanInterestRate{10'000}; // 10% + Number const loanPrincipal{1'000}; + std::uint32_t const paymentInterval = 30 * 24 * 60 * 60; + std::uint32_t const paymentsRemaining = 10; + auto const periodicRate = + loanPeriodicRate(loanInterestRate, paymentInterval); + + ExtendedPaymentComponents const overpaymentComponents = + computeOverpaymentComponents( + asset, + loanScale, + Number{50, 0}, + TenthBips32(10'000), // 10% overpayment interest + TenthBips32(10'000), // 10% overpayment fee + managementFeeRate); + + auto const loanProperites = computeLoanProperties( + asset, + loanPrincipal, + loanInterestRate, + paymentInterval, + paymentsRemaining, + managementFeeRate, + loanScale); + + Number const periodicPayment = loanProperites.periodicPayment; + + auto const ret = tryOverpayment( + asset, + loanScale, + overpaymentComponents, + loanProperites.loanState, + periodicPayment, + periodicRate, + paymentsRemaining, + managementFeeRate, + env.journal); + + BEAST_EXPECT(ret); + + auto const& [actualPaymentParts, newLoanProperties] = *ret; + auto const& newState = newLoanProperties.loanState; + + // =========== VALIDATE PAYMENT PARTS =========== + + // Since there is loan management fee, the fee is charged against + // overpayment interest portion first, so interest paid remains 4.5 + BEAST_EXPECTS( + (actualPaymentParts.interestPaid == Number{45, -1}), + " interestPaid mismatch: expected 4.5, got " + + to_string(actualPaymentParts.interestPaid)); + + // With overpayment interest portion, value change should equal the + // interest decrease plus overpayment interest portion + BEAST_EXPECTS( + (actualPaymentParts.valueChange == + Number{-164737, -5} + actualPaymentParts.interestPaid), + " valueChange mismatch: expected " + + to_string( + Number{-164737, -5} + actualPaymentParts.interestPaid) + + ", got " + to_string(actualPaymentParts.valueChange)); + + // While there is no overpayment fee, fee paid should equal the + // management fee charged against the overpayment interest portion + BEAST_EXPECTS( + (actualPaymentParts.feePaid == Number{55, -1}), + " feePaid mismatch: expected 5.5, got " + + to_string(actualPaymentParts.feePaid)); + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == 40, + " principalPaid mismatch: expected 40, got `" + + to_string(actualPaymentParts.principalPaid)); + + // =========== VALIDATE STATE CHANGES =========== + + BEAST_EXPECTS( + actualPaymentParts.principalPaid == + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding, + " principalPaid mismatch: expected " + + to_string( + loanProperites.loanState.principalOutstanding - + newState.principalOutstanding) + + ", got " + to_string(actualPaymentParts.principalPaid)); + + // Note that the management fee value change is not captured, as this + // value is not needed to correctly update the Vault state. + BEAST_EXPECTS( + (newState.managementFeeDue - + loanProperites.loanState.managementFeeDue == + Number{-18304, -5}), + " management fee change mismatch: expected " + + to_string(Number{-18304, -5}) + ", got " + + to_string( + newState.managementFeeDue - + loanProperites.loanState.managementFeeDue)); + + BEAST_EXPECTS( + actualPaymentParts.valueChange - actualPaymentParts.interestPaid == + newState.interestDue - loanProperites.loanState.interestDue, + " valueChange mismatch: expected " + + to_string( + newState.interestDue - + loanProperites.loanState.interestDue) + + ", got " + + to_string( + actualPaymentParts.valueChange - + actualPaymentParts.interestPaid)); + } + +public: + void + run() override + { + testTryOverpaymentNoInterestNoFee(); + testTryOverpaymentNoInterestOverpaymentFee(); + testTryOverpaymentLoanInterestNoOverpaymentFees(); + testTryOverpaymentLoanInterestOverpaymentInterest(); + testTryOverpaymentLoanInterestFeeOverpaymentInterestNoFee(); + testTryOverpaymentLoanInterestFeeOverpaymentInterestFee(); + + testComputeFullPaymentInterest(); + testLoanAccruedInterest(); + testLoanLatePaymentInterest(); + testLoanPeriodicPayment(); + testLoanPrincipalFromPeriodicPayment(); + testComputeRaisedRate(); + testComputePaymentFactor(); + testComputeOverpaymentComponents(); + testComputeInterestAndFeeParts(); + } +}; + +BEAST_DEFINE_TESTSUITE(LendingHelpers, app, xrpl); + +} // namespace test +} // namespace xrpl diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 5915ebae91..93be28e9e9 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -1024,6 +1024,12 @@ class LoanBroker_test : public beast::unit_test::suite destination(dest), ter(tecFROZEN), THISLINE); + + // preclaim: tecPSEUDO_ACCOUNT + env(coverWithdraw(alice, brokerKeylet.key, asset(10)), + destination(vaultInfo.pseudoAccount), + ter(tecPSEUDO_ACCOUNT), + THISLINE); } if (brokerTest == CoverClawback) @@ -1436,10 +1442,467 @@ class LoanBroker_test : public beast::unit_test::suite }); } + void + testLoanBrokerSetDebtMaximum() + { + testcase("testLoanBrokerSetDebtMaximum"); + using namespace jtx; + using namespace loanBroker; + Account const issuer{"issuer"}; + Account const alice{"alice"}; + Env env(*this); + Vault vault{env}; + + env.fund(XRP(100'000), issuer, alice); + env.close(); + + PrettyAsset const asset = [&]() { + env(trust(alice, issuer["IOU"](1'000'000)), THISLINE); + env.close(); + return PrettyAsset(issuer["IOU"]); + }(); + + env(pay(issuer, alice, asset(100'000)), THISLINE); + env.close(); + + auto [tx, vaultKeylet] = vault.create({.owner = alice, .asset = asset}); + env(tx, THISLINE); + env.close(); + auto const le = env.le(vaultKeylet); + VaultInfo vaultInfo = [&]() { + if (BEAST_EXPECT(le)) + return VaultInfo{asset, vaultKeylet.key, le->at(sfAccount)}; + return VaultInfo{asset, {}, {}}; + }(); + if (vaultInfo.vaultID == uint256{}) + return; + + env(vault.deposit( + {.depositor = alice, + .id = vaultKeylet.key, + .amount = asset(50)}), + THISLINE); + env.close(); + + auto const brokerKeylet = + keylet::loanbroker(alice.id(), env.seq(alice)); + env(set(alice, vaultInfo.vaultID), THISLINE); + env.close(); + + Account const borrower{"borrower"}; + env.fund(XRP(1'000), borrower); + env(loan::set(borrower, brokerKeylet.key, asset(50).value()), + sig(sfCounterpartySignature, alice), + fee(env.current()->fees().base * 2), + THISLINE); + auto const broker = env.le(brokerKeylet); + if (!BEAST_EXPECT(broker)) + return; + + BEAST_EXPECT(broker->at(sfDebtTotal) == 50); + auto debtTotal = broker->at(sfDebtTotal); + + auto tx2 = set(alice, vaultInfo.vaultID); + tx2[sfLoanBrokerID] = to_string(brokerKeylet.key); + tx2[sfDebtMaximum] = debtTotal - 1; + env(tx2, ter(tecLIMIT_EXCEEDED), THISLINE); + + tx2[sfDebtMaximum] = debtTotal + 1; + env(tx2, ter(tesSUCCESS), THISLINE); + + tx2[sfDebtMaximum] = 0; + env(tx2, ter(tesSUCCESS), THISLINE); + } + + void + testRIPD4323() + { + testcase << "RIPD-4323"; + using namespace jtx; + Account const issuer("issuer"); + Account const holder("holder"); + Account const& broker = issuer; + + auto test = [&](auto&& getToken) { + Env env(*this); + + env.fund(XRP(1'000), issuer, holder); + env.close(); + + auto const [token, deposit, err] = getToken(env); + + Vault vault(env); + auto const [tx, keylet] = + vault.create({.owner = broker, .asset = token.asset()}); + env(tx); + env.close(); + + env(vault.deposit( + {.depositor = broker, .id = keylet.key, .amount = deposit}), + ter(err)); + env.close(); + + auto const brokerKeylet = + keylet::loanbroker(broker, env.seq(broker)); + + env(loanBroker::set(broker, keylet.key)); + env.close(); + + env(loanBroker::coverDeposit(broker, brokerKeylet.key, deposit), + ter(err)); + env.close(); + }; + + test([&](Env&) { + // issuer can issue any amount + auto const token = issuer["IOU"]; + return std::make_tuple(token, token(1'000), tesSUCCESS); + }); + std::vector, // max amount + std::uint64_t, // deposit amount + TER>> // expected error + mptTests = { + // issuer can issue up to 2'000 tokens + {2'000, 4'000, 1'000, tesSUCCESS}, + // issuer can issue 500 tokens (250 VaultDeposit + + // 250 LoanBrokerCoverDeposit) + {2'000, 2'500, 250, tesSUCCESS}, + // issuer can issue 500 tokens (250 VaultDeposit + + // 250 LoanBrokerCoverDeposit). MaximumAmount is default. + {maxMPTokenAmount - 500, std::nullopt, 250, tesSUCCESS}, + // issuer can issue 500, and fails on depositing 1'000 + {2'000, 2'500, 1'000, tecINSUFFICIENT_FUNDS}, + // issuer has already issued MaximumAmount + {2'000, 2'000, 1'000, tecINSUFFICIENT_FUNDS}, + // issuer has already issued MaximumAmount. MaximumAmount is + // default. + {maxMPTokenAmount, std::nullopt, 250, tecINSUFFICIENT_FUNDS}, + }; + for (auto const& [pay, max, deposit, err] : mptTests) + { + test([&](Env& env) -> std::tuple { + MPT const token = MPTTester( + {.env = env, + .issuer = issuer, + .holders = {holder}, + .pay = pay, + .flags = MPTDEXFlags, + .maxAmt = max}); + return std::make_tuple(token, token(deposit), err); + }); + } + } + + void + testAMB06_VaultFreezeCheckMissing() + { + testcase << "RIPD-4466 - LoanBrokerSet disallows frozen vaults"; + using namespace jtx; + Env env(*this); + + Account const issuer{"issuer"}, lender{"lender"}, borrower{"borrower"}; + env.fund(XRP(20'000), issuer, lender, borrower); + auto const IOU = issuer["IOU"]; + + Vault vault{env}; + auto [tx, vaultKeylet] = + vault.create({.owner = lender, .asset = IOU.asset()}); + env(tx); + env.close(); + + // Get vault pseudo-account and FREEZE it + auto const vaultSle = env.le(vaultKeylet); + auto const vaultPseudo = vaultSle->at(sfAccount); + auto const vaultPseudoAcct = Account("VaultPseudo", vaultPseudo); + env(trust(issuer, vaultPseudoAcct["IOU"](0), tfSetFreeze)); + + env(loanBroker::set(lender, vaultKeylet.key), ter(tecFROZEN)); + } + + void + testRIPD4274IOU() + { + using namespace jtx; + Account issuer("broker"); + Account broker("issuer"); + Account dest("destination"); + auto const token = issuer["IOU"]; + + enum TrustState { + RequireAuth, + ZeroLimit, + ReachedLimit, + NearLimit, + NoTrustLine, + }; + + auto test = [&](TrustState trustState) { + Env env(*this); + + testcase << "RIPD-4274 IOU with state: " + << static_cast(trustState); + + auto setTrustLine = [&](Account const& acct, TrustState state) { + switch (state) + { + case RequireAuth: + env(trust(issuer, token(0), acct, tfSetfAuth)); + break; + case ZeroLimit: { + auto jv = trust(acct, token(0)); + // set QualityIn so that the trustline is not + // auto-deleted + jv[sfQualityIn] = 10'000'000; + env(jv); + } + break; + case ReachedLimit: { + env(trust(acct, token(1'000))); + env(pay(issuer, acct, token(1'000))); + env.close(); + } + break; + case NearLimit: { + env(trust(acct, token(1'000))); + env(pay(issuer, acct, token(950))); + env.close(); + } + break; + case NoTrustLine: + // don't create a trustline + break; + default: + BEAST_EXPECT(false); + } + env.close(); + }; + + env.fund(XRP(1'000), issuer, broker, dest); + env.close(); + + if (trustState == RequireAuth) + { + env(fset(issuer, asfRequireAuth)); + env.close(); + + setTrustLine(broker, RequireAuth); + } + + setTrustLine(dest, trustState); + + env(trust(broker, token(2'000), 0)); + env(pay(issuer, broker, token(2'000))); + env.close(); + + Vault vault(env); + auto const [tx, keylet] = + vault.create({.owner = broker, .asset = token.asset()}); + env(tx); + env.close(); + + // Test Vault withdraw + env(vault.deposit( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)})); + env.close(); + + env(vault.withdraw( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)}), + loanBroker::destination(dest), + ter(std::ignore)); + BEAST_EXPECT(env.ter() == tecNO_LINE); + env.close(); + + env(vault.withdraw( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)})); + + // Test LoanBroker withdraw + auto const brokerKeylet = + keylet::loanbroker(broker, env.seq(broker)); + + env(loanBroker::set(broker, keylet.key)); + env.close(); + + env(loanBroker::coverDeposit( + broker, brokerKeylet.key, token(1'000))); + env.close(); + + env(loanBroker::coverWithdraw(broker, brokerKeylet.key, token(100)), + loanBroker::destination(dest), + ter(std::ignore)); + BEAST_EXPECT(env.ter() == tecNO_LINE); + env.close(); + + // Clearing RequireAuth shouldn't change the result + if (trustState == RequireAuth) + { + env(fclear(issuer, asfRequireAuth)); + env.close(); + + env(loanBroker::coverWithdraw( + broker, brokerKeylet.key, token(100)), + loanBroker::destination(dest), + ter(std::ignore)); + BEAST_EXPECT(env.ter() == tecNO_LINE); + env.close(); + } + }; + + test(RequireAuth); + test(ZeroLimit); + test(ReachedLimit); + test(NearLimit); + test(NoTrustLine); + } + + void + testRIPD4274MPT() + { + using namespace jtx; + Account issuer("broker"); + Account broker("issuer"); + Account dest("destination"); + + enum MPTState { + RequireAuth, + ReachedMAX, + NoMPT, + }; + + auto test = [&](MPTState MPTState) { + Env env(*this); + + testcase << "RIPD-4274 MPT with state: " + << static_cast(MPTState); + + env.fund(XRP(1'000), issuer, broker, dest); + env.close(); + + auto const maybeToken = [&]() -> std::optional { + switch (MPTState) + { + case RequireAuth: { + auto tester = MPTTester( + {.env = env, + .issuer = issuer, + .holders = {broker, dest}, + .pay = 2'000, + .flags = MPTDEXFlags | tfMPTRequireAuth, + .authHolder = true, + .maxAmt = 5'000}); + // unauthorize dest + tester.authorize( + {.account = issuer, + .holder = dest, + .flags = tfMPTUnauthorize}); + return tester; + } + case ReachedMAX: { + auto tester = MPTTester( + {.env = env, + .issuer = issuer, + .holders = {broker, dest}, + .pay = 2'000, + .flags = MPTDEXFlags, + .maxAmt = 4'000}); + BEAST_EXPECT( + env.balance(issuer, tester) == tester(-4'000)); + return tester; + } + case NoMPT: { + return MPTTester( + {.env = env, + .issuer = issuer, + .holders = {broker}, + .pay = 2'000, + .flags = MPTDEXFlags, + .maxAmt = 4'000}); + } + default: + return std::nullopt; + } + }(); + if (!BEAST_EXPECT(maybeToken)) + return; + + auto const& token = *maybeToken; + + Vault vault(env); + auto const [tx, keylet] = + vault.create({.owner = broker, .asset = token.asset()}); + env(tx); + env.close(); + + // Test Vault withdraw + env(vault.deposit( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)})); + env.close(); + + env(vault.withdraw( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)}), + loanBroker::destination(dest), + ter(std::ignore)); + + // Shouldn't fail if at MaximumAmount since no new tokens are issued + TER const err = + MPTState == ReachedMAX ? TER(tesSUCCESS) : tecNO_AUTH; + BEAST_EXPECT(env.ter() == err); + env.close(); + + if (err != tesSUCCESS) + { + env(vault.withdraw( + {.depositor = broker, + .id = keylet.key, + .amount = token(1'000)})); + } + + // Test LoanBroker withdraw + auto const brokerKeylet = + keylet::loanbroker(broker, env.seq(broker)); + + env(loanBroker::set(broker, keylet.key)); + env.close(); + + env(loanBroker::coverDeposit( + broker, brokerKeylet.key, token(1'000))); + env.close(); + + env(loanBroker::coverWithdraw(broker, brokerKeylet.key, token(100)), + loanBroker::destination(dest), + ter(std::ignore)); + BEAST_EXPECT(env.ter() == err); + env.close(); + }; + + test(RequireAuth); + test(ReachedMAX); + test(NoMPT); + } + + void + testRIPD4274() + { + testRIPD4274IOU(); + testRIPD4274MPT(); + } + public: void run() override { + testLoanBrokerSetDebtMaximum(); testLoanBrokerCoverDepositNullVault(); testDisabled(); @@ -1451,6 +1914,11 @@ public: testInvalidLoanBrokerSet(); testRequireAuth(); + testRIPD4323(); + testAMB06_VaultFreezeCheckMissing(); + + testRIPD4274(); + // TODO: Write clawback failure tests with an issuer / MPT that doesn't // have the right flags set. } diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index 7c2e83aa19..e4f5360043 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -11,6 +11,8 @@ #include #include +#include + namespace xrpl { namespace test { @@ -141,7 +143,7 @@ protected: using namespace jtx; auto const vaultSle = env.le(keylet::vault(vaultID)); - return getVaultScale(vaultSle); + return getAssetsTotalScale(vaultSle); } }; @@ -372,7 +374,7 @@ protected: if (auto loan = env.le(loanKeylet); env.test.BEAST_EXPECT(loan)) { env.test.BEAST_EXPECT( - loan->at(sfPreviousPaymentDate) == previousPaymentDate); + loan->at(sfPreviousPaymentDueDate) == previousPaymentDate); env.test.BEAST_EXPECT( loan->at(sfPaymentRemaining) == paymentRemaining); env.test.BEAST_EXPECT( @@ -507,7 +509,7 @@ protected: if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { return LoanState{ - .previousPaymentDate = loan->at(sfPreviousPaymentDate), + .previousPaymentDate = loan->at(sfPreviousPaymentDueDate), .startDate = tp{d{loan->at(sfStartDate)}}, .nextPaymentDate = loan->at(sfNextPaymentDueDate), .paymentRemaining = loan->at(sfPaymentRemaining), @@ -551,12 +553,15 @@ protected: broker.vaultScale(env), state.principalOutstanding.exponent()))); BEAST_EXPECT(state.paymentInterval == 600); - BEAST_EXPECT( - state.totalValue == - roundToAsset( - broker.asset, - state.periodicPayment * state.paymentRemaining, - state.loanScale)); + { + NumberRoundModeGuard mg(Number::upward); + BEAST_EXPECT( + state.totalValue == + roundToAsset( + broker.asset, + state.periodicPayment * state.paymentRemaining, + state.loanScale)); + } BEAST_EXPECT( state.managementFeeOutstanding == computeManagementFee( @@ -589,7 +594,7 @@ protected: auto const unrealizedLoss = vaultSle->at(sfLossUnrealized) + state.totalValue - state.managementFeeOutstanding; - if (unrealizedLoss > assetsUnavailable) + if (!BEAST_EXPECT(unrealizedLoss <= assetsUnavailable)) { return false; } @@ -705,8 +710,9 @@ protected: << "\tManagement Fee Rate: " << feeRate << std::endl << "\tTotal Payments: " << total << std::endl << "\tPeriodic Payment: " << props.periodicPayment << std::endl - << "\tTotal Value: " << props.totalValueOutstanding << std::endl - << "\tManagement Fee: " << props.managementFeeOwedToBroker + << "\tTotal Value: " << props.loanState.valueOutstanding + << std::endl + << "\tManagement Fee: " << props.loanState.managementFeeDue << std::endl << "\tLoan Scale: " << props.loanScale << std::endl << "\tFirst payment principal: " << props.firstPaymentPrincipal @@ -856,9 +862,6 @@ protected: using namespace std::chrono_literals; using d = NetClock::duration; - // Account const evan{"evan"}; - // Account const alice{"alice"}; - bool const showStepBalances = paymentParams.showStepBalances; auto const currencyLabel = getCurrencyLabel(broker.asset); @@ -911,7 +914,7 @@ protected: state.principalOutstanding, state.managementFeeOutstanding); { - auto const raw = computeRawLoanState( + auto const raw = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -964,7 +967,7 @@ protected: Number totalFeesPaid = 0; std::size_t totalPaymentsMade = 0; - xrpl::LoanState currentTrueState = computeRawLoanState( + xrpl::LoanState currentTrueState = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -1019,7 +1022,7 @@ protected: paymentComponents.trackedInterestPart() + paymentComponents.trackedManagementFeeDelta); - xrpl::LoanState const nextTrueState = computeRawLoanState( + xrpl::LoanState const nextTrueState = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining - 1, @@ -1271,7 +1274,8 @@ protected: verifyLoanStatus, issuer, lender, - borrower); + borrower, + PaymentParameters{.showStepBalances = true}); } /** Runs through the complete lifecycle of a loan @@ -1452,7 +1456,7 @@ protected: BEAST_EXPECT( loan->at(sfPaymentInterval) == *loanParams.payInterval); BEAST_EXPECT(loan->at(sfGracePeriod) == *loanParams.gracePd); - BEAST_EXPECT(loan->at(sfPreviousPaymentDate) == 0); + BEAST_EXPECT(loan->at(sfPreviousPaymentDueDate) == 0); BEAST_EXPECT( loan->at(sfNextPaymentDueDate) == startDate + *loanParams.payInterval); @@ -1484,9 +1488,9 @@ protected: startDate + *loanParams.payInterval, *loanParams.payTotal, state.loanScale, - loanProperties.totalValueOutstanding, + loanProperties.loanState.valueOutstanding, principalRequestAmount, - loanProperties.managementFeeOwedToBroker, + loanProperties.loanState.managementFeeDue, loanProperties.periodicPayment, loanFlags | 0); @@ -1541,9 +1545,9 @@ protected: nextDueDate, *loanParams.payTotal, loanProperties.loanScale, - loanProperties.totalValueOutstanding, + loanProperties.loanState.valueOutstanding, principalRequestAmount, - loanProperties.managementFeeOwedToBroker, + loanProperties.loanState.managementFeeDue, loanProperties.periodicPayment, loanFlags | 0); @@ -2448,13 +2452,18 @@ protected: // Make all the payments in one transaction // service fee is 2 auto const startingPayments = state.paymentRemaining; - auto const rawPayoff = startingPayments * - (state.periodicPayment + broker.asset(2).value()); - STAmount const payoffAmount{broker.asset, rawPayoff}; - BEAST_EXPECT( - payoffAmount == - broker.asset(Number(1024014840139457, -12))); - BEAST_EXPECT(payoffAmount > state.principalOutstanding); + STAmount const payoffAmount = [&]() { + NumberRoundModeGuard mg(Number::upward); + auto const rawPayoff = startingPayments * + (state.periodicPayment + broker.asset(2).value()); + STAmount const payoffAmount{broker.asset, rawPayoff}; + BEAST_EXPECTS( + payoffAmount == + broker.asset(Number(1024014840139457, -12)), + to_string(payoffAmount)); + BEAST_EXPECT(payoffAmount > state.principalOutstanding); + return payoffAmount; + }(); singlePayment( loanKeylet, @@ -2662,7 +2671,7 @@ protected: Number::upward)); { - auto const raw = computeRawLoanState( + auto const raw = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -2705,7 +2714,7 @@ protected: Number totalInterestPaid = 0; std::size_t totalPaymentsMade = 0; - xrpl::LoanState currentTrueState = computeRawLoanState( + xrpl::LoanState currentTrueState = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -2730,11 +2739,12 @@ protected: paymentComponents.trackedValueDelta <= roundedPeriodicPayment); - xrpl::LoanState const nextTrueState = computeRawLoanState( - state.periodicPayment, - periodicRate, - state.paymentRemaining - 1, - broker.params.managementFeeRate); + xrpl::LoanState const nextTrueState = + computeTheoreticalLoanState( + state.periodicPayment, + periodicRate, + state.paymentRemaining - 1, + broker.params.managementFeeRate); detail::LoanStateDeltas const deltas = currentTrueState - nextTrueState; @@ -3453,11 +3463,12 @@ protected: ter{tecNO_AUTH}); env.close(); - // Can create loan without origination fee + // Cannot create loan, even without an origination fee env(set(borrower, broker.brokerID, principalRequest), counterparty(lender), sig(sfCounterpartySignature, lender), - fee(env.current()->fees().base * 5)); + fee(env.current()->fees().base * 5), + ter{tecNO_AUTH}); env.close(); // No MPToken for lender - no authorization and no payment @@ -3578,6 +3589,52 @@ protected: fee(env.current()->fees().base * 5)); }, CaseArgs{.requireAuth = true, .authorizeBorrower = true}); + + testCase( + [&, this](Env& env, BrokerInfo const& broker, auto&) { + using namespace loan; + Number const principalRequest = broker.asset(1'000).value(); + Vault vault{env}; + auto tx = vault.set({.owner = lender, .id = broker.vaultID}); + tx[sfAssetsMaximum] = BrokerParameters::defaults().vaultDeposit; + env(tx); + env.close(); + + testcase("Vault at maximum value"); + env(set(issuer, broker.brokerID, principalRequest), + counterparty(lender), + interestRate(TenthBips32(10'000)), + sig(sfCounterpartySignature, lender), + fee(env.current()->fees().base * 5), + ter(tecLIMIT_EXCEEDED), + THISLINE); + }, + nullptr); + + testCase( + [&, this](Env& env, BrokerInfo const& broker, auto&) { + using namespace loan; + Number const principalRequest = broker.asset(1'000).value(); + Vault vault{env}; + auto tx = vault.set({.owner = lender, .id = broker.vaultID}); + tx[sfAssetsMaximum] = + BrokerParameters::defaults().vaultDeposit + + broker.asset(1).number(); + env(tx); + env.close(); + + testcase("Vault maximum value exceeded"); + env(set(issuer, broker.brokerID, principalRequest), + counterparty(lender), + interestRate(TenthBips32(100'000)), + sig(sfCounterpartySignature, lender), + fee(env.current()->fees().base * 5), + paymentTotal(2), + paymentInterval(3600 * 24), + ter(tecLIMIT_EXCEEDED), + THISLINE); + }, + nullptr); } void @@ -3813,7 +3870,7 @@ protected: BEAST_EXPECT(loan[sfPaymentInterval] == 60); BEAST_EXPECT(loan[sfPeriodicPayment] == "1000000000"); BEAST_EXPECT(loan[sfPaymentRemaining] == 1); - BEAST_EXPECT(!loan.isMember(sfPreviousPaymentDate)); + BEAST_EXPECT(!loan.isMember(sfPreviousPaymentDueDate)); BEAST_EXPECT(loan[sfPrincipalOutstanding] == "1000000000"); BEAST_EXPECT(loan[sfTotalValueOutstanding] == "1000000000"); BEAST_EXPECT(!loan.isMember(sfLoanScale)); @@ -3994,7 +4051,6 @@ protected: createJson["CloseInterestRate"] = 55374; createJson["ClosePaymentFee"] = "3825205248"; - createJson["GracePeriod"] = 0; createJson["LatePaymentFee"] = "237"; createJson["LoanOriginationFee"] = "0"; createJson["OverpaymentFee"] = 35167; @@ -4009,7 +4065,7 @@ protected: createJson = env.json(createJson, sig(sfCounterpartySignature, lender)); // Fails in preclaim because principal requested can't be // represented as XRP - env(createJson, ter(tecPRECISION_LOSS)); + env(createJson, ter(tecPRECISION_LOSS), THISLINE); env.close(); BEAST_EXPECT(!env.le(keylet)); @@ -4021,7 +4077,7 @@ protected: createJson = env.json(createJson, sig(sfCounterpartySignature, lender)); // Fails in doApply because the payment is too small to be // represented as XRP. - env(createJson, ter(tecPRECISION_LOSS)); + env(createJson, ter(tecPRECISION_LOSS), THISLINE); env.close(); } @@ -4455,15 +4511,6 @@ protected: }; } - void - testBasicMath() - { - // Test the functions defined in LendingHelpers.h - testcase("Basic Math"); - - pass(); - } - void testIssuerLoan() { @@ -4679,7 +4726,30 @@ protected: jtx::fee const& loanSetFee, Number const& debtMaximumRequest) { // first temBAD_SIGNER: TODO + // invalid grace period + { + // zero grace period + env(set(borrower, brokerInfo.brokerID, debtMaximumRequest), + sig(sfCounterpartySignature, lender), + gracePeriod(0), + loanSetFee, + ter(temINVALID)); + // grace period less than default minimum + env(set(borrower, brokerInfo.brokerID, debtMaximumRequest), + sig(sfCounterpartySignature, lender), + gracePeriod(LoanSet::defaultGracePeriod - 1), + loanSetFee, + ter(temINVALID)); + + // grace period greater than payment interval + env(set(borrower, brokerInfo.brokerID, debtMaximumRequest), + sig(sfCounterpartySignature, lender), + paymentInterval(120), + gracePeriod(121), + loanSetFee, + ter(temINVALID)); + } // empty/zero broker ID { auto jv = set(borrower, uint256{}, debtMaximumRequest); @@ -4980,7 +5050,6 @@ protected: createJson["CloseInterestRate"] = 47299; createJson["ClosePaymentFee"] = "3985819770"; - createJson["GracePeriod"] = 0; createJson["InterestRate"] = 92; createJson["LatePaymentFee"] = "3866894865"; createJson["LoanOriginationFee"] = "0"; @@ -4996,7 +5065,7 @@ protected: auto const keylet = keylet::loan(broker.brokerID, loanSequence); createJson = env.json(createJson, sig(sfCounterpartySignature, lender)); - env(createJson, ter(tecPRECISION_LOSS)); + env(createJson, ter(tecPRECISION_LOSS), THISLINE); env.close(startDate); auto loanPayTx = env.json( @@ -5133,7 +5202,6 @@ protected: json(sfCounterpartySignature, Json::objectValue)); createJson["ClosePaymentFee"] = "0"; - createJson["GracePeriod"] = 0; createJson["InterestRate"] = 24346; createJson["LateInterestRate"] = 65535; createJson["LatePaymentFee"] = "0"; @@ -5253,7 +5321,6 @@ protected: json(sfCounterpartySignature, Json::objectValue)); createJson["ClosePaymentFee"] = "0"; - createJson["GracePeriod"] = 0; createJson["InterestRate"] = 12833; createJson["LateInterestRate"] = 77048; createJson["LatePaymentFee"] = "0"; @@ -5347,7 +5414,7 @@ protected: set(borrower, broker.brokerID, Number{55524'81, -2}), fee(loanSetFee), closePaymentFee(0), - gracePeriod(0), + gracePeriod(LoanSet::defaultGracePeriod), interestRate(TenthBips32(12833)), lateInterestRate(TenthBips32(77048)), latePaymentFee(0), @@ -5851,7 +5918,7 @@ protected: auto const periodicRate = loanPeriodicRate(interestRateValue, state.paymentInterval); - auto const rawLoanState = computeRawLoanState( + auto const rawLoanState = computeTheoreticalLoanState( state.periodicPayment, periodicRate, state.paymentRemaining, @@ -6029,7 +6096,7 @@ protected: { // --- PoC Summary ---------------------------------------------------- // Scenario: Borrower makes one periodic payment early (before next due) - // so doPayment sets sfPreviousPaymentDate to the (future) + // so doPayment sets sfPreviousPaymentDueDate to the (future) // sfNextPaymentDueDate and advances sfNextPaymentDueDate by one // interval. Borrower then immediately performs a full-payment // (tfLoanFullPayment). Why it matters: Full-payment interest accrual @@ -6144,15 +6211,16 @@ protected: // Accrued + prepayment-penalty interest based on current periodic // schedule auto const fullPaymentInterest = computeFullPaymentInterest( - after.periodicPayment, + detail::loanPrincipalFromPeriodicPayment( + after.periodicPayment, periodicRate2, after.paymentRemaining), periodicRate2, - after.paymentRemaining, env.current()->parentCloseTime(), after.paymentInterval, after.previousPaymentDate, static_cast( after.startDate.time_since_epoch().count()), closeInterestRate); + // Round to asset scale and split interest/fee parts auto const roundedInterest = roundToAsset(asset.raw(), fullPaymentInterest, after.loanScale); @@ -6180,9 +6248,9 @@ protected: // window by clamping prevPaymentDate to 'now' for the full-pay path. auto const prevClamped = std::min(after.previousPaymentDate, nowSecs); auto const fullPaymentInterestClamped = computeFullPaymentInterest( - after.periodicPayment, + detail::loanPrincipalFromPeriodicPayment( + after.periodicPayment, periodicRate2, after.paymentRemaining), periodicRate2, - after.paymentRemaining, env.current()->parentCloseTime(), after.paymentInterval, prevClamped, @@ -6436,8 +6504,7 @@ protected: .lateFee = Number{200, -6}, .interest = TenthBips32{50'000}, .payTotal = 10, - .payInterval = 150, - .gracePd = 0}; + .payInterval = 150}; auto const assetType = AssetType::XRP; @@ -6458,9 +6525,6 @@ protected: auto state = getCurrentState(env, broker, loanKeylet); if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { - // log << "loan after create: " << to_string(loan->getJson()) - // << std::endl; - env.close(tp{d{ loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}}); } @@ -6475,16 +6539,10 @@ protected: { auto const submitParam = to_string(jv); - // log << "about to submit: " << submitParam << std::endl; auto const jr = env.rpc("submit", borrower.name(), submitParam); - // log << jr << std::endl; BEAST_EXPECT(jr.isMember(jss::result)); auto const jResult = jr[jss::result]; - // BEAST_EXPECT(jResult[jss::error] == "invalidTransaction"); - // BEAST_EXPECT( - // jResult[jss::error_exception] == - // "fails local checks: Transaction has bad signature."); } env.close(); @@ -6520,8 +6578,7 @@ protected: .counter = borrower, .principalRequest = Number{100'000, -4}, .interest = TenthBips32{100'000}, - .payTotal = 10, - .gracePd = 0}; + .payTotal = 10}; auto const assetType = AssetType::MPT; @@ -7007,11 +7064,8 @@ protected: env.close(); PaymentParameters paymentParams{ - //.overpaymentFactor = Number{15, -1}, - //.overpaymentExtra = Number{1, -6}, - //.flags = tfLoanOverpayment, - .showStepBalances = true, - //.validateBalances = false, + .showStepBalances = false, + .validateBalances = true, }; makeLoanPayments( @@ -7026,6 +7080,532 @@ protected: paymentParams); } + void + testOverpaymentManagementFee() + { + testcase("testOverpaymentManagementFee"); + + using namespace jtx; + using namespace loan; + + Env env(*this, all); + + Account const lender{"lender"}, borrower{"borrower"}; + + env.fund(XRP(10'000'000), lender, borrower); + env.close(); + + PrettyAsset const asset{xrpIssue(), 1000}; + + auto const result = createVaultAndBroker( + env, + asset, + lender, + { + .vaultDeposit = asset(100'000).value(), + .managementFeeRate = TenthBips16(10'000), + }); + + auto const loanSetFee = fee(env.current()->fees().base * 2); + + auto const loanKeylet = keylet::loan( + result.brokerKeylet().key, + (env.le(result.brokerKeylet()))->at(sfLoanSequence)); + env(loan::set( + borrower, + result.brokerKeylet().key, + asset(10'000).value(), + tfLoanOverpayment), + sig(sfCounterpartySignature, lender), + loan::paymentInterval(86400 * 30), + loan::paymentTotal(3), + loan::overpaymentInterestRate( + TenthBips32(percentageToTenthBips(20))), + loanSetFee); + + // From calculator + auto const expectedOverpaymentManagementFee = Number{33333, 0}; + auto const loanBrokerBalanceBefore = env.balance(lender); + + auto const loanPayFee = fee(env.current()->fees().base * 2); + env(pay(borrower, + loanKeylet.key, + asset(5'000).value(), + tfLoanOverpayment), + loanPayFee); + env.close(); + + BEAST_EXPECTS( + env.balance(lender) - loanBrokerBalanceBefore == + expectedOverpaymentManagementFee, + "overpayment management fee missmatch; expected:" + + to_string(expectedOverpaymentManagementFee) + " got: " + + to_string(env.balance(lender) - loanBrokerBalanceBefore)); + } + + void + testLoanPayBrokerOwnerMissingTrustline() + { + testcase << "LoanPay Broker Owner Missing Trustline (PoC)"; + using namespace jtx; + using namespace loan; + Account const issuer("issuer"); + Account const borrower("borrower"); + Account const broker("broker"); + auto const IOU = issuer["IOU"]; + Env env(*this, all); + env.fund(XRP(20'000), issuer, broker, borrower); + env.close(); + // Set up trustlines and fund accounts + env(trust(broker, IOU(20'000'000))); + env(trust(borrower, IOU(20'000'000))); + env(pay(issuer, broker, IOU(10'000'000))); + env(pay(issuer, borrower, IOU(1'000))); + env.close(); + // Create vault and broker + auto const brokerInfo = createVaultAndBroker(env, IOU, broker); + // Create a loan first (this creates debt) + auto const keylet = keylet::loan(brokerInfo.brokerID, 1); + env(set(borrower, brokerInfo.brokerID, 10'000), + sig(sfCounterpartySignature, broker), + loanServiceFee(IOU(100).value()), + paymentInterval(100), + fee(XRP(100))); + env.close(); + // Ensure broker has sufficient cover so brokerPayee == brokerOwner + // We need coverAvailable >= (debtTotal * coverRateMinimum) + // Deposit enough cover to ensure the fee goes to broker owner + // The default coverRateMinimum is 10%, so for a 10,000 loan we need + // at least 1,000 cover. Default cover is 1,000, so we add more to be + // safe. + auto const additionalCover = IOU(50'000).value(); + env(loanBroker::coverDeposit( + broker, brokerInfo.brokerID, STAmount{IOU, additionalCover})); + env.close(); + // Verify broker owner has a trustline + auto const brokerTrustline = keylet::line(broker, IOU); + BEAST_EXPECT(env.le(brokerTrustline) != nullptr); + // Broker owner deletes their trustline + // First, pay any positive balance to issuer to zero it out + auto const brokerBalance = env.balance(broker, IOU); + env(pay(broker, issuer, brokerBalance)); + env.close(); + // Remove the trustline by setting limit to 0 + env(trust(broker, IOU(0))); + env.close(); + // Verify trustline is deleted + BEAST_EXPECT(env.le(brokerTrustline) == nullptr); + // Now borrower tries to make a payment + // We should get a tesSUCCESS instead of a tecNO_LINE. + env(pay(borrower, keylet.key, IOU(10'100)), + fee(XRP(100)), + ter(tesSUCCESS)); + env.close(); + // Verify trustline is still deleted + BEAST_EXPECT(env.le(brokerTrustline) == nullptr); + // Verify the service fee went to the broker pseudo-account + if (auto const brokerSle = + env.le(keylet::loanbroker(brokerInfo.brokerID)); + BEAST_EXPECT(brokerSle)) + { + Account const pseudo("pseudo-account", brokerSle->at(sfAccount)); + auto const balance = env.balance(pseudo, IOU); + // 1,000 default + 50,000 extra + 100 service fee from LoanPay + BEAST_EXPECTS( + balance == IOU(51'100), to_string(Json::Value(balance))); + } + } + + void + testLoanPayBrokerOwnerUnauthorizedMPT() + { + testcase << "LoanPay Broker Owner MPT unauthorized"; + using namespace jtx; + using namespace loan; + + Account const issuer("issuer"); + Account const borrower("borrower"); + Account const broker("broker"); + + Env env(*this, all); + env.fund(XRP(20'000), issuer, broker, borrower); + env.close(); + + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create( + {.flags = tfMPTCanClawback | tfMPTCanTransfer | tfMPTCanLock}); + + PrettyAsset const MPT{mptt.issuanceID()}; + + // Authorize broker and borrower + mptt.authorize({.account = broker}); + mptt.authorize({.account = borrower}); + + env.close(); + + // Fund accounts + env(pay(issuer, broker, MPT(10'000'000))); + env(pay(issuer, borrower, MPT(1'000))); + env.close(); + + // Create vault and broker + auto const brokerInfo = createVaultAndBroker(env, MPT, broker); + // Create a loan first (this creates debt) + auto const keylet = keylet::loan(brokerInfo.brokerID, 1); + env(set(borrower, brokerInfo.brokerID, 10'000), + sig(sfCounterpartySignature, broker), + loanServiceFee(MPT(100).value()), + paymentInterval(100), + fee(XRP(100))); + env.close(); + // Ensure broker has sufficient cover so brokerPayee == brokerOwner + // We need coverAvailable >= (debtTotal * coverRateMinimum) + // Deposit enough cover to ensure the fee goes to broker owner + // The default coverRateMinimum is 10%, so for a 10,000 loan we need + // at least 1,000 cover. Default cover is 1,000, so we add more to be + // safe. + auto const additionalCover = MPT(50'000).value(); + env(loanBroker::coverDeposit( + broker, brokerInfo.brokerID, STAmount{MPT, additionalCover})); + env.close(); + // Verify broker owner is authorized + auto const brokerMpt = keylet::mptoken(mptt.issuanceID(), broker); + BEAST_EXPECT(env.le(brokerMpt) != nullptr); + // Broker owner unauthorizes. + // First, pay any positive balance to issuer to zero it out + auto const brokerBalance = env.balance(broker, MPT); + env(pay(broker, issuer, brokerBalance)); + env.close(); + // Then, unauthorize the MPT. + mptt.authorize({.account = broker, .flags = tfMPTUnauthorize}); + env.close(); + // Verify the MPT is unauthorized. + BEAST_EXPECT(env.le(brokerMpt) == nullptr); + // Now borrower tries to make a payment + // We should get a tesSUCCESS instead of a tecNO_AUTH. + auto const borrowerBalance = env.balance(borrower, MPT); + env(pay(borrower, keylet.key, MPT(10'100)), + fee(XRP(100)), + ter(tesSUCCESS)); + env.close(); + // Verify the MPT is still unauthorized. + BEAST_EXPECT(env.le(brokerMpt) == nullptr); + // Verify the service fee went to the broker pseudo-account + if (auto const brokerSle = + env.le(keylet::loanbroker(brokerInfo.brokerID)); + BEAST_EXPECT(brokerSle)) + { + Account const pseudo("pseudo-account", brokerSle->at(sfAccount)); + auto const balance = env.balance(pseudo, MPT); + // 1,000 default + 50,000 extra + 100 service fee from LoanPay + BEAST_EXPECTS( + balance == MPT(51'100), to_string(Json::Value(balance))); + } + } + + void + testLoanPayBrokerOwnerNoPermissionedDomainMPT() + { + testcase + << "LoanPay Broker Owner without permissioned domain of the MPT"; + using namespace jtx; + using namespace loan; + + Account const issuer("issuer"); + Account const borrower("borrower"); + Account const broker("broker"); + + Env env(*this, all); + env.fund(XRP(20'000), issuer, broker, borrower); + env.close(); + + auto credType = "credential1"; + + pdomain::Credentials const credentials1{{issuer, credType}}; + env(pdomain::setTx(issuer, credentials1)); + env.close(); + + auto domainID = pdomain::getNewDomain(env.meta()); + + env(credentials::create(broker, issuer, credType)); + env(credentials::accept(broker, issuer, credType)); + env.close(); + + env(credentials::create(borrower, issuer, credType)); + env(credentials::accept(borrower, issuer, credType)); + env.close(); + + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create({ + .flags = tfMPTCanClawback | tfMPTRequireAuth | tfMPTCanTransfer | + tfMPTCanLock, + .domainID = domainID, + }); + + PrettyAsset const MPT{mptt.issuanceID()}; + + // Authorize broker and borrower + mptt.authorize({.account = broker}); + mptt.authorize({.account = borrower}); + + env.close(); + + // Fund accounts + env(pay(issuer, broker, MPT(10'000'000))); + env(pay(issuer, borrower, MPT(1'000))); + env.close(); + + // Create vault and broker + auto const brokerInfo = createVaultAndBroker(env, MPT, broker); + // Create a loan first (this creates debt) + auto const keylet = keylet::loan(brokerInfo.brokerID, 1); + env(set(borrower, brokerInfo.brokerID, 10'000), + sig(sfCounterpartySignature, broker), + loanServiceFee(MPT(100).value()), + paymentInterval(100), + fee(XRP(100))); + env.close(); + // Ensure broker has sufficient cover so brokerPayee == brokerOwner + // We need coverAvailable >= (debtTotal * coverRateMinimum) + // Deposit enough cover to ensure the fee goes to broker owner + // The default coverRateMinimum is 10%, so for a 10,000 loan we need + // at least 1,000 cover. Default cover is 1,000, so we add more to be + // safe. + auto const additionalCover = MPT(50'000).value(); + env(loanBroker::coverDeposit( + broker, brokerInfo.brokerID, STAmount{MPT, additionalCover})); + env.close(); + // Verify broker owner is authorized + auto const brokerMpt = keylet::mptoken(mptt.issuanceID(), broker); + BEAST_EXPECT(env.le(brokerMpt) != nullptr); + // Remove the credentials for the Broker owner. + // First, pay any positive balance to issuer to zero it out + auto const brokerBalance = env.balance(broker, MPT); + env(pay(broker, issuer, brokerBalance)); + env.close(); + + env(credentials::deleteCred(broker, broker, issuer, credType)); + env.close(); + + // Make sure the broker is not authorized to hold the MPT after we + // deleted the credentials + env(pay(issuer, broker, MPT(1'000)), ter(tecNO_AUTH)); + + // Now borrower tries to make a payment + // We should get a tesSUCCESS instead of a tecNO_AUTH. + auto const borrowerBalance = env.balance(borrower, MPT); + env(pay(borrower, keylet.key, MPT(10'100)), + fee(XRP(100)), + ter(tesSUCCESS)); + env.close(); + // Verify broker is still not authorized + env(pay(issuer, broker, MPT(1'000)), ter(tecNO_AUTH)); + // Verify the service fee went to the broker pseudo-account + if (auto const brokerSle = + env.le(keylet::loanbroker(brokerInfo.brokerID)); + BEAST_EXPECT(brokerSle)) + { + Account const pseudo("pseudo-account", brokerSle->at(sfAccount)); + auto const balance = env.balance(pseudo, MPT); + // 1,000 default + 50,000 extra + 100 service fee from LoanPay + BEAST_EXPECTS( + balance == MPT(51'100), to_string(Json::Value(balance))); + } + } + + void + testLoanSetBrokerOwnerNoPermissionedDomainMPT() + { + testcase + << "LoanSet Broker Owner without permissioned domain of the MPT"; + using namespace jtx; + using namespace loan; + + Account const issuer("issuer"); + Account const borrower("borrower"); + Account const broker("broker"); + + Env env(*this, all); + env.fund(XRP(20'000), issuer, broker, borrower); + env.close(); + + auto credType = "credential1"; + + pdomain::Credentials const credentials1{{issuer, credType}}; + env(pdomain::setTx(issuer, credentials1)); + env.close(); + + auto domainID = pdomain::getNewDomain(env.meta()); + + // Add credentials for the broker and borrower + env(credentials::create(broker, issuer, credType)); + env(credentials::accept(broker, issuer, credType)); + env.close(); + + env(credentials::create(borrower, issuer, credType)); + env(credentials::accept(borrower, issuer, credType)); + env.close(); + + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create({ + .flags = tfMPTCanClawback | tfMPTRequireAuth | tfMPTCanTransfer | + tfMPTCanLock, + .domainID = domainID, + }); + + PrettyAsset const MPT{mptt.issuanceID()}; + + // Authorize broker and borrower + mptt.authorize({.account = broker}); + mptt.authorize({.account = borrower}); + env.close(); + + // Fund accounts + env(pay(issuer, broker, MPT(10'000'000))); + env(pay(issuer, borrower, MPT(1'000))); + env.close(); + + // Create vault and broker + auto const brokerInfo = createVaultAndBroker(env, MPT, broker); + + // Remove the credentials for the Broker owner. + // Clear the balance first. + auto const brokerBalance = env.balance(broker, MPT); + env(pay(broker, issuer, brokerBalance)); + env.close(); + // Delete the credentials + env(credentials::deleteCred(broker, broker, issuer, credType)); + env.close(); + + // Create a loan, this should fail for tecNO_AUTH + env(set(borrower, brokerInfo.brokerID, 10'000), + sig(sfCounterpartySignature, broker), + loanServiceFee(MPT(100).value()), + paymentInterval(100), + fee(XRP(100)), + ter(tecNO_AUTH)); + env.close(); + } + + void + testSequentialFLCDepletion() + { + testcase << "First-Loss Capital Depletion on Sequential Defaults"; + + using namespace jtx; + using namespace loan; + using namespace loanBroker; + + Env env(*this, all); + + Account const issuer{"issuer"}; + Account const lender{"lender"}; + Account const borrowerA{"borrowerA"}; + Account const borrowerB{"borrowerB"}; + + env.fund(XRP(1'000'000), issuer, lender, borrowerA, borrowerB); + env.close(); + + PrettyAsset const asset = xrpIssue(); + auto const vaultDepositAmount = + asset(200'000); // Enough for 2 x 50k loans plus interest/fees + + auto const brokerInfo = createVaultAndBroker( + env, + asset, + lender, + { + .vaultDeposit = vaultDepositAmount.value(), + .debtMax = 0, + .coverRateMin = TenthBips32(20000), // 20% + .coverDeposit = 21'000, + .managementFeeRate = TenthBips16(100), // 0.1% + .coverRateLiquidation = TenthBips32(100000), + }); + auto const brokerKeylet = brokerInfo.brokerKeylet(); + + // Create two identical loans: each 50,000 XRP principal (scaled down to + // avoid funding issues) Total DebtTotal will be ~100,000 XRP (principal + // + interest) Formula will calculate cover as: 100% × (20% × 100,000) = + // 20,000 XRP So we need FLC = 20,000 XRP to be fully consumed by first + // default + auto const principalAmount = Number(50'000); + auto const loanPaymentInterval = 2592000; // 30 days + auto const loanGracePeriod = 604800; // 7 days + + // Create Loan A + auto loanATx = env.jt( + set(borrowerA, brokerKeylet.key, principalAmount), + sig(sfCounterpartySignature, lender), + interestRate(TenthBips32(500)), // 5% + paymentTotal(12), + loan::paymentInterval(loanPaymentInterval), + loan::gracePeriod(loanGracePeriod), + fee(XRP(10))); // Sufficient fee for multi-sig transaction + env(loanATx); + env.close(); + + auto const loanAKeylet = keylet::loan(brokerKeylet.key, 1); + + // Create Loan B + auto loanBTx = env.jt( + set(borrowerB, brokerKeylet.key, principalAmount), + sig(sfCounterpartySignature, lender), + interestRate(TenthBips32(500)), // 5% + paymentTotal(12), + loan::paymentInterval(loanPaymentInterval), + loan::gracePeriod(loanGracePeriod), + fee(XRP(10))); // Sufficient fee for multi-sig transaction + env(loanBTx); + env.close(); + + auto const loanBKeylet = keylet::loan(brokerKeylet.key, 2); + + auto loanASle = env.le(loanAKeylet); + if (!BEAST_EXPECT(loanASle)) + return; + + // Advance time past grace period for both loans to be defaultable + auto const loanANextDue = loanASle->at(sfNextPaymentDueDate); + auto const loanAGrace = loanASle->at(sfGracePeriod); + env.close(std::chrono::seconds{loanANextDue + loanAGrace + 60}); + + env(manage(lender, loanAKeylet.key, tfLoanDefault), ter(tesSUCCESS)); + env.close(); + + // Verify Loan A is defaulted + loanASle = env.le(loanAKeylet); + if (!BEAST_EXPECT(loanASle)) + return; + BEAST_EXPECT(loanASle->isFlag(lsfLoanDefault)); + BEAST_EXPECT(loanASle->at(sfPaymentRemaining) == 0); + + // Check broker state after first default (from committed ledger) + auto brokerSle = env.le(brokerKeylet); + if (!BEAST_EXPECT(brokerSle)) + return; + auto const afterFirstDebtTotal = brokerSle->at(sfDebtTotal); + auto const afterFirstCoverAvailable = brokerSle->at(sfCoverAvailable); + + // DebtTotal should have decreased by Loan A's debt + BEAST_EXPECT(afterFirstDebtTotal == 50'134); + + // CoverAvailable should have decreased significantly + BEAST_EXPECT(afterFirstCoverAvailable == 946); + + env(manage(lender, loanBKeylet.key, tfLoanDefault), ter(tesSUCCESS)); + + brokerSle = env.le(brokerKeylet); + if (!BEAST_EXPECT(brokerSle)) + return; + auto const afterSecondDebtTotal = brokerSle->at(sfDebtTotal); + auto const afterSecondCoverAvailable = brokerSle->at(sfCoverAvailable); + + BEAST_EXPECT(afterSecondDebtTotal == 0); + + BEAST_EXPECT(afterSecondCoverAvailable == 0); + } + public: void run() override @@ -7034,6 +7614,8 @@ public: testLoanPayLateFullPaymentBypassesPenalties(); testLoanCoverMinimumRoundingExploit(); #endif + testInvalidLoanSet(); + testCoverDepositWithdrawNonTransferableMPT(); testPoC_UnsignedUnderflowOnFullPayAfterEarlyPeriodic(); @@ -7045,12 +7627,9 @@ public: testServiceFeeOnBrokerDeepFreeze(); testRPC(); - testBasicMath(); - testInvalidLoanDelete(); testInvalidLoanManage(); testInvalidLoanPay(); - testInvalidLoanSet(); testBatchBypassCounterparty(); testLoanPayComputePeriodicPaymentValidRateInvariant(); @@ -7074,6 +7653,12 @@ public: testBorrowerIsBroker(); testIssuerIsBorrower(); testLimitExceeded(); + testOverpaymentManagementFee(); + testLoanPayBrokerOwnerMissingTrustline(); + testLoanPayBrokerOwnerUnauthorizedMPT(); + testLoanPayBrokerOwnerNoPermissionedDomainMPT(); + testLoanSetBrokerOwnerNoPermissionedDomainMPT(); + testSequentialFLCDepletion(); } }; @@ -7193,15 +7778,15 @@ class LoanArbitrary_test : public LoanBatch_test .vaultDeposit = 10000, .debtMax = 0, .coverRateMin = TenthBips32{0}, - // .managementFeeRate = TenthBips16{5919}, + .managementFeeRate = TenthBips16{0}, .coverRateLiquidation = TenthBips32{0}}; LoanParameters const loanParams{ .account = Account("lender"), .counter = Account("borrower"), - .principalRequest = Number{10000, 0}, - // .interest = TenthBips32{0}, - // .payTotal = 5816, - .payInterval = 150}; + .principalRequest = Number{200000, -6}, + .interest = TenthBips32{50000}, + .payTotal = 2, + .payInterval = 200}; runLoan(AssetType::XRP, brokerParams, loanParams); } diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index d0a1450d6c..a6d08b6531 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -5324,7 +5324,7 @@ class Vault_test : public beast::unit_test::suite // Create a simple Loan for the full amount of Vault assets env(set(depositor, brokerKeylet.key, asset(100).value()), loan::interestRate(TenthBips32(0)), - gracePeriod(10), + gracePeriod(60), paymentInterval(120), paymentTotal(10), sig(sfCounterpartySignature, owner), @@ -5344,7 +5344,7 @@ class Vault_test : public beast::unit_test::suite THISLINE); env.close(); - env.close(std::chrono::seconds{120 + 10}); + env.close(std::chrono::seconds{120 + 60}); env(manage(owner, loanKeylet.key, tfLoanDefault), ter(tesSUCCESS), diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index adffa8548a..ceb60eb319 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -644,7 +644,7 @@ MPTTester::operator[](std::string const& name) const } PrettyAmount -MPTTester::operator()(std::uint64_t amount) const +MPTTester::operator()(std::int64_t amount) const { return MPT("", issuanceID())(amount); } diff --git a/src/test/jtx/mpt.h b/src/test/jtx/mpt.h index 2f6bbb9ea8..3eea362b58 100644 --- a/src/test/jtx/mpt.h +++ b/src/test/jtx/mpt.h @@ -272,7 +272,7 @@ public: operator[](std::string const& name) const; PrettyAmount - operator()(std::uint64_t amount) const; + operator()(std::int64_t amount) const; operator Asset() const; diff --git a/src/xrpld/app/misc/LendingHelpers.h b/src/xrpld/app/misc/LendingHelpers.h index 071466f05c..79fc617569 100644 --- a/src/xrpld/app/misc/LendingHelpers.h +++ b/src/xrpld/app/misc/LendingHelpers.h @@ -84,50 +84,10 @@ struct LoanPaymentParts operator==(LoanPaymentParts const& other) const; }; -/* Describes the initial computed properties of a loan. - * - * This structure contains the fundamental calculated values that define a - * loan's payment structure and amortization schedule. These properties are - * computed: - * - At loan creation (LoanSet transaction) - * - When loan terms change (e.g., after an overpayment that reduces the loan - * balance) - */ -struct LoanProperties -{ - // The unrounded amount to be paid at each regular payment period. - // Calculated using the standard amortization formula based on principal, - // interest rate, and number of payments. - // The actual amount paid in the LoanPay transaction must be rounded up to - // the precision of the asset and loan. - Number periodicPayment; - - // The total amount the borrower will pay over the life of the loan. - // Equal to periodicPayment * paymentsRemaining. - // This includes principal, interest, and management fees. - Number totalValueOutstanding; - - // The total management fee that will be paid to the broker over the - // loan's lifetime. This is a percentage of the total interest (gross) - // as specified by the broker's management fee rate. - Number managementFeeOwedToBroker; - - // The scale (decimal places) used for rounding all loan amounts. - // This is the maximum of: - // - The asset's native scale - // - A minimum scale required to represent the periodic payment accurately - // All loan state values (principal, interest, fees) are rounded to this - // scale. - std::int32_t loanScale; - - // The principal portion of the first payment. - Number firstPaymentPrincipal; -}; - /** This structure captures the parts of a loan state. * - * Whether the values are raw (unrounded) or rounded will depend on how it was - * computed. + * Whether the values are theoretical (unrounded) or rounded will depend on how + * it was computed. * * Many of the fields can be derived from each other, but they're all provided * here to reduce code duplication and possible mistakes. @@ -161,6 +121,39 @@ struct LoanState } }; +/* Describes the initial computed properties of a loan. + * + * This structure contains the fundamental calculated values that define a + * loan's payment structure and amortization schedule. These properties are + * computed: + * - At loan creation (LoanSet transaction) + * - When loan terms change (e.g., after an overpayment that reduces the loan + * balance) + */ +struct LoanProperties +{ + // The unrounded amount to be paid at each regular payment period. + // Calculated using the standard amortization formula based on principal, + // interest rate, and number of payments. + // The actual amount paid in the LoanPay transaction must be rounded up to + // the precision of the asset and loan. + Number periodicPayment; + + // The loan's current state, with all values rounded to the loan's scale. + LoanState loanState; + + // The scale (decimal places) used for rounding all loan amounts. + // This is the maximum of: + // - The asset's native scale + // - A minimum scale required to represent the periodic payment accurately + // All loan state values (principal, interest, fees) are rounded to this + // scale. + std::int32_t loanScale; + + // The principal portion of the first payment. + Number firstPaymentPrincipal; +}; + // Some values get re-rounded to the vault scale any time they are adjusted. In // addition, they are prevented from ever going below zero. This helps avoid // accumulated rounding errors and leftover dust amounts. @@ -179,11 +172,12 @@ adjustImpreciseNumber( } inline int -getVaultScale(SLE::const_ref vaultSle) +getAssetsTotalScale(SLE::const_ref vaultSle) { if (!vaultSle) return Number::minExponent - 1; // LCOV_EXCL_LINE - return vaultSle->at(sfAssetsTotal).exponent(); + return STAmount{vaultSle->at(sfAsset), vaultSle->at(sfAssetsTotal)} + .exponent(); } TER @@ -196,20 +190,12 @@ checkLoanGuards( beast::Journal j); LoanState -computeRawLoanState( +computeTheoreticalLoanState( Number const& periodicPayment, Number const& periodicRate, std::uint32_t const paymentRemaining, TenthBips32 const managementFeeRate); -LoanState -computeRawLoanState( - Number const& periodicPayment, - TenthBips32 interestRate, - std::uint32_t paymentInterval, - std::uint32_t const paymentRemaining, - TenthBips32 const managementFeeRate); - // Constructs a valid LoanState object from arbitrary inputs LoanState constructLoanState( @@ -231,7 +217,7 @@ computeManagementFee( Number computeFullPaymentInterest( - Number const& rawPrincipalOutstanding, + Number const& theoreticalPrincipalOutstanding, Number const& periodicRate, NetClock::time_point parentCloseTime, std::uint32_t paymentInterval, @@ -239,17 +225,6 @@ computeFullPaymentInterest( std::uint32_t startDate, TenthBips32 closeInterestRate); -Number -computeFullPaymentInterest( - Number const& periodicPayment, - Number const& periodicRate, - std::uint32_t paymentRemaining, - NetClock::time_point parentCloseTime, - std::uint32_t paymentInterval, - std::uint32_t prevPaymentDate, - std::uint32_t startDate, - TenthBips32 closeInterestRate); - namespace detail { // These classes and functions should only be accessed by LendingHelper // functions and unit tests @@ -387,6 +362,70 @@ struct LoanStateDeltas nonNegative(); }; +Expected, TER> +tryOverpayment( + Asset const& asset, + std::int32_t loanScale, + ExtendedPaymentComponents const& overpaymentComponents, + LoanState const& roundedLoanState, + Number const& periodicPayment, + Number const& periodicRate, + std::uint32_t paymentRemaining, + TenthBips16 const managementFeeRate, + beast::Journal j); + +Number +computeRaisedRate(Number const& periodicRate, std::uint32_t paymentsRemaining); + +Number +computePaymentFactor( + Number const& periodicRate, + std::uint32_t paymentsRemaining); + +std::pair +computeInterestAndFeeParts( + Asset const& asset, + Number const& interest, + TenthBips16 managementFeeRate, + std::int32_t loanScale); + +Number +loanPeriodicPayment( + Number const& principalOutstanding, + Number const& periodicRate, + std::uint32_t paymentsRemaining); + +Number +loanPrincipalFromPeriodicPayment( + Number const& periodicPayment, + Number const& periodicRate, + std::uint32_t paymentsRemaining); + +Number +loanLatePaymentInterest( + Number const& principalOutstanding, + TenthBips32 lateInterestRate, + NetClock::time_point parentCloseTime, + std::uint32_t nextPaymentDueDate); + +Number +loanAccruedInterest( + Number const& principalOutstanding, + Number const& periodicRate, + NetClock::time_point parentCloseTime, + std::uint32_t startDate, + std::uint32_t prevPaymentDate, + std::uint32_t paymentInterval); + +ExtendedPaymentComponents +computeOverpaymentComponents( + Asset const& asset, + int32_t const loanScale, + Number const& overpayment, + TenthBips32 const overpaymentInterestRate, + TenthBips32 const overpaymentFeeRate, + TenthBips16 const managementFeeRate); + PaymentComponents computePaymentComponents( Asset const& asset, @@ -413,13 +452,22 @@ operator+(LoanState const& lhs, detail::LoanStateDeltas const& rhs); LoanProperties computeLoanProperties( Asset const& asset, - Number principalOutstanding, + Number const& principalOutstanding, TenthBips32 interestRate, std::uint32_t paymentInterval, std::uint32_t paymentsRemaining, TenthBips32 managementFeeRate, std::int32_t minimumScale); +LoanProperties +computeLoanProperties( + Asset const& asset, + Number const& principalOutstanding, + Number const& periodicRate, + std::uint32_t paymentsRemaining, + TenthBips32 managementFeeRate, + std::int32_t minimumScale); + bool isRounded(Asset const& asset, Number const& value, std::int32_t scale); diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/xrpld/app/misc/detail/LendingHelpers.cpp index 37385583e7..a8354ff049 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/xrpld/app/misc/detail/LendingHelpers.cpp @@ -100,6 +100,9 @@ computePaymentFactor( Number const& periodicRate, std::uint32_t paymentsRemaining) { + if (paymentsRemaining == 0) + return numZero; + // For zero interest, payment factor is simply 1/paymentsRemaining if (periodicRate == beast::zero) return Number{1} / paymentsRemaining; @@ -132,27 +135,6 @@ loanPeriodicPayment( computePaymentFactor(periodicRate, paymentsRemaining); } -/* Calculates the periodic payment amount from annualized interest rate. - * Converts the annual rate to periodic rate before computing payment. - * - * Equation (7) from XLS-66 spec, Section A-2 Equation Glossary - */ -Number -loanPeriodicPayment( - Number const& principalOutstanding, - TenthBips32 interestRate, - std::uint32_t paymentInterval, - std::uint32_t paymentsRemaining) -{ - if (principalOutstanding == 0 || paymentsRemaining == 0) - return 0; - - Number const periodicRate = loanPeriodicRate(interestRate, paymentInterval); - - return loanPeriodicPayment( - principalOutstanding, periodicRate, paymentsRemaining); -} - /* Reverse-calculates principal from periodic payment amount. * Used to determine theoretical principal at any point in the schedule. * @@ -164,6 +146,9 @@ loanPrincipalFromPeriodicPayment( Number const& periodicRate, std::uint32_t paymentsRemaining) { + if (paymentsRemaining == 0) + return numZero; + if (periodicRate == 0) return periodicPayment * paymentsRemaining; @@ -171,21 +156,6 @@ loanPrincipalFromPeriodicPayment( computePaymentFactor(periodicRate, paymentsRemaining); } -/* Splits gross interest into net interest (to vault) and management fee (to - * broker). Returns pair of (net interest, management fee). - * - * Equation (33) from XLS-66 spec, Section A-2 Equation Glossary - */ -std::pair -computeInterestAndFeeParts( - Number const& interest, - TenthBips16 managementFeeRate) -{ - auto const fee = tenthBipsOfValue(interest, managementFeeRate); - - return std::make_pair(interest - fee, fee); -} - /* * Computes the interest and management fee parts from interest amount. * @@ -216,6 +186,12 @@ loanLatePaymentInterest( NetClock::time_point parentCloseTime, std::uint32_t nextPaymentDueDate) { + if (principalOutstanding == beast::zero) + return numZero; + + if (lateInterestRate == TenthBips32{0}) + return numZero; + auto const now = parentCloseTime.time_since_epoch().count(); // If the payment is not late by any amount of time, then there's no late @@ -248,6 +224,9 @@ loanAccruedInterest( if (periodicRate == beast::zero) return numZero; + if (paymentInterval == 0) + return numZero; + auto const lastPaymentDate = std::max(prevPaymentDate, startDate); auto const now = parentCloseTime.time_since_epoch().count(); @@ -401,42 +380,33 @@ doPayment( * The function preserves accumulated rounding errors across the re-amortization * to ensure the loan state remains consistent with its payment history. */ -Expected +Expected, TER> tryOverpayment( Asset const& asset, std::int32_t loanScale, ExtendedPaymentComponents const& overpaymentComponents, - Number& totalValueOutstanding, - Number& principalOutstanding, - Number& managementFeeOutstanding, - Number& periodicPayment, - TenthBips32 interestRate, - std::uint32_t paymentInterval, + LoanState const& roundedOldState, + Number const& periodicPayment, Number const& periodicRate, std::uint32_t paymentRemaining, - std::uint32_t prevPaymentDate, - std::optional nextDueDate, TenthBips16 const managementFeeRate, beast::Journal j) { // Calculate what the loan state SHOULD be theoretically (at full precision) - auto const raw = computeRawLoanState( + auto const theoreticalState = computeTheoreticalLoanState( periodicPayment, periodicRate, paymentRemaining, managementFeeRate); - // Get the actual loan state (with accumulated rounding from past payments) - auto const rounded = constructLoanState( - totalValueOutstanding, principalOutstanding, managementFeeOutstanding); - // Calculate the accumulated rounding errors. These need to be preserved // across the re-amortization to maintain consistency with the loan's // payment history. Without preserving these errors, the loan could end // up with a different total value than what the borrower has actually paid. - auto const errors = rounded - raw; + auto const errors = roundedOldState - theoreticalState; - // Compute the new principal by applying the overpayment to the raw - // (theoretical) principal. Use max with 0 to ensure we never go negative. - auto const newRawPrincipal = std::max( - raw.principalOutstanding - overpaymentComponents.trackedPrincipalDelta, + // Compute the new principal by applying the overpayment to the theoretical + // principal. Use max with 0 to ensure we never go negative. + auto const newTheoreticalPrincipal = std::max( + theoreticalState.principalOutstanding - + overpaymentComponents.trackedPrincipalDelta, Number{0}); // Compute new loan properties based on the reduced principal. This @@ -444,9 +414,8 @@ tryOverpayment( // for the remaining payment schedule. auto newLoanProperties = computeLoanProperties( asset, - newRawPrincipal, - interestRate, - paymentInterval, + newTheoreticalPrincipal, + periodicRate, paymentRemaining, managementFeeRate, loanScale); @@ -454,56 +423,60 @@ tryOverpayment( JLOG(j.debug()) << "new periodic payment: " << newLoanProperties.periodicPayment << ", new total value: " - << newLoanProperties.totalValueOutstanding + << newLoanProperties.loanState.valueOutstanding << ", first payment principal: " << newLoanProperties.firstPaymentPrincipal; // Calculate what the new loan state should be with the new periodic payment - auto const newRaw = computeRawLoanState( - newLoanProperties.periodicPayment, - periodicRate, - paymentRemaining, - managementFeeRate) + + // including rounding errors + auto const newTheoreticalState = computeTheoreticalLoanState( + newLoanProperties.periodicPayment, + periodicRate, + paymentRemaining, + managementFeeRate) + errors; - JLOG(j.debug()) << "new raw value: " << newRaw.valueOutstanding - << ", principal: " << newRaw.principalOutstanding - << ", interest gross: " << newRaw.interestOutstanding(); - // Update the loan state variables with the new values PLUS the preserved - // rounding errors. This ensures the loan's tracked state remains - // consistent with its payment history. + JLOG(j.debug()) << "new theoretical value: " + << newTheoreticalState.valueOutstanding << ", principal: " + << newTheoreticalState.principalOutstanding + << ", interest gross: " + << newTheoreticalState.interestOutstanding(); - principalOutstanding = std::clamp( - roundToAsset( - asset, newRaw.principalOutstanding, loanScale, Number::upward), - numZero, - rounded.principalOutstanding); - totalValueOutstanding = std::clamp( + // Update the loan state variables with the new values that include the + // preserved rounding errors. This ensures the loan's tracked state remains + // consistent with its payment history. + auto const principalOutstanding = std::clamp( roundToAsset( asset, - principalOutstanding + newRaw.interestOutstanding(), + newTheoreticalState.principalOutstanding, loanScale, Number::upward), numZero, - rounded.valueOutstanding); - managementFeeOutstanding = std::clamp( - roundToAsset(asset, newRaw.managementFeeDue, loanScale), + roundedOldState.principalOutstanding); + auto const totalValueOutstanding = std::clamp( + roundToAsset( + asset, + principalOutstanding + newTheoreticalState.interestOutstanding(), + loanScale, + Number::upward), numZero, - rounded.managementFeeDue); + roundedOldState.valueOutstanding); + auto const managementFeeOutstanding = std::clamp( + roundToAsset(asset, newTheoreticalState.managementFeeDue, loanScale), + numZero, + roundedOldState.managementFeeDue); - auto const newRounded = constructLoanState( + auto const roundedNewState = constructLoanState( totalValueOutstanding, principalOutstanding, managementFeeOutstanding); // Update newLoanProperties so that checkLoanGuards can make an accurate // evaluation. - newLoanProperties.totalValueOutstanding = newRounded.valueOutstanding; + newLoanProperties.loanState = roundedNewState; - JLOG(j.debug()) << "new rounded value: " << newRounded.valueOutstanding - << ", principal: " << newRounded.principalOutstanding - << ", interest gross: " << newRounded.interestOutstanding(); - - // Update the periodic payment to reflect the re-amortized schedule - periodicPayment = newLoanProperties.periodicPayment; + JLOG(j.debug()) << "new rounded value: " << roundedNewState.valueOutstanding + << ", principal: " << roundedNewState.principalOutstanding + << ", interest gross: " + << roundedNewState.interestOutstanding(); // check that the loan is still valid if (auto const ter = checkLoanGuards( @@ -513,7 +486,7 @@ tryOverpayment( // small interest amounts, that may have already been paid // off. Check what's still outstanding. This should // guarantee that the interest checks pass. - newRounded.interestOutstanding() != beast::zero, + roundedNewState.interestOutstanding() != beast::zero, paymentRemaining, newLoanProperties, j)) @@ -527,32 +500,40 @@ tryOverpayment( // Validate that all computed properties are reasonable. These checks should // never fail under normal circumstances, but we validate defensively. if (newLoanProperties.periodicPayment <= 0 || - newLoanProperties.totalValueOutstanding <= 0 || - newLoanProperties.managementFeeOwedToBroker < 0) + newLoanProperties.loanState.valueOutstanding <= 0 || + newLoanProperties.loanState.managementFeeDue < 0) { // LCOV_EXCL_START JLOG(j.warn()) << "Overpayment not allowed: Computed loan " "properties are invalid. Does " "not compute. TotalValueOutstanding: " - << newLoanProperties.totalValueOutstanding + << newLoanProperties.loanState.valueOutstanding << ", PeriodicPayment : " << newLoanProperties.periodicPayment << ", ManagementFeeOwedToBroker: " - << newLoanProperties.managementFeeOwedToBroker; + << newLoanProperties.loanState.managementFeeDue; return Unexpected(tesSUCCESS); // LCOV_EXCL_STOP } - auto const deltas = rounded - newRounded; + auto const deltas = roundedOldState - roundedNewState; - auto const hypotheticalValueOutstanding = - rounded.valueOutstanding - deltas.principal; + // The change in loan management fee is equal to the change between the old + // and the new outstanding management fees + XRPL_ASSERT_PARTS( + deltas.managementFee == + roundedOldState.managementFeeDue - managementFeeOutstanding, + "xrpl::detail::tryOverpayment", + "no fee change"); // Calculate how the loan's value changed due to the overpayment. // This should be negative (value decreased) or zero. A principal // overpayment should never increase the loan's value. - auto const valueChange = - newRounded.valueOutstanding - hypotheticalValueOutstanding; + // The value change is derived from the reduction in interest due to + // the lower principal. + // We do not consider the change in management fee here, since + // management fees are excluded from the valueOutstanding. + auto const valueChange = -deltas.interest; if (valueChange > 0) { JLOG(j.warn()) << "Principal overpayment would increase the value of " @@ -560,21 +541,23 @@ tryOverpayment( return Unexpected(tesSUCCESS); } - return LoanPaymentParts{ - // Principal paid is the reduction in principal outstanding - .principalPaid = deltas.principal, - // Interest paid is the reduction in interest due - .interestPaid = - deltas.interest + overpaymentComponents.untrackedInterest, - // Value change includes both the reduction from paying down principal - // (negative) and any untracked interest penalties (positive, e.g., if - // the overpayment itself incurs a fee) - .valueChange = - valueChange + overpaymentComponents.trackedInterestPart(), - // Fee paid includes both the reduction in tracked management fees and - // any untracked fees on the overpayment itself - .feePaid = deltas.managementFee + - overpaymentComponents.untrackedManagementFee}; + return std::make_pair( + LoanPaymentParts{ + // Principal paid is the reduction in principal outstanding + .principalPaid = deltas.principal, + // Interest paid is the reduction in interest due + .interestPaid = overpaymentComponents.untrackedInterest, + // Value change includes both the reduction from paying down + // principal (negative) and any untracked interest penalties + // (positive, e.g., if the overpayment itself incurs a fee) + .valueChange = + valueChange + overpaymentComponents.untrackedInterest, + // Fee paid includes both the reduction in tracked management fees + // and any untracked fees on the overpayment itself + .feePaid = overpaymentComponents.untrackedManagementFee + + overpaymentComponents.trackedManagementFeeDelta, + }, + newLoanProperties); } /* Validates and applies an overpayment to the loan state. @@ -598,23 +581,16 @@ doOverpayment( NumberProxy& principalOutstandingProxy, NumberProxy& managementFeeOutstandingProxy, NumberProxy& periodicPaymentProxy, - TenthBips32 const interestRate, - std::uint32_t const paymentInterval, Number const& periodicRate, std::uint32_t const paymentRemaining, - std::uint32_t const prevPaymentDate, - std::optional const nextDueDate, TenthBips16 const managementFeeRate, beast::Journal j) { - // Create temporary copies of the loan state that can be safely modified - // and discarded if the overpayment doesn't work out. This prevents - // corrupting the actual ledger data if validation fails. - Number totalValueOutstanding = totalValueOutstandingProxy; - Number principalOutstanding = principalOutstandingProxy; - Number managementFeeOutstanding = managementFeeOutstandingProxy; - Number periodicPayment = periodicPaymentProxy; - + auto const loanState = constructLoanState( + totalValueOutstandingProxy, + principalOutstandingProxy, + managementFeeOutstandingProxy); + auto const periodicPayment = periodicPaymentProxy; JLOG(j.debug()) << "overpayment components:" << ", totalValue before: " << *totalValueOutstandingProxy @@ -633,33 +609,28 @@ doOverpayment( asset, loanScale, overpaymentComponents, - totalValueOutstanding, - principalOutstanding, - managementFeeOutstanding, + loanState, periodicPayment, - interestRate, - paymentInterval, periodicRate, paymentRemaining, - prevPaymentDate, - nextDueDate, managementFeeRate, j); if (!ret) return Unexpected(ret.error()); - auto const& loanPaymentParts = *ret; + auto const& [loanPaymentParts, newLoanProperties] = *ret; + auto const newRoundedLoanState = newLoanProperties.loanState; // Safety check: the principal must have decreased. If it didn't (or // increased!), something went wrong in the calculation and we should // reject the overpayment. - if (principalOutstandingProxy <= principalOutstanding) + if (principalOutstandingProxy <= newRoundedLoanState.principalOutstanding) { // LCOV_EXCL_START JLOG(j.warn()) << "Overpayment not allowed: principal " << "outstanding did not decrease. Before: " - << *principalOutstandingProxy - << ". After: " << principalOutstanding; + << *principalOutstandingProxy << ". After: " + << newRoundedLoanState.principalOutstanding; return Unexpected(tesSUCCESS); // LCOV_EXCL_STOP } @@ -670,34 +641,29 @@ doOverpayment( XRPL_ASSERT_PARTS( overpaymentComponents.trackedPrincipalDelta == - principalOutstandingProxy - principalOutstanding, + principalOutstandingProxy - + newRoundedLoanState.principalOutstanding, "xrpl::detail::doOverpayment", "principal change agrees"); - XRPL_ASSERT_PARTS( - overpaymentComponents.trackedManagementFeeDelta == - managementFeeOutstandingProxy - managementFeeOutstanding, - "xrpl::detail::doOverpayment", - "no fee change"); - // I'm not 100% sure the following asserts are correct. If in doubt, and // everything else works, remove any that cause trouble. - JLOG(j.debug()) << "valueChange: " << loanPaymentParts.valueChange - << ", totalValue before: " << *totalValueOutstandingProxy - << ", totalValue after: " << totalValueOutstanding - << ", totalValue delta: " - << (totalValueOutstandingProxy - totalValueOutstanding) - << ", principalDelta: " - << overpaymentComponents.trackedPrincipalDelta - << ", principalPaid: " << loanPaymentParts.principalPaid - << ", Computed difference: " - << overpaymentComponents.trackedPrincipalDelta - - (totalValueOutstandingProxy - totalValueOutstanding); + JLOG(j.debug()) + << "valueChange: " << loanPaymentParts.valueChange + << ", totalValue before: " << *totalValueOutstandingProxy + << ", totalValue after: " << newRoundedLoanState.valueOutstanding + << ", totalValue delta: " + << (totalValueOutstandingProxy - newRoundedLoanState.valueOutstanding) + << ", principalDelta: " << overpaymentComponents.trackedPrincipalDelta + << ", principalPaid: " << loanPaymentParts.principalPaid + << ", Computed difference: " + << overpaymentComponents.trackedPrincipalDelta - + (totalValueOutstandingProxy - newRoundedLoanState.valueOutstanding); XRPL_ASSERT_PARTS( loanPaymentParts.valueChange == - totalValueOutstanding - + newRoundedLoanState.valueOutstanding - (totalValueOutstandingProxy - overpaymentComponents.trackedPrincipalDelta) + overpaymentComponents.trackedInterestPart(), @@ -710,19 +676,12 @@ doOverpayment( "xrpl::detail::doOverpayment", "principal payment matches"); - XRPL_ASSERT_PARTS( - loanPaymentParts.feePaid == - overpaymentComponents.untrackedManagementFee + - overpaymentComponents.trackedManagementFeeDelta, - "xrpl::detail::doOverpayment", - "fee payment matches"); - // All validations passed, so update the proxy objects (which will // modify the actual Loan ledger object) - totalValueOutstandingProxy = totalValueOutstanding; - principalOutstandingProxy = principalOutstanding; - managementFeeOutstandingProxy = managementFeeOutstanding; - periodicPaymentProxy = periodicPayment; + totalValueOutstandingProxy = newRoundedLoanState.valueOutstanding; + principalOutstandingProxy = newRoundedLoanState.principalOutstanding; + managementFeeOutstandingProxy = newRoundedLoanState.managementFeeDue; + periodicPaymentProxy = newLoanProperties.periodicPayment; return loanPaymentParts; } @@ -789,25 +748,21 @@ computeLatePayment( // this to keep the logic clear. This preserves all the other fields without // having to enumerate them. - ExtendedPaymentComponents const late = [&]() { - auto inner = periodic; + ExtendedPaymentComponents const late{ + periodic, + // Untracked management fee includes: + // 1. Regular service fee (from periodic.untrackedManagementFee) + // 2. Late payment fee (fixed penalty) + // 3. Management fee portion of late interest + periodic.untrackedManagementFee + latePaymentFee + + roundedLateManagementFee, - return ExtendedPaymentComponents{ - inner, - // Untracked management fee includes: - // 1. Regular service fee (from periodic.untrackedManagementFee) - // 2. Late payment fee (fixed penalty) - // 3. Management fee portion of late interest - periodic.untrackedManagementFee + latePaymentFee + - roundedLateManagementFee, - - // Untracked interest includes: - // 1. Any untracked interest from the regular payment (usually 0) - // 2. Late penalty interest (increases loan value) - // This positive value indicates the loan's value increased due - // to the late payment. - periodic.untrackedInterest + roundedLateInterest}; - }(); + // Untracked interest includes: + // 1. Any untracked interest from the regular payment (usually 0) + // 2. Late penalty interest (increases loan value) + // This positive value indicates the loan's value increased due + // to the late payment. + periodic.untrackedInterest + roundedLateInterest}; XRPL_ASSERT_PARTS( isRounded(asset, late.totalDue, loanScale), @@ -875,15 +830,16 @@ computeFullPayment( } // Calculate the theoretical principal based on the payment schedule. - // This raw (unrounded) value is used to compute interest and penalties - // accurately. - Number const rawPrincipalOutstanding = loanPrincipalFromPeriodicPayment( - periodicPayment, periodicRate, paymentRemaining); + // This theoretical (unrounded) value is used to compute interest and + // penalties accurately. + Number const theoreticalPrincipalOutstanding = + loanPrincipalFromPeriodicPayment( + periodicPayment, periodicRate, paymentRemaining); // Full payment interest includes both accrued interest (time since last // payment) and prepayment penalty (for closing early). auto const fullPaymentInterest = computeFullPaymentInterest( - rawPrincipalOutstanding, + theoreticalPrincipalOutstanding, periodicRate, view.parentCloseTime(), paymentInterval, @@ -896,9 +852,8 @@ computeFullPayment( auto const [roundedFullInterest, roundedFullManagementFee] = [&]() { auto const interest = roundToAsset( asset, fullPaymentInterest, loanScale, Number::downward); - auto const parts = computeInterestAndFeeParts( + return computeInterestAndFeeParts( asset, interest, managementFeeRate, loanScale); - return std::make_tuple(parts.first, parts.second); }(); ExtendedPaymentComponents const full{ @@ -943,7 +898,8 @@ computeFullPayment( JLOG(j.trace()) << "computeFullPayment result: periodicPayment: " << periodicPayment << ", periodicRate: " << periodicRate << ", paymentRemaining: " << paymentRemaining - << ", rawPrincipalOutstanding: " << rawPrincipalOutstanding + << ", theoreticalPrincipalOutstanding: " + << theoreticalPrincipalOutstanding << ", fullPaymentInterest: " << fullPaymentInterest << ", roundedFullInterest: " << roundedFullInterest << ", roundedFullManagementFee: " @@ -980,6 +936,8 @@ PaymentComponents::trackedInterestPart() const * * Special handling for the final payment: all remaining balances are paid off * regardless of the periodic payment amount. + * + * Implements the pseudo-code function `compute_payment_due()`. */ PaymentComponents computePaymentComponents( @@ -1023,7 +981,7 @@ computePaymentComponents( // Calculate what the loan state SHOULD be after this payment (the target). // This is computed at full precision using the theoretical amortization. - LoanState const trueTarget = computeRawLoanState( + LoanState const trueTarget = computeTheoreticalLoanState( periodicPayment, periodicRate, paymentRemaining - 1, managementFeeRate); // Round the target to the loan's scale to match how actual loan values @@ -1229,17 +1187,12 @@ computeOverpaymentComponents( // This interest doesn't follow the normal amortization schedule - it's // a one-time charge for paying early. // Equation (20) and (21) from XLS-66 spec, Section A-2 Equation Glossary - auto const [rawOverpaymentInterest, _] = [&]() { - Number const interest = - tenthBipsOfValue(overpayment, overpaymentInterestRate); - return detail::computeInterestAndFeeParts(interest, managementFeeRate); - }(); - - // Round the penalty interest components to the loan scale auto const [roundedOverpaymentInterest, roundedOverpaymentManagementFee] = [&]() { - Number const interest = - roundToAsset(asset, rawOverpaymentInterest, loanScale); + auto const interest = roundToAsset( + asset, + tenthBipsOfValue(overpayment, overpaymentInterestRate), + loanScale); return detail::computeInterestAndFeeParts( asset, interest, managementFeeRate, loanScale); }(); @@ -1256,12 +1209,11 @@ computeOverpaymentComponents( .specialCase = detail::PaymentSpecialCase::extra}, // Untracked management fee is the fixed overpayment fee overpaymentFee, - // Untracked interest is the penalty interest charged for - // overpaying. - // This is positive, representing a one-time cost, but it's - // typically - // much smaller than the interest savings from reducing - // principal. + // Untracked interest is the penalty interest charged for overpaying. + // This is positive, representing a one-time cost, but it's typically + // much smaller than the interest savings from reducing principal. + // It is equal to the paymentComponents.trackedInterestPart() + // but is kept separate for clarity. roundedOverpaymentInterest}; XRPL_ASSERT_PARTS( result.trackedInterestPart() == roundedOverpaymentInterest, @@ -1320,7 +1272,7 @@ checkLoanGuards( beast::Journal j) { auto const totalInterestOutstanding = - properties.totalValueOutstanding - principalRequested; + properties.loanState.valueOutstanding - principalRequested; // Guard 1: if there is no computed total interest over the life of the // loan for a non-zero interest rate, we cannot properly amortize the // loan @@ -1375,13 +1327,13 @@ checkLoanGuards( NumberRoundModeGuard mg(Number::upward); if (std::int64_t const computedPayments{ - properties.totalValueOutstanding / roundedPayment}; + properties.loanState.valueOutstanding / roundedPayment}; computedPayments != paymentTotal) { JLOG(j.warn()) << "Loan Periodic payment (" << properties.periodicPayment << ") rounding (" << roundedPayment << ") on a total value of " - << properties.totalValueOutstanding + << properties.loanState.valueOutstanding << " can not complete the loan in the specified " "number of payments (" << computedPayments << " != " << paymentTotal << ")"; @@ -1399,7 +1351,7 @@ checkLoanGuards( */ Number computeFullPaymentInterest( - Number const& rawPrincipalOutstanding, + Number const& theoreticalPrincipalOutstanding, Number const& periodicRate, NetClock::time_point parentCloseTime, std::uint32_t paymentInterval, @@ -1408,7 +1360,7 @@ computeFullPaymentInterest( TenthBips32 closeInterestRate) { auto const accruedInterest = detail::loanAccruedInterest( - rawPrincipalOutstanding, + theoreticalPrincipalOutstanding, periodicRate, parentCloseTime, startDate, @@ -1422,7 +1374,7 @@ computeFullPaymentInterest( // Equation (28) from XLS-66 spec, Section A-2 Equation Glossary auto const prepaymentPenalty = closeInterestRate == beast::zero ? Number{} - : tenthBipsOfValue(rawPrincipalOutstanding, closeInterestRate); + : tenthBipsOfValue(theoreticalPrincipalOutstanding, closeInterestRate); XRPL_ASSERT( prepaymentPenalty >= 0, @@ -1433,42 +1385,17 @@ computeFullPaymentInterest( return accruedInterest + prepaymentPenalty; } -Number -computeFullPaymentInterest( - Number const& periodicPayment, - Number const& periodicRate, - std::uint32_t paymentRemaining, - NetClock::time_point parentCloseTime, - std::uint32_t paymentInterval, - std::uint32_t prevPaymentDate, - std::uint32_t startDate, - TenthBips32 closeInterestRate) -{ - Number const rawPrincipalOutstanding = - detail::loanPrincipalFromPeriodicPayment( - periodicPayment, periodicRate, paymentRemaining); - - return computeFullPaymentInterest( - rawPrincipalOutstanding, - periodicRate, - parentCloseTime, - paymentInterval, - prevPaymentDate, - startDate, - closeInterestRate); -} - /* Calculates the theoretical loan state at maximum precision for a given point * in the amortization schedule. * * This function computes what the loan's outstanding balances should be based * on the periodic payment amount and number of payments remaining, * without considering any rounding that may have been applied to the actual - * Loan object's state. This "raw" (unrounded) state is used as a target for - * computing payment components and validating that the loan's tracked state + * Loan object's state. This "theoretical" (unrounded) state is used as a target + * for computing payment components and validating that the loan's tracked state * hasn't drifted too far from the theoretical values. * - * The raw state serves several purposes: + * The theoretical state serves several purposes: * 1. Computing the expected payment breakdown (principal, interest, fees) * 2. Detecting and correcting rounding errors that accumulate over time * 3. Validating that overpayments are calculated correctly @@ -1476,9 +1403,12 @@ computeFullPaymentInterest( * * If paymentRemaining is 0, returns a fully zeroed-out LoanState, * representing a completely paid-off loan. + * + * Implements the `calculate_true_loan_state` function from the XLS-66 spec + * section 3.2.4.4 Transaction Pseudo-code */ LoanState -computeRawLoanState( +computeTheoreticalLoanState( Number const& periodicPayment, Number const& periodicRate, std::uint32_t const paymentRemaining, @@ -1494,55 +1424,42 @@ computeRawLoanState( } // Equation (30) from XLS-66 spec, Section A-2 Equation Glossary - Number const rawTotalValueOutstanding = periodicPayment * paymentRemaining; + Number const totalValueOutstanding = periodicPayment * paymentRemaining; - Number const rawPrincipalOutstanding = + Number const principalOutstanding = detail::loanPrincipalFromPeriodicPayment( periodicPayment, periodicRate, paymentRemaining); // Equation (31) from XLS-66 spec, Section A-2 Equation Glossary - Number const rawInterestOutstandingGross = - rawTotalValueOutstanding - rawPrincipalOutstanding; + Number const interestOutstandingGross = + totalValueOutstanding - principalOutstanding; // Equation (32) from XLS-66 spec, Section A-2 Equation Glossary - Number const rawManagementFeeOutstanding = - tenthBipsOfValue(rawInterestOutstandingGross, managementFeeRate); + Number const managementFeeOutstanding = + tenthBipsOfValue(interestOutstandingGross, managementFeeRate); // Equation (33) from XLS-66 spec, Section A-2 Equation Glossary - Number const rawInterestOutstandingNet = - rawInterestOutstandingGross - rawManagementFeeOutstanding; + Number const interestOutstandingNet = + interestOutstandingGross - managementFeeOutstanding; return LoanState{ - .valueOutstanding = rawTotalValueOutstanding, - .principalOutstanding = rawPrincipalOutstanding, - .interestDue = rawInterestOutstandingNet, - .managementFeeDue = rawManagementFeeOutstanding}; + .valueOutstanding = totalValueOutstanding, + .principalOutstanding = principalOutstanding, + .interestDue = interestOutstandingNet, + .managementFeeDue = managementFeeOutstanding, + }; }; -LoanState -computeRawLoanState( - Number const& periodicPayment, - TenthBips32 interestRate, - std::uint32_t paymentInterval, - std::uint32_t const paymentRemaining, - TenthBips32 const managementFeeRate) -{ - return computeRawLoanState( - periodicPayment, - loanPeriodicRate(interestRate, paymentInterval), - paymentRemaining, - managementFeeRate); -} - /* Constructs a LoanState from rounded Loan ledger object values. * * This function creates a LoanState structure from the three tracked values - * stored in a Loan ledger object. Unlike calculateRawLoanState(), which + * stored in a Loan ledger object. Unlike calculateTheoreticalLoanState(), which * computes theoretical unrounded values, this function works with values * that have already been rounded to the loan's scale. * - * The key difference from calculateRawLoanState(): - * - calculateRawLoanState: Computes theoretical values at full precision + * The key difference from calculateTheoreticalLoanState(): + * - calculateTheoreticalLoanState: Computes theoretical values at full + * precision * - constructRoundedLoanState: Builds state from actual rounded ledger values * * The interestDue field is derived from the other three values rather than @@ -1600,11 +1517,16 @@ computeManagementFee( /* * Given the loan parameters, compute the derived properties of the loan. + * + * Pulls together several formulas from the XLS-66 spec, which are noted at each + * step, plus the concepts from 3.2.4.3 Conceptual Loan Value. They are used for + * to check some of the conditions in 3.2.1.5 Failure Conditions for the LoanSet + * transaction. */ LoanProperties computeLoanProperties( Asset const& asset, - Number principalOutstanding, + Number const& principalOutstanding, TenthBips32 interestRate, std::uint32_t paymentInterval, std::uint32_t paymentsRemaining, @@ -1615,12 +1537,39 @@ computeLoanProperties( XRPL_ASSERT( interestRate == 0 || periodicRate > 0, "xrpl::computeLoanProperties : valid rate"); + return computeLoanProperties( + asset, + principalOutstanding, + periodicRate, + paymentsRemaining, + managementFeeRate, + minimumScale); +} +/* + * Given the loan parameters, compute the derived properties of the loan. + * + * Pulls together several formulas from the XLS-66 spec, which are noted at each + * step, plus the concepts from 3.2.4.3 Conceptual Loan Value. They are used for + * to check some of the conditions in 3.2.1.5 Failure Conditions for the LoanSet + * transaction. + */ +LoanProperties +computeLoanProperties( + Asset const& asset, + Number const& principalOutstanding, + Number const& periodicRate, + std::uint32_t paymentsRemaining, + TenthBips32 managementFeeRate, + std::int32_t minimumScale) +{ auto const periodicPayment = detail::loanPeriodicPayment( principalOutstanding, periodicRate, paymentsRemaining); auto const [totalValueOutstanding, loanScale] = [&]() { - NumberRoundModeGuard mg(Number::to_nearest); + // only round up if there should be interest + NumberRoundModeGuard mg( + periodicRate == 0 ? Number::to_nearest : Number::upward); // Use STAmount's internal rounding instead of roundToAsset, because // we're going to use this result to determine the scale for all the // other rounding. @@ -1641,7 +1590,7 @@ computeLoanProperties( // We may need to truncate the total value because of the minimum // scale - amount = roundToAsset(asset, amount, loanScale, Number::to_nearest); + amount = roundToAsset(asset, amount, loanScale); return std::make_pair(amount, loanScale); }(); @@ -1649,12 +1598,12 @@ computeLoanProperties( // Since we just figured out the loan scale, we haven't been able to // validate that the principal fits in it, so to allow this function to // succeed, round it here, and let the caller do the validation. - principalOutstanding = roundToAsset( + auto const roundedPrincipalOutstanding = roundToAsset( asset, principalOutstanding, loanScale, Number::to_nearest); // Equation (31) from XLS-66 spec, Section A-2 Equation Glossary auto const totalInterestOutstanding = - totalValueOutstanding - principalOutstanding; + totalValueOutstanding - roundedPrincipalOutstanding; auto const feeOwedToBroker = computeManagementFee( asset, totalInterestOutstanding, managementFeeRate, loanScale); @@ -1664,13 +1613,13 @@ computeLoanProperties( auto const firstPaymentPrincipal = [&]() { // Compute the parts for the first payment. Ensure that the // principal payment will actually change the principal. - auto const startingState = computeRawLoanState( + auto const startingState = computeTheoreticalLoanState( periodicPayment, periodicRate, paymentsRemaining, managementFeeRate); - auto const firstPaymentState = computeRawLoanState( + auto const firstPaymentState = computeTheoreticalLoanState( periodicPayment, periodicRate, paymentsRemaining - 1, @@ -1684,10 +1633,13 @@ computeLoanProperties( return LoanProperties{ .periodicPayment = periodicPayment, - .totalValueOutstanding = totalValueOutstanding, - .managementFeeOwedToBroker = feeOwedToBroker, + .loanState = constructLoanState( + totalValueOutstanding, + roundedPrincipalOutstanding, + feeOwedToBroker), .loanScale = loanScale, - .firstPaymentPrincipal = firstPaymentPrincipal}; + .firstPaymentPrincipal = firstPaymentPrincipal, + }; } /* @@ -1740,7 +1692,7 @@ loanMakePayment( Number const periodicPayment = loan->at(sfPeriodicPayment); - auto prevPaymentDateProxy = loan->at(sfPreviousPaymentDate); + auto prevPaymentDateProxy = loan->at(sfPreviousPaymentDueDate); std::uint32_t const startDate = loan->at(sfStartDate); std::uint32_t const paymentInterval = loan->at(sfPaymentInterval); @@ -2016,12 +1968,8 @@ loanMakePayment( principalOutstandingProxy, managementFeeOutstandingProxy, periodicPaymentProxy, - interestRate, - paymentInterval, periodicRate, paymentRemainingProxy, - prevPaymentDateProxy, - nextDueDateProxy, managementFeeRate, j)) totalParts += *overResult; diff --git a/src/xrpld/app/paths/Flow.cpp b/src/xrpld/app/paths/Flow.cpp index a102e44854..b5088d15b3 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/xrpld/app/paths/Flow.cpp @@ -1,11 +1,11 @@ #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 4e701d348f..3d3a76f42d 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/src/xrpld/app/paths/detail/StrandFlow.h index fab92dca35..ca4b18f0a3 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/src/xrpld/app/paths/detail/StrandFlow.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index 83271321be..ed1866bf24 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -1,9 +1,9 @@ -#include #include #include #include #include +#include #include #include #include diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp index 32c8fecf20..1cc6b1f5ae 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp @@ -270,7 +270,7 @@ LoanBrokerCoverClawback::preclaim(PreclaimContext const& ctx) JLOG(ctx.j.warn()) << "LoanBroker cover is already at minimum."; return findClawAmount.error(); } - STAmount const clawAmount = *findClawAmount; + STAmount const& clawAmount = *findClawAmount; // Explicitly check the balance of the trust line / MPT to make sure the // balance is actually there. It should always match `sfCoverAvailable`, so @@ -287,6 +287,14 @@ LoanBrokerCoverClawback::preclaim(PreclaimContext const& ctx) // Check if the vault asset issuer has the correct flags auto const sleIssuer = ctx.view.read(keylet::account(vaultAsset.getIssuer())); + if (!sleIssuer) + { + // LCOV_EXCL_START + JLOG(ctx.j.fatal()) << "Issuer account does not exist."; + return tefBAD_LEDGER; + // LCOV_EXCL_STOP + } + return std::visit( [&](T const&) { return preclaimHelper(ctx, *sleIssuer, clawAmount); @@ -321,7 +329,7 @@ LoanBrokerCoverClawback::doApply() determineClawAmount(*sleBroker, vaultAsset, amount); if (!findClawAmount) return tecINTERNAL; // LCOV_EXCL_LINE - STAmount const clawAmount = *findClawAmount; + STAmount const& clawAmount = *findClawAmount; // Just for paranoia's sake if (clawAmount.native()) return tecINTERNAL; // LCOV_EXCL_LINE diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp index c894df2c2b..b68cf46a00 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp @@ -81,7 +81,8 @@ LoanBrokerCoverDeposit::preclaim(PreclaimContext const& ctx) vaultAsset, FreezeHandling::fhZERO_IF_FROZEN, AuthHandling::ahZERO_IF_UNAUTHORIZED, - ctx.j) < amount) + ctx.j, + SpendableHandling::shFULL_BALANCE) < amount) return tecINSUFFICIENT_FUNDS; return tesSUCCESS; diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp index 4c0b3e9af5..830f9e26c1 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp @@ -48,6 +48,11 @@ LoanBrokerCoverWithdraw::preclaim(PreclaimContext const& ctx) auto const dstAcct = tx[~sfDestination].value_or(account); + if (isPseudoAccount(ctx.view, dstAcct)) + { + JLOG(ctx.j.warn()) << "Trying to withdraw into a pseudo-account."; + return tecPSEUDO_ACCOUNT; + } auto const sleBroker = ctx.view.read(keylet::loanbroker(brokerID)); if (!sleBroker) { diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp index 76773037fa..227bad10a9 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp @@ -46,30 +46,6 @@ LoanBrokerDelete::preclaim(PreclaimContext const& ctx) JLOG(ctx.j.warn()) << "LoanBrokerDelete: Owner count is " << ownerCount; return tecHAS_OBLIGATIONS; } - if (auto const debtTotal = sleBroker->at(sfDebtTotal); - debtTotal != beast::zero) - { - // Any remaining debt should have been wiped out by the last Loan - // Delete. This check is purely defensive. - auto const vault = - ctx.view.read(keylet::vault(sleBroker->at(sfVaultID))); - if (!vault) - return tefINTERNAL; // LCOV_EXCL_LINE - auto const asset = vault->at(sfAsset); - auto const scale = getVaultScale(vault); - - auto const rounded = - roundToAsset(asset, debtTotal, scale, Number::towards_zero); - - if (rounded != beast::zero) - { - // LCOV_EXCL_START - JLOG(ctx.j.warn()) << "LoanBrokerDelete: Debt total is " - << debtTotal << ", which rounds to " << rounded; - return tecHAS_OBLIGATIONS; - // LCOV_EXCL_START - } - } auto const vault = ctx.view.read(keylet::vault(sleBroker->at(sfVaultID))); if (!vault) @@ -82,6 +58,26 @@ LoanBrokerDelete::preclaim(PreclaimContext const& ctx) Asset const asset = vault->at(sfAsset); + if (auto const debtTotal = sleBroker->at(sfDebtTotal); + debtTotal != beast::zero) + { + // Any remaining debt should have been wiped out by the last Loan + // Delete. This check is purely defensive. + auto const scale = getAssetsTotalScale(vault); + + auto const rounded = + roundToAsset(asset, debtTotal, scale, Number::towards_zero); + + if (rounded != beast::zero) + { + // LCOV_EXCL_START + JLOG(ctx.j.warn()) << "LoanBrokerDelete: Debt total is " + << debtTotal << ", which rounds to " << rounded; + return tecHAS_OBLIGATIONS; + // LCOV_EXCL_STOP + } + } + auto const coverAvailable = STAmount{asset, sleBroker->at(sfCoverAvailable)}; // If there are assets in the cover, broker will receive them on deletion. diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp index 7b12a6cf39..0cbae4d779 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp @@ -89,6 +89,18 @@ LoanBrokerSet::preclaim(PreclaimContext const& ctx) JLOG(ctx.j.warn()) << "Account is not the owner of the LoanBroker."; return tecNO_PERMISSION; } + + if (auto const debtMax = tx[~sfDebtMaximum]) + { + // Can't reduce the debt maximum below the current total debt + auto const currentDebtTotal = sleBroker->at(sfDebtTotal); + if (*debtMax != 0 && *debtMax < currentDebtTotal) + { + JLOG(ctx.j.warn()) + << "Cannot reduce DebtMaximum below current DebtTotal."; + return tecLIMIT_EXCEEDED; + } + } } else { @@ -105,6 +117,13 @@ LoanBrokerSet::preclaim(PreclaimContext const& ctx) } if (auto const ter = canAddHolding(ctx.view, sleVault->at(sfAsset))) return ter; + + if (auto const ter = checkFrozen( + ctx.view, sleVault->at(sfAccount), sleVault->at(sfAsset))) + { + JLOG(ctx.j.warn()) << "Vault pseudo-account is frozen."; + return ter; + } } return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanDelete.cpp b/src/xrpld/app/tx/detail/LoanDelete.cpp index 659f0bba8b..3643e6331b 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanDelete.cpp @@ -115,7 +115,7 @@ LoanDelete::doApply() roundToAsset( vaultSle->at(sfAsset), debtTotalProxy, - getVaultScale(vaultSle), + getAssetsTotalScale(vaultSle), Number::towards_zero) == beast::zero, "xrpl::LoanDelete::doApply", "last loan, remaining debt rounds to zero"); diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/xrpld/app/tx/detail/LoanManage.cpp index 2d405f204b..bd0539ae4e 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/xrpld/app/tx/detail/LoanManage.cpp @@ -106,7 +106,7 @@ LoanManage::preclaim(PreclaimContext const& ctx) if (loanBrokerSle->at(sfOwner) != account) { JLOG(ctx.j.warn()) - << "LoanBroker for Loan does not belong to the account. LoanModify " + << "LoanBroker for Loan does not belong to the account. LoanManage " "can only be submitted by the Loan Broker."; return tecNO_PERMISSION; } @@ -158,7 +158,7 @@ LoanManage::defaultLoan( auto const minimumCover = tenthBipsOfValue(brokerDebtTotalProxy.value(), coverRateMinimum); // Round the liquidation amount up, too - return roundToAsset( + auto const covered = roundToAsset( vaultAsset, /* * This formula is from the XLS-66 spec, section 3.2.3.2 (State @@ -169,6 +169,9 @@ LoanManage::defaultLoan( tenthBipsOfValue(minimumCover, coverRateLiquidation), totalDefaultAmount), loanScale); + auto const coverAvailable = *brokerSle->at(sfCoverAvailable); + + return std::min(covered, coverAvailable); }(); auto const vaultDefaultAmount = totalDefaultAmount - defaultCovered; @@ -178,7 +181,7 @@ LoanManage::defaultLoan( // The vault may be at a different scale than the loan. Reduce rounding // errors during the accounting by rounding some of the values to that // scale. - auto const vaultScale = getVaultScale(vaultSle); + auto const vaultScale = getAssetsTotalScale(vaultSle); { // Decrease the Total Value of the Vault: @@ -223,11 +226,13 @@ LoanManage::defaultLoan( } if (*vaultAvailableProxy > *vaultTotalProxy) { - JLOG(j.warn()) << "Vault assets available must not be greater " - "than assets outstanding. Available: " - << *vaultAvailableProxy - << ", Total: " << *vaultTotalProxy; - return tecLIMIT_EXCEEDED; + // LCOV_EXCL_START + JLOG(j.fatal()) + << "Vault assets available must not be greater " + "than assets outstanding. Available: " + << *vaultAvailableProxy << ", Total: " << *vaultTotalProxy; + return tecINTERNAL; + // LCOV_EXCL_STOP } // The loss has been realized @@ -242,7 +247,11 @@ LoanManage::defaultLoan( return tefBAD_LEDGER; // LCOV_EXCL_STOP } - vaultLossUnrealizedProxy -= totalDefaultAmount; + adjustImpreciseNumber( + vaultLossUnrealizedProxy, + -totalDefaultAmount, + vaultAsset, + vaultScale); } view.update(vaultSle); } @@ -250,11 +259,9 @@ LoanManage::defaultLoan( // Update the LoanBroker object: { - auto const asset = *vaultSle->at(sfAsset); - // Decrease the Debt of the LoanBroker: adjustImpreciseNumber( - brokerDebtTotalProxy, -totalDefaultAmount, asset, vaultScale); + brokerDebtTotalProxy, -totalDefaultAmount, vaultAsset, vaultScale); // Decrease the First-Loss Capital Cover Available: auto coverAvailableProxy = brokerSle->at(sfCoverAvailable); if (coverAvailableProxy < defaultCovered) @@ -297,13 +304,20 @@ LoanManage::impairLoan( ApplyView& view, SLE::ref loanSle, SLE::ref vaultSle, + Asset const& vaultAsset, beast::Journal j) { Number const lossUnrealized = owedToVault(loanSle); + // The vault may be at a different scale than the loan. Reduce rounding + // errors during the accounting by rounding some of the values to that + // scale. + auto const vaultScale = getAssetsTotalScale(vaultSle); + // Update the Vault object(set "paper loss") auto vaultLossUnrealizedProxy = vaultSle->at(sfLossUnrealized); - vaultLossUnrealizedProxy += lossUnrealized; + adjustImpreciseNumber( + vaultLossUnrealizedProxy, lossUnrealized, vaultAsset, vaultScale); if (vaultLossUnrealizedProxy > vaultSle->at(sfAssetsTotal) - vaultSle->at(sfAssetsAvailable)) { @@ -329,13 +343,19 @@ LoanManage::impairLoan( return tesSUCCESS; } -TER +[[nodiscard]] TER LoanManage::unimpairLoan( ApplyView& view, SLE::ref loanSle, SLE::ref vaultSle, + Asset const& vaultAsset, beast::Journal j) { + // The vault may be at a different scale than the loan. Reduce rounding + // errors during the accounting by rounding some of the values to that + // scale. + auto const vaultScale = getAssetsTotalScale(vaultSle); + // Update the Vault object(clear "paper loss") auto vaultLossUnrealizedProxy = vaultSle->at(sfLossUnrealized); Number const lossReversed = owedToVault(loanSle); @@ -347,14 +367,18 @@ LoanManage::unimpairLoan( return tefBAD_LEDGER; // LCOV_EXCL_STOP } - vaultLossUnrealizedProxy -= lossReversed; + // Reverse the "paper loss" + adjustImpreciseNumber( + vaultLossUnrealizedProxy, -lossReversed, vaultAsset, vaultScale); + view.update(vaultSle); // Update the Loan object loanSle->clearFlag(lsfLoanImpaired); auto const paymentInterval = loanSle->at(sfPaymentInterval); auto const normalPaymentDueDate = - std::max(loanSle->at(sfPreviousPaymentDate), loanSle->at(sfStartDate)) + + std::max( + loanSle->at(sfPreviousPaymentDueDate), loanSle->at(sfStartDate)) + paymentInterval; if (!hasExpired(view, normalPaymentDueDate)) { @@ -396,22 +420,12 @@ LoanManage::doApply() // Valid flag combinations are checked in preflight. No flags is valid - // just a noop. if (tx.isFlag(tfLoanDefault)) - { - if (auto const ter = - defaultLoan(view, loanSle, brokerSle, vaultSle, vaultAsset, j_)) - return ter; - } - else if (tx.isFlag(tfLoanImpair)) - { - if (auto const ter = impairLoan(view, loanSle, vaultSle, j_)) - return ter; - } - else if (tx.isFlag(tfLoanUnimpair)) - { - if (auto const ter = unimpairLoan(view, loanSle, vaultSle, j_)) - return ter; - } - + return defaultLoan(view, loanSle, brokerSle, vaultSle, vaultAsset, j_); + if (tx.isFlag(tfLoanImpair)) + return impairLoan(view, loanSle, vaultSle, vaultAsset, j_); + if (tx.isFlag(tfLoanUnimpair)) + return unimpairLoan(view, loanSle, vaultSle, vaultAsset, j_); + // Noop, as described above. return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanManage.h b/src/xrpld/app/tx/detail/LoanManage.h index 7a02c7a16f..155611580f 100644 --- a/src/xrpld/app/tx/detail/LoanManage.h +++ b/src/xrpld/app/tx/detail/LoanManage.h @@ -44,15 +44,17 @@ public: ApplyView& view, SLE::ref loanSle, SLE::ref vaultSle, + Asset const& vaultAsset, beast::Journal j); /** Helper function that might be needed by other transactors */ - static TER + [[nodiscard]] static TER unimpairLoan( ApplyView& view, SLE::ref loanSle, SLE::ref vaultSle, + Asset const& vaultAsset, beast::Journal j); TER diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index d34a766d70..f3973d9488 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -152,9 +152,7 @@ LoanPay::preclaim(PreclaimContext const& ctx) } auto const principalOutstanding = loanSle->at(sfPrincipalOutstanding); - TenthBips32 const interestRate{loanSle->at(sfInterestRate)}; auto const paymentRemaining = loanSle->at(sfPaymentRemaining); - TenthBips32 const lateInterestRate{loanSle->at(sfLateInterestRate)}; if (paymentRemaining == 0 || principalOutstanding == 0) { @@ -211,13 +209,14 @@ LoanPay::preclaim(PreclaimContext const& ctx) // Do not support "partial payments" - if the transaction says to pay X, // then the account must have X available, even if the loan payment takes // less. - if (auto const balance = accountSpendable( + if (auto const balance = accountHolds( ctx.view, account, asset, fhZERO_IF_FROZEN, ahZERO_IF_UNAUTHORIZED, - ctx.j); + ctx.j, + SpendableHandling::shFULL_BALANCE); balance < amount) { JLOG(ctx.j.warn()) << "Payment amount too large. Amount: " @@ -262,11 +261,12 @@ LoanPay::doApply() auto debtTotalProxy = brokerSle->at(sfDebtTotal); // Send the broker fee to the owner if they have sufficient cover available, - // _and_ if the owner can receive funds. If not, so as not to block the - // payment, add it to the cover balance (send it to the broker pseudo - // account). + // _and_ if the owner can receive funds + // _and_ if the broker is authorized to hold funds. If not, so as not to + // block the payment, add it to the cover balance (send it to the broker + // pseudo account). // - // Normally freeze status is checked in preflight, but we do it here to + // Normally freeze status is checked in preclaim, but we do it here to // avoid duplicating the check. It'll claim a fee either way. bool const sendBrokerFeeToOwner = [&]() { // Round the minimum required cover up to be conservative. This ensures @@ -278,7 +278,8 @@ LoanPay::doApply() asset, tenthBipsOfValue(debtTotalProxy.value(), coverRateMinimum), loanScale) && - !isDeepFrozen(view, brokerOwner, asset); + !isDeepFrozen(view, brokerOwner, asset) && + !requireAuth(view, asset, brokerOwner, AuthType::StrongAuth); }(); auto const brokerPayee = @@ -305,7 +306,12 @@ LoanPay::doApply() // change will be discarded. if (loanSle->isFlag(lsfLoanImpaired)) { - LoanManage::unimpairLoan(view, loanSle, vaultSle, j_); + if (auto const ret = + LoanManage::unimpairLoan(view, loanSle, vaultSle, asset, j_)) + { + JLOG(j_.fatal()) << "Failed to unimpair loan before payment."; + return ret; // LCOV_EXCL_LINE + } } LoanPaymentType const paymentType = [&tx]() { @@ -377,7 +383,7 @@ LoanPay::doApply() // The vault may be at a different scale than the loan. Reduce rounding // errors during the payment by rounding some of the values to that scale. - auto const vaultScale = assetsTotalProxy.value().exponent(); + auto const vaultScale = getAssetsTotalScale(vaultSle); auto const totalPaidToVaultRaw = paymentParts->principalPaid + paymentParts->interestPaid; @@ -421,35 +427,41 @@ LoanPay::doApply() // Vault object state changes view.update(vaultSle); - Number const assetsAvailableBefore = *assetsAvailableProxy; - Number const pseudoAccountBalanceBefore = accountHolds( - view, - vaultPseudoAccount, - asset, - FreezeHandling::fhIGNORE_FREEZE, - AuthHandling::ahIGNORE_AUTH, - j_); - +#if !NDEBUG { + Number const assetsAvailableBefore = *assetsAvailableProxy; + Number const pseudoAccountBalanceBefore = accountHolds( + view, + vaultPseudoAccount, + asset, + FreezeHandling::fhIGNORE_FREEZE, + AuthHandling::ahIGNORE_AUTH, + j_); + XRPL_ASSERT_PARTS( assetsAvailableBefore == pseudoAccountBalanceBefore, "xrpl::LoanPay::doApply", "vault pseudo balance agrees before"); + } +#endif - assetsAvailableProxy += totalPaidToVaultRounded; - assetsTotalProxy += paymentParts->valueChange; + assetsAvailableProxy += totalPaidToVaultRounded; + assetsTotalProxy += paymentParts->valueChange; - XRPL_ASSERT_PARTS( - *assetsAvailableProxy <= *assetsTotalProxy, - "xrpl::LoanPay::doApply", - "assets available must not be greater than assets outstanding"); + XRPL_ASSERT_PARTS( + *assetsAvailableProxy <= *assetsTotalProxy, + "xrpl::LoanPay::doApply", + "assets available must not be greater than assets outstanding"); - if (*assetsAvailableProxy > *assetsTotalProxy) - { - // LCOV_EXCL_START - return tecINTERNAL; - // LCOV_EXCL_STOP - } + if (*assetsAvailableProxy > *assetsTotalProxy) + { + // LCOV_EXCL_START + JLOG(j_.fatal()) << "Vault assets available must not be greater " + "than assets outstanding. Available: " + << *assetsAvailableProxy + << ", Total: " << *assetsTotalProxy; + return tecINTERNAL; + // LCOV_EXCL_STOP } JLOG(j_.debug()) << "total paid to vault raw: " << totalPaidToVaultRaw @@ -474,21 +486,34 @@ LoanPay::doApply() } #if !NDEBUG - auto const accountBalanceBefore = accountSpendable( - view, account_, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_); + auto const accountBalanceBefore = accountHolds( + view, + account_, + asset, + fhIGNORE_FREEZE, + ahIGNORE_AUTH, + j_, + SpendableHandling::shFULL_BALANCE); auto const vaultBalanceBefore = account_ == vaultPseudoAccount ? STAmount{asset, 0} - : accountSpendable( + : accountHolds( view, vaultPseudoAccount, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, - j_); + j_, + SpendableHandling::shFULL_BALANCE); auto const brokerBalanceBefore = account_ == brokerPayee ? STAmount{asset, 0} - : accountSpendable( - view, brokerPayee, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_); + : accountHolds( + view, + brokerPayee, + asset, + fhIGNORE_FREEZE, + ahIGNORE_AUTH, + j_, + SpendableHandling::shFULL_BALANCE); #endif if (totalPaidToVaultRounded != beast::zero) @@ -529,6 +554,7 @@ LoanPay::doApply() WaiveTransferFee::Yes)) return ter; +#if !NDEBUG Number const assetsAvailableAfter = *assetsAvailableProxy; Number const pseudoAccountBalanceAfter = accountHolds( view, @@ -542,22 +568,34 @@ LoanPay::doApply() "xrpl::LoanPay::doApply", "vault pseudo balance agrees after"); -#if !NDEBUG - auto const accountBalanceAfter = accountSpendable( - view, account_, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_); + auto const accountBalanceAfter = accountHolds( + view, + account_, + asset, + fhIGNORE_FREEZE, + ahIGNORE_AUTH, + j_, + SpendableHandling::shFULL_BALANCE); auto const vaultBalanceAfter = account_ == vaultPseudoAccount ? STAmount{asset, 0} - : accountSpendable( + : accountHolds( view, vaultPseudoAccount, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, - j_); + j_, + SpendableHandling::shFULL_BALANCE); auto const brokerBalanceAfter = account_ == brokerPayee ? STAmount{asset, 0} - : accountSpendable( - view, brokerPayee, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_); + : accountHolds( + view, + brokerPayee, + asset, + fhIGNORE_FREEZE, + ahIGNORE_AUTH, + j_, + SpendableHandling::shFULL_BALANCE); XRPL_ASSERT_PARTS( accountBalanceBefore + vaultBalanceBefore + brokerBalanceBefore == diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index e8fe76a48f..4c14cde421 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -88,10 +88,12 @@ LoanSet::preflight(PreflightContext const& ctx) if (auto const paymentInterval = tx[~sfPaymentInterval]; !validNumericMinimum(paymentInterval, LoanSet::minPaymentInterval)) return temINVALID; - - else if (!validNumericRange( - tx[~sfGracePeriod], - paymentInterval.value_or(LoanSet::defaultPaymentInterval))) + // Grace period is between min default value and payment interval + else if (auto const gracePeriod = tx[~sfGracePeriod]; // + !validNumericRange( + gracePeriod, + paymentInterval.value_or(LoanSet::defaultPaymentInterval), + defaultGracePeriod)) return temINVALID; // Copied from preflight2 @@ -282,6 +284,15 @@ LoanSet::preclaim(PreclaimContext const& ctx) if (!vault) // Should be impossible return tefBAD_LEDGER; // LCOV_EXCL_LINE + + if (vault->at(sfAssetsMaximum) != 0 && + vault->at(sfAssetsTotal) >= vault->at(sfAssetsMaximum)) + { + JLOG(ctx.j.warn()) + << "Vault at maximum assets limit. Can't add another loan."; + return tecLIMIT_EXCEEDED; + } + Asset const asset = vault->at(sfAsset); auto const vaultPseudo = vault->at(sfAccount); @@ -383,7 +394,7 @@ LoanSet::doApply() auto vaultAvailableProxy = vaultSle->at(sfAssetsAvailable); auto vaultTotalProxy = vaultSle->at(sfAssetsTotal); - auto const vaultScale = getVaultScale(vaultSle); + auto const vaultScale = getAssetsTotalScale(vaultSle); if (vaultAvailableProxy < principalRequested) { JLOG(j_.warn()) @@ -406,6 +417,21 @@ LoanSet::doApply() TenthBips16{brokerSle->at(sfManagementFeeRate)}, vaultScale); + LoanState const state = constructLoanState( + properties.loanState.valueOutstanding, + principalRequested, + properties.loanState.managementFeeDue); + + auto const vaultMaximum = *vaultSle->at(sfAssetsMaximum); + XRPL_ASSERT_PARTS( + vaultMaximum == 0 || vaultMaximum > *vaultTotalProxy, + "xrpl::LoanSet::doApply", + "Vault is below maximum limit"); + if (vaultMaximum != 0 && state.interestDue > vaultMaximum - vaultTotalProxy) + { + JLOG(j_.warn()) << "Loan would exceed the maximum assets of the vault"; + return tecLIMIT_EXCEEDED; + } // Check that relevant values won't lose precision. This is mostly only // relevant for IOU assets. { @@ -417,8 +443,8 @@ LoanSet::doApply() JLOG(j_.warn()) << field.f->getName() << " (" << *value << ") has too much precision. Total loan value is " - << properties.totalValueOutstanding << " with a scale of " - << properties.loanScale; + << properties.loanState.valueOutstanding + << " with a scale of " << properties.loanScale; return tecPRECISION_LOSS; } } @@ -434,22 +460,20 @@ LoanSet::doApply() return ret; // Check that the other computed values are valid - if (properties.managementFeeOwedToBroker < 0 || - properties.totalValueOutstanding <= 0 || + if (properties.loanState.managementFeeDue < 0 || + properties.loanState.valueOutstanding <= 0 || properties.periodicPayment <= 0) { // LCOV_EXCL_START JLOG(j_.warn()) - << "Computed loan properties are invalid. Does not compute."; + << "Computed loan properties are invalid. Does not compute." + << " Management fee: " << properties.loanState.managementFeeDue + << ". Total Value: " << properties.loanState.valueOutstanding + << ". PeriodicPayment: " << properties.periodicPayment; return tecINTERNAL; // LCOV_EXCL_STOP } - LoanState const state = constructLoanState( - properties.totalValueOutstanding, - principalRequested, - properties.managementFeeOwedToBroker); - auto const originationFee = tx[~sfLoanOriginationFee].value_or(Number{}); auto const loanAssetsToBorrower = principalRequested - originationFee; @@ -534,12 +558,12 @@ LoanSet::doApply() // ignore tecDUPLICATE. That means the holding already exists, // and is fine here return ter; - - if (auto const ter = requireAuth( - view, vaultAsset, brokerOwner, AuthType::StrongAuth)) - return ter; } + if (auto const ter = + requireAuth(view, vaultAsset, brokerOwner, AuthType::StrongAuth)) + return ter; + if (auto const ter = accountSendMulti( view, vaultPseudo, @@ -588,9 +612,10 @@ LoanSet::doApply() // Set dynamic / computed fields to their initial values loan->at(sfPrincipalOutstanding) = principalRequested; loan->at(sfPeriodicPayment) = properties.periodicPayment; - loan->at(sfTotalValueOutstanding) = properties.totalValueOutstanding; - loan->at(sfManagementFeeOutstanding) = properties.managementFeeOwedToBroker; - loan->at(sfPreviousPaymentDate) = 0; + loan->at(sfTotalValueOutstanding) = properties.loanState.valueOutstanding; + loan->at(sfManagementFeeOutstanding) = + properties.loanState.managementFeeDue; + loan->at(sfPreviousPaymentDueDate) = 0; loan->at(sfNextPaymentDueDate) = startDate + paymentInterval; loan->at(sfPaymentRemaining) = paymentTotal; view.insert(loan); diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/xrpld/app/tx/detail/VaultDeposit.cpp index d9471a38f5..51b38afc36 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/xrpld/app/tx/detail/VaultDeposit.cpp @@ -115,16 +115,14 @@ VaultDeposit::preclaim(PreclaimContext const& ctx) !isTesSuccess(ter)) return ter; - // Asset issuer does not have any balance, they can just create funds by - // depositing in the vault. - if ((vaultAsset.native() || vaultAsset.getIssuer() != account) && - accountHolds( + if (accountHolds( ctx.view, account, vaultAsset, FreezeHandling::fhZERO_IF_FROZEN, AuthHandling::ahZERO_IF_UNAUTHORIZED, - ctx.j) < assets) + ctx.j, + SpendableHandling::shFULL_BALANCE) < assets) return tecINSUFFICIENT_FUNDS; return tesSUCCESS; diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 2e9d5b35bf..d9ae357b1a 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -425,7 +425,7 @@ parseLoan(Json::Value const& params, Json::StaticString const fieldName) } auto const id = LedgerEntryHelpers::requiredUInt256( - params, jss::loan_broker_id, "malformedLoanBrokerID"); + params, jss::loan_broker_id, "malformedBroker"); if (!id) return Unexpected(id.error()); auto const seq = LedgerEntryHelpers::requiredUInt32( From 33f4c92b6122ef9072b189ff8e49d161229dd7c0 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Tue, 13 Jan 2026 17:01:11 -0400 Subject: [PATCH 37/62] Expand Number to support the full integer range (#6025) - Refactor Number internals away from int64 to uint64 & a sign flag - ctors and accessors use `rep`. Very few things expose `internalrep`. - An exception is "unchecked" and the new "normalized", which explicitly take an internalrep. But with those special control flags, it's easier to distinguish and control when they are used. - For now, skip the larger mantissas in AMM transactions and tests - Remove trailing zeros from scientific notation Number strings - Update tests. This has the happy side effect of making some of the string representations _more_ consistent between the small and large mantissa ranges. - Add semi-automatic rounding of STNumbers based on Asset types - Create a new SField metadata enum, sMD_NeedsAsset, which indicates the field should be associated with an Asset so it can be rounded. - Add a new STTakesAsset intermediate class to handle the Asset association to a derived ST class. Currently only used in STNumber, but could be used by other types in the future. - Add "associateAsset" which takes an SLE and an Asset, finds the sMD_NeedsAsset fields, and associates the Asset to them. In the case of STNumber, that both stores the Asset, and rounds the value immediately. - Transactors only need to add a call to associateAsset _after_ all of the STNumbers have been set. Unfortunately, the inner workings of STObject do not do the association correctly with uninitialized fields. - When serializing an STNumber that has an Asset, round it before serializing. - Add an override of roundToAsset, which rounds a Number value in place to an Asset, but without any additional scale. - Update and fix a bunch of Loan-related tests to accommodate the expanded Number class. --------- Co-authored-by: Vito <5780819+Tapanito@users.noreply.github.com> --- include/xrpl/basics/Number.h | 529 ++++++- include/xrpl/protocol/AmountConversions.h | 2 +- include/xrpl/protocol/IOUAmount.h | 21 +- include/xrpl/protocol/Issue.h | 3 + include/xrpl/protocol/MPTIssue.h | 6 + include/xrpl/protocol/Protocol.h | 1 + include/xrpl/protocol/SField.h | 5 +- include/xrpl/protocol/STAmount.h | 71 +- include/xrpl/protocol/STNumber.h | 17 +- include/xrpl/protocol/STTakesAsset.h | 63 + include/xrpl/protocol/SystemParameters.h | 2 + include/xrpl/protocol/detail/sfields.macro | 20 +- src/libxrpl/basics/Number.cpp | 677 ++++++-- src/libxrpl/protocol/IOUAmount.cpp | 32 +- src/libxrpl/protocol/Issue.cpp | 6 + src/libxrpl/protocol/Rules.cpp | 14 +- src/libxrpl/protocol/STAmount.cpp | 39 +- src/libxrpl/protocol/STNumber.cpp | 94 +- src/libxrpl/protocol/STTakesAsset.cpp | 29 + src/test/app/AMMClawback_test.cpp | 5 +- src/test/app/AMMExtended_test.cpp | 42 +- src/test/app/AMM_test.cpp | 53 +- src/test/app/EscrowToken_test.cpp | 20 +- src/test/app/LendingHelpers_test.cpp | 15 +- src/test/app/LoanBroker_test.cpp | 89 +- src/test/app/Loan_test.cpp | 91 +- src/test/app/MPToken_test.cpp | 4 +- src/test/basics/IOUAmount_test.cpp | 31 +- src/test/basics/Number_test.cpp | 1402 ++++++++++++++--- src/test/jtx/AMMTest.h | 16 +- src/test/jtx/amount.h | 16 + src/test/jtx/impl/AMMTest.cpp | 7 +- src/test/protocol/STNumber_test.cpp | 59 +- src/test/rpc/GetAggregatePrice_test.cpp | 68 +- .../app/tx/detail/LoanBrokerCoverClawback.cpp | 4 + .../app/tx/detail/LoanBrokerCoverDeposit.cpp | 10 + .../app/tx/detail/LoanBrokerCoverWithdraw.cpp | 9 + src/xrpld/app/tx/detail/LoanBrokerDelete.cpp | 4 + src/xrpld/app/tx/detail/LoanBrokerSet.cpp | 66 +- src/xrpld/app/tx/detail/LoanBrokerSet.h | 3 + src/xrpld/app/tx/detail/LoanDelete.cpp | 10 +- src/xrpld/app/tx/detail/LoanManage.cpp | 8 +- src/xrpld/app/tx/detail/LoanPay.cpp | 11 + src/xrpld/app/tx/detail/LoanSet.cpp | 40 +- src/xrpld/app/tx/detail/Transactor.cpp | 6 +- src/xrpld/app/tx/detail/VaultClawback.cpp | 3 + src/xrpld/app/tx/detail/VaultCreate.cpp | 3 + src/xrpld/app/tx/detail/VaultDelete.cpp | 4 + src/xrpld/app/tx/detail/VaultDeposit.cpp | 4 + src/xrpld/app/tx/detail/VaultSet.cpp | 5 + src/xrpld/app/tx/detail/VaultWithdraw.cpp | 4 + src/xrpld/app/tx/detail/applySteps.cpp | 118 +- 52 files changed, 3151 insertions(+), 710 deletions(-) create mode 100644 include/xrpl/protocol/STTakesAsset.h create mode 100644 src/libxrpl/protocol/STTakesAsset.cpp diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 4420530239..d1ef749784 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -1,8 +1,11 @@ #ifndef XRPL_BASICS_NUMBER_H_INCLUDED #define XRPL_BASICS_NUMBER_H_INCLUDED +#include + #include #include +#include #include #include @@ -13,42 +16,252 @@ class Number; std::string to_string(Number const& amount); +template +constexpr std::optional +logTen(T value) +{ + int log = 0; + while (value >= 10 && value % 10 == 0) + { + value /= 10; + ++log; + } + if (value == 1) + return log; + return std::nullopt; +} + template constexpr bool isPowerOfTen(T value) { - while (value >= 10 && value % 10 == 0) - value /= 10; - return value == 1; + return logTen(value).has_value(); } +/** MantissaRange defines a range for the mantissa of a normalized Number. + * + * The mantissa is in the range [min, max], where + * * min is a power of 10, and + * * max = min * 10 - 1. + * + * The mantissa_scale enum indicates whether the range is "small" or "large". + * This intentionally restricts the number of MantissaRanges that can be + * instantiated to two: one for each scale. + * + * The "small" scale is based on the behavior of STAmount for IOUs. It has a min + * value of 10^15, and a max value of 10^16-1. This was sufficient for + * uses before Lending Protocol was implemented, mostly related to AMM. + * + * However, it does not have sufficient precision to represent the full integer + * range of int64_t values (-2^63 to 2^63-1), which are needed for XRP and MPT + * values. The implementation of SingleAssetVault, and LendingProtocol need to + * represent those integer values accurately and precisely, both for the + * STNumber field type, and for internal calculations. That necessitated the + * "large" scale. + * + * The "large" scale is intended to represent all values that can be represented + * by an STAmount - IOUs, XRP, and MPTs. It has a min value of 10^18, and a max + * value of 10^19-1. + * + * Note that if the mentioned amendments are eventually retired, this class + * should be left in place, but the "small" scale option should be removed. This + * will allow for future expansion beyond 64-bits if it is ever needed. + */ +struct MantissaRange +{ + using rep = std::uint64_t; + enum mantissa_scale { small, large }; + + explicit constexpr MantissaRange(mantissa_scale scale_) + : min(getMin(scale_)) + , max(min * 10 - 1) + , log(logTen(min).value_or(-1)) + , scale(scale_) + { + } + + rep min; + rep max; + int log; + mantissa_scale scale; + +private: + static constexpr rep + getMin(mantissa_scale scale_) + { + switch (scale_) + { + case small: + return 1'000'000'000'000'000ULL; + case large: + return 1'000'000'000'000'000'000ULL; + default: + // Since this can never be called outside a non-constexpr + // context, this throw assures that the build fails if an + // invalid scale is used. + throw std::runtime_error("Unknown mantissa scale"); + } + } +}; + +// Like std::integral, but only 64-bit integral types. +template +concept Integral64 = + std::is_same_v || std::is_same_v; + +/** Number is a floating point type that can represent a wide range of values. + * + * It can represent all values that can be represented by an STAmount - + * regardless of asset type - XRPAmount, MPTAmount, and IOUAmount, with at least + * as much precision as those types require. + * + * ---- Internal Representation ---- + * + * Internally, Number is represented with three values: + * 1. a bool sign flag, + * 2. a std::uint64_t mantissa, + * 3. an int exponent. + * + * The internal mantissa is an unsigned integer in the range defined by the + * current MantissaRange. The exponent is an integer in the range + * [minExponent, maxExponent]. + * + * See the description of MantissaRange for more details on the ranges. + * + * A non-zero mantissa is (almost) always normalized, meaning it and the + * exponent are grown or shrunk until the mantissa is in the range + * [MantissaRange.min, MantissaRange.max]. + * + * Note: + * 1. Normalization can be disabled by using the "unchecked" ctor tag. This + * should only be used at specific conversion points, some constexpr + * values, and in unit tests. + * 2. The max of the "large" range, 10^19-1, is the largest 10^X-1 value that + * fits in an unsigned 64-bit number. (10^19-1 < 2^64-1 and + * 10^20-1 > 2^64-1). This avoids under- and overflows. + * + * ---- External Interface ---- + * + * The external interface of Number consists of a std::int64_t mantissa, which + * is restricted to 63-bits, and an int exponent, which must be in the range + * [minExponent, maxExponent]. The range of the mantissa depends on which + * MantissaRange is currently active. For the "short" range, the mantissa will + * be between 10^15 and 10^16-1. For the "large" range, the mantissa will be + * between -(2^63-1) and 2^63-1. As noted above, the "large" range is needed to + * represent the full range of valid XRP and MPT integer values accurately. + * + * Note: + * 1. 2^63-1 is between 10^18 and 10^19-1, which are the limits of the "large" + * mantissa range. + * 2. The functions mantissa() and exponent() return the external view of the + * Number value, specifically using a signed 63-bit mantissa. This may + * require altering the internal representation to fit into that range + * before the value is returned. The interface guarantees consistency of + * the two values. + * 3. Number cannot represent -2^63 (std::numeric_limits::min()) + * as an exact integer, but it doesn't need to, because all asset values + * on-ledger are non-negative. This is due to implementation details of + * several operations which use unsigned arithmetic internally. This is + * sufficient to represent all valid XRP values (where the absolute value + * can not exceed INITIAL_XRP: 10^17), and MPT values (where the absolute + * value can not exceed maxMPTokenAmount: 2^63-1). + * + * ---- Mantissa Range Switching ---- + * + * The mantissa range may be changed at runtime via setMantissaScale(). The + * default mantissa range is "large". The range is updated whenever transaction + * processing begins, based on whether SingleAssetVault or LendingProtocol are + * enabled. If either is enabled, the mantissa range is set to "large". If not, + * it is set to "small", preserving backward compatibility and correct + * "amendment-gating". + * + * It is extremely unlikely that any more calls to setMantissaScale() will be + * needed outside of unit tests. + * + * ---- Usage With Different Ranges ---- + * + * Outside of unit tests, and existing checks, code that uses Number should not + * know or care which mantissa range is active. + * + * The results of computations using Numbers with a small mantissa may differ + * from computations using Numbers with a large mantissa, specifically as it + * effects the results after rounding. That is why the large mantissa range is + * amendment gated in transaction processing. + * + * It is extremely unlikely that any more calls to getMantissaScale() will be + * needed outside of unit tests. + * + * Code that uses Number should not assume or check anything about the + * mantissa() or exponent() except that they fit into the "large" range + * specified in the "External Interface" section. + * + * ----- Unit Tests ----- + * + * Within unit tests, it may be useful to explicitly switch between the two + * ranges, or to check which range is active when checking the results of + * computations. If the test is doing the math directly, the + * set/getMantissaScale() functions may be most appropriate. However, if the + * test has anything to do with transaction processing, it should enable or + * disable the amendments that control the mantissa range choice + * (SingleAssetVault and LendingProtocol), and/or check if either of those + * amendments are enabled to determine which result to expect. + * + */ class Number { using rep = std::int64_t; - rep mantissa_{0}; + using internalrep = MantissaRange::rep; + + bool negative_{false}; + internalrep mantissa_{0}; int exponent_{std::numeric_limits::lowest()}; public: - // The range for the mantissa when normalized - constexpr static std::int64_t minMantissa = 1'000'000'000'000'000LL; - static_assert(isPowerOfTen(minMantissa)); - constexpr static std::int64_t maxMantissa = minMantissa * 10 - 1; - static_assert(maxMantissa == 9'999'999'999'999'999LL); - // The range for the exponent when normalized constexpr static int minExponent = -32768; constexpr static int maxExponent = 32768; + constexpr static internalrep maxRep = std::numeric_limits::max(); + static_assert(maxRep == 9'223'372'036'854'775'807); + static_assert(-maxRep == std::numeric_limits::min() + 1); + + // May need to make unchecked private struct unchecked { explicit unchecked() = default; }; + // Like unchecked, normalized is used with the ctors that take an + // internalrep mantissa. Unlike unchecked, those ctors will normalize the + // value. + // Only unit tests are expected to use this class + struct normalized + { + explicit normalized() = default; + }; + explicit constexpr Number() = default; Number(rep mantissa); explicit Number(rep mantissa, int exponent); - explicit constexpr Number(rep mantissa, int exponent, unchecked) noexcept; + explicit constexpr Number( + bool negative, + internalrep mantissa, + int exponent, + unchecked) noexcept; + // Assume unsigned values are... unsigned. i.e. positive + 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); + // Assume unsigned values are... unsigned. i.e. positive + explicit Number(internalrep mantissa, int exponent, normalized); constexpr rep mantissa() const noexcept; @@ -78,11 +291,11 @@ public: Number& operator/=(Number const& x); - static constexpr Number + static Number min() noexcept; - static constexpr Number + static Number max() noexcept; - static constexpr Number + static Number lowest() noexcept; /** Conversions to Number are implicit and conversions away from Number @@ -96,7 +309,8 @@ public: friend constexpr bool operator==(Number const& x, Number const& y) noexcept { - return x.mantissa_ == y.mantissa_ && x.exponent_ == y.exponent_; + return x.negative_ == y.negative_ && x.mantissa_ == y.mantissa_ && + x.exponent_ == y.exponent_; } friend constexpr bool @@ -110,8 +324,8 @@ public: { // If the two amounts have different signs (zero is treated as positive) // then the comparison is true iff the left is negative. - bool const lneg = x.mantissa_ < 0; - bool const rneg = y.mantissa_ < 0; + bool const lneg = x.negative_; + bool const rneg = y.negative_; if (lneg != rneg) return lneg; @@ -139,7 +353,7 @@ public: constexpr int signum() const noexcept { - return (mantissa_ < 0) ? -1 : (mantissa_ ? 1 : 0); + return negative_ ? -1 : (mantissa_ ? 1 : 0); } Number @@ -169,6 +383,15 @@ public: return os << to_string(x); } + friend std::string + to_string(Number const& amount); + + friend Number + root(Number f, unsigned d); + + friend Number + root2(Number f); + // Thread local rounding control. Default is to_nearest enum rounding_mode { to_nearest, towards_zero, downward, upward }; static rounding_mode @@ -177,44 +400,206 @@ public: static rounding_mode setround(rounding_mode mode); + /** Returns which mantissa scale is currently in use for normalization. + * + * If you think you need to call this outside of unit tests, no you don't. + */ + static MantissaRange::mantissa_scale + getMantissaScale(); + /** Changes which mantissa scale is used for normalization. + * + * If you think you need to call this outside of unit tests, no you don't. + */ + static void + setMantissaScale(MantissaRange::mantissa_scale scale); + + inline static internalrep + minMantissa() + { + return range_.get().min; + } + + inline static internalrep + maxMantissa() + { + return range_.get().max; + } + + inline static int + mantissaLog() + { + return range_.get().log; + } + + /// oneSmall is needed because the ranges are private + constexpr static Number + oneSmall(); + /// oneLarge is needed because the ranges are private + constexpr static Number + oneLarge(); + + // And one is needed because it needs to choose between oneSmall and + // oneLarge based on the current range + static Number + one(); + + template + [[nodiscard]] + std::pair + normalizeToRange(T minMantissa, T maxMantissa) const; + private: static thread_local rounding_mode mode_; + // The available ranges for mantissa + + constexpr static MantissaRange smallRange{MantissaRange::small}; + static_assert(isPowerOfTen(smallRange.min)); + static_assert(smallRange.min == 1'000'000'000'000'000LL); + static_assert(smallRange.max == 9'999'999'999'999'999LL); + static_assert(smallRange.log == 15); + static_assert(smallRange.min < maxRep); + static_assert(smallRange.max < maxRep); + constexpr static MantissaRange largeRange{MantissaRange::large}; + static_assert(isPowerOfTen(largeRange.min)); + static_assert(largeRange.min == 1'000'000'000'000'000'000ULL); + static_assert(largeRange.max == internalrep(9'999'999'999'999'999'999ULL)); + static_assert(largeRange.log == 18); + static_assert(largeRange.min < maxRep); + static_assert(largeRange.max > maxRep); + + // The range for the mantissa when normalized. + // Use reference_wrapper to avoid making copies, and prevent accidentally + // changing the values inside the range. + static thread_local std::reference_wrapper range_; void normalize(); - constexpr bool + + /** Normalize Number components to an arbitrary range. + * + * min/maxMantissa are parameters because this function is used by both + * normalize(), which reads from range_, and by normalizeToRange, + * which is public and can accept an arbitrary range from the caller. + */ + template + static void + normalize( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa); + + template + friend void + doNormalize( + bool& negative, + T& mantissa_, + int& exponent_, + MantissaRange::rep const& minMantissa, + MantissaRange::rep const& maxMantissa); + + bool isnormal() const noexcept; + // Copy the number, but modify the exponent by "exponentDelta". Because the + // mantissa doesn't change, the result will be "mostly" normalized, but the + // exponent could go out of range, so it will be checked. + Number + shiftExponent(int exponentDelta) const; + + // Safely convert rep (int64) mantissa to internalrep (uint64). If the rep + // 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 + externalToInternal(rep mantissa); + class Guard; }; +inline constexpr Number::Number( + bool negative, + internalrep mantissa, + int exponent, + unchecked) noexcept + : negative_(negative), mantissa_{mantissa}, exponent_{exponent} +{ +} + +inline constexpr Number::Number( + internalrep mantissa, + int exponent, + unchecked) noexcept + : Number(false, mantissa, exponent, unchecked{}) +{ +} + constexpr static Number numZero{}; -inline constexpr Number::Number(rep mantissa, int exponent, unchecked) noexcept - : mantissa_{mantissa}, exponent_{exponent} +inline Number::Number( + bool negative, + internalrep mantissa, + int exponent, + normalized) + : Number(negative, mantissa, exponent, unchecked{}) +{ + normalize(); +} + +inline Number::Number(internalrep mantissa, int exponent, normalized) + : Number(false, mantissa, exponent, normalized{}) { } inline Number::Number(rep mantissa, int exponent) - : mantissa_{mantissa}, exponent_{exponent} + : Number(mantissa < 0, externalToInternal(mantissa), exponent, normalized{}) { - normalize(); } inline Number::Number(rep mantissa) : Number{mantissa, 0} { } +/** Returns the mantissa of the external view of the Number. + * + * Please see the "---- External Interface ----" section of the class + * documentation for an explanation of why the internal value may be modified. + */ inline constexpr Number::rep Number::mantissa() const noexcept { - return mantissa_; + auto m = mantissa_; + if (m > maxRep) + { + XRPL_ASSERT_PARTS( + !isnormal() || (m % 10 == 0 && m / 10 <= maxRep), + "xrpl::Number::mantissa", + "large normalized mantissa has no remainder"); + m /= 10; + } + auto const sign = negative_ ? -1 : 1; + return sign * static_cast(m); } +/** Returns the exponent of the external view of the Number. + * + * Please see the "---- External Interface ----" section of the class + * documentation for an explanation of why the internal value may be modified. + */ inline constexpr int Number::exponent() const noexcept { - return exponent_; + auto e = exponent_; + if (mantissa_ > maxRep) + { + XRPL_ASSERT_PARTS( + !isnormal() || (mantissa_ % 10 == 0 && mantissa_ / 10 <= maxRep), + "xrpl::Number::exponent", + "large normalized mantissa has no remainder"); + ++e; + } + return e; } inline constexpr Number @@ -226,15 +611,17 @@ Number::operator+() const noexcept inline constexpr Number Number::operator-() const noexcept { + if (mantissa_ == 0) + return Number{}; auto x = *this; - x.mantissa_ = -x.mantissa_; + x.negative_ = !x.negative_; return x; } inline Number& Number::operator++() { - *this += Number{1000000000000000, -15, unchecked{}}; + *this += one(); return *this; } @@ -249,7 +636,7 @@ Number::operator++(int) inline Number& Number::operator--() { - *this -= Number{1000000000000000, -15, unchecked{}}; + *this -= one(); return *this; } @@ -299,30 +686,54 @@ operator/(Number const& x, Number const& y) return z; } -inline constexpr Number +inline Number Number::min() noexcept { - return Number{minMantissa, minExponent, unchecked{}}; + return Number{false, range_.get().min, minExponent, unchecked{}}; } -inline constexpr Number +inline Number Number::max() noexcept { - return Number{maxMantissa, maxExponent, unchecked{}}; + return Number{ + false, std::min(range_.get().max, maxRep), maxExponent, unchecked{}}; } -inline constexpr Number +inline Number Number::lowest() noexcept { - return -Number{maxMantissa, maxExponent, unchecked{}}; + return Number{ + true, std::min(range_.get().max, maxRep), maxExponent, unchecked{}}; } -inline constexpr bool +inline bool Number::isnormal() const noexcept { - auto const abs_m = mantissa_ < 0 ? -mantissa_ : mantissa_; - return minMantissa <= abs_m && abs_m <= maxMantissa && - minExponent <= exponent_ && exponent_ <= maxExponent; + MantissaRange const& range = range_; + auto const abs_m = mantissa_; + return *this == Number{} || + (range.min <= abs_m && abs_m <= range.max && + (abs_m <= maxRep || abs_m % 10 == 0) && minExponent <= exponent_ && + exponent_ <= maxExponent); +} + +template +std::pair +Number::normalizeToRange(T minMantissa, T maxMantissa) const +{ + bool negative = negative_; + internalrep mantissa = mantissa_; + int exponent = exponent_; + + if constexpr (std::is_unsigned_v) + XRPL_ASSERT_PARTS( + !negative, + "xrpl::Number::normalizeToRange", + "Number is non-negative for unsigned range."); + Number::normalize(negative, mantissa, exponent, minMantissa, maxMantissa); + + auto const sign = negative ? -1 : 1; + return std::make_pair(static_cast(sign * mantissa), exponent); } inline constexpr Number @@ -364,6 +775,20 @@ squelch(Number const& x, Number const& limit) noexcept return x; } +inline std::string +to_string(MantissaRange::mantissa_scale const& scale) +{ + switch (scale) + { + case MantissaRange::small: + return "small"; + case MantissaRange::large: + return "large"; + default: + throw std::runtime_error("Bad scale"); + } +} + class saveNumberRoundMode { Number::rounding_mode mode_; @@ -402,6 +827,34 @@ public: operator=(NumberRoundModeGuard const&) = delete; }; +/** Sets the new scale and restores the old scale when it leaves scope. + * + * If you think you need to use this class outside of unit tests, no you don't. + * + */ +class NumberMantissaScaleGuard +{ + MantissaRange::mantissa_scale const saved_; + +public: + explicit NumberMantissaScaleGuard( + MantissaRange::mantissa_scale scale) noexcept + : saved_{Number::getMantissaScale()} + { + Number::setMantissaScale(scale); + } + + ~NumberMantissaScaleGuard() + { + Number::setMantissaScale(saved_); + } + + NumberMantissaScaleGuard(NumberMantissaScaleGuard const&) = delete; + + NumberMantissaScaleGuard& + operator=(NumberMantissaScaleGuard const&) = delete; +}; + } // namespace xrpl #endif // XRPL_BASICS_NUMBER_H_INCLUDED diff --git a/include/xrpl/protocol/AmountConversions.h b/include/xrpl/protocol/AmountConversions.h index 195e373fa0..2cdccecabb 100644 --- a/include/xrpl/protocol/AmountConversions.h +++ b/include/xrpl/protocol/AmountConversions.h @@ -121,7 +121,7 @@ toAmount( { if (isXRP(issue)) return STAmount(issue, static_cast(n)); - return STAmount(issue, n.mantissa(), n.exponent()); + return STAmount(issue, n); } else { diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index c04cb5cf70..405de18e29 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -26,8 +26,10 @@ class IOUAmount : private boost::totally_ordered, private boost::additive { private: - std::int64_t mantissa_; - int exponent_; + using mantissa_type = std::int64_t; + using exponent_type = int; + mantissa_type mantissa_; + exponent_type exponent_; /** Adjusts the mantissa and exponent to the proper range. @@ -38,11 +40,14 @@ private: void normalize(); + static IOUAmount + fromNumber(Number const& number); + public: IOUAmount() = default; explicit IOUAmount(Number const& other); IOUAmount(beast::Zero); - IOUAmount(std::int64_t mantissa, int exponent); + IOUAmount(mantissa_type mantissa, exponent_type exponent); IOUAmount& operator=(beast::Zero); @@ -71,10 +76,10 @@ public: int signum() const noexcept; - int + exponent_type exponent() const noexcept; - std::int64_t + mantissa_type mantissa() const noexcept; static IOUAmount @@ -92,7 +97,7 @@ inline IOUAmount::IOUAmount(beast::Zero) *this = beast::zero; } -inline IOUAmount::IOUAmount(std::int64_t mantissa, int exponent) +inline IOUAmount::IOUAmount(mantissa_type mantissa, exponent_type exponent) : mantissa_(mantissa), exponent_(exponent) { normalize(); @@ -149,13 +154,13 @@ IOUAmount::signum() const noexcept return (mantissa_ < 0) ? -1 : (mantissa_ ? 1 : 0); } -inline int +inline IOUAmount::exponent_type IOUAmount::exponent() const noexcept { return exponent_; } -inline std::int64_t +inline IOUAmount::mantissa_type IOUAmount::mantissa() const noexcept { return mantissa_; diff --git a/include/xrpl/protocol/Issue.h b/include/xrpl/protocol/Issue.h index 519d7a96f3..a76b7a8316 100644 --- a/include/xrpl/protocol/Issue.h +++ b/include/xrpl/protocol/Issue.h @@ -37,6 +37,9 @@ public: bool native() const; + bool + integral() const; + friend constexpr std::weak_ordering operator<=>(Issue const& lhs, Issue const& rhs); }; diff --git a/include/xrpl/protocol/MPTIssue.h b/include/xrpl/protocol/MPTIssue.h index b89b59ee0d..ca81548a29 100644 --- a/include/xrpl/protocol/MPTIssue.h +++ b/include/xrpl/protocol/MPTIssue.h @@ -46,6 +46,12 @@ public: { return false; } + + bool + integral() const + { + return true; + } }; constexpr bool diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 0c72b80de4..43be9d3b45 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -233,6 +233,7 @@ std::size_t constexpr maxMPTokenMetadataLength = 1024; /** The maximum amount of MPTokenIssuance */ std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull; +static_assert(Number::maxRep >= maxMPTokenAmount); /** The maximum length of Data payload */ std::size_t constexpr maxDataPayloadLength = 256; diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index b1d353196d..7f404b4d5f 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -135,7 +135,10 @@ public: sMD_Always = 0x10, // value when node containing it is affected at all sMD_BaseTen = 0x20, // value is treated as base 10, overriding behavior sMD_PseudoAccount = 0x40, // if this field is set in an ACCOUNT_ROOT - // _only_, then it is a pseudo-account + // _only_, then it is a pseudo-account + sMD_NeedsAsset = 0x80, // This field needs to be associated with an + // asset before it is serialized as a ledger + // object. Intended for STNumber. sMD_Default = sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create }; diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 79cbf51436..4d86aed2ec 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -138,7 +138,7 @@ public: template STAmount(A const& asset, Number const& number) - : STAmount(asset, number.mantissa(), number.exponent()) + : STAmount(fromNumber(asset, number)) { } @@ -282,6 +282,10 @@ public: mpt() const; private: + template + static STAmount + fromNumber(A const& asset, Number const& number); + static std::unique_ptr construct(SerialIter&, SField const& name); @@ -345,10 +349,19 @@ STAmount::STAmount( , mIsNegative(negative) { // mValue is uint64, but needs to fit in the range of int64 - XRPL_ASSERT( - mValue <= std::numeric_limits::max(), - "xrpl::STAmount::STAmount(SField, A, std::uint64_t, int, bool) : " - "maximum mantissa input"); + if (Number::getMantissaScale() == MantissaRange::small) + { + XRPL_ASSERT( + mValue <= std::numeric_limits::max(), + "xrpl::STAmount::STAmount(SField, A, std::uint64_t, int, bool) : " + "maximum mantissa input"); + } + else + { + if (integral() && mValue > std::numeric_limits::max()) + throw std::overflow_error( + "STAmount mantissa is too large " + std::to_string(mantissa)); + } canonicalize(); } @@ -542,14 +555,23 @@ STAmount::operator=(XRPAmount const& amount) return *this; } -inline STAmount& -STAmount::operator=(Number const& number) +template +inline STAmount +STAmount::fromNumber(A const& a, Number const& number) { - mIsNegative = number.mantissa() < 0; - mValue = mIsNegative ? -number.mantissa() : number.mantissa(); - mOffset = number.exponent(); - canonicalize(); - return *this; + bool const negative = number.mantissa() < 0; + Number const working{negative ? -number : number}; + Asset asset{a}; + if (asset.integral()) + { + std::uint64_t const intValue = static_cast(working); + return STAmount{asset, intValue, 0, negative}; + } + + auto const [mantissa, exponent] = + working.normalizeToRange(cMinValue, cMaxValue); + + return STAmount{asset, mantissa, exponent, negative}; } inline void @@ -699,17 +721,32 @@ getRate(STAmount const& offerOut, STAmount const& offerIn); * @param rounding Optional Number rounding mode * */ -STAmount +[[nodiscard]] STAmount roundToScale( STAmount const& value, std::int32_t scale, Number::rounding_mode rounding = Number::getround()); +/** Round an arbitrary precision Number IN PLACE to the precision of a given + * Asset. + * + * This is used to ensure that calculations do not collect dust for IOUs, or + * fractional amounts for the integral types XRP and MPT. + * + * @param asset The relevant asset + * @param value The lvalue to be rounded + */ +template +void +roundToAsset(A const& asset, Number& value) +{ + value = STAmount{asset, value}; +} + /** Round an arbitrary precision Number to the precision of a given Asset. * - * This is used to ensure that calculations do not collect dust beyond the - * precision of the reference value for IOUs, or fractional amounts for the - * integral types XRP and MPT. + * This is used to ensure that calculations do not collect dust beyond specified + * scale for IOUs, or fractional amounts for the integral types XRP and MPT. * * @param asset The relevant asset * @param value The value to be rounded @@ -718,7 +755,7 @@ roundToScale( * @param rounding Optional Number rounding mode */ template -Number +[[nodiscard]] Number roundToAsset( A const& asset, Number const& value, diff --git a/include/xrpl/protocol/STNumber.h b/include/xrpl/protocol/STNumber.h index dfdb16af93..39b0c3b042 100644 --- a/include/xrpl/protocol/STNumber.h +++ b/include/xrpl/protocol/STNumber.h @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -19,8 +20,19 @@ namespace xrpl { * it can represent a value of any token type (XRP, IOU, or MPT) * without paying the storage cost of duplicating asset information * that may be deduced from the context. + * + * STNumber derives from STTakesAsset, so that it can be associated with the + * related Asset during transaction processing. Which asset is relevant depends + * on the object and transaction. As of this writing, only Vault, LoanBroker, + * and Loan objects use STNumber fields. All of those fields represent amounts + * of the Vault's Asset, so they should be associated with the Vault's Asset. + * + * e.g. + * associateAsset(*loanSle, asset); + * associateAsset(*brokerSle, asset); + * associateAsset(*vaultSle, asset); */ -class STNumber : public STBase, public CountedObject +class STNumber : public STTakesAsset, public CountedObject { private: Number value_; @@ -56,6 +68,9 @@ public: bool isDefault() const override; + void + associateAsset(Asset const& a) override; + operator Number() const { return value_; diff --git a/include/xrpl/protocol/STTakesAsset.h b/include/xrpl/protocol/STTakesAsset.h new file mode 100644 index 0000000000..767223b97d --- /dev/null +++ b/include/xrpl/protocol/STTakesAsset.h @@ -0,0 +1,63 @@ +#ifndef XRPL_PROTOCOL_STTAKESASSET_H_INCLUDED +#define XRPL_PROTOCOL_STTAKESASSET_H_INCLUDED + +#include +#include + +namespace xrpl { + +/** Intermediate class for any STBase-derived class to store an Asset. + * + * In the class definition, this class should be specified as a base class + * _instead_ of STBase. + * + * Specifically, the Asset is only stored and used at runtime. It should not be + * serialized to the ledger. + * + * The derived class decides what to do with the Asset, and when. It will not + * necessarily be set at any given time. As of this writing, only STNumber uses + * it to round the stored Number to the Asset's precision both when associated, + * and when serializing the Number. + */ +class STTakesAsset : public STBase +{ +protected: + std::optional asset_; + +public: + using STBase::STBase; + using STBase::operator=; + + virtual void + associateAsset(Asset const& a); +}; + +inline void +STTakesAsset::associateAsset(Asset const& a) +{ + asset_.emplace(a); +} + +class STLedgerEntry; + +/** Associate an Asset with all sMD_NeedsAsset fields in a ledger entry. + * + * This function iterates over all fields in the given ledger entry. For each + * field that is set and has the SField::sMD_NeedsAsset metadata flag, it calls + * `associateAsset` on that field with the given Asset. Such field must be + * derived from STTakesAsset - if it is not, the conversion will throw. + * + * Typically, associateAsset should be called near the end of doApply() of any + * Transactor classes on the SLEs of any new or modified ledger entries + * containing STNumber fields, after doing all of the modifications t the SLEs. + * + * @param sle The ledger entry whose fields will be updated. + * @param asset The Asset to associate with the relevant fields. + * + */ +void +associateAsset(STLedgerEntry& sle, Asset const& asset); + +} // namespace xrpl + +#endif diff --git a/include/xrpl/protocol/SystemParameters.h b/include/xrpl/protocol/SystemParameters.h index c0732bc9fe..c2f66e9ea1 100644 --- a/include/xrpl/protocol/SystemParameters.h +++ b/include/xrpl/protocol/SystemParameters.h @@ -23,6 +23,8 @@ systemName() /** Number of drops in the genesis account. */ constexpr XRPAmount INITIAL_XRP{100'000'000'000 * DROPS_PER_XRP}; +static_assert(INITIAL_XRP.drops() == 100'000'000'000'000'000); +static_assert(Number::maxRep >= INITIAL_XRP.drops()); /** Returns true if the amount does not exceed the initial XRP in existence. */ inline bool diff --git a/include/xrpl/protocol/detail/sfields.macro b/include/xrpl/protocol/detail/sfields.macro index d0736469e4..712cf568af 100644 --- a/include/xrpl/protocol/detail/sfields.macro +++ b/include/xrpl/protocol/detail/sfields.macro @@ -207,22 +207,22 @@ TYPED_SFIELD(sfLoanID, UINT256, 38) // number (common) TYPED_SFIELD(sfNumber, NUMBER, 1) -TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2) -TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3) -TYPED_SFIELD(sfAssetsTotal, NUMBER, 4) -TYPED_SFIELD(sfLossUnrealized, NUMBER, 5) -TYPED_SFIELD(sfDebtTotal, NUMBER, 6) -TYPED_SFIELD(sfDebtMaximum, NUMBER, 7) -TYPED_SFIELD(sfCoverAvailable, NUMBER, 8) +TYPED_SFIELD(sfAssetsAvailable, NUMBER, 2, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfAssetsMaximum, NUMBER, 3, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfAssetsTotal, NUMBER, 4, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfLossUnrealized, NUMBER, 5, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfDebtTotal, NUMBER, 6, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfDebtMaximum, NUMBER, 7, SField::sMD_NeedsAsset | SField::sMD_Default) +TYPED_SFIELD(sfCoverAvailable, NUMBER, 8, SField::sMD_NeedsAsset | SField::sMD_Default) TYPED_SFIELD(sfLoanOriginationFee, NUMBER, 9) TYPED_SFIELD(sfLoanServiceFee, NUMBER, 10) TYPED_SFIELD(sfLatePaymentFee, NUMBER, 11) TYPED_SFIELD(sfClosePaymentFee, NUMBER, 12) -TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13) +TYPED_SFIELD(sfPrincipalOutstanding, NUMBER, 13, SField::sMD_NeedsAsset | SField::sMD_Default) TYPED_SFIELD(sfPrincipalRequested, NUMBER, 14) -TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15) +TYPED_SFIELD(sfTotalValueOutstanding, NUMBER, 15, SField::sMD_NeedsAsset | SField::sMD_Default) TYPED_SFIELD(sfPeriodicPayment, NUMBER, 16) -TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17) +TYPED_SFIELD(sfManagementFeeOutstanding, NUMBER, 17, SField::sMD_NeedsAsset | SField::sMD_Default) // int32 TYPED_SFIELD(sfLoanScale, INT32, 1) diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 9984b26ffe..436ebf6779 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -1,4 +1,6 @@ #include +// Keep Number.h first to ensure it can build without hidden dependencies +#include #include #include @@ -13,16 +15,20 @@ #include #ifdef _MSC_VER -#pragma message("Using boost::multiprecision::uint128_t") +#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; #else // !defined(_MSC_VER) using uint128_t = __uint128_t; +using int128_t = __int128_t; #endif // !defined(_MSC_VER) namespace xrpl { thread_local Number::rounding_mode Number::mode_ = Number::to_nearest; +thread_local std::reference_wrapper Number::range_ = + largeRange; Number::rounding_mode Number::getround() @@ -36,12 +42,30 @@ Number::setround(rounding_mode mode) return std::exchange(mode_, mode); } +MantissaRange::mantissa_scale +Number::getMantissaScale() +{ + return range_.get().scale; +} + +void +Number::setMantissaScale(MantissaRange::mantissa_scale scale) +{ + if (scale != MantissaRange::small && scale != MantissaRange::large) + LogicError("Unknown mantissa scale"); + range_ = scale == MantissaRange::small ? smallRange : largeRange; +} + // Guard // The Guard class is used to temporarily add extra digits of // precision to an operation. This enables the final result // to be correctly rounded to the internal precision of Number. +template +concept UnsignedMantissa = + std::is_unsigned_v || std::is_same_v; + class Number::Guard { std::uint64_t digits_; // 16 decimal guard digits @@ -62,8 +86,9 @@ public: is_negative() const noexcept; // add a digit + template void - push(unsigned d) noexcept; + push(T d) noexcept; // recover a digit unsigned @@ -76,16 +101,40 @@ public: round() noexcept; // Modify the result to the correctly rounded value + template void - doRoundUp(rep& mantissa, int& exponent, std::string location); + doRoundUp( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa, + std::string location); + + // Modify the result to the correctly rounded value + template + void + doRoundDown( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa); // Modify the result to the correctly rounded value void - doRoundDown(rep& mantissa, int& exponent); + doRound(rep& drops, std::string location); - // Modify the result to the correctly rounded value +private: void - doRound(rep& drops); + doPush(unsigned d) noexcept; + + template + void + bringIntoRange( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa); }; inline void @@ -107,13 +156,20 @@ Number::Guard::is_negative() const noexcept } inline void -Number::Guard::push(unsigned d) noexcept +Number::Guard::doPush(unsigned d) noexcept { - xbit_ = xbit_ || (digits_ & 0x0000'0000'0000'000F) != 0; + xbit_ = xbit_ || ((digits_ & 0x0000'0000'0000'000F) != 0); digits_ >>= 4; digits_ |= (d & 0x0000'0000'0000'000FULL) << 60; } +template +inline void +Number::Guard::push(T d) noexcept +{ + doPush(static_cast(d)); +} + inline unsigned Number::Guard::pop() noexcept { @@ -163,30 +219,65 @@ Number::Guard::round() noexcept return 0; } +template void -Number::Guard::doRoundUp(rep& mantissa, int& exponent, std::string location) +Number::Guard::bringIntoRange( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa) +{ + // Bring mantissa back into the minMantissa / maxMantissa range AFTER + // rounding + if (mantissa < minMantissa) + { + mantissa *= 10; + --exponent; + } + if (exponent < minExponent) + { + constexpr Number zero = Number{}; + + negative = zero.negative_; + mantissa = zero.mantissa_; + exponent = zero.exponent_; + } +} + +template +void +Number::Guard::doRoundUp( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa, + std::string location) { auto r = round(); if (r == 1 || (r == 0 && (mantissa & 1) == 1)) { ++mantissa; - if (mantissa > maxMantissa) + // Ensure mantissa after incrementing fits within both the + // min/maxMantissa range and is a valid "rep". + if (mantissa > maxMantissa || mantissa > maxRep) { mantissa /= 10; ++exponent; } } - if (exponent < minExponent) - { - mantissa = 0; - exponent = Number{}.exponent_; - } + bringIntoRange(negative, mantissa, exponent, minMantissa); if (exponent > maxExponent) throw std::overflow_error(location); } +template void -Number::Guard::doRoundDown(rep& mantissa, int& exponent) +Number::Guard::doRoundDown( + bool& negative, + T& mantissa, + int& exponent, + internalrep const& minMantissa) { auto r = round(); if (r == 1 || (r == 0 && (mantissa & 1) == 1)) @@ -198,20 +289,27 @@ Number::Guard::doRoundDown(rep& mantissa, int& exponent) --exponent; } } - if (exponent < minExponent) - { - mantissa = 0; - exponent = Number{}.exponent_; - } + bringIntoRange(negative, mantissa, exponent, minMantissa); } // Modify the result to the correctly rounded value void -Number::Guard::doRound(rep& drops) +Number::Guard::doRound(rep& drops, std::string location) { auto r = round(); if (r == 1 || (r == 0 && (drops & 1) == 1)) { + if (drops >= maxRep) + { + static_assert(sizeof(internalrep) == sizeof(rep)); + // This should be impossible, because it's impossible to represent + // "maxRep + 0.6" in Number, regardless of the scale. There aren't + // enough digits available. You'd either get a mantissa of "maxRep" + // or "(maxRep + 1) / 10", neither of which will round up when + // converting to rep, though the latter might overflow _before_ + // rounding. + throw std::overflow_error(location); // LCOV_EXCL_LINE + } ++drops; } if (is_negative()) @@ -220,20 +318,88 @@ Number::Guard::doRound(rep& drops) // Number -constexpr Number one{1000000000000000, -15, Number::unchecked{}}; - -void -Number::normalize() +// Safely convert rep (int64) mantissa to internalrep (uint64). If the rep 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. +Number::internalrep +Number::externalToInternal(rep mantissa) { + // If the mantissa is already positive, just return it + if (mantissa >= 0) + return mantissa; + // If the mantissa is negative, but fits within the positive range of rep, + // return it negated + if (mantissa >= -std::numeric_limits::max()) + return -mantissa; + + // If the mantissa doesn't fit within the positive range, convert to + // 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 temp = mantissa; + return static_cast(-temp); +} + +constexpr Number +Number::oneSmall() +{ + return Number{ + false, + Number::smallRange.min, + -Number::smallRange.log, + Number::unchecked{}}; +}; + +constexpr Number oneSml = Number::oneSmall(); + +constexpr Number +Number::oneLarge() +{ + return Number{ + false, + Number::largeRange.min, + -Number::largeRange.log, + Number::unchecked{}}; +}; + +constexpr Number oneLrg = Number::oneLarge(); + +Number +Number::one() +{ + if (&range_.get() == &smallRange) + return oneSml; + XRPL_ASSERT(&range_.get() == &largeRange, "Number::one() : valid range_"); + return oneLrg; +} + +// Use the member names in this static function for now so the diff is cleaner +// TODO: Rename the function parameters to get rid of the "_" suffix +template +void +doNormalize( + bool& negative, + T& mantissa_, + int& exponent_, + MantissaRange::rep const& minMantissa, + MantissaRange::rep const& maxMantissa) +{ + auto constexpr minExponent = Number::minExponent; + auto constexpr maxExponent = Number::maxExponent; + auto constexpr maxRep = Number::maxRep; + + using Guard = Number::Guard; + + constexpr Number zero = Number{}; if (mantissa_ == 0) { - *this = Number{}; + mantissa_ = zero.mantissa_; + exponent_ = zero.exponent_; + negative = zero.negative_; return; } - bool const negative = (mantissa_ < 0); - auto m = static_cast>(mantissa_); - if (negative) - m = -m; + auto m = mantissa_; while ((m < minMantissa) && (exponent_ > minExponent)) { m *= 10; @@ -250,57 +416,161 @@ Number::normalize() m /= 10; ++exponent_; } - mantissa_ = m; - if ((exponent_ < minExponent) || (mantissa_ < minMantissa)) + if ((exponent_ < minExponent) || (m < minMantissa)) { - *this = Number{}; + mantissa_ = zero.mantissa_; + exponent_ = zero.exponent_; + negative = zero.negative_; return; } - g.doRoundUp(mantissa_, exponent_, "Number::normalize 2"); + // When using the largeRange, "m" needs fit within an int64, even if + // the final mantissa_ is going to end up larger to fit within the + // MantissaRange. Cut it down here so that the rounding will be done while + // it's smaller. + // + // Example: 9,900,000,000,000,123,456 > 9,223,372,036,854,775,807, + // so "m" will be modified to 990,000,000,000,012,345. Then that value + // will be rounded to 990,000,000,000,012,345 or + // 990,000,000,000,012,346, depending on the rounding mode. Finally, + // mantissa_ will be "m*10" so it fits within the range, and end up as + // 9,900,000,000,000,123,450 or 9,900,000,000,000,123,460. + // mantissa() will return mantissa_ / 10, and exponent() will return + // exponent_ + 1. + if (m > maxRep) + { + if (exponent_ >= maxExponent) + throw std::overflow_error("Number::normalize 1.5"); + g.push(m % 10); + m /= 10; + ++exponent_; + } + // Before modification, m should be within the min/max range. After + // modification, it must be less than maxRep. In other words, the original + // value should have been no more than maxRep * 10. + // (maxRep * 10 > maxMantissa) + XRPL_ASSERT_PARTS( + m <= maxRep, + "xrpl::doNormalize", + "intermediate mantissa fits in int64"); + mantissa_ = m; - if (negative) - mantissa_ = -mantissa_; + g.doRoundUp( + negative, + mantissa_, + exponent_, + minMantissa, + maxMantissa, + "Number::normalize 2"); + XRPL_ASSERT_PARTS( + mantissa_ >= minMantissa && mantissa_ <= maxMantissa, + "xrpl::doNormalize", + "final mantissa fits in range"); +} + +template <> +void +Number::normalize( + bool& negative, + uint128_t& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa) +{ + doNormalize(negative, mantissa, exponent, minMantissa, maxMantissa); +} + +template <> +void +Number::normalize( + bool& negative, + unsigned long long& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa) +{ + doNormalize(negative, mantissa, exponent, minMantissa, maxMantissa); +} + +template <> +void +Number::normalize( + bool& negative, + unsigned long& mantissa, + int& exponent, + internalrep const& minMantissa, + internalrep const& maxMantissa) +{ + doNormalize(negative, mantissa, exponent, minMantissa, maxMantissa); +} + +void +Number::normalize() +{ + auto const& range = range_.get(); + normalize(negative_, mantissa_, exponent_, range.min, range.max); +} + +// Copy the number, but set a new exponent. Because the mantissa doesn't change, +// the result will be "mostly" normalized, but the exponent could go out of +// range. +Number +Number::shiftExponent(int exponentDelta) const +{ + XRPL_ASSERT_PARTS(isnormal(), "xrpl::Number::shiftExponent", "normalized"); + auto const newExponent = exponent_ + exponentDelta; + if (newExponent >= maxExponent) + throw std::overflow_error("Number::shiftExponent"); + if (newExponent < minExponent) + { + return Number{}; + } + Number const result{negative_, mantissa_, newExponent, unchecked{}}; + XRPL_ASSERT_PARTS( + result.isnormal(), + "xrpl::Number::shiftExponent", + "result is normalized"); + return result; } Number& Number::operator+=(Number const& y) { - if (y == Number{}) + constexpr Number zero = Number{}; + if (y == zero) return *this; - if (*this == Number{}) + if (*this == zero) { *this = y; return *this; } if (*this == -y) { - *this = Number{}; + *this = zero; return *this; } + XRPL_ASSERT( isnormal() && y.isnormal(), "xrpl::Number::operator+=(Number) : is normal"); - auto xm = mantissa(); - auto xe = exponent(); - int xn = 1; - if (xm < 0) - { - xm = -xm; - xn = -1; - } - auto ym = y.mantissa(); - auto ye = y.exponent(); - int yn = 1; - if (ym < 0) - { - ym = -ym; - yn = -1; - } + // *n = negative + // *s = sign + // *m = mantissa + // *e = exponent + + // Need to use uint128_t, because large mantissas can overflow when added + // together. + bool xn = negative_; + uint128_t xm = mantissa_; + auto xe = exponent_; + + bool yn = y.negative_; + uint128_t ym = y.mantissa_; + auto ye = y.exponent_; Guard g; if (xe < ye) { - if (xn == -1) + if (xn) g.set_negative(); do { @@ -311,7 +581,7 @@ Number::operator+=(Number const& y) } else if (xe > ye) { - if (yn == -1) + if (yn) g.set_negative(); do { @@ -320,16 +590,22 @@ Number::operator+=(Number const& y) ++ye; } while (xe > ye); } + + auto const& range = range_.get(); + auto const& minMantissa = range.min; + auto const& maxMantissa = range.max; + if (xn == yn) { xm += ym; - if (xm > maxMantissa) + if (xm > maxMantissa || xm > maxRep) { g.push(xm % 10); xm /= 10; ++xe; } - g.doRoundUp(xm, xe, "Number::addition overflow"); + g.doRoundUp( + xn, xm, xe, minMantissa, maxMantissa, "Number::addition overflow"); } else { @@ -343,16 +619,19 @@ Number::operator+=(Number const& y) xe = ye; xn = yn; } - while (xm < minMantissa) + while (xm < minMantissa && xm * 10 <= maxRep) { xm *= 10; xm -= g.pop(); --xe; } - g.doRoundDown(xm, xe); + g.doRoundDown(xn, xm, xe, minMantissa); } - mantissa_ = xm * xn; + + negative_ = xn; + mantissa_ = static_cast(xm); exponent_ = xe; + normalize(); return *this; } @@ -387,39 +666,42 @@ divu10(uint128_t& u) Number& Number::operator*=(Number const& y) { - if (*this == Number{}) + constexpr Number zero = Number{}; + if (*this == zero) return *this; - if (y == Number{}) + if (y == zero) { *this = y; return *this; } - XRPL_ASSERT( - isnormal() && y.isnormal(), - "xrpl::Number::operator*=(Number) : is normal"); - auto xm = mantissa(); - auto xe = exponent(); - int xn = 1; - if (xm < 0) - { - xm = -xm; - xn = -1; - } - auto ym = y.mantissa(); - auto ye = y.exponent(); - int yn = 1; - if (ym < 0) - { - ym = -ym; - yn = -1; - } + // *n = negative + // *s = sign + // *m = mantissa + // *e = exponent + + bool xn = negative_; + int xs = xn ? -1 : 1; + internalrep xm = mantissa_; + auto xe = exponent_; + + bool yn = y.negative_; + int ys = yn ? -1 : 1; + internalrep ym = y.mantissa_; + auto ye = y.exponent_; + auto zm = uint128_t(xm) * uint128_t(ym); auto ze = xe + ye; - auto zn = xn * yn; + auto zs = xs * ys; + bool zn = (zs == -1); Guard g; - if (zn == -1) + if (zn) g.set_negative(); - while (zm > maxMantissa) + + auto const& range = range_.get(); + auto const& minMantissa = range.min; + auto const& maxMantissa = range.max; + + while (zm > maxMantissa || zm > maxRep) { // The following is optimization for: // g.push(static_cast(zm % 10)); @@ -427,61 +709,129 @@ Number::operator*=(Number const& y) g.push(divu10(zm)); ++ze; } - xm = static_cast(zm); + xm = static_cast(zm); xe = ze; g.doRoundUp( + zn, xm, xe, + minMantissa, + maxMantissa, "Number::multiplication overflow : exponent is " + std::to_string(xe)); - mantissa_ = xm * zn; + negative_ = zn; + mantissa_ = xm; exponent_ = xe; - XRPL_ASSERT( - isnormal() || *this == Number{}, - "xrpl::Number::operator*=(Number) : result is normal"); + + normalize(); return *this; } Number& Number::operator/=(Number const& y) { - if (y == Number{}) + constexpr Number zero = Number{}; + if (y == zero) throw std::overflow_error("Number: divide by 0"); - if (*this == Number{}) + if (*this == zero) return *this; - int np = 1; - auto nm = mantissa(); - auto ne = exponent(); - if (nm < 0) + // n* = numerator + // d* = denominator + // *p = negative (positive?) + // *s = sign + // *m = mantissa + // *e = exponent + + bool np = negative_; + int ns = (np ? -1 : 1); + auto nm = mantissa_; + auto ne = exponent_; + + bool dp = y.negative_; + int ds = (dp ? -1 : 1); + auto dm = y.mantissa_; + auto de = y.exponent_; + + auto const& range = range_.get(); + auto const& minMantissa = range.min; + auto const& maxMantissa = range.max; + + // Shift by 10^17 gives greatest precision while not overflowing + // uint128_t or the cast back to int64_t + // TODO: Can/should this be made bigger for largeRange? + // log(2^128,10) ~ 38.5 + // largeRange.log = 18, fits in 10^19 + // f can be up to 10^(38-19) = 10^19 safely + static_assert(smallRange.log == 15); + static_assert(largeRange.log == 18); + bool small = Number::getMantissaScale() == MantissaRange::small; + uint128_t const f = + small ? 100'000'000'000'000'000 : 10'000'000'000'000'000'000ULL; + XRPL_ASSERT_PARTS( + f >= minMantissa * 10, "Number::operator/=", "factor expected size"); + + // unsigned denominator + auto const dmu = static_cast(dm); + // correctionFactor can be anything between 10 and f, depending on how much + // extra precision we want to only use for rounding with the + // largeRange. Three digits seems like plenty, and is more than + // the smallRange uses. + uint128_t const correctionFactor = 1'000; + + auto const numerator = uint128_t(nm) * f; + + auto zm = numerator / dmu; + auto ze = ne - de - (small ? 17 : 19); + bool zn = (ns * ds) < 0; + if (!small) { - nm = -nm; - np = -1; + // Virtually multiply numerator by correctionFactor. Since that would + // overflow in the existing uint128_t, we'll do that part separately. + // The math for this would work for small mantissas, but we need to + // preserve existing behavior. + // + // Consider: + // ((numerator * correctionFactor) / dmu) / correctionFactor + // = ((numerator / dmu) * correctionFactor) / correctionFactor) + // + // But that assumes infinite precision. With integer math, this is + // equivalent to + // + // = ((numerator / dmu * correctionFactor) + // + ((numerator % dmu) * correctionFactor) / dmu) / correctionFactor + // + // We have already set `mantissa_ = numerator / dmu`. Now we + // compute `remainder = numerator % dmu`, and if it is + // nonzero, we do the rest of the arithmetic. If it's zero, we can skip + // it. + auto const remainder = (numerator % dmu); + if (remainder != 0) + { + zm *= correctionFactor; + auto const correction = remainder * correctionFactor / dmu; + zm += correction; + // divide by 1000 by moving the exponent, so we don't lose the + // integer value we just computed + ze -= 3; + } } - int dp = 1; - auto dm = y.mantissa(); - auto de = y.exponent(); - if (dm < 0) - { - dm = -dm; - dp = -1; - } - // Shift by 10^17 gives greatest precision while not overflowing uint128_t - // or the cast back to int64_t - uint128_t const f = 100'000'000'000'000'000; - mantissa_ = static_cast(uint128_t(nm) * f / uint128_t(dm)); - exponent_ = ne - de - 17; - mantissa_ *= np * dp; - normalize(); + normalize(zn, zm, ze, minMantissa, maxMantissa); + negative_ = zn; + mantissa_ = static_cast(zm); + exponent_ = ze; + XRPL_ASSERT_PARTS( + isnormal(), "xrpl::Number::operator/=", "result is normalized"); + return *this; } Number::operator rep() const { - rep drops = mantissa_; - int offset = exponent_; + rep drops = mantissa(); + int offset = exponent(); Guard g; if (drops != 0) { - if (drops < 0) + if (negative_) { g.set_negative(); drops = -drops; @@ -493,11 +843,11 @@ Number::operator rep() const } for (; offset > 0; --offset) { - if (drops > std::numeric_limits::max() / 10) + if (drops > maxRep / 10) throw std::overflow_error("Number::operator rep() overflow"); drops *= 10; } - g.doRound(drops); + g.doRound(drops, "Number::operator rep() rounding overflow"); } return drops; } @@ -524,34 +874,37 @@ std::string to_string(Number const& amount) { // keep full internal accuracy, but make more human friendly if possible - if (amount == Number{}) + constexpr Number zero = Number{}; + if (amount == zero) return "0"; - auto const exponent = amount.exponent(); - auto mantissa = amount.mantissa(); + auto exponent = amount.exponent_; + auto mantissa = amount.mantissa_; + bool const negative = amount.negative_; // Use scientific notation for exponents that are too small or too large - if (((exponent != 0) && ((exponent < -25) || (exponent > -5)))) + auto const rangeLog = Number::mantissaLog(); + if (((exponent != 0) && + ((exponent < -(rangeLog + 10)) || (exponent > -(rangeLog - 10))))) { - std::string ret = std::to_string(mantissa); + while (mantissa != 0 && mantissa % 10 == 0 && + exponent < Number::maxExponent) + { + mantissa /= 10; + ++exponent; + } + std::string ret = negative ? "-" : ""; + ret.append(std::to_string(mantissa)); ret.append(1, 'e'); ret.append(std::to_string(exponent)); return ret; } - bool negative = false; - - if (mantissa < 0) - { - mantissa = -mantissa; - negative = true; - } - XRPL_ASSERT( exponent + 43 > 0, "xrpl::to_string(Number) : minimum exponent"); - ptrdiff_t const pad_prefix = 27; - ptrdiff_t const pad_suffix = 23; + ptrdiff_t const pad_prefix = rangeLog + 12; + ptrdiff_t const pad_suffix = rangeLog + 8; std::string const raw_value(std::to_string(mantissa)); std::string val; @@ -561,7 +914,7 @@ to_string(Number const& amount) val.append(raw_value); val.append(pad_suffix, '0'); - ptrdiff_t const offset(exponent + 43); + ptrdiff_t const offset(exponent + pad_prefix + rangeLog + 1); auto pre_from(val.begin()); auto const pre_to(val.begin() + offset); @@ -621,7 +974,7 @@ Number power(Number const& f, unsigned n) { if (n == 0) - return one; + return Number::one(); if (n == 1) return f; auto r = power(f, n / 2); @@ -643,6 +996,9 @@ power(Number const& f, unsigned n) Number root(Number f, unsigned d) { + constexpr Number zero = Number{}; + auto const one = Number::one(); + if (f == one || d == 1) return f; if (d == 0) @@ -650,16 +1006,16 @@ root(Number f, unsigned d) if (f == -one) return one; if (abs(f) < one) - return Number{}; + return zero; throw std::overflow_error("Number::root infinity"); } - if (f < Number{} && d % 2 == 0) + if (f < zero && d % 2 == 0) throw std::overflow_error("Number::root nan"); - if (f == Number{}) + if (f == zero) return f; // Scale f into the range (0, 1) such that f's exponent is a multiple of d - auto e = f.exponent() + 16; + auto e = f.exponent_ + Number::mantissaLog() + 1; auto const di = static_cast(d); auto ex = [e = e, di = di]() // Euclidean remainder of e/d { @@ -670,9 +1026,12 @@ root(Number f, unsigned d) return di - k2; }(); e += ex; - f = Number{f.mantissa(), f.exponent() - e}; // f /= 10^e; + f = f.shiftExponent(-e); // f /= 10^e; + + XRPL_ASSERT_PARTS( + f.isnormal(), "xrpl::root(Number, unsigned)", "f is normalized"); bool neg = false; - if (f < Number{}) + if (f < zero) { neg = true; f = -f; @@ -702,24 +1061,33 @@ root(Number f, unsigned d) } while (r != rm1 && r != rm2); // return r * 10^(e/d) to reverse scaling - return Number{r.mantissa(), r.exponent() + e / di}; + auto const result = r.shiftExponent(e / di); + XRPL_ASSERT_PARTS( + result.isnormal(), + "xrpl::root(Number, unsigned)", + "result is normalized"); + return result; } Number root2(Number f) { + constexpr Number zero = Number{}; + auto const one = Number::one(); + if (f == one) return f; - if (f < Number{}) + if (f < zero) throw std::overflow_error("Number::root nan"); - if (f == Number{}) + if (f == zero) return f; // Scale f into the range (0, 1) such that f's exponent is a multiple of d - auto e = f.exponent() + 16; + auto e = f.exponent_ + Number::mantissaLog() + 1; if (e % 2 != 0) ++e; - f = Number{f.mantissa(), f.exponent() - e}; // f /= 10^e; + f = f.shiftExponent(-e); // f /= 10^e; + XRPL_ASSERT_PARTS(f.isnormal(), "xrpl::root2(Number)", "f is normalized"); // Quadratic least squares curve fit of f^(1/d) in the range [0, 1] auto const D = 105; @@ -740,7 +1108,11 @@ root2(Number f) } while (r != rm1 && r != rm2); // return r * 10^(e/2) to reverse scaling - return Number{r.mantissa(), r.exponent() + e / 2}; + auto const result = r.shiftExponent(e / 2); + XRPL_ASSERT_PARTS( + result.isnormal(), "xrpl::root2(Number)", "result is normalized"); + + return result; } // Returns f^(n/d) @@ -748,6 +1120,9 @@ root2(Number f) Number power(Number const& f, unsigned n, unsigned d) { + constexpr Number zero = Number{}; + auto const one = Number::one(); + if (f == one) return f; auto g = std::gcd(n, d); @@ -758,7 +1133,7 @@ power(Number const& f, unsigned n, unsigned d) if (f == -one) return one; if (abs(f) < one) - return Number{}; + return zero; // abs(f) > one throw std::overflow_error("Number::power infinity"); } @@ -766,7 +1141,7 @@ power(Number const& f, unsigned n, unsigned d) return one; n /= g; d /= g; - if ((n % 2) == 1 && (d % 2) == 0 && f < Number{}) + if ((n % 2) == 1 && (d % 2) == 0 && f < zero) throw std::overflow_error("Number::power nan"); return root(power(f, n), d); } diff --git a/src/libxrpl/protocol/IOUAmount.cpp b/src/libxrpl/protocol/IOUAmount.cpp index 5c9ab1febc..297c2bac12 100644 --- a/src/libxrpl/protocol/IOUAmount.cpp +++ b/src/libxrpl/protocol/IOUAmount.cpp @@ -1,8 +1,11 @@ +#include +// Do not remove. Forces IOUAmount.h to stay first, to verify it can compile +// without any hidden dependencies #include #include #include #include -#include +#include #include @@ -40,11 +43,24 @@ setSTNumberSwitchover(bool v) } /* The range for the mantissa when normalized */ -static std::int64_t constexpr minMantissa = 1000000000000000ull; -static std::int64_t constexpr maxMantissa = 9999999999999999ull; +// log(2^63,10) ~ 18.96 +// +static std::int64_t constexpr minMantissa = STAmount::cMinValue; +static std::int64_t constexpr maxMantissa = STAmount::cMaxValue; /* The range for the exponent when normalized */ -static int constexpr minExponent = -96; -static int constexpr maxExponent = 80; +static int constexpr minExponent = STAmount::cMinOffset; +static int constexpr maxExponent = STAmount::cMaxOffset; + +IOUAmount +IOUAmount::fromNumber(Number const& number) +{ + // Need to create a default IOUAmount and assign directly so it doesn't try + // to normalize, which calls fromNumber + IOUAmount result{}; + std::tie(result.mantissa_, result.exponent_) = + number.normalizeToRange(minMantissa, maxMantissa); + return result; +} IOUAmount IOUAmount::minPositiveAmount() @@ -64,8 +80,7 @@ IOUAmount::normalize() if (getSTNumberSwitchover()) { Number const v{mantissa_, exponent_}; - mantissa_ = v.mantissa(); - exponent_ = v.exponent(); + *this = fromNumber(v); if (exponent_ > maxExponent) Throw("value overflow"); if (exponent_ < minExponent) @@ -106,8 +121,7 @@ IOUAmount::normalize() mantissa_ = -mantissa_; } -IOUAmount::IOUAmount(Number const& other) - : mantissa_(other.mantissa()), exponent_(other.exponent()) +IOUAmount::IOUAmount(Number const& other) : IOUAmount(fromNumber(other)) { if (exponent_ > maxExponent) Throw("value overflow"); diff --git a/src/libxrpl/protocol/Issue.cpp b/src/libxrpl/protocol/Issue.cpp index b858a31e3e..ca5bf35e8b 100644 --- a/src/libxrpl/protocol/Issue.cpp +++ b/src/libxrpl/protocol/Issue.cpp @@ -49,6 +49,12 @@ Issue::native() const return *this == xrpIssue(); } +bool +Issue::integral() const +{ + return native(); +} + bool isConsistent(Issue const& ac) { diff --git a/src/libxrpl/protocol/Rules.cpp b/src/libxrpl/protocol/Rules.cpp index b1f2c2d631..3710322699 100644 --- a/src/libxrpl/protocol/Rules.cpp +++ b/src/libxrpl/protocol/Rules.cpp @@ -1,10 +1,13 @@ +#include +// Do not remove. Forces Rules.h to stay first, to verify it can compile +// without any hidden dependencies #include +#include #include #include #include #include #include -#include #include #include @@ -33,6 +36,15 @@ getCurrentTransactionRules() void setCurrentTransactionRules(std::optional r) { + // Make global changes associated with the rules before the value is moved. + // Push the appropriate setting, instead of having the class pull every time + // the value is needed. That could get expensive fast. + bool enableLargeNumbers = !r || + (r->enabled(featureSingleAssetVault) || + r->enabled(featureLendingProtocol)); + Number::setMantissaScale( + enableLargeNumbers ? MantissaRange::large : MantissaRange::small); + *getCurrentTransactionRulesRef() = std::move(r); } diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index ebccfb3e64..ec60971e63 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -11,11 +11,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -310,7 +312,8 @@ STAmount& STAmount::operator=(IOUAmount const& iou) { XRPL_ASSERT( - native() == false, "xrpl::STAmount::operator=(IOUAmount) : is not XRP"); + integral() == false, + "xrpl::STAmount::operator=(IOUAmount) : is not integral"); mOffset = iou.exponent(); mIsNegative = iou < beast::zero; if (mIsNegative) @@ -320,6 +323,26 @@ STAmount::operator=(IOUAmount const& iou) return *this; } +STAmount& +STAmount::operator=(Number const& number) +{ + if (!getCurrentTransactionRules() || + isFeatureEnabled(featureSingleAssetVault) || + isFeatureEnabled(featureLendingProtocol)) + { + *this = fromNumber(mAsset, number); + } + else + { + auto const originalMantissa = number.mantissa(); + mIsNegative = originalMantissa < 0; + mValue = mIsNegative ? -originalMantissa : originalMantissa; + mOffset = number.exponent(); + } + canonicalize(); + return *this; +} + //------------------------------------------------------------------------------ // // Operators @@ -849,11 +872,11 @@ STAmount::canonicalize() if (getSTNumberSwitchover()) { - Number num( - mIsNegative ? -mValue : mValue, mOffset, Number::unchecked{}); + Number num(mIsNegative, mValue, mOffset, Number::unchecked{}); auto set = [&](auto const& val) { - mIsNegative = val.value() < 0; - mValue = mIsNegative ? -val.value() : val.value(); + auto const value = val.value(); + mIsNegative = value < 0; + mValue = mIsNegative ? -value : value; }; if (native()) set(XRPAmount{num}); @@ -1323,7 +1346,7 @@ multiply(STAmount const& v1, STAmount const& v2, Asset const& asset) if (getSTNumberSwitchover()) { auto const r = Number{v1} * Number{v2}; - return STAmount{asset, r.mantissa(), r.exponent()}; + return STAmount{asset, r}; } std::uint64_t value1 = v1.mantissa(); @@ -1471,6 +1494,10 @@ roundToScale( if (value.integral()) return value; + // Nothing to do for zero. + if (value == beast::zero) + return value; + // If the value's exponent is greater than or equal to the scale, then // rounding will do nothing, and might even lose precision, so just return // the value. diff --git a/src/libxrpl/protocol/STNumber.cpp b/src/libxrpl/protocol/STNumber.cpp index f85bb48e0a..2f2dae7493 100644 --- a/src/libxrpl/protocol/STNumber.cpp +++ b/src/libxrpl/protocol/STNumber.cpp @@ -1,9 +1,13 @@ +#include +// Do not remove. Keep STNumber.h first #include #include #include +#include #include +#include #include -#include +#include #include #include @@ -17,11 +21,11 @@ namespace xrpl { STNumber::STNumber(SField const& field, Number const& value) - : STBase(field), value_(value) + : STTakesAsset(field), value_(value) { } -STNumber::STNumber(SerialIter& sit, SField const& field) : STBase(field) +STNumber::STNumber(SerialIter& sit, SField const& field) : STTakesAsset(field) { // We must call these methods in separate statements // to guarantee their order of execution. @@ -42,6 +46,19 @@ STNumber::getText() const return to_string(value_); } +void +STNumber::associateAsset(Asset const& a) +{ + STTakesAsset::associateAsset(a); + + XRPL_ASSERT_PARTS( + getFName().shouldMeta(SField::sMD_NeedsAsset), + "STNumber::associateAsset", + "field needs asset"); + + roundToAsset(a, value_); +} + void STNumber::add(Serializer& s) const { @@ -49,8 +66,49 @@ STNumber::add(Serializer& s) const XRPL_ASSERT( getFName().fieldType == getSType(), "xrpl::STNumber::add : field type match"); - s.add64(value_.mantissa()); - s.add32(value_.exponent()); + + auto value = value_; + auto const mantissa = value.mantissa(); + auto const exponent = value.exponent(); + + SField const& field = getFName(); + if (field.shouldMeta(SField::sMD_NeedsAsset)) + { + // asset is defined in the STTakesAsset base class + if (asset_) + { + // The number should be rounded to the asset's precision, but round + // it here if it has an asset assigned. + roundToAsset(*asset_, value); + XRPL_ASSERT_PARTS( + value_ == value, + "xrpl::STNumber::add", + "value is already rounded"); + } + else + { +#if !NDEBUG + // There are circumstances where an already-rounded Number is + // serialized without being touched by a transactor, and thus + // without an asset. We can't know if it's rounded, because it could + // represent _anything_, particularly when serializing user-provided + // Json. Regardless, the only time we should be serializing an + // STNumber is when the scale is large. + XRPL_ASSERT_PARTS( + Number::getMantissaScale() == MantissaRange::large, + "xrpl::STNumber::add", + "STNumber only used with large mantissa scale"); +#endif + } + } + + XRPL_ASSERT_PARTS( + mantissa <= std::numeric_limits::max() && + mantissa >= std::numeric_limits::min(), + "xrpl::STNumber::add", + "mantissa in valid range"); + s.add64(mantissa); + s.add32(exponent); } Number const& @@ -179,20 +237,30 @@ numberFromJson(SField const& field, Json::Value const& value) else if (value.isString()) { parts = partsFromString(value.asString()); - // Only strings can represent out-of-range values. - if (parts.mantissa > std::numeric_limits::max()) - Throw("too high"); + + XRPL_ASSERT_PARTS( + !getCurrentTransactionRules(), + "xrpld::numberFromJson", + "Not in a Transactor context"); + + // Number mantissas are much bigger than the allowable parsed values, so + // it can't be out of range. + static_assert( + std::numeric_limits::max() >= + std::numeric_limits::max()); } else { Throw("not a number"); } - std::int64_t mantissa = parts.mantissa; - if (parts.negative) - mantissa = -mantissa; - - return STNumber{field, Number{mantissa, parts.exponent}}; + return STNumber{ + field, + Number{ + parts.negative, + parts.mantissa, + parts.exponent, + Number::normalized{}}}; } } // namespace xrpl diff --git a/src/libxrpl/protocol/STTakesAsset.cpp b/src/libxrpl/protocol/STTakesAsset.cpp new file mode 100644 index 0000000000..d43e7b04a1 --- /dev/null +++ b/src/libxrpl/protocol/STTakesAsset.cpp @@ -0,0 +1,29 @@ +#include +// Do not remove. Force STTakesAsset.h first +#include + +namespace xrpl { + +void +associateAsset(SLE& sle, Asset const& asset) +{ + // Iterating by offset is the only way to get non-const references + for (int i = 0; i < sle.getCount(); ++i) + { + STBase& entry = sle.getIndex(i); + SField const& field = entry.getFName(); + if (field.shouldMeta(SField::sMD_NeedsAsset)) + { + auto const type = entry.getSType(); + // If the field is not set or present, skip it. + if (type == STI_NOTPRESENT) + continue; + // If the type doesn't downcast, then the flag shouldn't be on the + // SField + auto& ta = entry.downcast(); + ta.associateAsset(asset); + } + } +} + +} // namespace xrpl diff --git a/src/test/app/AMMClawback_test.cpp b/src/test/app/AMMClawback_test.cpp index 93fda8fe34..52f05f9ed5 100644 --- a/src/test/app/AMMClawback_test.cpp +++ b/src/test/app/AMMClawback_test.cpp @@ -2425,7 +2425,10 @@ class AMMClawback_test : public beast::unit_test::suite void run() override { - FeatureBitset const all = jtx::testable_amendments(); + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + FeatureBitset const all = jtx::testable_amendments() - + featureSingleAssetVault - featureLendingProtocol; testInvalidRequest(); testFeatureDisabled(all - featureAMMClawback); diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 317f6cb63d..d1816df51b 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -26,6 +26,9 @@ namespace test { */ struct AMMExtended_test : public jtx::AMMTest { + // Use small Number mantissas for the life of this test. + NumberMantissaScaleGuard const sg_{xrpl::MantissaRange::small}; + private: void testRmFundedOffer(FeatureBitset features) @@ -42,6 +45,7 @@ private: // funded and not used for the payment. using namespace jtx; + Env env{*this, features}; fund( @@ -1418,7 +1422,12 @@ private: testOffers() { using namespace jtx; - FeatureBitset const all{testable_amendments()}; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + FeatureBitset const all{ + testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; + testRmFundedOffer(all); testRmFundedOffer(all - fixAMMv1_1 - fixAMMv1_3); testEnforceNoRipple(all); @@ -3746,7 +3755,11 @@ private: testFlow() { using namespace jtx; - FeatureBitset const all{testable_amendments()}; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas in the transaction engine + FeatureBitset const all{ + testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; testFalseDry(all); testBookStep(all); @@ -3760,7 +3773,11 @@ private: testCrossingLimits() { using namespace jtx; - FeatureBitset const all{testable_amendments()}; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas in the transaction engine + FeatureBitset const all{ + testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; testStepLimit(all); testStepLimit(all - fixAMMv1_1 - fixAMMv1_3); } @@ -3769,7 +3786,11 @@ private: testDeliverMin() { using namespace jtx; - FeatureBitset const all{testable_amendments()}; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas in the transaction engine + FeatureBitset const all{ + testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; test_convert_all_of_an_asset(all); test_convert_all_of_an_asset(all - fixAMMv1_1 - fixAMMv1_3); } @@ -3777,7 +3798,12 @@ private: void testDepositAuth() { - testPayment(jtx::testable_amendments()); + // For now, just disable SAV entirely, which locks in the small Number + // mantissas in the transaction engine + FeatureBitset const all{ + jtx::testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; + testPayment(all); testPayIOU(); } @@ -3785,7 +3811,11 @@ private: testFreeze() { using namespace test::jtx; - auto const sa = testable_amendments(); + // For now, just disable SAV entirely, which locks in the small Number + // mantissas in the transaction engine + FeatureBitset const sa{ + testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; testRippleState(sa); testGlobalFreeze(sa); testOffersWhenFrozen(sa); diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 468d5b3ffd..55bf4aa0a3 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -30,7 +30,19 @@ namespace test { */ struct AMM_test : public jtx::AMMTest { + // Use small Number mantissas for the life of this test. + NumberMantissaScaleGuard const sg_{xrpl::MantissaRange::small}; + private: + static FeatureBitset + testable_amendments() + { + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + return jtx::testable_amendments() - featureSingleAssetVault - + featureLendingProtocol; + } + void testInstanceCreate() { @@ -38,6 +50,7 @@ private: using namespace jtx; +#if NUMBERTODO // XRP to IOU, with featureSingleAssetVault testAMM( [&](AMM& ammAlice, Env&) { @@ -48,6 +61,7 @@ private: 0, {}, {testable_amendments() | featureSingleAssetVault}); +#endif // XRP to IOU, without featureSingleAssetVault testAMM( @@ -1365,8 +1379,8 @@ private: { testcase("Deposit"); - using namespace jtx; auto const all = testable_amendments(); + using namespace jtx; // Equal deposit: 1000000 tokens, 10% of the current pool testAMM([&](AMM& ammAlice, Env& env) { @@ -1384,15 +1398,14 @@ private: // equal asset deposit: unit test to exercise the rounding-down of // LPTokens in the AMMHelpers.cpp: adjustLPTokens calculations // The LPTokens need to have 16 significant digits and a fractional part - for (Number const deltaLPTokens : + for (Number const& deltaLPTokens : {Number{UINT64_C(100000'0000000009), -10}, Number{UINT64_C(100000'0000000001), -10}}) { testAMM([&](AMM& ammAlice, Env& env) { // initial LPToken balance IOUAmount const initLPToken = ammAlice.getLPTokensBalance(); - IOUAmount const newLPTokens{ - deltaLPTokens.mantissa(), deltaLPTokens.exponent()}; + IOUAmount const newLPTokens{deltaLPTokens}; // carol performs a two-asset deposit ammAlice.deposit( @@ -1417,11 +1430,9 @@ private: Number const deltaXRP = fr * 1e10; Number const deltaUSD = fr * 1e4; - STAmount const depositUSD = - STAmount{USD, deltaUSD.mantissa(), deltaUSD.exponent()}; + STAmount const depositUSD = STAmount{USD, deltaUSD}; - STAmount const depositXRP = - STAmount{XRP, deltaXRP.mantissa(), deltaXRP.exponent()}; + STAmount const depositXRP = STAmount{XRP, deltaXRP}; // initial LPTokens (1e7) + newLPTokens BEAST_EXPECT(ammAlice.expectBalances( @@ -1487,7 +1498,7 @@ private: }); // Single deposit: 100000 tokens worth of XRP - testAMM([&](AMM& ammAlice, Env&) { + testAMM([&](AMM& ammAlice, Env& env) { ammAlice.deposit(carol, 100'000, XRP(205)); BEAST_EXPECT(ammAlice.expectBalances( XRP(10'201), USD(10'000), IOUAmount{10'100'000, 0})); @@ -1668,8 +1679,8 @@ private: { testcase("Invalid Withdraw"); - using namespace jtx; auto const all = testable_amendments(); + using namespace jtx; testAMM( [&](AMM& ammAlice, Env& env) { @@ -2248,8 +2259,8 @@ private: { testcase("Withdraw"); - using namespace jtx; auto const all = testable_amendments(); + using namespace jtx; // Equal withdrawal by Carol: 1000000 of tokens, 10% of the current // pool @@ -2669,8 +2680,8 @@ private: testFeeVote() { testcase("Fee Vote"); - using namespace jtx; auto const all = testable_amendments(); + using namespace jtx; // One vote sets fee to 1%. testAMM([&](AMM& ammAlice, Env& env) { @@ -3014,6 +3025,10 @@ private: using namespace jtx; using namespace std::chrono; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + features = features - featureSingleAssetVault - featureLendingProtocol; + // Auction slot initially is owned by AMM creator, who pays 0 price. // Bid 110 tokens. Pay bidMin. @@ -3758,6 +3773,11 @@ private: testcase("Basic Payment"); using namespace jtx; + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + features = features - featureSingleAssetVault - featureLendingProtocol - + featureLendingProtocol; + // Payment 100USD for 100XRP. // Force one path with tfNoRippleDirect. testAMM( @@ -4836,12 +4856,12 @@ private: testAmendment() { testcase("Amendment"); - using namespace jtx; FeatureBitset const all{testable_amendments()}; FeatureBitset const noAMM{all - featureAMM}; FeatureBitset const noNumber{all - fixUniversalNumber}; FeatureBitset const noAMMAndNumber{ all - featureAMM - fixUniversalNumber}; + using namespace jtx; for (auto const& feature : {noAMM, noNumber, noAMMAndNumber}) { @@ -6476,6 +6496,8 @@ private: Env env(*this, features, std::make_unique(&logs)); auto rules = env.current()->rules(); CurrentTransactionRulesGuard rg(rules); + NumberMantissaScaleGuard sg(MantissaRange::small); + for (auto const& t : tests) { auto getPool = [&](std::string const& v, bool isXRP) { @@ -7025,7 +7047,7 @@ private: {{xrpPool, iouPool}}, 889, std::nullopt, - {jtx::testable_amendments() | fixAMMv1_1}); + {testable_amendments() | fixAMMv1_1}); } void @@ -7566,6 +7588,7 @@ private: { auto const [amount, amount2, lptBalance] = amm.balances(GBP, EUR); + NumberMantissaScaleGuard sg(MantissaRange::small); NumberRoundModeGuard g( env.enabled(fixAMMv1_3) ? Number::upward : Number::getround()); auto const res = root2(amount * amount2); @@ -7880,7 +7903,7 @@ private: void run() override { - FeatureBitset const all{jtx::testable_amendments()}; + FeatureBitset const all{testable_amendments()}; testInvalidInstance(); testInstanceCreate(); testInvalidDeposit(all); diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index 955ca8f449..589a8b474e 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -559,12 +559,15 @@ struct EscrowToken_test : public beast::unit_test::suite env(pay(gw, bob, USD(1))); env.close(); + bool const largeMantissa = features[featureSingleAssetVault] || + features[featureLendingProtocol]; + // alice cannot create escrow for 1/10 iou - precision loss env(escrow::create(alice, bob, USD(1)), escrow::condition(escrow::cb1), escrow::finish_time(env.now() + 1s), fee(baseFee * 150), - ter(tecPRECISION_LOSS)); + ter(largeMantissa ? (TER)tesSUCCESS : (TER)tecPRECISION_LOSS)); env.close(); } } @@ -2076,12 +2079,15 @@ struct EscrowToken_test : public beast::unit_test::suite env(pay(gw, bob, USD(1))); env.close(); + bool const largeMantissa = features[featureSingleAssetVault] || + features[featureLendingProtocol]; + // alice cannot create escrow for 1/10 iou - precision loss env(escrow::create(alice, bob, USD(1)), escrow::condition(escrow::cb1), escrow::finish_time(env.now() + 1s), fee(baseFee * 150), - ter(tecPRECISION_LOSS)); + ter(largeMantissa ? (TER)tesSUCCESS : (TER)tecPRECISION_LOSS)); env.close(); auto const seq1 = env.seq(alice); @@ -3924,9 +3930,13 @@ public: { using namespace test::jtx; FeatureBitset const all{testable_amendments()}; - testIOUWithFeats(all); - testMPTWithFeats(all); - testMPTWithFeats(all - fixTokenEscrowV1); + for (FeatureBitset const& feats : + {all - featureSingleAssetVault - featureLendingProtocol, all}) + { + testIOUWithFeats(feats); + testMPTWithFeats(feats); + testMPTWithFeats(feats - fixTokenEscrowV1); + } } }; diff --git a/src/test/app/LendingHelpers_test.cpp b/src/test/app/LendingHelpers_test.cpp index 50efe0ebe3..55fffad6b0 100644 --- a/src/test/app/LendingHelpers_test.cpp +++ b/src/test/app/LendingHelpers_test.cpp @@ -104,7 +104,7 @@ class LendingHelpers_test : public beast::unit_test::suite .name = "Multiple payments remaining", .periodicRate = Number{5, -2}, .paymentsRemaining = 3, - .expectedPaymentFactor = Number{367208564631245, -15}, + .expectedPaymentFactor = Number{3672085646312450436, -19}, }, // from calc { .name = "Zero payments remaining", @@ -172,7 +172,7 @@ class LendingHelpers_test : public beast::unit_test::suite loanPeriodicRate(TenthBips32(100'000), 30 * 24 * 60 * 60), .paymentsRemaining = 3, .expectedPeriodicPayment = - Number{3895690663961231, -13}, // from calc + Number{389569066396123265, -15}, // from calc }, }; @@ -229,7 +229,8 @@ class LendingHelpers_test : public beast::unit_test::suite }, { .name = "Standard case", - .periodicPayment = Number{3895690663961231, -13}, // from calc + .periodicPayment = + Number{389569066396123265, -15}, // from calc .periodicRate = loanPeriodicRate(TenthBips32(100'000), 30 * 24 * 60 * 60), .paymentsRemaining = 3, @@ -426,7 +427,7 @@ class LendingHelpers_test : public beast::unit_test::suite NetClock::time_point{NetClock::duration{3'000}}, .nextPaymentDueDate = 2'000, .expectedLateInterest = - Number{3170979198376459, -17}, // from calc + Number{317097919837645865, -19}, // from calc }, }; @@ -519,7 +520,7 @@ class LendingHelpers_test : public beast::unit_test::suite .prevPaymentDate = 2'000, .paymentInterval = 30 * 24 * 60 * 60, .expectedAccruedInterest = - Number{1929012345679012, -17}, // from calc + Number{1929012345679012346, -20}, // from calc }, }; @@ -587,7 +588,7 @@ class LendingHelpers_test : public beast::unit_test::suite .startDate = 1'000, .closeInterestRate = TenthBips32{0}, .expectedFullPaymentInterest = - Number{1929012345679012, -17}, // from calc + Number{1929012345679012346, -20}, // from calc }, { .name = "Standard case", @@ -600,7 +601,7 @@ class LendingHelpers_test : public beast::unit_test::suite .startDate = 1'000, .closeInterestRate = TenthBips32{10'000}, .expectedFullPaymentInterest = - Number{1000192901234568, -13}, // from calc + Number{1000192901234567901, -16}, // from calc }, }; diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 93be28e9e9..769ed40321 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -752,30 +752,36 @@ class LoanBroker_test : public beast::unit_test::suite // LoanBrokerID env(set(alice, vault.vaultID), loanBrokerID(nextKeylet.key), - ter(tecNO_ENTRY)); + ter(tecNO_ENTRY), + THISLINE); // VaultID env(set(alice, nextKeylet.key), loanBrokerID(broker->key()), - ter(tecNO_PERMISSION)); + ter(tecNO_ENTRY), + THISLINE); // Owner env(set(evan, vault.vaultID), loanBrokerID(broker->key()), - ter(tecNO_PERMISSION)); + ter(tecNO_PERMISSION), + THISLINE); // ManagementFeeRate env(set(alice, vault.vaultID), loanBrokerID(broker->key()), managementFeeRate(maxManagementFeeRate), - ter(temINVALID)); + ter(temINVALID), + THISLINE); // CoverRateMinimum env(set(alice, vault.vaultID), loanBrokerID(broker->key()), coverRateMinimum(maxManagementFeeRate), - ter(temINVALID)); + ter(temINVALID), + THISLINE); // CoverRateLiquidation env(set(alice, vault.vaultID), loanBrokerID(broker->key()), coverRateLiquidation(maxManagementFeeRate), - ter(temINVALID)); + ter(temINVALID), + THISLINE); // fields that can be changed testData = "Test Data 1234"; @@ -783,23 +789,43 @@ class LoanBroker_test : public beast::unit_test::suite env(set(alice, vault.vaultID), loanBrokerID(broker->key()), data(std::string(maxDataPayloadLength + 1, 'W')), - ter(temINVALID)); + ter(temINVALID), + THISLINE); // Bad debt maximum env(set(alice, vault.vaultID), loanBrokerID(broker->key()), debtMaximum(Number(-175, -1)), - ter(temINVALID)); + ter(temINVALID), + THISLINE); + Number debtMax{175, -1}; + if (vault.asset.integral()) + { + env(set(alice, vault.vaultID), + loanBrokerID(broker->key()), + data(testData), + debtMaximum(debtMax), + ter(tecPRECISION_LOSS), + THISLINE); + roundToAsset(vault.asset, debtMax); + } // Data & Debt maximum env(set(alice, vault.vaultID), loanBrokerID(broker->key()), data(testData), - debtMaximum(Number(175, -1))); + debtMaximum(debtMax), + THISLINE); }, [&](SLE::const_ref broker) { // Check the updated fields BEAST_EXPECT(checkVL(broker->at(sfData), testData)); - BEAST_EXPECT(broker->at(sfDebtMaximum) == Number(175, -1)); + Number const expected = + STAmount{vault.asset, Number(175, -1)}; + auto const actual = broker->at(sfDebtMaximum); + BEAST_EXPECTS( + actual == expected, + "Expected: " + to_string(expected) + + ", Actual: " + to_string(actual)); }); lifecycle( @@ -1457,9 +1483,14 @@ class LoanBroker_test : public beast::unit_test::suite env.close(); PrettyAsset const asset = [&]() { - env(trust(alice, issuer["IOU"](1'000'000)), THISLINE); + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create( + {.flags = tfMPTCanClawback | tfMPTCanTransfer | tfMPTCanLock}); env.close(); - return PrettyAsset(issuer["IOU"]); + PrettyAsset const mptAsset = mptt["MPT"]; + mptt.authorize({.account = alice}); + env.close(); + return mptAsset; }(); env(pay(issuer, alice, asset(100'000)), THISLINE); @@ -1512,6 +1543,40 @@ class LoanBroker_test : public beast::unit_test::suite tx2[sfDebtMaximum] = 0; env(tx2, ter(tesSUCCESS), THISLINE); + + tx2[sfDebtMaximum] = Json::Value::maxInt; + env(tx2, ter(tesSUCCESS), THISLINE); + + { + auto const dm = power(2, 64) - 1; + BEAST_EXPECT(dm > maxMPTokenAmount); + tx2[sfDebtMaximum] = dm; + env(tx2, ter(temINVALID), THISLINE); + } + + { + auto const dm = power(2, 63) - 1; + BEAST_EXPECTS(dm > maxMPTokenAmount, to_string(dm)); + tx2[sfDebtMaximum] = dm; + env(tx2, ter(temINVALID), THISLINE); + } + + { + auto const dm = power(2, 63) - 3; + BEAST_EXPECTS(dm == maxMPTokenAmount, to_string(dm)); + tx2[sfDebtMaximum] = dm; + env(tx2, ter(tesSUCCESS), THISLINE); + } + + { + auto const dm = 2 * (power(2, 62) - 1) + 1; + BEAST_EXPECTS(dm == maxMPTokenAmount, to_string(dm)); + tx2[sfDebtMaximum] = dm; + env(tx2, ter(tesSUCCESS), THISLINE); + } + + tx2[sfDebtMaximum] = Number{9223372036854775807, 0}; + env(tx2, ter(tesSUCCESS), THISLINE); } void diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index e4f5360043..e9780211de 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -352,8 +352,14 @@ protected: env.balance(account, broker.asset) - (balanceBefore - balanceChangeAmount), borrowerScale); - env.test.BEAST_EXPECT( - roundToScale(difference, loanScale) >= beast::zero); + env.test.expect( + roundToScale(difference, loanScale) >= beast::zero, + "Balance before: " + to_string(balanceBefore.value()) + + ", expected change: " + to_string(balanceChangeAmount) + + ", difference (balance after - expected): " + + to_string(difference), + __FILE__, + __LINE__); } } @@ -2396,7 +2402,7 @@ protected: interval * Number(12, -2) / secondsInYear; BEAST_EXPECT( periodicRate == - Number(2283105022831050, -21, Number::unchecked{})); + Number(2283105022831050228ULL, -24, Number::normalized{})); STAmount const principalOutstanding{ broker.asset, state.principalOutstanding}; STAmount const accruedInterest{ @@ -2449,6 +2455,10 @@ protected: getCurrentState(env, broker, loanKeylet, verifyLoanStatus); env.close(); + BEAST_EXPECT( + STAmount(broker.asset, state.periodicPayment) == + broker.asset(Number(8333457002039338267, -17))); + // Make all the payments in one transaction // service fee is 2 auto const startingPayments = state.paymentRemaining; @@ -2456,15 +2466,28 @@ protected: NumberRoundModeGuard mg(Number::upward); auto const rawPayoff = startingPayments * (state.periodicPayment + broker.asset(2).value()); - STAmount const payoffAmount{broker.asset, rawPayoff}; + STAmount payoffAmount{broker.asset, rawPayoff}; BEAST_EXPECTS( payoffAmount == - broker.asset(Number(1024014840139457, -12)), + broker.asset(Number(1024014840244721, -12)), to_string(payoffAmount)); BEAST_EXPECT(payoffAmount > state.principalOutstanding); + + payoffAmount = roundToScale(payoffAmount, state.loanScale); + return payoffAmount; }(); + auto const totalPayoffValue = state.totalValue + + startingPayments * broker.asset(2).value(); + STAmount const totalPayoffAmount{ + broker.asset, totalPayoffValue}; + + BEAST_EXPECTS( + totalPayoffAmount == payoffAmount, + "Payoff amount: " + to_string(payoffAmount) + + ". Total Value: " + to_string(totalPayoffAmount)); + singlePayment( loanKeylet, verifyLoanStatus, @@ -2633,7 +2656,7 @@ protected: interval * Number(12, -2) / secondsInYear; BEAST_EXPECT( periodicRate == - Number(2283105022831050, -21, Number::unchecked{})); + Number(2283105022831050228, -24, Number::normalized{})); STAmount const roundedPeriodicPayment{ broker.asset, roundPeriodicPayment( @@ -2651,7 +2674,7 @@ protected: roundedPeriodicPayment == roundToScale( broker.asset( - Number(8333457001162141, -14), Number::upward), + Number(8333457002039338267, -17), Number::upward), state.loanScale, Number::upward)); // 83334570.01162141 @@ -2666,7 +2689,7 @@ protected: totalDue == roundToScale( broker.asset( - Number(8533457001162141, -14), Number::upward), + Number(8533457002039338267, -17), Number::upward), state.loanScale, Number::upward)); @@ -2702,7 +2725,7 @@ protected: transactionAmount == roundToScale( broker.asset( - Number(9533457001162141, -14), Number::upward), + Number(9533457002039400, -14), Number::upward), state.loanScale, Number::upward)); @@ -2735,9 +2758,15 @@ protected: state.paymentRemaining, broker.params.managementFeeRate); - BEAST_EXPECT( - paymentComponents.trackedValueDelta <= - roundedPeriodicPayment); + BEAST_EXPECTS( + paymentComponents.specialCase == + detail::PaymentSpecialCase::final || + paymentComponents.trackedValueDelta <= + roundedPeriodicPayment, + "Delta: " + + to_string(paymentComponents.trackedValueDelta) + + ", periodic payment: " + + to_string(roundedPeriodicPayment)); xrpl::LoanState const nextTrueState = computeTheoreticalLoanState( @@ -2792,8 +2821,10 @@ protected: paymentComponents.trackedInterestPart() + paymentComponents.trackedManagementFeeDelta); BEAST_EXPECT( + paymentComponents.specialCase == + detail::PaymentSpecialCase::final || paymentComponents.trackedValueDelta <= - roundedPeriodicPayment); + roundedPeriodicPayment); BEAST_EXPECT( state.paymentRemaining < 12 || @@ -2804,7 +2835,7 @@ protected: Number::upward) == roundToScale( broker.asset( - Number(8333228695260180, -14), + Number(8333228691531218890, -17), Number::upward), state.loanScale, Number::upward)); @@ -3689,7 +3720,7 @@ protected: env(pay(issuer, borrower, mptAsset(10'000))); env.close(); - std::array const assets{xrpAsset, mptAsset, iouAsset}; + std::array const assets{iouAsset, xrpAsset, mptAsset}; // Create vaults and loan brokers std::vector brokers; @@ -5041,7 +5072,6 @@ protected: auto const loanSetFee = fee(env.current()->fees().base * 2); Number const principalRequest{1, 3}; - auto const startDate = env.now() + 60s; auto createJson = env.json( set(borrower, broker.brokerID, principalRequest), @@ -5065,13 +5095,13 @@ protected: auto const keylet = keylet::loan(broker.brokerID, loanSequence); createJson = env.json(createJson, sig(sfCounterpartySignature, lender)); - env(createJson, ter(tecPRECISION_LOSS), THISLINE); - env.close(startDate); + env(createJson, THISLINE); + env.close(); auto loanPayTx = env.json( pay(borrower, keylet.key, STAmount{broker.asset, Number{}})); loanPayTx["Amount"]["value"] = "0.000281284125490196"; - env(loanPayTx, ter(tecNO_ENTRY)); + env(loanPayTx, ter(tecINSUFFICIENT_PAYMENT), THISLINE); env.close(); } @@ -5640,21 +5670,26 @@ protected: BEAST_EXPECT(beforeState.periodicPayment > 0); // pay all but the last payment - Number const payment = beforeState.periodicPayment * (total - 1); - XRPAmount const payFee{ - baseFee * ((total - 1) / loanPaymentsPerFeeIncrement + 1)}; - auto loanPayTx = env.json( - pay(borrower, keylet.key, STAmount{broker.asset, payment}), - fee(payFee)); - env(loanPayTx, ter(tesSUCCESS)); - env.close(); + { + NumberRoundModeGuard mg{Number::upward}; + Number const payment = + beforeState.periodicPayment * (total - 1); + XRPAmount const payFee{ + baseFee * ((total - 1) / loanPaymentsPerFeeIncrement + 1)}; + STAmount const paymentAmount = roundToScale( + STAmount{broker.asset, payment}, beforeState.loanScale); + auto loanPayTx = env.json( + pay(borrower, keylet.key, paymentAmount), fee(payFee)); + env(loanPayTx, ter(tesSUCCESS)); + env.close(); + } // The loan is on the last payment auto const afterState = getCurrentState(env, broker, keylet); + BEAST_EXPECT(afterState.paymentRemaining == 1); BEAST_EXPECT(afterState.nextPaymentDate == maxTime - grace); BEAST_EXPECT( afterState.previousPaymentDate == maxTime - grace - interval); - BEAST_EXPECT(afterState.paymentRemaining == 1); } } diff --git a/src/test/app/MPToken_test.cpp b/src/test/app/MPToken_test.cpp index 747f78ef6b..65cb753755 100644 --- a/src/test/app/MPToken_test.cpp +++ b/src/test/app/MPToken_test.cpp @@ -1594,7 +1594,7 @@ class MPToken_test : public beast::unit_test::suite jv[jss::secret] = alice.name(); jv[jss::tx_json] = pay(alice, bob, mpt); jv[jss::tx_json][jss::Amount][jss::value] = - to_string(maxMPTokenAmount + 1); + std::to_string(maxMPTokenAmount + 1); auto const jrr = env.rpc("json", "submit", to_string(jv)); BEAST_EXPECT(jrr[jss::result][jss::error] == "invalidParams"); } @@ -2474,7 +2474,7 @@ class MPToken_test : public beast::unit_test::suite alice.name(), makeMptID(env.seq(alice), alice)); Json::Value jv = claw(alice, mpt(1), bob); - jv[jss::Amount][jss::value] = to_string(maxMPTokenAmount + 1); + jv[jss::Amount][jss::value] = std::to_string(maxMPTokenAmount + 1); Json::Value jv1; jv1[jss::secret] = alice.name(); jv1[jss::tx_json] = jv; diff --git a/src/test/basics/IOUAmount_test.cpp b/src/test/basics/IOUAmount_test.cpp index 305f2c83a1..d299f439d4 100644 --- a/src/test/basics/IOUAmount_test.cpp +++ b/src/test/basics/IOUAmount_test.cpp @@ -141,15 +141,28 @@ public: { testcase("IOU strings"); - BEAST_EXPECT(to_string(IOUAmount(-2, 0)) == "-2"); - BEAST_EXPECT(to_string(IOUAmount(0, 0)) == "0"); - BEAST_EXPECT(to_string(IOUAmount(2, 0)) == "2"); - BEAST_EXPECT(to_string(IOUAmount(25, -3)) == "0.025"); - BEAST_EXPECT(to_string(IOUAmount(-25, -3)) == "-0.025"); - BEAST_EXPECT(to_string(IOUAmount(25, 1)) == "250"); - BEAST_EXPECT(to_string(IOUAmount(-25, 1)) == "-250"); - BEAST_EXPECT(to_string(IOUAmount(2, 20)) == "2000000000000000e5"); - BEAST_EXPECT(to_string(IOUAmount(-2, -20)) == "-2000000000000000e-35"); + auto test = [this](IOUAmount const& n, std::string const& expected) { + auto const result = to_string(n); + std::stringstream ss; + ss << "to_string(" << result << "). Expected: " << expected; + BEAST_EXPECTS(result == expected, ss.str()); + }; + + for (auto const mantissaSize : + {MantissaRange::small, MantissaRange::large}) + { + NumberMantissaScaleGuard mg(mantissaSize); + + test(IOUAmount(-2, 0), "-2"); + test(IOUAmount(0, 0), "0"); + test(IOUAmount(2, 0), "2"); + test(IOUAmount(25, -3), "0.025"); + test(IOUAmount(-25, -3), "-0.025"); + test(IOUAmount(25, 1), "250"); + test(IOUAmount(-25, 1), "-250"); + test(IOUAmount(2, 20), "2e20"); + test(IOUAmount(-2, -20), "-2e-20"); + } } void diff --git a/src/test/basics/Number_test.cpp b/src/test/basics/Number_test.cpp index b7c5ee45b7..1fa5ae6e8f 100644 --- a/src/test/basics/Number_test.cpp +++ b/src/test/basics/Number_test.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -14,46 +15,84 @@ public: void testZero() { - testcase("zero"); + testcase << "zero " << to_string(Number::getMantissaScale()); - Number const z{0, 0}; + for (Number const& z : {Number{0, 0}, Number{0}}) + { + BEAST_EXPECT(z.mantissa() == 0); + BEAST_EXPECT(z.exponent() == Number{}.exponent()); - BEAST_EXPECT(z.mantissa() == 0); - BEAST_EXPECT(z.exponent() == Number{}.exponent()); - - BEAST_EXPECT((z + z) == z); - BEAST_EXPECT((z - z) == z); - BEAST_EXPECT(z == -z); + BEAST_EXPECT((z + z) == z); + BEAST_EXPECT((z - z) == z); + BEAST_EXPECT(z == -z); + } } void test_limits() { - testcase("test_limits"); + auto const scale = Number::getMantissaScale(); + testcase << "test_limits " << to_string(scale); bool caught = false; + auto const minMantissa = Number::minMantissa(); try { - Number x{10'000'000'000'000'000, 32768}; + Number x = + Number{false, minMantissa * 10, 32768, Number::normalized{}}; } catch (std::overflow_error const&) { caught = true; } BEAST_EXPECT(caught); - Number x{10'000'000'000'000'000, 32767}; - BEAST_EXPECT((x == Number{1'000'000'000'000'000, 32768})); - Number z{1'000'000'000'000'000, -32769}; - BEAST_EXPECT(z == Number{}); - Number y{1'000'000'000'000'001'500, 32000}; - BEAST_EXPECT((y == Number{1'000'000'000'000'002, 32003})); - Number m{std::numeric_limits::min()}; - BEAST_EXPECT((m == Number{-9'223'372'036'854'776, 3})); - Number M{std::numeric_limits::max()}; - BEAST_EXPECT((M == Number{9'223'372'036'854'776, 3})); + + auto test = [this](auto const& x, auto const& y, int line) { + auto const result = x == y; + std::stringstream ss; + ss << x << " == " << y << " -> " << (result ? "true" : "false"); + expect(result, ss.str(), __FILE__, line); + }; + + test( + Number{false, minMantissa * 10, 32767, Number::normalized{}}, + Number{false, minMantissa, 32768, Number::normalized{}}, + __LINE__); + test( + Number{false, minMantissa, -32769, Number::normalized{}}, + Number{}, + __LINE__); + test( + Number{false, minMantissa, 32000, Number::normalized{}} * 1'000 + + Number{false, 1'500, 32000, Number::normalized{}}, + Number{false, minMantissa + 2, 32003, Number::normalized{}}, + __LINE__); + // 9,223,372,036,854,775,808 + + test( + Number{std::numeric_limits::min()}, + scale == MantissaRange::small + ? Number{-9'223'372'036'854'776, 3} + : Number{true, 9'223'372'036'854'775'808ULL, 0, Number::normalized{}}, + __LINE__); + test( + Number{std::numeric_limits::min() + 1}, + scale == MantissaRange::small ? Number{-9'223'372'036'854'776, 3} + : Number{-9'223'372'036'854'775'807}, + __LINE__); + test( + Number{std::numeric_limits::max()}, + Number{ + scale == MantissaRange::small + ? 9'223'372'036'854'776 + : std::numeric_limits::max(), + 18 - Number::mantissaLog()}, + __LINE__); caught = false; try { - Number q{99'999'999'999'999'999, 32767}; + [[maybe_unused]] + Number q = + Number{false, minMantissa, 32767, Number::normalized{}} * 100; } catch (std::overflow_error const&) { @@ -65,76 +104,307 @@ public: void test_add() { - testcase("test_add"); + auto const scale = Number::getMantissaScale(); + testcase << "test_add " << to_string(scale); + using Case = std::tuple; - Case c[]{ - {Number{1'000'000'000'000'000, -15}, - Number{6'555'555'555'555'555, -29}, - Number{1'000'000'000'000'066, -15}}, - {Number{-1'000'000'000'000'000, -15}, - Number{-6'555'555'555'555'555, -29}, - Number{-1'000'000'000'000'066, -15}}, - {Number{-1'000'000'000'000'000, -15}, - Number{6'555'555'555'555'555, -29}, - Number{-9'999'999'999'999'344, -16}}, - {Number{-6'555'555'555'555'555, -29}, - Number{1'000'000'000'000'000, -15}, - Number{9'999'999'999'999'344, -16}}, - {Number{}, Number{5}, Number{5}}, - {Number{5'555'555'555'555'555, -32768}, - Number{-5'555'555'555'555'554, -32768}, - Number{0}}, - {Number{-9'999'999'999'999'999, -31}, - Number{1'000'000'000'000'000, -15}, - Number{9'999'999'999'999'990, -16}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x + y == z); - bool caught = false; - try + auto const cSmall = std::to_array( + {{Number{1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'066, -15}}, + {Number{-1'000'000'000'000'000, -15}, + Number{-6'555'555'555'555'555, -29}, + Number{-1'000'000'000'000'066, -15}}, + {Number{-1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{-9'999'999'999'999'344, -16}}, + {Number{-6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'000, -15}, + Number{9'999'999'999'999'344, -16}}, + {Number{}, Number{5}, Number{5}}, + {Number{5}, Number{}, Number{5}}, + {Number{5'555'555'555'555'555, -32768}, + Number{-5'555'555'555'555'554, -32768}, + Number{0}}, + {Number{-9'999'999'999'999'999, -31}, + Number{1'000'000'000'000'000, -15}, + Number{9'999'999'999'999'990, -16}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items from C + // with larger mantissa + { + {Number{1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'065'556, -18}}, + {Number{-1'000'000'000'000'000, -15}, + Number{-6'555'555'555'555'555, -29}, + Number{-1'000'000'000'000'065'556, -18}}, + {Number{-1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{ + true, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{-6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'000, -15}, + Number{ + false, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{}, Number{5}, Number{5}}, + {Number{5}, Number{}, Number{5}}, + {Number{5'555'555'555'555'555'000, -32768}, + Number{-5'555'555'555'555'554'000, -32768}, + Number{0}}, + {Number{-9'999'999'999'999'999, -31}, + Number{1'000'000'000'000'000, -15}, + Number{9'999'999'999'999'990, -16}}, + // Items from cSmall expanded for the larger mantissa + {Number{1'000'000'000'000'000'000, -18}, + Number{6'555'555'555'555'555'555, -35}, + Number{1'000'000'000'000'000'066, -18}}, + {Number{-1'000'000'000'000'000'000, -18}, + Number{-6'555'555'555'555'555'555, -35}, + Number{-1'000'000'000'000'000'066, -18}}, + {Number{-1'000'000'000'000'000'000, -18}, + Number{6'555'555'555'555'555'555, -35}, + Number{ + true, + 9'999'999'999'999'999'344ULL, + -19, + Number::normalized{}}}, + {Number{-6'555'555'555'555'555'555, -35}, + Number{1'000'000'000'000'000'000, -18}, + Number{ + false, + 9'999'999'999'999'999'344ULL, + -19, + Number::normalized{}}}, + {Number{}, Number{5}, Number{5}}, + {Number{5'555'555'555'555'555'555, -32768}, + Number{-5'555'555'555'555'555'554, -32768}, + Number{0}}, + {Number{ + true, + 9'999'999'999'999'999'999ULL, + -37, + Number::normalized{}}, + Number{1'000'000'000'000'000'000, -18}, + Number{ + false, + 9'999'999'999'999'999'990ULL, + -19, + Number::normalized{}}}, + {Number{Number::maxRep}, + Number{6, -1}, + Number{Number::maxRep / 10, 1}}, + {Number{Number::maxRep - 1}, + Number{1, 0}, + Number{Number::maxRep}}, + // Test extremes + { + // Each Number operand rounds up, so the actual mantissa is + // minMantissa + Number{ + false, + 9'999'999'999'999'999'999ULL, + 0, + Number::normalized{}}, + Number{ + false, + 9'999'999'999'999'999'999ULL, + 0, + Number::normalized{}}, + Number{2, 19}, + }, + { + // Does not round. Mantissas are going to be > maxRep, so if + // added together as uint64_t's, the result will overflow. + // With addition using uint128_t, there's no problem. After + // normalizing, the resulting mantissa ends up less than + // maxRep. + Number{ + false, + 9'999'999'999'999'999'990ULL, + 0, + Number::normalized{}}, + Number{ + false, + 9'999'999'999'999'999'990ULL, + 0, + Number::normalized{}}, + Number{ + false, + 1'999'999'999'999'999'998ULL, + 1, + Number::normalized{}}, + }, + }); + auto test = [this](auto const& c) { + for (auto const& [x, y, z] : c) + { + auto const result = x + y; + std::stringstream ss; + ss << x << " + " << y << " = " << result << ". Expected: " << z; + BEAST_EXPECTS(result == z, ss.str()); + } + }; + if (scale == MantissaRange::small) + test(cSmall); + else + test(cLarge); { - Number{9'999'999'999'999'999, 32768} + - Number{5'000'000'000'000'000, 32767}; + bool caught = false; + try + { + Number{ + false, Number::maxMantissa(), 32768, Number::normalized{}} + + Number{ + false, + Number::minMantissa(), + 32767, + Number::normalized{}} * + 5; + } + catch (std::overflow_error const&) + { + caught = true; + } + BEAST_EXPECT(caught); } - catch (std::overflow_error const&) - { - caught = true; - } - BEAST_EXPECT(caught); } void test_sub() { - testcase("test_sub"); + auto const scale = Number::getMantissaScale(); + testcase << "test_sub " << to_string(scale); + using Case = std::tuple; - Case c[]{ - {Number{1'000'000'000'000'000, -15}, - Number{6'555'555'555'555'555, -29}, - Number{9'999'999'999'999'344, -16}}, - {Number{6'555'555'555'555'555, -29}, - Number{1'000'000'000'000'000, -15}, - Number{-9'999'999'999'999'344, -16}}, - {Number{1'000'000'000'000'000, -15}, - Number{1'000'000'000'000'000, -15}, - Number{0}}, - {Number{1'000'000'000'000'000, -15}, - Number{1'000'000'000'000'001, -15}, - Number{-1'000'000'000'000'000, -30}}, - {Number{1'000'000'000'000'001, -15}, - Number{1'000'000'000'000'000, -15}, - Number{1'000'000'000'000'000, -30}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x - y == z); + auto const cSmall = std::to_array( + {{Number{1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{9'999'999'999'999'344, -16}}, + {Number{6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'000, -15}, + Number{-9'999'999'999'999'344, -16}}, + {Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'000, -15}, + Number{0}}, + {Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'001, -15}, + Number{-1'000'000'000'000'000, -30}}, + {Number{1'000'000'000'000'001, -15}, + Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'000, -30}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items from C + // with larger mantissa + { + {Number{1'000'000'000'000'000, -15}, + Number{6'555'555'555'555'555, -29}, + Number{ + false, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{6'555'555'555'555'555, -29}, + Number{1'000'000'000'000'000, -15}, + Number{ + true, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'000, -15}, + Number{0}}, + {Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'001, -15}, + Number{-1'000'000'000'000'000, -30}}, + {Number{1'000'000'000'000'001, -15}, + Number{1'000'000'000'000'000, -15}, + Number{1'000'000'000'000'000, -30}}, + // Items from cSmall expanded for the larger mantissa + {Number{1'000'000'000'000'000'000, -18}, + Number{6'555'555'555'555'555'555, -32}, + Number{ + false, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{6'555'555'555'555'555'555, -32}, + Number{1'000'000'000'000'000'000, -18}, + Number{ + true, + 9'999'999'999'999'344'444ULL, + -19, + Number::normalized{}}}, + {Number{1'000'000'000'000'000'000, -18}, + Number{1'000'000'000'000'000'000, -18}, + Number{0}}, + {Number{1'000'000'000'000'000'000, -18}, + Number{1'000'000'000'000'000'001, -18}, + Number{-1'000'000'000'000'000'000, -36}}, + {Number{1'000'000'000'000'000'001, -18}, + Number{1'000'000'000'000'000'000, -18}, + Number{1'000'000'000'000'000'000, -36}}, + {Number{Number::maxRep}, + Number{6, -1}, + Number{Number::maxRep - 1}}, + {Number{false, Number::maxRep + 1, 0, Number::normalized{}}, + Number{1, 0}, + Number{Number::maxRep / 10 + 1, 1}}, + {Number{false, Number::maxRep + 1, 0, Number::normalized{}}, + Number{3, 0}, + Number{Number::maxRep}}, + {power(2, 63), Number{3, 0}, Number{Number::maxRep}}, + }); + auto test = [this](auto const& c) { + for (auto const& [x, y, z] : c) + { + auto const result = x - y; + std::stringstream ss; + ss << x << " - " << y << " = " << result << ". Expected: " << z; + BEAST_EXPECTS(result == z, ss.str()); + } + }; + if (scale == MantissaRange::small) + test(cSmall); + else + test(cLarge); } void test_mul() { - testcase("test_mul"); + auto const scale = Number::getMantissaScale(); + testcase << "test_mul " << to_string(scale); + using Case = std::tuple; + auto test = [this](auto const& c) { + for (auto const& [x, y, z] : c) + { + auto const result = x * y; + std::stringstream ss; + ss << x << " * " << y << " = " << result << ". Expected: " << z; + BEAST_EXPECTS(result == z, ss.str()); + } + }; + auto tests = [&](auto const& cSmall, auto const& cLarge) { + if (scale == MantissaRange::small) + test(cSmall); + else + test(cLarge); + }; + auto const maxMantissa = Number::maxMantissa(); + saveNumberRoundMode save{Number::setround(Number::to_nearest)}; { - Case c[]{ + auto const cSmall = std::to_array({ {Number{7}, Number{8}, Number{56}}, {Number{1414213562373095, -15}, Number{1414213562373095, -15}, @@ -150,166 +420,520 @@ public: Number{1000000000000000, -14}}, {Number{1000000000000000, -32768}, Number{1000000000000000, -32768}, - Number{0}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x * y == z); + Number{0}}, + // Maximum mantissa range + {Number{9'999'999'999'999'999, 0}, + Number{9'999'999'999'999'999, 0}, + Number{9'999'999'999'999'998, 16}}, + }); + auto const cLarge = std::to_array({ + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + {Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999862, -18}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999862, -18}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999862, -18}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{ + false, + 9'999'999'999'999'999'579ULL, + -18, + Number::normalized{}}}, + {Number{1000000000000000000, -32768}, + Number{1000000000000000000, -32768}, + Number{0}}, + // Items from cSmall expanded for the larger mantissa, + // except duplicates. Sadly, it looks like sqrt(2)^2 != 2 + // with higher precision + {Number{1414213562373095049, -18}, + Number{1414213562373095049, -18}, + Number{2000000000000000001, -18}}, + {Number{-1414213562373095048, -18}, + Number{1414213562373095048, -18}, + Number{-1999999999999999998, -18}}, + {Number{-1414213562373095048, -18}, + Number{-1414213562373095049, -18}, + Number{1999999999999999999, -18}}, + {Number{3214285714285714278, -18}, + Number{3111111111111111119, -18}, + Number{10, 0}}, + // Maximum mantissa range - rounds up to 1e19 + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1, 38}}, + // Maximum int64 range + {Number{Number::maxRep, 0}, + Number{Number::maxRep, 0}, + Number{85'070'591'730'234'615'85, 19}}, + }); + tests(cSmall, cLarge); } Number::setround(Number::towards_zero); + testcase << "test_mul " << to_string(Number::getMantissaScale()) + << " towards_zero"; { - Case c[]{ - {Number{7}, Number{8}, Number{56}}, - {Number{1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{1999999999999999, -15}}, - {Number{-1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{-1999999999999999, -15}}, - {Number{-1414213562373095, -15}, - Number{-1414213562373095, -15}, - Number{1999999999999999, -15}}, - {Number{3214285714285706, -15}, - Number{3111111111111119, -15}, - Number{9999999999999999, -15}}, - {Number{1000000000000000, -32768}, - Number{1000000000000000, -32768}, - Number{0}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x * y == z); + auto const cSmall = std::to_array( + {{Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999, -15}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999, -15}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999, -15}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{9999999999999999, -15}}, + {Number{1000000000000000, -32768}, + Number{1000000000000000, -32768}, + Number{0}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + { + {Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999861, -18}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999861, -18}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999861, -18}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{ + false, + 9999999999999999579ULL, + -18, + Number::normalized{}}}, + {Number{1000000000000000000, -32768}, + Number{1000000000000000000, -32768}, + Number{0}}, + // Items from cSmall expanded for the larger mantissa, + // except duplicates. Sadly, it looks like sqrt(2)^2 != 2 + // with higher precision + {Number{1414213562373095049, -18}, + Number{1414213562373095049, -18}, + Number{2, 0}}, + {Number{-1414213562373095048, -18}, + Number{1414213562373095048, -18}, + Number{-1999999999999999997, -18}}, + {Number{-1414213562373095048, -18}, + Number{-1414213562373095049, -18}, + Number{1999999999999999999, -18}}, + {Number{3214285714285714278, -18}, + Number{3111111111111111119, -18}, + Number{10, 0}}, + // Maximum mantissa range - rounds down to maxMantissa/10e1 + // 99'999'999'999'999'999'800'000'000'000'000'000'100 + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{false, maxMantissa, 0, Number::normalized{}}, + Number{ + false, + maxMantissa / 10 - 1, + 20, + Number::normalized{}}}, + // Maximum int64 range + // 85'070'591'730'234'615'847'396'907'784'232'501'249 + {Number{Number::maxRep, 0}, + Number{Number::maxRep, 0}, + Number{85'070'591'730'234'615'84, 19}}, + }); + tests(cSmall, cLarge); } Number::setround(Number::downward); + testcase << "test_mul " << to_string(Number::getMantissaScale()) + << " downward"; { - Case c[]{ - {Number{7}, Number{8}, Number{56}}, - {Number{1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{1999999999999999, -15}}, - {Number{-1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{-2000000000000000, -15}}, - {Number{-1414213562373095, -15}, - Number{-1414213562373095, -15}, - Number{1999999999999999, -15}}, - {Number{3214285714285706, -15}, - Number{3111111111111119, -15}, - Number{9999999999999999, -15}}, - {Number{1000000000000000, -32768}, - Number{1000000000000000, -32768}, - Number{0}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x * y == z); + auto const cSmall = std::to_array( + {{Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999, -15}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-2000000000000000, -15}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999, -15}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{9999999999999999, -15}}, + {Number{1000000000000000, -32768}, + Number{1000000000000000, -32768}, + Number{0}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + { + {Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999861, -18}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999862, -18}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999861, -18}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{ + false, + 9'999'999'999'999'999'579ULL, + -18, + Number::normalized{}}}, + {Number{1000000000000000000, -32768}, + Number{1000000000000000000, -32768}, + Number{0}}, + // Items from cSmall expanded for the larger mantissa, + // except duplicates. Sadly, it looks like sqrt(2)^2 != 2 + // with higher precision + {Number{1414213562373095049, -18}, + Number{1414213562373095049, -18}, + Number{2, 0}}, + {Number{-1414213562373095048, -18}, + Number{1414213562373095048, -18}, + Number{-1999999999999999998, -18}}, + {Number{-1414213562373095048, -18}, + Number{-1414213562373095049, -18}, + Number{1999999999999999999, -18}}, + {Number{3214285714285714278, -18}, + Number{3111111111111111119, -18}, + Number{10, 0}}, + // Maximum mantissa range - rounds down to maxMantissa/10e1 + // 99'999'999'999'999'999'800'000'000'000'000'000'100 + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{false, maxMantissa, 0, Number::normalized{}}, + Number{ + false, + maxMantissa / 10 - 1, + 20, + Number::normalized{}}}, + // Maximum int64 range + // 85'070'591'730'234'615'847'396'907'784'232'501'249 + {Number{Number::maxRep, 0}, + Number{Number::maxRep, 0}, + Number{85'070'591'730'234'615'84, 19}}, + }); + tests(cSmall, cLarge); } Number::setround(Number::upward); + testcase << "test_mul " << to_string(Number::getMantissaScale()) + << " upward"; { - Case c[]{ - {Number{7}, Number{8}, Number{56}}, - {Number{1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{2000000000000000, -15}}, - {Number{-1414213562373095, -15}, - Number{1414213562373095, -15}, - Number{-1999999999999999, -15}}, - {Number{-1414213562373095, -15}, - Number{-1414213562373095, -15}, - Number{2000000000000000, -15}}, - {Number{3214285714285706, -15}, - Number{3111111111111119, -15}, - Number{1000000000000000, -14}}, - {Number{1000000000000000, -32768}, - Number{1000000000000000, -32768}, - Number{0}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x * y == z); + auto const cSmall = std::to_array( + {{Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{2000000000000000, -15}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999, -15}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{2000000000000000, -15}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{1000000000000000, -14}}, + {Number{1000000000000000, -32768}, + Number{1000000000000000, -32768}, + Number{0}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + { + {Number{7}, Number{8}, Number{56}}, + {Number{1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{1999999999999999862, -18}}, + {Number{-1414213562373095, -15}, + Number{1414213562373095, -15}, + Number{-1999999999999999861, -18}}, + {Number{-1414213562373095, -15}, + Number{-1414213562373095, -15}, + Number{1999999999999999862, -18}}, + {Number{3214285714285706, -15}, + Number{3111111111111119, -15}, + Number{999999999999999958, -17}}, + {Number{1000000000000000000, -32768}, + Number{1000000000000000000, -32768}, + Number{0}}, + // Items from cSmall expanded for the larger mantissa, + // except duplicates. Sadly, it looks like sqrt(2)^2 != 2 + // with higher precision + {Number{1414213562373095049, -18}, + Number{1414213562373095049, -18}, + Number{2000000000000000001, -18}}, + {Number{-1414213562373095048, -18}, + Number{1414213562373095048, -18}, + Number{-1999999999999999997, -18}}, + {Number{-1414213562373095048, -18}, + Number{-1414213562373095049, -18}, + Number{2, 0}}, + {Number{3214285714285714278, -18}, + Number{3111111111111111119, -18}, + Number{1000000000000000001, -17}}, + // Maximum mantissa range - rounds up to minMantissa*10 + // 1e19*1e19=1e38 + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1, 38}}, + // Maximum int64 range + // 85'070'591'730'234'615'847'396'907'784'232'501'249 + {Number{Number::maxRep, 0}, + Number{Number::maxRep, 0}, + Number{85'070'591'730'234'615'85, 19}}, + }); + tests(cSmall, cLarge); } - bool caught = false; - try + testcase << "test_mul " << to_string(Number::getMantissaScale()) + << " overflow"; { - Number{9'999'999'999'999'999, 32768} * - Number{5'000'000'000'000'000, 32767}; + bool caught = false; + try + { + Number{false, maxMantissa, 32768, Number::normalized{}} * + Number{ + false, + Number::minMantissa() * 5, + 32767, + Number::normalized{}}; + } + catch (std::overflow_error const&) + { + caught = true; + } + BEAST_EXPECT(caught); } - catch (std::overflow_error const&) - { - caught = true; - } - BEAST_EXPECT(caught); } void test_div() { - testcase("test_div"); + auto const scale = Number::getMantissaScale(); + testcase << "test_div " << to_string(scale); + using Case = std::tuple; + auto test = [this](auto const& c) { + for (auto const& [x, y, z] : c) + { + auto const result = x / y; + std::stringstream ss; + ss << x << " / " << y << " = " << result << ". Expected: " << z; + BEAST_EXPECTS(result == z, ss.str()); + } + }; + auto const maxMantissa = Number::maxMantissa(); + auto tests = [&](auto const& cSmall, auto const& cLarge) { + if (scale == MantissaRange::small) + test(cSmall); + else + test(cLarge); + }; saveNumberRoundMode save{Number::setround(Number::to_nearest)}; { - Case c[]{ - {Number{1}, Number{2}, Number{5, -1}}, - {Number{1}, Number{10}, Number{1, -1}}, - {Number{1}, Number{-10}, Number{-1, -1}}, - {Number{0}, Number{100}, Number{0}}, - {Number{1414213562373095, -10}, - Number{1414213562373095, -10}, - Number{1}}, - {Number{9'999'999'999'999'999}, - Number{1'000'000'000'000'000}, - Number{9'999'999'999'999'999, -15}}, - {Number{2}, Number{3}, Number{6'666'666'666'666'667, -16}}, - {Number{-2}, Number{3}, Number{-6'666'666'666'666'667, -16}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x / y == z); + auto const cSmall = std::to_array( + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'667, -16}}, + {Number{-2}, Number{3}, Number{-6'666'666'666'666'667, -16}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428, -16}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666'667, -19}}, + {Number{-2}, + Number{3}, + Number{-6'666'666'666'666'666'667, -19}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428'571, -19}}, + // Items from cSmall expanded for the larger mantissa, except + // duplicates. + {Number{1414213562373095049, -13}, + Number{1414213562373095049, -13}, + Number{1}}, + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1'000'000'000'000'000'000}, + Number{false, maxMantissa, -18, Number::normalized{}}}}); + tests(cSmall, cLarge); } + testcase << "test_div " << to_string(Number::getMantissaScale()) + << " towards_zero"; Number::setround(Number::towards_zero); { - Case c[]{ - {Number{1}, Number{2}, Number{5, -1}}, - {Number{1}, Number{10}, Number{1, -1}}, - {Number{1}, Number{-10}, Number{-1, -1}}, - {Number{0}, Number{100}, Number{0}}, - {Number{1414213562373095, -10}, - Number{1414213562373095, -10}, - Number{1}}, - {Number{9'999'999'999'999'999}, - Number{1'000'000'000'000'000}, - Number{9'999'999'999'999'999, -15}}, - {Number{2}, Number{3}, Number{6'666'666'666'666'666, -16}}, - {Number{-2}, Number{3}, Number{-6'666'666'666'666'666, -16}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x / y == z); + auto const cSmall = std::to_array( + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666, -16}}, + {Number{-2}, Number{3}, Number{-6'666'666'666'666'666, -16}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428, -16}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666'666, -19}}, + {Number{-2}, + Number{3}, + Number{-6'666'666'666'666'666'666, -19}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428'571, -19}}, + // Items from cSmall expanded for the larger mantissa, except + // duplicates. + {Number{1414213562373095049, -13}, + Number{1414213562373095049, -13}, + Number{1}}, + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1'000'000'000'000'000'000}, + Number{false, maxMantissa, -18, Number::normalized{}}}}); + tests(cSmall, cLarge); } + testcase << "test_div " << to_string(Number::getMantissaScale()) + << " downward"; Number::setround(Number::downward); { - Case c[]{ - {Number{1}, Number{2}, Number{5, -1}}, - {Number{1}, Number{10}, Number{1, -1}}, - {Number{1}, Number{-10}, Number{-1, -1}}, - {Number{0}, Number{100}, Number{0}}, - {Number{1414213562373095, -10}, - Number{1414213562373095, -10}, - Number{1}}, - {Number{9'999'999'999'999'999}, - Number{1'000'000'000'000'000}, - Number{9'999'999'999'999'999, -15}}, - {Number{2}, Number{3}, Number{6'666'666'666'666'666, -16}}, - {Number{-2}, Number{3}, Number{-6'666'666'666'666'667, -16}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x / y == z); + auto const cSmall = std::to_array( + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666, -16}}, + {Number{-2}, Number{3}, Number{-6'666'666'666'666'667, -16}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428, -16}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666'666, -19}}, + {Number{-2}, + Number{3}, + Number{-6'666'666'666'666'666'667, -19}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428'571, -19}}, + // Items from cSmall expanded for the larger mantissa, except + // duplicates. + {Number{1414213562373095049, -13}, + Number{1414213562373095049, -13}, + Number{1}}, + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1'000'000'000'000'000'000}, + Number{false, maxMantissa, -18, Number::normalized{}}}}); + tests(cSmall, cLarge); } + testcase << "test_div " << to_string(Number::getMantissaScale()) + << " upward"; Number::setround(Number::upward); { - Case c[]{ - {Number{1}, Number{2}, Number{5, -1}}, - {Number{1}, Number{10}, Number{1, -1}}, - {Number{1}, Number{-10}, Number{-1, -1}}, - {Number{0}, Number{100}, Number{0}}, - {Number{1414213562373095, -10}, - Number{1414213562373095, -10}, - Number{1}}, - {Number{9'999'999'999'999'999}, - Number{1'000'000'000'000'000}, - Number{9'999'999'999'999'999, -15}}, - {Number{2}, Number{3}, Number{6'666'666'666'666'667, -16}}, - {Number{-2}, Number{3}, Number{-6'666'666'666'666'666, -16}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT(x / y == z); + auto const cSmall = std::to_array( + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'667, -16}}, + {Number{-2}, Number{3}, Number{-6'666'666'666'666'666, -16}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'429, -16}}}); + auto const cLarge = std::to_array( + // Note that items with extremely large mantissas need to be + // calculated, because otherwise they overflow uint64. Items + // from C with larger mantissa + {{Number{1}, Number{2}, Number{5, -1}}, + {Number{1}, Number{10}, Number{1, -1}}, + {Number{1}, Number{-10}, Number{-1, -1}}, + {Number{0}, Number{100}, Number{0}}, + {Number{1414213562373095, -10}, + Number{1414213562373095, -10}, + Number{1}}, + {Number{9'999'999'999'999'999}, + Number{1'000'000'000'000'000}, + Number{9'999'999'999'999'999, -15}}, + {Number{2}, Number{3}, Number{6'666'666'666'666'666'667, -19}}, + {Number{-2}, + Number{3}, + Number{-6'666'666'666'666'666'666, -19}}, + {Number{1}, Number{7}, Number{1'428'571'428'571'428'572, -19}}, + // Items from cSmall expanded for the larger mantissa, except + // duplicates. + {Number{1414213562373095049, -13}, + Number{1414213562373095049, -13}, + Number{1}}, + {Number{false, maxMantissa, 0, Number::normalized{}}, + Number{1'000'000'000'000'000'000}, + Number{false, maxMantissa, -18, Number::normalized{}}}}); + tests(cSmall, cLarge); } + testcase << "test_div " << to_string(Number::getMantissaScale()) + << " overflow"; bool caught = false; try { @@ -325,20 +949,59 @@ public: void test_root() { - testcase("test_root"); + auto const scale = Number::getMantissaScale(); + testcase << "test_root " << to_string(scale); + using Case = std::tuple; - Case c[]{ - {Number{2}, 2, Number{1414213562373095, -15}}, - {Number{2'000'000}, 2, Number{1414213562373095, -12}}, - {Number{2, -30}, 2, Number{1414213562373095, -30}}, - {Number{-27}, 3, Number{-3}}, - {Number{1}, 5, Number{1}}, - {Number{-1}, 0, Number{1}}, - {Number{5, -1}, 0, Number{0}}, - {Number{0}, 5, Number{0}}, - {Number{5625, -4}, 2, Number{75, -2}}}; - for (auto const& [x, y, z] : c) - BEAST_EXPECT((root(x, y) == z)); + auto test = [this](auto const& c) { + for (auto const& [x, y, z] : c) + { + auto const result = root(x, y); + std::stringstream ss; + ss << "root(" << x << ", " << y << ") = " << result + << ". Expected: " << z; + BEAST_EXPECTS(result == z, ss.str()); + } + }; + /* + auto tests = [&](auto const& cSmall, auto const& cLarge) { + test(cSmall); + if (scale != MantissaRange::small) + test(cLarge); + }; + */ + + auto const cSmall = std::to_array( + {{Number{2}, 2, Number{1414213562373095049, -18}}, + {Number{2'000'000}, 2, Number{1414213562373095049, -15}}, + {Number{2, -30}, 2, Number{1414213562373095049, -33}}, + {Number{-27}, 3, Number{-3}}, + {Number{1}, 5, Number{1}}, + {Number{-1}, 0, Number{1}}, + {Number{5, -1}, 0, Number{0}}, + {Number{0}, 5, Number{0}}, + {Number{5625, -4}, 2, Number{75, -2}}}); + auto const cLarge = std::to_array({ + {Number{false, Number::maxMantissa() - 9, -1, Number::normalized{}}, + 2, + Number{false, 999'999'999'999'999'999, -9, Number::normalized{}}}, + {Number{false, Number::maxMantissa() - 9, 0, Number::normalized{}}, + 2, + Number{ + false, 3'162'277'660'168'379'330, -9, Number::normalized{}}}, + {Number{Number::maxRep}, + 2, + Number{false, 3'037'000'499'976049692, -9, Number::normalized{}}}, + {Number{Number::maxRep}, + 4, + Number{false, 55'108'98747006743627, -14, Number::normalized{}}}, + }); + test(cSmall); + if (Number::getMantissaScale() != MantissaRange::small) + { + NumberRoundModeGuard mg(Number::towards_zero); + test(cLarge); + } bool caught = false; try { @@ -361,10 +1024,52 @@ public: BEAST_EXPECT(caught); } + void + test_root2() + { + auto const scale = Number::getMantissaScale(); + testcase << "test_root2 " << to_string(scale); + + auto test = [this](auto const& c) { + for (auto const& x : c) + { + auto const expected = root(x, 2); + auto const result = root2(x); + std::stringstream ss; + ss << "root2(" << x << ") = " << result + << ". Expected: " << expected; + BEAST_EXPECTS(result == expected, ss.str()); + } + }; + + auto const cSmall = std::to_array({ + Number{2}, + Number{2'000'000}, + Number{2, -30}, + Number{27}, + Number{1}, + Number{5, -1}, + Number{0}, + Number{5625, -4}, + Number{Number::maxRep}, + }); + test(cSmall); + bool caught = false; + try + { + (void)root2(Number{-2}); + } + catch (std::overflow_error const&) + { + caught = true; + } + BEAST_EXPECT(caught); + } + void test_power1() { - testcase("test_power1"); + testcase << "test_power1 " << to_string(Number::getMantissaScale()); using Case = std::tuple; Case c[]{ {Number{64}, 0, Number{1}}, @@ -372,7 +1077,13 @@ public: {Number{64}, 2, Number{4096}}, {Number{-64}, 2, Number{4096}}, {Number{64}, 3, Number{262144}}, - {Number{-64}, 3, Number{-262144}}}; + {Number{-64}, 3, Number{-262144}}, + {Number{64}, + 11, + Number{false, 7378697629483820646ULL, 1, Number::normalized{}}}, + {Number{-64}, + 11, + Number{true, 7378697629483820646ULL, 1, Number::normalized{}}}}; for (auto const& [x, y, z] : c) BEAST_EXPECT((power(x, y) == z)); } @@ -380,7 +1091,7 @@ public: void test_power2() { - testcase("test_power2"); + testcase << "test_power2 " << to_string(Number::getMantissaScale()); using Case = std::tuple; Case c[]{ {Number{1}, 3, 7, Number{1}}, @@ -426,7 +1137,7 @@ public: void testConversions() { - testcase("testConversions"); + testcase << "testConversions " << to_string(Number::getMantissaScale()); IOUAmount x{5, 6}; Number y = x; @@ -452,7 +1163,7 @@ public: void test_to_integer() { - testcase("test_to_integer"); + testcase << "test_to_integer " << to_string(Number::getMantissaScale()); using Case = std::tuple; saveNumberRoundMode save{Number::setround(Number::to_nearest)}; { @@ -620,7 +1331,7 @@ public: void test_squelch() { - testcase("test_squelch"); + testcase << "test_squelch " << to_string(Number::getMantissaScale()); Number limit{1, -6}; BEAST_EXPECT((squelch(Number{2, -6}, limit) == Number{2, -6})); BEAST_EXPECT((squelch(Number{1, -6}, limit) == Number{1, -6})); @@ -633,22 +1344,129 @@ public: void testToString() { - testcase("testToString"); - BEAST_EXPECT(to_string(Number(-2, 0)) == "-2"); - BEAST_EXPECT(to_string(Number(0, 0)) == "0"); - BEAST_EXPECT(to_string(Number(2, 0)) == "2"); - BEAST_EXPECT(to_string(Number(25, -3)) == "0.025"); - BEAST_EXPECT(to_string(Number(-25, -3)) == "-0.025"); - BEAST_EXPECT(to_string(Number(25, 1)) == "250"); - BEAST_EXPECT(to_string(Number(-25, 1)) == "-250"); - BEAST_EXPECT(to_string(Number(2, 20)) == "2000000000000000e5"); - BEAST_EXPECT(to_string(Number(-2, -20)) == "-2000000000000000e-35"); + auto const scale = Number::getMantissaScale(); + testcase << "testToString " << to_string(scale); + + auto test = [this](Number const& n, std::string const& expected) { + auto const result = to_string(n); + std::stringstream ss; + ss << "to_string(" << result << "). Expected: " << expected; + BEAST_EXPECTS(result == expected, ss.str()); + }; + + test(Number(-2, 0), "-2"); + test(Number(0, 0), "0"); + test(Number(2, 0), "2"); + test(Number(25, -3), "0.025"); + test(Number(-25, -3), "-0.025"); + test(Number(25, 1), "250"); + test(Number(-25, 1), "-250"); + test(Number(2, 20), "2e20"); + test(Number(-2, -20), "-2e-20"); + // Test the edges + // ((exponent < -(25)) || (exponent > -(5))))) + // or ((exponent < -(28)) || (exponent > -(8))))) + test(Number(2, -10), "0.0000000002"); + test(Number(2, -11), "2e-11"); + + test(Number(-2, 10), "-20000000000"); + test(Number(-2, 11), "-2e11"); + + switch (scale) + { + case MantissaRange::small: + + test(Number::min(), "1e-32753"); + test(Number::max(), "9999999999999999e32768"); + test(Number::lowest(), "-9999999999999999e32768"); + { + NumberRoundModeGuard mg(Number::towards_zero); + + auto const maxMantissa = Number::maxMantissa(); + BEAST_EXPECT(maxMantissa == 9'999'999'999'999'999); + test( + Number{ + false, + maxMantissa * 1000 + 999, + -3, + Number::normalized()}, + "9999999999999999"); + test( + Number{ + true, + maxMantissa * 1000 + 999, + -3, + Number::normalized()}, + "-9999999999999999"); + + test( + Number{std::numeric_limits::max(), -3}, + "9223372036854775"); + test( + -(Number{std::numeric_limits::max(), -3}), + "-9223372036854775"); + + test( + Number{std::numeric_limits::min(), 0}, + "-9223372036854775e3"); + test( + -(Number{std::numeric_limits::min(), 0}), + "9223372036854775e3"); + } + break; + case MantissaRange::large: + // Test the edges + // ((exponent < -(28)) || (exponent > -(8))))) + test(Number::min(), "1e-32750"); + test(Number::max(), "9223372036854775807e32768"); + test(Number::lowest(), "-9223372036854775807e32768"); + { + NumberRoundModeGuard mg(Number::towards_zero); + + auto const maxMantissa = Number::maxMantissa(); + BEAST_EXPECT(maxMantissa == 9'999'999'999'999'999'999ULL); + test( + Number{false, maxMantissa, 0, Number::normalized{}}, + "9999999999999999990"); + test( + Number{true, maxMantissa, 0, Number::normalized{}}, + "-9999999999999999990"); + + test( + Number{std::numeric_limits::max(), 0}, + "9223372036854775807"); + test( + -(Number{std::numeric_limits::max(), 0}), + "-9223372036854775807"); + + // Because the absolute value of min is larger than max, it + // will be scaled down to fit under max. Since we're + // rounding towards zero, the 8 at the end is dropped. + test( + Number{std::numeric_limits::min(), 0}, + "-9223372036854775800"); + test( + -(Number{std::numeric_limits::min(), 0}), + "9223372036854775800"); + } + + test( + Number{std::numeric_limits::max(), 0} + 1, + "9223372036854775810"); + test( + -(Number{std::numeric_limits::max(), 0} + 1), + "-9223372036854775810"); + break; + default: + BEAST_EXPECT(false); + } } void test_relationals() { - testcase("test_relationals"); + testcase << "test_relationals " + << to_string(Number::getMantissaScale()); BEAST_EXPECT(!(Number{100} < Number{10})); BEAST_EXPECT(Number{100} > Number{10}); BEAST_EXPECT(Number{100} >= Number{10}); @@ -658,7 +1476,7 @@ public: void test_stream() { - testcase("test_stream"); + testcase << "test_stream " << to_string(Number::getMantissaScale()); Number x{100}; std::ostringstream os; os << x; @@ -668,7 +1486,7 @@ public: void test_inc_dec() { - testcase("test_inc_dec"); + testcase << "test_inc_dec " << to_string(Number::getMantissaScale()); Number x{100}; Number y = +x; BEAST_EXPECT(x == y); @@ -685,19 +1503,19 @@ public: Issue const issue; Number const n{7'518'783'80596, -5}; saveNumberRoundMode const save{Number::setround(Number::to_nearest)}; - auto res2 = STAmount{issue, n.mantissa(), n.exponent()}; + auto res2 = STAmount{issue, n}; BEAST_EXPECT(res2 == STAmount{7518784}); Number::setround(Number::towards_zero); - res2 = STAmount{issue, n.mantissa(), n.exponent()}; + res2 = STAmount{issue, n}; BEAST_EXPECT(res2 == STAmount{7518783}); Number::setround(Number::downward); - res2 = STAmount{issue, n.mantissa(), n.exponent()}; + res2 = STAmount{issue, n}; BEAST_EXPECT(res2 == STAmount{7518783}); Number::setround(Number::upward); - res2 = STAmount{issue, n.mantissa(), n.exponent()}; + res2 = STAmount{issue, n}; BEAST_EXPECT(res2 == STAmount{7518784}); } @@ -834,28 +1652,94 @@ public: } } + void + testInt64() + { + auto const scale = Number::getMantissaScale(); + testcase << "std::int64_t " << to_string(scale); + + // Control case + BEAST_EXPECT(Number::maxMantissa() > 10); + Number ten{10}; + BEAST_EXPECT(ten.exponent() <= 0); + + if (scale == MantissaRange::small) + { + BEAST_EXPECT( + std::numeric_limits::max() > INITIAL_XRP.drops()); + BEAST_EXPECT(Number::maxMantissa() < INITIAL_XRP.drops()); + Number const initalXrp{INITIAL_XRP}; + BEAST_EXPECT(initalXrp.exponent() > 0); + + Number const maxInt64{Number::maxRep}; + BEAST_EXPECT(maxInt64.exponent() > 0); + // 85'070'591'730'234'615'865'843'651'857'942'052'864 - 38 digits + BEAST_EXPECT( + (power(maxInt64, 2) == Number{85'070'591'730'234'62, 22})); + + Number const max = + Number{false, Number::maxMantissa(), 0, Number::normalized{}}; + BEAST_EXPECT(max.exponent() <= 0); + // 99'999'999'999'999'980'000'000'000'000'001 - 32 digits + BEAST_EXPECT((power(max, 2) == Number{99'999'999'999'999'98, 16})); + } + else + { + BEAST_EXPECT( + std::numeric_limits::max() > INITIAL_XRP.drops()); + BEAST_EXPECT(Number::maxMantissa() > INITIAL_XRP.drops()); + Number const initalXrp{INITIAL_XRP}; + BEAST_EXPECT(initalXrp.exponent() <= 0); + + Number const maxInt64{Number::maxRep}; + BEAST_EXPECT(maxInt64.exponent() <= 0); + // 85'070'591'730'234'615'847'396'907'784'232'501'249 - 38 digits + BEAST_EXPECT( + (power(maxInt64, 2) == Number{85'070'591'730'234'615'85, 19})); + + NumberRoundModeGuard mg(Number::towards_zero); + + auto const maxMantissa = Number::maxMantissa(); + Number const max = + Number{false, maxMantissa, 0, Number::normalized{}}; + BEAST_EXPECT(max.mantissa() == maxMantissa / 10); + BEAST_EXPECT(max.exponent() == 1); + // 99'999'999'999'999'999'800'000'000'000'000'000'100 - also 38 + // digits + BEAST_EXPECT(( + power(max, 2) == + Number{false, maxMantissa / 10 - 1, 20, Number::normalized{}})); + } + } + void run() override { - testZero(); - test_limits(); - test_add(); - test_sub(); - test_mul(); - test_div(); - test_root(); - test_power1(); - test_power2(); - testConversions(); - test_to_integer(); - test_squelch(); - testToString(); - test_relationals(); - test_stream(); - test_inc_dec(); - test_toSTAmount(); - test_truncate(); - testRounding(); + for (auto const scale : {MantissaRange::small, MantissaRange::large}) + { + NumberMantissaScaleGuard sg(scale); + testZero(); + test_limits(); + testToString(); + test_add(); + test_sub(); + test_mul(); + test_div(); + test_root(); + test_root2(); + test_power1(); + test_power2(); + testConversions(); + test_to_integer(); + test_squelch(); + test_relationals(); + test_stream(); + test_inc_dec(); + test_toSTAmount(); + test_truncate(); + testRounding(); + testInt64(); + } } }; diff --git a/src/test/jtx/AMMTest.h b/src/test/jtx/AMMTest.h index 83366d61e2..208e3c4e5f 100644 --- a/src/test/jtx/AMMTest.h +++ b/src/test/jtx/AMMTest.h @@ -21,7 +21,12 @@ struct TestAMMArg std::optional> pool = std::nullopt; std::uint16_t tfee = 0; std::optional ter = std::nullopt; - std::vector features = {testable_amendments()}; + std::vector features = { + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + jtx::testable_amendments() - featureSingleAssetVault - + featureLendingProtocol}; + bool noLog = false; }; @@ -66,6 +71,15 @@ protected: public: AMMTestBase(); + static FeatureBitset + testable_amendments() + { + // For now, just disable SAV entirely, which locks in the small Number + // mantissas + return jtx::testable_amendments() - featureSingleAssetVault - + featureLendingProtocol; + } + protected: /** testAMM() funds 30,000XRP and 30,000IOU * for each non-XRP asset to Alice and Carol diff --git a/src/test/jtx/amount.h b/src/test/jtx/amount.h index a310fc5b44..147307f7b7 100644 --- a/src/test/jtx/amount.h +++ b/src/test/jtx/amount.h @@ -261,6 +261,12 @@ struct XRP_t return xrpIssue(); } + bool + integral() const + { + return true; + } + /** Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount @@ -400,6 +406,11 @@ public: { return issue(); } + bool + integral() const + { + return issue().integral(); + } /** Implicit conversion to Issue or Asset. @@ -490,6 +501,11 @@ public: { return mptIssue(); } + bool + integral() const + { + return true; + } /** Implicit conversion to MPTIssue or asset. diff --git a/src/test/jtx/impl/AMMTest.cpp b/src/test/jtx/impl/AMMTest.cpp index de7ce5504b..139b9113b9 100644 --- a/src/test/jtx/impl/AMMTest.cpp +++ b/src/test/jtx/impl/AMMTest.cpp @@ -105,9 +105,14 @@ AMMTestBase::testAMM( for (auto const& features : arg.features) { + // Use small Number mantissas for the life of this test. + NumberMantissaScaleGuard const sg{xrpl::MantissaRange::small}; + + // For now, just disable SAV entirely, which locks in the small Number + // mantissas Env env{ *this, - features, + features - featureSingleAssetVault - featureLendingProtocol, arg.noLog ? std::make_unique(&logs) : nullptr}; auto const [asset1, asset2] = diff --git a/src/test/protocol/STNumber_test.cpp b/src/test/protocol/STNumber_test.cpp index 1275c756cf..4e7a8388ee 100644 --- a/src/test/protocol/STNumber_test.cpp +++ b/src/test/protocol/STNumber_test.cpp @@ -29,10 +29,8 @@ struct STNumber_test : public beast::unit_test::suite } void - run() override + doRun() { - static_assert(!std::is_convertible_v); - { STNumber const stnum{sfNumber}; BEAST_EXPECT(stnum.getSType() == STI_NUMBER); @@ -127,6 +125,41 @@ struct STNumber_test : public beast::unit_test::suite BEAST_EXPECT( numberFromJson(sfNumber, "-0.000e6") == STNumber(sfNumber, 0)); + { + NumberRoundModeGuard mg(Number::towards_zero); + // maxint64 9,223,372,036,854,775,807 + auto const maxInt = + std::to_string(std::numeric_limits::max()); + // minint64 -9,223,372,036,854,775,808 + auto const minInt = + std::to_string(std::numeric_limits::min()); + if (Number::getMantissaScale() == MantissaRange::small) + { + BEAST_EXPECT( + numberFromJson(sfNumber, maxInt) == + STNumber(sfNumber, Number{9'223'372'036'854'775, 3})); + BEAST_EXPECT( + numberFromJson(sfNumber, minInt) == + STNumber(sfNumber, Number{-9'223'372'036'854'775, 3})); + } + else + { + BEAST_EXPECT( + numberFromJson(sfNumber, maxInt) == + STNumber( + sfNumber, Number{9'223'372'036'854'775'807, 0})); + BEAST_EXPECT( + numberFromJson(sfNumber, minInt) == + STNumber( + sfNumber, + Number{ + true, + 9'223'372'036'854'775'808ULL, + 0, + Number::normalized{}})); + } + } + constexpr auto imin = std::numeric_limits::min(); BEAST_EXPECT( numberFromJson(sfNumber, imin) == @@ -279,15 +312,21 @@ struct STNumber_test : public beast::unit_test::suite } } } + + void + run() override + { + static_assert(!std::is_convertible_v); + + for (auto const scale : {MantissaRange::small, MantissaRange::large}) + { + NumberMantissaScaleGuard sg(scale); + testcase << to_string(Number::getMantissaScale()); + doRun(); + } + } }; BEAST_DEFINE_TESTSUITE(STNumber, protocol, xrpl); -void -testCompile(std::ostream& out) -{ - STNumber number{sfNumber, 42}; - out << number; -} - } // namespace xrpl diff --git a/src/test/rpc/GetAggregatePrice_test.cpp b/src/test/rpc/GetAggregatePrice_test.cpp index 52f82ffc6c..0ffefc6cb6 100644 --- a/src/test/rpc/GetAggregatePrice_test.cpp +++ b/src/test/rpc/GetAggregatePrice_test.cpp @@ -191,18 +191,38 @@ public: // Aggregate data set includes all price oracle instances, no trimming // or time threshold { - Env env(*this); - OraclesData oracles; - prep(env, oracles); - // entire and trimmed stats - auto ret = Oracle::aggregatePrice(env, "XRP", "USD", oracles); - BEAST_EXPECT(ret[jss::entire_set][jss::mean] == "74.45"); - BEAST_EXPECT(ret[jss::entire_set][jss::size].asUInt() == 10); - BEAST_EXPECT( - ret[jss::entire_set][jss::standard_deviation] == - "0.3027650354097492"); - BEAST_EXPECT(ret[jss::median] == "74.45"); - BEAST_EXPECT(ret[jss::time] == 946694900); + auto const all = testable_amendments(); + for (auto const& feats : + {all - featureSingleAssetVault - featureLendingProtocol, all}) + { + for (auto const mantissaSize : + {MantissaRange::small, MantissaRange::large}) + { + // Regardless of the features enabled, RPC is controlled by + // the global mantissa size. And since it's a thread-local, + // overriding it locally won't make a difference either. + // This will mean all RPC will use the default of "large". + NumberMantissaScaleGuard mg(mantissaSize); + + Env env(*this, feats); + OraclesData oracles; + prep(env, oracles); + // entire and trimmed stats + auto ret = + Oracle::aggregatePrice(env, "XRP", "USD", oracles); + BEAST_EXPECT(ret[jss::entire_set][jss::mean] == "74.45"); + BEAST_EXPECT( + ret[jss::entire_set][jss::size].asUInt() == 10); + // Short: 0.3027650354097492 + BEAST_EXPECTS( + ret[jss::entire_set][jss::standard_deviation] == + "0.3027650354097491666", + ret[jss::entire_set][jss::standard_deviation] + .asString()); + BEAST_EXPECT(ret[jss::median] == "74.45"); + BEAST_EXPECT(ret[jss::time] == 946694900); + } + } } // Aggregate data set includes all price oracle instances @@ -215,15 +235,19 @@ public: Oracle::aggregatePrice(env, "XRP", "USD", oracles, 20, 100); BEAST_EXPECT(ret[jss::entire_set][jss::mean] == "74.45"); BEAST_EXPECT(ret[jss::entire_set][jss::size].asUInt() == 10); - BEAST_EXPECT( + // Short: "0.3027650354097492", + BEAST_EXPECTS( ret[jss::entire_set][jss::standard_deviation] == - "0.3027650354097492"); + "0.3027650354097491666", + ret[jss::entire_set][jss::standard_deviation].asString()); BEAST_EXPECT(ret[jss::median] == "74.45"); BEAST_EXPECT(ret[jss::trimmed_set][jss::mean] == "74.45"); BEAST_EXPECT(ret[jss::trimmed_set][jss::size].asUInt() == 6); - BEAST_EXPECT( + // Short: "0.187082869338697", + BEAST_EXPECTS( ret[jss::trimmed_set][jss::standard_deviation] == - "0.187082869338697"); + "0.1870828693386970693", + ret[jss::trimmed_set][jss::standard_deviation].asString()); BEAST_EXPECT(ret[jss::time] == 946694900); } @@ -274,15 +298,19 @@ public: Oracle::aggregatePrice(env, "XRP", "USD", oracles, 20, "200"); BEAST_EXPECT(ret[jss::entire_set][jss::mean] == "74.6"); BEAST_EXPECT(ret[jss::entire_set][jss::size].asUInt() == 7); - BEAST_EXPECT( + // Short: 0.2160246899469287 + BEAST_EXPECTS( ret[jss::entire_set][jss::standard_deviation] == - "0.2160246899469287"); + "0.2160246899469286744", + ret[jss::entire_set][jss::standard_deviation].asString()); BEAST_EXPECT(ret[jss::median] == "74.6"); BEAST_EXPECT(ret[jss::trimmed_set][jss::mean] == "74.6"); BEAST_EXPECT(ret[jss::trimmed_set][jss::size].asUInt() == 5); - BEAST_EXPECT( + // Short: 0.158113883008419 + BEAST_EXPECTS( ret[jss::trimmed_set][jss::standard_deviation] == - "0.158113883008419"); + "0.1581138830084189666", + ret[jss::trimmed_set][jss::standard_deviation].asString()); BEAST_EXPECT(ret[jss::time] == 946694900); } diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp index 1cc6b1f5ae..c61145dda1 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp @@ -2,6 +2,8 @@ // #include +#include + namespace xrpl { bool @@ -338,6 +340,8 @@ LoanBrokerCoverClawback::doApply() sleBroker->at(sfCoverAvailable) -= clawAmount; view().update(sleBroker); + associateAsset(*sleBroker, vaultAsset); + // Transfer assets from pseudo-account to depositor. return accountSend( view(), brokerPseudoID, account, clawAmount, j_, WaiveTransferFee::Yes); diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp index b68cf46a00..ed47d40631 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp @@ -2,6 +2,8 @@ // #include +#include + namespace xrpl { bool @@ -100,6 +102,12 @@ LoanBrokerCoverDeposit::doApply() if (!broker) return tecINTERNAL; // LCOV_EXCL_LINE + auto const vault = view().read(keylet::vault(broker->at(sfVaultID))); + if (!vault) + return tecINTERNAL; // LCOV_EXCL_LINE + + auto const vaultAsset = vault->at(sfAsset); + auto const brokerPseudoID = broker->at(sfAccount); // Transfer assets from depositor to pseudo-account. @@ -116,6 +124,8 @@ LoanBrokerCoverDeposit::doApply() broker->at(sfCoverAvailable) += amount; view().update(broker); + associateAsset(*broker, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp index 830f9e26c1..5d4d2053ed 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp @@ -4,6 +4,7 @@ #include #include +#include namespace xrpl { @@ -156,12 +157,20 @@ LoanBrokerCoverWithdraw::doApply() if (!broker) return tecINTERNAL; // LCOV_EXCL_LINE + auto const vault = view().read(keylet::vault(broker->at(sfVaultID))); + if (!vault) + return tecINTERNAL; // LCOV_EXCL_LINE + + auto const vaultAsset = vault->at(sfAsset); + auto const brokerPseudoID = *broker->at(sfAccount); // Decrease the LoanBroker's CoverAvailable by Amount broker->at(sfCoverAvailable) -= amount; view().update(broker); + associateAsset(*broker, vaultAsset); + return doWithdraw( view(), tx, diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp index 227bad10a9..f3f57f8659 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp @@ -2,6 +2,8 @@ // #include +#include + namespace xrpl { bool @@ -185,6 +187,8 @@ LoanBrokerDelete::doApply() adjustOwnerCount(view(), owner, -2, j_); } + associateAsset(*broker, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp index 0cbae4d779..b7e9e4c79f 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.cpp @@ -2,6 +2,8 @@ // #include +#include + namespace xrpl { bool @@ -62,6 +64,15 @@ LoanBrokerSet::preflight(PreflightContext const& ctx) return tesSUCCESS; } +std::vector> const& +LoanBrokerSet::getValueFields() +{ + static std::vector> const valueFields{ + ~sfDebtMaximum}; + + return valueFields; +} + TER LoanBrokerSet::preclaim(PreclaimContext const& ctx) { @@ -70,8 +81,24 @@ LoanBrokerSet::preclaim(PreclaimContext const& ctx) auto const account = tx[sfAccount]; auto const vaultID = tx[sfVaultID]; + auto const sleVault = ctx.view.read(keylet::vault(vaultID)); + if (!sleVault) + { + JLOG(ctx.j.warn()) << "Vault does not exist."; + return tecNO_ENTRY; + } + Asset const asset = sleVault->at(sfAsset); + + if (account != sleVault->at(sfOwner)) + { + JLOG(ctx.j.warn()) << "Account is not the owner of the Vault."; + return tecNO_PERMISSION; + } + if (auto const brokerID = tx[~sfLoanBrokerID]) { + // Updating an existing Broker + auto const sleBroker = ctx.view.read(keylet::loanbroker(*brokerID)); if (!sleBroker) { @@ -104,18 +131,7 @@ LoanBrokerSet::preclaim(PreclaimContext const& ctx) } else { - auto const sleVault = ctx.view.read(keylet::vault(vaultID)); - if (!sleVault) - { - JLOG(ctx.j.warn()) << "Vault does not exist."; - return tecNO_ENTRY; - } - if (account != sleVault->at(sfOwner)) - { - JLOG(ctx.j.warn()) << "Account is not the owner of the Vault."; - return tecNO_PERMISSION; - } - if (auto const ter = canAddHolding(ctx.view, sleVault->at(sfAsset))) + if (auto const ter = canAddHolding(ctx.view, asset)) return ter; if (auto const ter = checkFrozen( @@ -125,6 +141,21 @@ LoanBrokerSet::preclaim(PreclaimContext const& ctx) return ter; } } + + // Check that relevant values can be represented as the vault asset + // type. This is mostly only relevant for integral (non-IOU) types + for (auto const& field : getValueFields()) + { + if (auto const value = tx[field]; + value && STAmount{asset, *value} != *value) + { + JLOG(ctx.j.warn()) << field.f->getName() << " (" << *value + << ") can not be represented as a(n) " + << to_string(asset) << "."; + return tecPRECISION_LOSS; + } + } + return tesSUCCESS; } @@ -147,12 +178,20 @@ LoanBrokerSet::doApply() // LCOV_EXCL_STOP } + auto const vault = view.read(keylet::vault(broker->at(sfVaultID))); + if (!vault) + return tecINTERNAL; // LCOV_EXCL_LINE + + auto const vaultAsset = vault->at(sfAsset); + if (auto const data = tx[~sfData]) broker->at(sfData) = *data; if (auto const debtMax = tx[~sfDebtMaximum]) broker->at(sfDebtMaximum) = *debtMax; view.update(broker); + + associateAsset(*broker, vaultAsset); } else { @@ -168,6 +207,7 @@ LoanBrokerSet::doApply() // LCOV_EXCL_STOP } auto const vaultPseudoID = sleVault->at(sfAccount); + auto const vaultAsset = sleVault->at(sfAsset); auto const sequence = tx.getSeqValue(); auto owner = view.peek(keylet::account(account_)); @@ -224,6 +264,8 @@ LoanBrokerSet::doApply() broker->at(sfCoverRateLiquidation) = *coverLiq; view.insert(broker); + + associateAsset(*broker, vaultAsset); } return tesSUCCESS; diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.h b/src/xrpld/app/tx/detail/LoanBrokerSet.h index 625c0adeb2..57170b9cb9 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.h +++ b/src/xrpld/app/tx/detail/LoanBrokerSet.h @@ -20,6 +20,9 @@ public: static NotTEC preflight(PreflightContext const& ctx); + static std::vector> const& + getValueFields(); + static TER preclaim(PreclaimContext const& ctx); diff --git a/src/xrpld/app/tx/detail/LoanDelete.cpp b/src/xrpld/app/tx/detail/LoanDelete.cpp index 3643e6331b..ddb286db12 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.cpp +++ b/src/xrpld/app/tx/detail/LoanDelete.cpp @@ -2,6 +2,8 @@ // #include +#include + namespace xrpl { bool @@ -78,9 +80,10 @@ LoanDelete::doApply() return tefBAD_LEDGER; // LCOV_EXCL_LINE auto const brokerPseudoAccount = brokerSle->at(sfAccount); - auto const vaultSle = view.peek(keylet ::vault(brokerSle->at(sfVaultID))); + auto const vaultSle = view.peek(keylet::vault(brokerSle->at(sfVaultID))); if (!vaultSle) return tefBAD_LEDGER; // LCOV_EXCL_LINE + auto const vaultAsset = vaultSle->at(sfAsset); // Remove LoanID from Directory of the LoanBroker pseudo-account. if (!view.dirRemove( @@ -125,6 +128,11 @@ LoanDelete::doApply() // Decrement the borrower's owner count adjustOwnerCount(view, borrowerSle, -1, j_); + // These associations shouldn't do anything, but do them just to be safe + associateAsset(*loanSle, vaultAsset); + associateAsset(*brokerSle, vaultAsset); + associateAsset(*vaultSle, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/xrpld/app/tx/detail/LoanManage.cpp index bd0539ae4e..17dee8ffe8 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/xrpld/app/tx/detail/LoanManage.cpp @@ -2,6 +2,7 @@ // #include +#include #include namespace xrpl { @@ -412,7 +413,7 @@ LoanManage::doApply() if (!brokerSle) return tefBAD_LEDGER; // LCOV_EXCL_LINE - auto const vaultSle = view.peek(keylet ::vault(brokerSle->at(sfVaultID))); + auto const vaultSle = view.peek(keylet::vault(brokerSle->at(sfVaultID))); if (!vaultSle) return tefBAD_LEDGER; // LCOV_EXCL_LINE auto const vaultAsset = vaultSle->at(sfAsset); @@ -426,6 +427,11 @@ LoanManage::doApply() if (tx.isFlag(tfLoanUnimpair)) return unimpairLoan(view, loanSle, vaultSle, vaultAsset, j_); // Noop, as described above. + + associateAsset(*loanSle, vaultAsset); + associateAsset(*brokerSle, vaultAsset); + associateAsset(*vaultSle, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index f3973d9488..13f62d4c0d 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -485,6 +486,16 @@ LoanPay::doApply() coverAvailableProxy += totalPaidToBroker; } + associateAsset(*loanSle, asset); + associateAsset(*brokerSle, asset); + associateAsset(*vaultSle, asset); + + // Duplicate some checks after rounding + XRPL_ASSERT_PARTS( + *assetsAvailableProxy <= *assetsTotalProxy, + "xrpl::LoanPay::doApply", + "assets available must not be greater than assets outstanding"); + #if !NDEBUG auto const accountBalanceBefore = accountHolds( view, diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index 4c14cde421..0b83d3009f 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -2,6 +2,7 @@ // #include +#include #include namespace xrpl { @@ -301,17 +302,15 @@ LoanSet::preclaim(PreclaimContext const& ctx) // This check is almost duplicated in doApply, but that check is done after // the overall loan scale is known. This is mostly only relevant for // integral (non-IOU) types + for (auto const& field : getValueFields()) { - for (auto const& field : getValueFields()) + if (auto const value = tx[field]; + value && STAmount{asset, *value} != *value) { - if (auto const value = tx[field]; - value && STAmount{asset, *value} != *value) - { - JLOG(ctx.j.warn()) << field.f->getName() << " (" << *value - << ") can not be represented as a(n) " - << to_string(asset) << "."; - return tecPRECISION_LOSS; - } + JLOG(ctx.j.warn()) << field.f->getName() << " (" << *value + << ") can not be represented as a(n) " + << to_string(asset) << "."; + return tecPRECISION_LOSS; } } @@ -434,19 +433,16 @@ LoanSet::doApply() } // Check that relevant values won't lose precision. This is mostly only // relevant for IOU assets. + for (auto const& field : getValueFields()) { - for (auto const& field : getValueFields()) + if (auto const value = tx[field]; + value && !isRounded(vaultAsset, *value, properties.loanScale)) { - if (auto const value = tx[field]; - value && !isRounded(vaultAsset, *value, properties.loanScale)) - { - JLOG(j_.warn()) - << field.f->getName() << " (" << *value - << ") has too much precision. Total loan value is " - << properties.loanState.valueOutstanding - << " with a scale of " << properties.loanScale; - return tecPRECISION_LOSS; - } + JLOG(j_.warn()) << field.f->getName() << " (" << *value + << ") has too much precision. Total loan value is " + << properties.loanState.valueOutstanding + << " with a scale of " << properties.loanScale; + return tecPRECISION_LOSS; } } @@ -649,6 +645,10 @@ LoanSet::doApply() if (auto const ter = dirLink(view, borrower, loan, sfOwnerNode)) return ter; + associateAsset(*vaultSle, vaultAsset); + associateAsset(*brokerSle, vaultAsset); + associateAsset(*loan, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/xrpld/app/tx/detail/Transactor.cpp index a834f7c6c3..691443ed93 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/xrpld/app/tx/detail/Transactor.cpp @@ -1136,6 +1136,10 @@ Transactor::operator()() { JLOG(j_.trace()) << "apply: " << ctx_.tx.getTransactionID(); + // These global updates really should have been for every Transaction + // step: preflight, preclaim, and doApply. And even calculateBaseFee. See + // with_txn_type(). + // // raii classes for the current ledger rules. // fixUniversalNumber predate the rulesGuard and should be replaced. NumberSO stNumberSO{view().rules().enabled(fixUniversalNumber)}; @@ -1152,7 +1156,7 @@ Transactor::operator()() { // LCOV_EXCL_START JLOG(j_.fatal()) << "Transaction serdes mismatch"; - JLOG(j_.info()) << to_string(ctx_.tx.getJson(JsonOptions::none)); + JLOG(j_.fatal()) << ctx_.tx.getJson(JsonOptions::none); JLOG(j_.fatal()) << s2.getJson(JsonOptions::none); UNREACHABLE( "xrpl::Transactor::operator() : transaction serdes mismatch"); diff --git a/src/xrpld/app/tx/detail/VaultClawback.cpp b/src/xrpld/app/tx/detail/VaultClawback.cpp index 2552e8c1ff..dbdf4440ec 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.cpp +++ b/src/xrpld/app/tx/detail/VaultClawback.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -457,6 +458,8 @@ VaultClawback::doApply() } } + associateAsset(*vault, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/VaultCreate.cpp b/src/xrpld/app/tx/detail/VaultCreate.cpp index 893a1108fa..402d877a00 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.cpp +++ b/src/xrpld/app/tx/detail/VaultCreate.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -230,6 +231,8 @@ VaultCreate::doApply() return err; } + associateAsset(*vault, asset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/VaultDelete.cpp b/src/xrpld/app/tx/detail/VaultDelete.cpp index 756e7b94e6..9b63c7766b 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.cpp +++ b/src/xrpld/app/tx/detail/VaultDelete.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -85,6 +86,7 @@ VaultDelete::doApply() // Destroy the asset holding. auto asset = vault->at(sfAsset); + if (auto ter = removeEmptyHolding(view(), vault->at(sfAccount), asset, j_); !isTesSuccess(ter)) return ter; @@ -205,6 +207,8 @@ VaultDelete::doApply() // Destroy the vault. view().erase(vault); + associateAsset(*vault, asset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/xrpld/app/tx/detail/VaultDeposit.cpp index 51b38afc36..02ef4afad1 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/xrpld/app/tx/detail/VaultDeposit.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,7 @@ VaultDeposit::doApply() auto const vault = view().peek(keylet::vault(ctx_.tx[sfVaultID])); if (!vault) return tefINTERNAL; // LCOV_EXCL_LINE + auto const vaultAsset = vault->at(sfAsset); auto const amount = ctx_.tx[sfAmount]; // Make sure the depositor can hold shares. @@ -282,6 +284,8 @@ VaultDeposit::doApply() !isTesSuccess(ter)) return ter; + associateAsset(*vault, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/VaultSet.cpp b/src/xrpld/app/tx/detail/VaultSet.cpp index 648ac12c3d..13c8ad5db8 100644 --- a/src/xrpld/app/tx/detail/VaultSet.cpp +++ b/src/xrpld/app/tx/detail/VaultSet.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -128,6 +129,8 @@ VaultSet::doApply() if (!vault) return tefINTERNAL; // LCOV_EXCL_LINE + auto const vaultAsset = vault->at(sfAsset); + auto const mptIssuanceID = (*vault)[sfShareMPTID]; auto const sleIssuance = view().peek(keylet::mptIssuance(mptIssuanceID)); if (!sleIssuance) @@ -172,6 +175,8 @@ VaultSet::doApply() // to verify the operation. view().update(vault); + associateAsset(*vault, vaultAsset); + return tesSUCCESS; } diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.cpp b/src/xrpld/app/tx/detail/VaultWithdraw.cpp index f8b7a1a739..9a4334e435 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.cpp +++ b/src/xrpld/app/tx/detail/VaultWithdraw.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -115,6 +116,7 @@ VaultWithdraw::doApply() auto const amount = ctx_.tx[sfAmount]; Asset const vaultAsset = vault->at(sfAsset); + MPTIssue const share{mptIssuanceID}; STAmount sharesRedeemed = {share}; STAmount assetsWithdrawn; @@ -239,6 +241,8 @@ VaultWithdraw::doApply() auto const dstAcct = ctx_.tx[~sfDestination].value_or(account_); + associateAsset(*vault, vaultAsset); + return doWithdraw( view(), ctx_.tx, diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/xrpld/app/tx/detail/applySteps.cpp index e0bd9d0d2d..0fae1a15e0 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/xrpld/app/tx/detail/applySteps.cpp @@ -34,8 +34,38 @@ struct UnknownTxnType : std::exception // throw an "UnknownTxnType" exception on error template auto -with_txn_type(TxType txnType, F&& f) +with_txn_type(Rules const& rules, TxType txnType, F&& f) { + // These global updates really should have been for every Transaction + // step: preflight, preclaim, calculateBaseFee, and doApply. Unfortunately, + // they were only included in doApply (via Transactor::operator()). That may + // have been sufficient when the changes were only related to operations + // that mutated data, but some features will now change how they read data, + // so these need to be more global. + // + // To prevent unintentional side effects on existing checks, they will be + // set for every operation only once SingleAssetVault (or later + // LendingProtocol) are enabled. + // + // See also Transactor::operator(). + // + std::optional stNumberSO; + std::optional rulesGuard; + std::optional mantissaScaleGuard; + if (rules.enabled(featureSingleAssetVault) || + rules.enabled(featureLendingProtocol)) + { + // raii classes for the current ledger rules. + // fixUniversalNumber predates the rulesGuard and should be replaced. + stNumberSO.emplace(rules.enabled(fixUniversalNumber)); + rulesGuard.emplace(rules); + } + else + { + // Without those features enabled, always use the old number rules. + mantissaScaleGuard.emplace(MantissaRange::small); + } + switch (txnType) { #pragma push_macro("TRANSACTION") @@ -99,7 +129,7 @@ invoke_preflight(PreflightContext const& ctx) { try { - return with_txn_type(ctx.tx.getTxnType(), [&]() { + return with_txn_type(ctx.rules, ctx.tx.getTxnType(), [&]() { auto const tec = Transactor::invokePreflight(ctx); return std::make_pair( tec, @@ -126,50 +156,51 @@ invoke_preclaim(PreclaimContext const& ctx) { // use name hiding to accomplish compile-time polymorphism of static // class functions for Transactor and derived classes. - return with_txn_type(ctx.tx.getTxnType(), [&]() -> TER { - // preclaim functionality is divided into two sections: - // 1. Up to and including the signature check: returns NotTEC. - // All transaction checks before and including checkSign - // MUST return NotTEC, or something more restrictive. - // Allowing tec results in these steps risks theft or - // destruction of funds, as a fee will be charged before the - // signature is checked. - // 2. After the signature check: returns TER. + return with_txn_type( + ctx.view.rules(), ctx.tx.getTxnType(), [&]() -> TER { + // preclaim functionality is divided into two sections: + // 1. Up to and including the signature check: returns NotTEC. + // All transaction checks before and including checkSign + // MUST return NotTEC, or something more restrictive. + // Allowing tec results in these steps risks theft or + // destruction of funds, as a fee will be charged before the + // signature is checked. + // 2. After the signature check: returns TER. - // If the transactor requires a valid account and the - // transaction doesn't list one, preflight will have already - // a flagged a failure. - auto const id = ctx.tx.getAccountID(sfAccount); + // If the transactor requires a valid account and the + // transaction doesn't list one, preflight will have already + // a flagged a failure. + auto const id = ctx.tx.getAccountID(sfAccount); - if (id != beast::zero) - { - if (NotTEC const preSigResult = [&]() -> NotTEC { - if (NotTEC const result = - T::checkSeqProxy(ctx.view, ctx.tx, ctx.j)) - return result; + if (id != beast::zero) + { + if (NotTEC const preSigResult = [&]() -> NotTEC { + if (NotTEC const result = + T::checkSeqProxy(ctx.view, ctx.tx, ctx.j)) + return result; - if (NotTEC const result = - T::checkPriorTxAndLastLedger(ctx)) - return result; + if (NotTEC const result = + T::checkPriorTxAndLastLedger(ctx)) + return result; - if (NotTEC const result = - T::checkPermission(ctx.view, ctx.tx)) - return result; + if (NotTEC const result = + T::checkPermission(ctx.view, ctx.tx)) + return result; - if (NotTEC const result = T::checkSign(ctx)) - return result; + if (NotTEC const result = T::checkSign(ctx)) + return result; - return tesSUCCESS; - }()) - return preSigResult; + return tesSUCCESS; + }()) + return preSigResult; - if (TER const result = - T::checkFee(ctx, calculateBaseFee(ctx.view, ctx.tx))) - return result; - } + if (TER const result = T::checkFee( + ctx, calculateBaseFee(ctx.view, ctx.tx))) + return result; + } - return T::preclaim(ctx); - }); + return T::preclaim(ctx); + }); } catch (UnknownTxnType const& e) { @@ -204,7 +235,7 @@ invoke_calculateBaseFee(ReadView const& view, STTx const& tx) { try { - return with_txn_type(tx.getTxnType(), [&]() { + return with_txn_type(view.rules(), tx.getTxnType(), [&]() { return T::calculateBaseFee(view, tx); }); } @@ -263,10 +294,11 @@ invoke_apply(ApplyContext& ctx) { try { - return with_txn_type(ctx.tx.getTxnType(), [&]() { - T p(ctx); - return p(); - }); + return with_txn_type( + ctx.view().rules(), ctx.tx.getTxnType(), [&]() { + T p(ctx); + return p(); + }); } catch (UnknownTxnType const& e) { From efa57e872badfacc82e4d95c65b64d0b95dc6bf3 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Tue, 13 Jan 2026 17:53:40 -0400 Subject: [PATCH 38/62] Change LendingProtocol feature and dependencies to supported (#6146) --- include/xrpl/protocol/detail/features.macro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xrpl/protocol/detail/features.macro b/include/xrpl/protocol/detail/features.macro index 932668c16f..0c952bf59b 100644 --- a/include/xrpl/protocol/detail/features.macro +++ b/include/xrpl/protocol/detail/features.macro @@ -17,7 +17,7 @@ // Keep it sorted in reverse chronological order. XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo) -XRPL_FEATURE(LendingProtocol, Supported::no, VoteBehavior::DefaultNo) +XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(PermissionDelegationV1_1, Supported::no, VoteBehavior::DefaultNo) XRPL_FIX (DirectoryLimit, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (IncludeKeyletFields, Supported::yes, VoteBehavior::DefaultNo) @@ -31,7 +31,7 @@ XRPL_FIX (EnforceNFTokenTrustlineV2, Supported::yes, VoteBehavior::DefaultNo XRPL_FIX (AMMv1_3, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(PermissionedDEX, Supported::yes, VoteBehavior::DefaultNo) XRPL_FEATURE(Batch, Supported::yes, VoteBehavior::DefaultNo) -XRPL_FEATURE(SingleAssetVault, Supported::no, VoteBehavior::DefaultNo) +XRPL_FEATURE(SingleAssetVault, Supported::yes, VoteBehavior::DefaultNo) XRPL_FIX (PayChanCancelAfter, Supported::yes, VoteBehavior::DefaultNo) // Check flags in Credential transactions XRPL_FIX (InvalidTxFlags, Supported::yes, VoteBehavior::DefaultNo) From ebcfd6645db82e0485fdb380ecdf9f413a4c1044 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Wed, 14 Jan 2026 14:40:07 -0500 Subject: [PATCH 39/62] test: Replace `failed` string in Vault test case (#6214) The word `failed` in the test case makes it hard to search through the test logs when an actual test failure occurs, so this change renames the word to just `fail` instead. --- src/test/app/Vault_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index a6d08b6531..41a4fc2b3b 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -2076,7 +2076,7 @@ class Vault_test : public beast::unit_test::suite PrettyAsset const& asset, Vault& vault, MPTTester& mptt) { - testcase("MPT failed reserve to re-create MPToken"); + testcase("MPT fail reserve to re-create MPToken"); auto [tx, keylet] = vault.create({.owner = owner, .asset = asset}); From c9458b72cab68d3cbbf533cc87d14309c2eb93b7 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 14 Jan 2026 19:45:00 -0400 Subject: [PATCH 40/62] test: Suppress "parse failed" message in Batch tests (#6207) --- src/test/app/Batch_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index 68bf7e833b..67b0933ae2 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -427,6 +427,7 @@ class Batch_test : public beast::unit_test::suite auto const batchFee = batch::calcBatchFee(env, 0, 2); auto tx1 = batch::inner(pay(alice, bob, XRP(1)), seq + 1); tx1[jss::Fee] = "1.5"; + env.set_parse_failure_expected(true); try { env(batch::outer(alice, seq, batchFee, tfAllOrNothing), @@ -438,6 +439,7 @@ class Batch_test : public beast::unit_test::suite { BEAST_EXPECT(true); } + env.set_parse_failure_expected(false); } // temSEQ_AND_TICKET: Batch: inner txn cannot have both Sequence From ec44347ffc23db2dba3332c730a94e73e22054a6 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 15 Jan 2026 13:36:13 +0000 Subject: [PATCH 41/62] test: Use gtest instead of doctest (#6216) This change switches over the doctest framework to the gtest framework. --- .config/cspell.config.yaml | 1 + conan.lock | 2 +- conanfile.py | 2 +- src/tests/README.md | 4 +- src/tests/libxrpl/CMakeLists.txt | 4 +- src/tests/libxrpl/basics/RangeSet.cpp | 100 +- src/tests/libxrpl/basics/Slice.cpp | 42 +- src/tests/libxrpl/basics/base64.cpp | 10 +- src/tests/libxrpl/basics/contract.cpp | 12 +- src/tests/libxrpl/basics/main.cpp | 10 +- src/tests/libxrpl/basics/mulDiv.cpp | 38 +- src/tests/libxrpl/basics/scope.cpp | 44 +- src/tests/libxrpl/basics/tagged_integer.cpp | 98 +- src/tests/libxrpl/crypto/csprng.cpp | 8 +- src/tests/libxrpl/crypto/main.cpp | 10 +- src/tests/libxrpl/json/Output.cpp | 16 +- src/tests/libxrpl/json/Value.cpp | 1061 +++++++++---------- src/tests/libxrpl/json/Writer.cpp | 40 +- src/tests/libxrpl/json/main.cpp | 10 +- src/tests/libxrpl/net/HTTPClient.cpp | 40 +- src/tests/libxrpl/net/main.cpp | 10 +- 21 files changed, 782 insertions(+), 780 deletions(-) diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index 8f782d9960..3bd295c14b 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -270,6 +270,7 @@ words: - xbridge - xchain - ximinez + - EXPECT_STREQ - XMACRO - xrpkuwait - xrpl diff --git a/conan.lock b/conan.lock index 44dc9031d2..f3fa1e5f6e 100644 --- a/conan.lock +++ b/conan.lock @@ -17,9 +17,9 @@ "libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03", "libarchive/3.8.1#ffee18995c706e02bf96e7a2f7042e0d%1765850144.736", "jemalloc/5.3.0#e951da9cf599e956cebc117880d2d9f8%1729241615.244", + "gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1768312129.152", "grpc/1.72.0#f244a57bff01e708c55a1100b12e1589%1765850193.734", "ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772", - "doctest/2.4.12#eb9fb352fb2fdfc8abb17ec270945165%1765850143.95", "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772", "c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336", "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837", diff --git a/conanfile.py b/conanfile.py index 96e3384979..8501909ce3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -39,7 +39,7 @@ class Xrpl(ConanFile): ] test_requires = [ - "doctest/2.4.12", + "gtest/1.17.0", ] tool_requires = [ diff --git a/src/tests/README.md b/src/tests/README.md index 7c4cc5edf8..2a642a7633 100644 --- a/src/tests/README.md +++ b/src/tests/README.md @@ -1,5 +1,5 @@ # Unit tests This directory contains unit tests for the project. The difference from existing `src/test` folder -is that we switch to 3rd party testing framework (doctest). We intend to gradually move existing tests -from our own framework to doctest and such tests will be moved to this new folder. +is that we switch to 3rd party testing framework (`gtest`). We intend to gradually move existing tests +from our own framework to `gtest` and such tests will be moved to this new folder. diff --git a/src/tests/libxrpl/CMakeLists.txt b/src/tests/libxrpl/CMakeLists.txt index a2374698d9..74dc184700 100644 --- a/src/tests/libxrpl/CMakeLists.txt +++ b/src/tests/libxrpl/CMakeLists.txt @@ -1,14 +1,14 @@ include(XrplAddTest) # Test requirements. -find_package(doctest REQUIRED) +find_package(GTest REQUIRED) # Custom target for all tests defined in this file add_custom_target(xrpl.tests) # Common library dependencies for the rest of the tests. add_library(xrpl.imports.test INTERFACE) -target_link_libraries(xrpl.imports.test INTERFACE doctest::doctest xrpl.libxrpl) +target_link_libraries(xrpl.imports.test INTERFACE gtest::gtest xrpl.libxrpl) # One test for each module. xrpl_add_test(basics) diff --git a/src/tests/libxrpl/basics/RangeSet.cpp b/src/tests/libxrpl/basics/RangeSet.cpp index 8c43b26758..d0fc656368 100644 --- a/src/tests/libxrpl/basics/RangeSet.cpp +++ b/src/tests/libxrpl/basics/RangeSet.cpp @@ -1,15 +1,13 @@ #include -#include +#include #include #include using namespace xrpl; -TEST_SUITE_BEGIN("RangeSet"); - -TEST_CASE("prevMissing") +TEST(RangeSet, prevMissing) { // Set will include: // [ 0, 5] @@ -31,80 +29,78 @@ TEST_CASE("prevMissing") expected = ((i % 10) > 6) ? (i - 1) : oneBelowRange; } - CHECK(prevMissing(set, i) == expected); + EXPECT_EQ(prevMissing(set, i), expected); } } -TEST_CASE("toString") +TEST(RangeSet, toString) { RangeSet set; - CHECK(to_string(set) == "empty"); + EXPECT_EQ(to_string(set), "empty"); set.insert(1); - CHECK(to_string(set) == "1"); + EXPECT_EQ(to_string(set), "1"); set.insert(range(4u, 6u)); - CHECK(to_string(set) == "1,4-6"); + EXPECT_EQ(to_string(set), "1,4-6"); set.insert(2); - CHECK(to_string(set) == "1-2,4-6"); + EXPECT_EQ(to_string(set), "1-2,4-6"); set.erase(range(4u, 5u)); - CHECK(to_string(set) == "1-2,6"); + EXPECT_EQ(to_string(set), "1-2,6"); } -TEST_CASE("fromString") +TEST(RangeSet, fromString) { RangeSet set; - CHECK(!from_string(set, "")); - CHECK(boost::icl::length(set) == 0); + EXPECT_FALSE(from_string(set, "")); + EXPECT_EQ(boost::icl::length(set), 0); - CHECK(!from_string(set, "#")); - CHECK(boost::icl::length(set) == 0); + EXPECT_FALSE(from_string(set, "#")); + EXPECT_EQ(boost::icl::length(set), 0); - CHECK(!from_string(set, ",")); - CHECK(boost::icl::length(set) == 0); + EXPECT_FALSE(from_string(set, ",")); + EXPECT_EQ(boost::icl::length(set), 0); - CHECK(!from_string(set, ",-")); - CHECK(boost::icl::length(set) == 0); + EXPECT_FALSE(from_string(set, ",-")); + EXPECT_EQ(boost::icl::length(set), 0); - CHECK(!from_string(set, "1,,2")); - CHECK(boost::icl::length(set) == 0); + EXPECT_FALSE(from_string(set, "1,,2")); + EXPECT_EQ(boost::icl::length(set), 0); - CHECK(from_string(set, "1")); - CHECK(boost::icl::length(set) == 1); - CHECK(boost::icl::first(set) == 1); + EXPECT_TRUE(from_string(set, "1")); + EXPECT_EQ(boost::icl::length(set), 1); + EXPECT_EQ(boost::icl::first(set), 1); - CHECK(from_string(set, "1,1")); - CHECK(boost::icl::length(set) == 1); - CHECK(boost::icl::first(set) == 1); + EXPECT_TRUE(from_string(set, "1,1")); + EXPECT_EQ(boost::icl::length(set), 1); + EXPECT_EQ(boost::icl::first(set), 1); - CHECK(from_string(set, "1-1")); - CHECK(boost::icl::length(set) == 1); - CHECK(boost::icl::first(set) == 1); + EXPECT_TRUE(from_string(set, "1-1")); + EXPECT_EQ(boost::icl::length(set), 1); + EXPECT_EQ(boost::icl::first(set), 1); - CHECK(from_string(set, "1,4-6")); - CHECK(boost::icl::length(set) == 4); - CHECK(boost::icl::first(set) == 1); - CHECK(!boost::icl::contains(set, 2)); - CHECK(!boost::icl::contains(set, 3)); - CHECK(boost::icl::contains(set, 4)); - CHECK(boost::icl::contains(set, 5)); - CHECK(boost::icl::last(set) == 6); + EXPECT_TRUE(from_string(set, "1,4-6")); + EXPECT_EQ(boost::icl::length(set), 4); + EXPECT_EQ(boost::icl::first(set), 1); + EXPECT_FALSE(boost::icl::contains(set, 2)); + EXPECT_FALSE(boost::icl::contains(set, 3)); + EXPECT_TRUE(boost::icl::contains(set, 4)); + EXPECT_TRUE(boost::icl::contains(set, 5)); + EXPECT_EQ(boost::icl::last(set), 6); - CHECK(from_string(set, "1-2,4-6")); - CHECK(boost::icl::length(set) == 5); - CHECK(boost::icl::first(set) == 1); - CHECK(boost::icl::contains(set, 2)); - CHECK(boost::icl::contains(set, 4)); - CHECK(boost::icl::last(set) == 6); + EXPECT_TRUE(from_string(set, "1-2,4-6")); + EXPECT_EQ(boost::icl::length(set), 5); + EXPECT_EQ(boost::icl::first(set), 1); + EXPECT_TRUE(boost::icl::contains(set, 2)); + EXPECT_TRUE(boost::icl::contains(set, 4)); + EXPECT_EQ(boost::icl::last(set), 6); - CHECK(from_string(set, "1-2,6")); - CHECK(boost::icl::length(set) == 3); - CHECK(boost::icl::first(set) == 1); - CHECK(boost::icl::contains(set, 2)); - CHECK(boost::icl::last(set) == 6); + EXPECT_TRUE(from_string(set, "1-2,6")); + EXPECT_EQ(boost::icl::length(set), 3); + EXPECT_EQ(boost::icl::first(set), 1); + EXPECT_TRUE(boost::icl::contains(set, 2)); + EXPECT_EQ(boost::icl::last(set), 6); } - -TEST_SUITE_END(); diff --git a/src/tests/libxrpl/basics/Slice.cpp b/src/tests/libxrpl/basics/Slice.cpp index 03d89ff174..b36abe596d 100644 --- a/src/tests/libxrpl/basics/Slice.cpp +++ b/src/tests/libxrpl/basics/Slice.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include @@ -12,37 +12,35 @@ static std::uint8_t const data[] = { 0x18, 0xb4, 0x70, 0xcb, 0xf5, 0xac, 0x2d, 0x89, 0x4d, 0x19, 0x9c, 0xf0, 0x2c, 0x15, 0xd1, 0xf9, 0x9b, 0x66, 0xd2, 0x30, 0xd3}; -TEST_SUITE_BEGIN("Slice"); - -TEST_CASE("equality & inequality") +TEST(Slice, equality_and_inequality) { Slice const s0{}; - CHECK(s0.size() == 0); - CHECK(s0.data() == nullptr); - CHECK(s0 == s0); + EXPECT_EQ(s0.size(), 0); + EXPECT_EQ(s0.data(), nullptr); + EXPECT_EQ(s0, s0); // Test slices of equal and unequal size pointing to same data: for (std::size_t i = 0; i != sizeof(data); ++i) { Slice const s1{data, i}; - CHECK(s1.size() == i); - CHECK(s1.data() != nullptr); + EXPECT_EQ(s1.size(), i); + EXPECT_NE(s1.data(), nullptr); if (i == 0) - CHECK(s1 == s0); + EXPECT_EQ(s1, s0); else - CHECK(s1 != s0); + EXPECT_NE(s1, s0); for (std::size_t j = 0; j != sizeof(data); ++j) { Slice const s2{data, j}; if (i == j) - CHECK(s1 == s2); + EXPECT_EQ(s1, s2); else - CHECK(s1 != s2); + EXPECT_NE(s1, s2); } } @@ -53,22 +51,22 @@ TEST_CASE("equality & inequality") for (std::size_t i = 0; i != sizeof(data); ++i) a[i] = b[i] = data[i]; - CHECK(makeSlice(a) == makeSlice(b)); + EXPECT_EQ(makeSlice(a), makeSlice(b)); b[7]++; - CHECK(makeSlice(a) != makeSlice(b)); + EXPECT_NE(makeSlice(a), makeSlice(b)); a[7]++; - CHECK(makeSlice(a) == makeSlice(b)); + EXPECT_EQ(makeSlice(a), makeSlice(b)); } -TEST_CASE("indexing") +TEST(Slice, indexing) { Slice const s{data, sizeof(data)}; for (std::size_t i = 0; i != sizeof(data); ++i) - CHECK(s[i] == data[i]); + EXPECT_EQ(s[i], data[i]); } -TEST_CASE("advancing") +TEST(Slice, advancing) { for (std::size_t i = 0; i < sizeof(data); ++i) { @@ -77,10 +75,8 @@ TEST_CASE("advancing") Slice s(data + i, sizeof(data) - i); s += j; - CHECK(s.data() == data + i + j); - CHECK(s.size() == sizeof(data) - i - j); + EXPECT_EQ(s.data(), data + i + j); + EXPECT_EQ(s.size(), sizeof(data) - i - j); } } } - -TEST_SUITE_END(); diff --git a/src/tests/libxrpl/basics/base64.cpp b/src/tests/libxrpl/basics/base64.cpp index f6544105d8..cfffadf660 100644 --- a/src/tests/libxrpl/basics/base64.cpp +++ b/src/tests/libxrpl/basics/base64.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include @@ -10,11 +10,11 @@ static void check(std::string const& in, std::string const& out) { auto const encoded = base64_encode(in); - CHECK(encoded == out); - CHECK(base64_decode(encoded) == in); + EXPECT_EQ(encoded, out); + EXPECT_EQ(base64_decode(encoded), in); } -TEST_CASE("base64") +TEST(base64, base64) { // cspell: disable check("", ""); @@ -46,5 +46,5 @@ TEST_CASE("base64") std::string const notBase64 = "not_base64!!"; std::string const truncated = "not"; - CHECK(base64_decode(notBase64) == base64_decode(truncated)); + EXPECT_EQ(base64_decode(notBase64), base64_decode(truncated)); } diff --git a/src/tests/libxrpl/basics/contract.cpp b/src/tests/libxrpl/basics/contract.cpp index a1f6f0b777..d9b729e85d 100644 --- a/src/tests/libxrpl/basics/contract.cpp +++ b/src/tests/libxrpl/basics/contract.cpp @@ -1,13 +1,13 @@ #include -#include +#include #include #include using namespace xrpl; -TEST_CASE("contract") +TEST(contract, contract) { try { @@ -15,7 +15,7 @@ TEST_CASE("contract") } catch (std::runtime_error const& e1) { - CHECK(std::string(e1.what()) == "Throw test"); + EXPECT_STREQ(e1.what(), "Throw test"); try { @@ -23,15 +23,15 @@ TEST_CASE("contract") } catch (std::runtime_error const& e2) { - CHECK(std::string(e2.what()) == "Throw test"); + EXPECT_STREQ(e2.what(), "Throw test"); } catch (...) { - CHECK(false); + FAIL() << "std::runtime_error should have been re-caught"; } } catch (...) { - CHECK(false); + FAIL() << "std::runtime_error should have been caught the first time"; } } diff --git a/src/tests/libxrpl/basics/main.cpp b/src/tests/libxrpl/basics/main.cpp index 0a3f254ea8..5142bbe08a 100644 --- a/src/tests/libxrpl/basics/main.cpp +++ b/src/tests/libxrpl/basics/main.cpp @@ -1,2 +1,8 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include + +int +main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/tests/libxrpl/basics/mulDiv.cpp b/src/tests/libxrpl/basics/mulDiv.cpp index d3c58ea2f4..c98c3fd61a 100644 --- a/src/tests/libxrpl/basics/mulDiv.cpp +++ b/src/tests/libxrpl/basics/mulDiv.cpp @@ -1,45 +1,45 @@ #include -#include +#include #include #include using namespace xrpl; -TEST_CASE("mulDiv") +TEST(mulDiv, mulDiv) { auto const max = std::numeric_limits::max(); std::uint64_t const max32 = std::numeric_limits::max(); auto result = mulDiv(85, 20, 5); - REQUIRE(result); - CHECK(*result == 340); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 340); result = mulDiv(20, 85, 5); - REQUIRE(result); - CHECK(*result == 340); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 340); result = mulDiv(0, max - 1, max - 3); - REQUIRE(result); - CHECK(*result == 0); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 0); result = mulDiv(max - 1, 0, max - 3); - REQUIRE(result); - CHECK(*result == 0); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 0); result = mulDiv(max, 2, max / 2); - REQUIRE(result); - CHECK(*result == 4); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 4); result = mulDiv(max, 1000, max / 1000); - REQUIRE(result); - CHECK(*result == 1000000); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 1000000); result = mulDiv(max, 1000, max / 1001); - REQUIRE(result); - CHECK(*result == 1001000); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 1001000); result = mulDiv(max32 + 1, max32 + 1, 5); - REQUIRE(result); - CHECK(*result == 3689348814741910323); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(*result, 3689348814741910323); // Overflow result = mulDiv(max - 1, max - 2, 5); - CHECK(!result); + EXPECT_FALSE(result.has_value()); } diff --git a/src/tests/libxrpl/basics/scope.cpp b/src/tests/libxrpl/basics/scope.cpp index b3774d54bd..309a41ec04 100644 --- a/src/tests/libxrpl/basics/scope.cpp +++ b/src/tests/libxrpl/basics/scope.cpp @@ -1,10 +1,10 @@ #include -#include +#include using namespace xrpl; -TEST_CASE("scope_exit") +TEST(scope, scope_exit) { // scope_exit always executes the functor on destruction, // unless release() is called @@ -12,23 +12,23 @@ TEST_CASE("scope_exit") { scope_exit x{[&i]() { i = 1; }}; } - CHECK(i == 1); + EXPECT_EQ(i, 1); { scope_exit x{[&i]() { i = 2; }}; x.release(); } - CHECK(i == 1); + EXPECT_EQ(i, 1); { scope_exit x{[&i]() { i += 2; }}; auto x2 = std::move(x); } - CHECK(i == 3); + EXPECT_EQ(i, 3); { scope_exit x{[&i]() { i = 4; }}; x.release(); auto x2 = std::move(x); } - CHECK(i == 3); + EXPECT_EQ(i, 3); { try { @@ -39,7 +39,7 @@ TEST_CASE("scope_exit") { } } - CHECK(i == 5); + EXPECT_EQ(i, 5); { try { @@ -51,10 +51,10 @@ TEST_CASE("scope_exit") { } } - CHECK(i == 5); + EXPECT_EQ(i, 5); } -TEST_CASE("scope_fail") +TEST(scope, scope_fail) { // scope_fail executes the functor on destruction only // if an exception is unwinding, unless release() is called @@ -62,23 +62,23 @@ TEST_CASE("scope_fail") { scope_fail x{[&i]() { i = 1; }}; } - CHECK(i == 0); + EXPECT_EQ(i, 0); { scope_fail x{[&i]() { i = 2; }}; x.release(); } - CHECK(i == 0); + EXPECT_EQ(i, 0); { scope_fail x{[&i]() { i = 3; }}; auto x2 = std::move(x); } - CHECK(i == 0); + EXPECT_EQ(i, 0); { scope_fail x{[&i]() { i = 4; }}; x.release(); auto x2 = std::move(x); } - CHECK(i == 0); + EXPECT_EQ(i, 0); { try { @@ -89,7 +89,7 @@ TEST_CASE("scope_fail") { } } - CHECK(i == 5); + EXPECT_EQ(i, 5); { try { @@ -101,10 +101,10 @@ TEST_CASE("scope_fail") { } } - CHECK(i == 5); + EXPECT_EQ(i, 5); } -TEST_CASE("scope_success") +TEST(scope, scope_success) { // scope_success executes the functor on destruction only // if an exception is not unwinding, unless release() is called @@ -112,23 +112,23 @@ TEST_CASE("scope_success") { scope_success x{[&i]() { i = 1; }}; } - CHECK(i == 1); + EXPECT_EQ(i, 1); { scope_success x{[&i]() { i = 2; }}; x.release(); } - CHECK(i == 1); + EXPECT_EQ(i, 1); { scope_success x{[&i]() { i += 2; }}; auto x2 = std::move(x); } - CHECK(i == 3); + EXPECT_EQ(i, 3); { scope_success x{[&i]() { i = 4; }}; x.release(); auto x2 = std::move(x); } - CHECK(i == 3); + EXPECT_EQ(i, 3); { try { @@ -139,7 +139,7 @@ TEST_CASE("scope_success") { } } - CHECK(i == 3); + EXPECT_EQ(i, 3); { try { @@ -151,5 +151,5 @@ TEST_CASE("scope_success") { } } - CHECK(i == 3); + EXPECT_EQ(i, 3); } diff --git a/src/tests/libxrpl/basics/tagged_integer.cpp b/src/tests/libxrpl/basics/tagged_integer.cpp index 45efc579ab..09f8b6787b 100644 --- a/src/tests/libxrpl/basics/tagged_integer.cpp +++ b/src/tests/libxrpl/basics/tagged_integer.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include @@ -102,127 +102,123 @@ static_assert( !std::is_convertible::value, "TagUInt2 should not be convertible to a TagUInt3"); -TEST_SUITE_BEGIN("tagged_integer"); - using TagInt = tagged_integer; -TEST_CASE("comparison operators") +TEST(tagged_integer, comparison_operators) { TagInt const zero(0); TagInt const one(1); - CHECK(one == one); - CHECK(!(one == zero)); + EXPECT_TRUE(one == one); + EXPECT_FALSE(one == zero); - CHECK(one != zero); - CHECK(!(one != one)); + EXPECT_TRUE(one != zero); + EXPECT_FALSE(one != one); - CHECK(zero < one); - CHECK(!(one < zero)); + EXPECT_TRUE(zero < one); + EXPECT_FALSE(one < zero); - CHECK(one > zero); - CHECK(!(zero > one)); + EXPECT_TRUE(one > zero); + EXPECT_FALSE(zero > one); - CHECK(one >= one); - CHECK(one >= zero); - CHECK(!(zero >= one)); + EXPECT_TRUE(one >= one); + EXPECT_TRUE(one >= zero); + EXPECT_FALSE(zero >= one); - CHECK(zero <= one); - CHECK(zero <= zero); - CHECK(!(one <= zero)); + EXPECT_TRUE(zero <= one); + EXPECT_TRUE(zero <= zero); + EXPECT_FALSE(one <= zero); } -TEST_CASE("increment / decrement operators") +TEST(tagged_integer, increment_decrement_operators) { TagInt const zero(0); TagInt const one(1); TagInt a{0}; ++a; - CHECK(a == one); + EXPECT_EQ(a, one); --a; - CHECK(a == zero); + EXPECT_EQ(a, zero); a++; - CHECK(a == one); + EXPECT_EQ(a, one); a--; - CHECK(a == zero); + EXPECT_EQ(a, zero); } -TEST_CASE("arithmetic operators") +TEST(tagged_integer, arithmetic_operators) { TagInt a{-2}; - CHECK(+a == TagInt{-2}); - CHECK(-a == TagInt{2}); - CHECK(TagInt{-3} + TagInt{4} == TagInt{1}); - CHECK(TagInt{-3} - TagInt{4} == TagInt{-7}); - CHECK(TagInt{-3} * TagInt{4} == TagInt{-12}); - CHECK(TagInt{8} / TagInt{4} == TagInt{2}); - CHECK(TagInt{7} % TagInt{4} == TagInt{3}); + EXPECT_EQ(+a, TagInt{-2}); + EXPECT_EQ(-a, TagInt{2}); + EXPECT_EQ(TagInt{-3} + TagInt{4}, TagInt{1}); + EXPECT_EQ(TagInt{-3} - TagInt{4}, TagInt{-7}); + EXPECT_EQ(TagInt{-3} * TagInt{4}, TagInt{-12}); + EXPECT_EQ(TagInt{8} / TagInt{4}, TagInt{2}); + EXPECT_EQ(TagInt{7} % TagInt{4}, TagInt{3}); - CHECK(~TagInt{8} == TagInt{~TagInt::value_type{8}}); - CHECK((TagInt{6} & TagInt{3}) == TagInt{2}); - CHECK((TagInt{6} | TagInt{3}) == TagInt{7}); - CHECK((TagInt{6} ^ TagInt{3}) == TagInt{5}); + EXPECT_EQ(~TagInt{8}, TagInt{~TagInt::value_type{8}}); + EXPECT_EQ((TagInt{6} & TagInt{3}), TagInt{2}); + EXPECT_EQ((TagInt{6} | TagInt{3}), TagInt{7}); + EXPECT_EQ((TagInt{6} ^ TagInt{3}), TagInt{5}); - CHECK((TagInt{4} << TagInt{2}) == TagInt{16}); - CHECK((TagInt{16} >> TagInt{2}) == TagInt{4}); + EXPECT_EQ((TagInt{4} << TagInt{2}), TagInt{16}); + EXPECT_EQ((TagInt{16} >> TagInt{2}), TagInt{4}); } -TEST_CASE("assignment operators") +TEST(tagged_integer, assignment_operators) { TagInt a{-2}; TagInt b{0}; b = a; - CHECK(b == TagInt{-2}); + EXPECT_EQ(b, TagInt{-2}); // -3 + 4 == 1 a = TagInt{-3}; a += TagInt{4}; - CHECK(a == TagInt{1}); + EXPECT_EQ(a, TagInt{1}); // -3 - 4 == -7 a = TagInt{-3}; a -= TagInt{4}; - CHECK(a == TagInt{-7}); + EXPECT_EQ(a, TagInt{-7}); // -3 * 4 == -12 a = TagInt{-3}; a *= TagInt{4}; - CHECK(a == TagInt{-12}); + EXPECT_EQ(a, TagInt{-12}); // 8/4 == 2 a = TagInt{8}; a /= TagInt{4}; - CHECK(a == TagInt{2}); + EXPECT_EQ(a, TagInt{2}); // 7 % 4 == 3 a = TagInt{7}; a %= TagInt{4}; - CHECK(a == TagInt{3}); + EXPECT_EQ(a, TagInt{3}); // 6 & 3 == 2 a = TagInt{6}; a /= TagInt{3}; - CHECK(a == TagInt{2}); + EXPECT_EQ(a, TagInt{2}); // 6 | 3 == 7 a = TagInt{6}; a |= TagInt{3}; - CHECK(a == TagInt{7}); + EXPECT_EQ(a, TagInt{7}); // 6 ^ 3 == 5 a = TagInt{6}; a ^= TagInt{3}; - CHECK(a == TagInt{5}); + EXPECT_EQ(a, TagInt{5}); // 4 << 2 == 16 a = TagInt{4}; a <<= TagInt{2}; - CHECK(a == TagInt{16}); + EXPECT_EQ(a, TagInt{16}); // 16 >> 2 == 4 a = TagInt{16}; a >>= TagInt{2}; - CHECK(a == TagInt{4}); + EXPECT_EQ(a, TagInt{4}); } - -TEST_SUITE_END(); diff --git a/src/tests/libxrpl/crypto/csprng.cpp b/src/tests/libxrpl/crypto/csprng.cpp index e59c8a555a..41dcfd57a9 100644 --- a/src/tests/libxrpl/crypto/csprng.cpp +++ b/src/tests/libxrpl/crypto/csprng.cpp @@ -1,15 +1,15 @@ #include -#include +#include using namespace xrpl; -TEST_CASE("get values") +TEST(csprng, get_values) { auto& engine = crypto_prng(); auto rand_val = engine(); - CHECK(rand_val >= engine.min()); - CHECK(rand_val <= engine.max()); + EXPECT_GE(rand_val, engine.min()); + EXPECT_LE(rand_val, engine.max()); uint16_t twoByte{0}; engine(&twoByte, sizeof(uint16_t)); } diff --git a/src/tests/libxrpl/crypto/main.cpp b/src/tests/libxrpl/crypto/main.cpp index 0a3f254ea8..5142bbe08a 100644 --- a/src/tests/libxrpl/crypto/main.cpp +++ b/src/tests/libxrpl/crypto/main.cpp @@ -1,2 +1,8 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include + +int +main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/tests/libxrpl/json/Output.cpp b/src/tests/libxrpl/json/Output.cpp index 6e6c20a0e5..96d7369d51 100644 --- a/src/tests/libxrpl/json/Output.cpp +++ b/src/tests/libxrpl/json/Output.cpp @@ -2,31 +2,29 @@ #include #include -#include +#include #include using namespace xrpl; using namespace Json; -TEST_SUITE_BEGIN("JsonOutput"); - static void checkOutput(std::string const& valueDesc) { std::string output; Json::Value value; - REQUIRE(Json::Reader().parse(valueDesc, value)); + ASSERT_TRUE(Json::Reader().parse(valueDesc, value)); auto out = stringOutput(output); outputJson(value, out); auto expected = Json::FastWriter().write(value); - CHECK(output == expected); - CHECK(output == valueDesc); - CHECK(output == jsonAsString(value)); + EXPECT_EQ(output, expected); + EXPECT_EQ(output, valueDesc); + EXPECT_EQ(output, jsonAsString(value)); } -TEST_CASE("output cases") +TEST(JsonOutput, output_cases) { checkOutput("{}"); checkOutput("[]"); @@ -36,5 +34,3 @@ TEST_CASE("output cases") checkOutput("[[]]"); checkOutput(R"({"array":[{"12":23},{},null,false,0.5]})"); } - -TEST_SUITE_END(); diff --git a/src/tests/libxrpl/json/Value.cpp b/src/tests/libxrpl/json/Value.cpp index 25bd2f548d..4db1274a4d 100644 --- a/src/tests/libxrpl/json/Value.cpp +++ b/src/tests/libxrpl/json/Value.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -14,9 +14,7 @@ namespace xrpl { -TEST_SUITE_BEGIN("json_value"); - -TEST_CASE("limits") +TEST(json_value, limits) { using namespace Json; static_assert(Value::minInt == Int(~(UInt(-1) / 2))); @@ -24,31 +22,31 @@ TEST_CASE("limits") static_assert(Value::maxUInt == UInt(-1)); } -TEST_CASE("construct and compare Json::StaticString") +TEST(json_value, construct_and_compare_Json_StaticString) { static constexpr char sample[]{"Contents of a Json::StaticString"}; static constexpr Json::StaticString test1(sample); char const* addrTest1{test1}; - CHECK(addrTest1 == &sample[0]); - CHECK(test1.c_str() == &sample[0]); + EXPECT_EQ(addrTest1, &sample[0]); + EXPECT_EQ(test1.c_str(), &sample[0]); static constexpr Json::StaticString test2{ "Contents of a Json::StaticString"}; static constexpr Json::StaticString test3{"Another StaticString"}; - CHECK(test1 == test2); - CHECK(test1 != test3); + EXPECT_EQ(test1, test2); + EXPECT_NE(test1, test3); std::string str{sample}; - CHECK(str == test2); - CHECK(str != test3); - CHECK(test2 == str); - CHECK(test3 != str); + EXPECT_EQ(str, test2); + EXPECT_NE(str, test3); + EXPECT_EQ(test2, str); + EXPECT_NE(test3, str); } -TEST_CASE("different types") +TEST(json_value, different_types) { // Exercise ValueType constructor static constexpr Json::StaticString staticStr{"staticStr"}; @@ -56,166 +54,166 @@ TEST_CASE("different types") auto testCopy = [](Json::ValueType typ) { Json::Value val{typ}; Json::Value cpy{val}; - CHECK(val.type() == typ); - CHECK(cpy.type() == typ); + EXPECT_EQ(val.type(), typ); + EXPECT_EQ(cpy.type(), typ); return val; }; { Json::Value const nullV{testCopy(Json::nullValue)}; - CHECK(nullV.isNull()); - CHECK(!nullV.isBool()); - CHECK(!nullV.isInt()); - CHECK(!nullV.isUInt()); - CHECK(!nullV.isIntegral()); - CHECK(!nullV.isDouble()); - CHECK(!nullV.isNumeric()); - CHECK(!nullV.isString()); - CHECK(!nullV.isArray()); - CHECK(nullV.isArrayOrNull()); - CHECK(!nullV.isObject()); - CHECK(nullV.isObjectOrNull()); + EXPECT_TRUE(nullV.isNull()); + EXPECT_FALSE(nullV.isBool()); + EXPECT_FALSE(nullV.isInt()); + EXPECT_FALSE(nullV.isUInt()); + EXPECT_FALSE(nullV.isIntegral()); + EXPECT_FALSE(nullV.isDouble()); + EXPECT_FALSE(nullV.isNumeric()); + EXPECT_FALSE(nullV.isString()); + EXPECT_FALSE(nullV.isArray()); + EXPECT_TRUE(nullV.isArrayOrNull()); + EXPECT_FALSE(nullV.isObject()); + EXPECT_TRUE(nullV.isObjectOrNull()); } { Json::Value const intV{testCopy(Json::intValue)}; - CHECK(!intV.isNull()); - CHECK(!intV.isBool()); - CHECK(intV.isInt()); - CHECK(!intV.isUInt()); - CHECK(intV.isIntegral()); - CHECK(!intV.isDouble()); - CHECK(intV.isNumeric()); - CHECK(!intV.isString()); - CHECK(!intV.isArray()); - CHECK(!intV.isArrayOrNull()); - CHECK(!intV.isObject()); - CHECK(!intV.isObjectOrNull()); + EXPECT_FALSE(intV.isNull()); + EXPECT_FALSE(intV.isBool()); + EXPECT_TRUE(intV.isInt()); + EXPECT_FALSE(intV.isUInt()); + EXPECT_TRUE(intV.isIntegral()); + EXPECT_FALSE(intV.isDouble()); + EXPECT_TRUE(intV.isNumeric()); + EXPECT_FALSE(intV.isString()); + EXPECT_FALSE(intV.isArray()); + EXPECT_FALSE(intV.isArrayOrNull()); + EXPECT_FALSE(intV.isObject()); + EXPECT_FALSE(intV.isObjectOrNull()); } { Json::Value const uintV{testCopy(Json::uintValue)}; - CHECK(!uintV.isNull()); - CHECK(!uintV.isBool()); - CHECK(!uintV.isInt()); - CHECK(uintV.isUInt()); - CHECK(uintV.isIntegral()); - CHECK(!uintV.isDouble()); - CHECK(uintV.isNumeric()); - CHECK(!uintV.isString()); - CHECK(!uintV.isArray()); - CHECK(!uintV.isArrayOrNull()); - CHECK(!uintV.isObject()); - CHECK(!uintV.isObjectOrNull()); + EXPECT_FALSE(uintV.isNull()); + EXPECT_FALSE(uintV.isBool()); + EXPECT_FALSE(uintV.isInt()); + EXPECT_TRUE(uintV.isUInt()); + EXPECT_TRUE(uintV.isIntegral()); + EXPECT_FALSE(uintV.isDouble()); + EXPECT_TRUE(uintV.isNumeric()); + EXPECT_FALSE(uintV.isString()); + EXPECT_FALSE(uintV.isArray()); + EXPECT_FALSE(uintV.isArrayOrNull()); + EXPECT_FALSE(uintV.isObject()); + EXPECT_FALSE(uintV.isObjectOrNull()); } { Json::Value const realV{testCopy(Json::realValue)}; - CHECK(!realV.isNull()); - CHECK(!realV.isBool()); - CHECK(!realV.isInt()); - CHECK(!realV.isUInt()); - CHECK(!realV.isIntegral()); - CHECK(realV.isDouble()); - CHECK(realV.isNumeric()); - CHECK(!realV.isString()); - CHECK(!realV.isArray()); - CHECK(!realV.isArrayOrNull()); - CHECK(!realV.isObject()); - CHECK(!realV.isObjectOrNull()); + EXPECT_FALSE(realV.isNull()); + EXPECT_FALSE(realV.isBool()); + EXPECT_FALSE(realV.isInt()); + EXPECT_FALSE(realV.isUInt()); + EXPECT_FALSE(realV.isIntegral()); + EXPECT_TRUE(realV.isDouble()); + EXPECT_TRUE(realV.isNumeric()); + EXPECT_FALSE(realV.isString()); + EXPECT_FALSE(realV.isArray()); + EXPECT_FALSE(realV.isArrayOrNull()); + EXPECT_FALSE(realV.isObject()); + EXPECT_FALSE(realV.isObjectOrNull()); } { Json::Value const stringV{testCopy(Json::stringValue)}; - CHECK(!stringV.isNull()); - CHECK(!stringV.isBool()); - CHECK(!stringV.isInt()); - CHECK(!stringV.isUInt()); - CHECK(!stringV.isIntegral()); - CHECK(!stringV.isDouble()); - CHECK(!stringV.isNumeric()); - CHECK(stringV.isString()); - CHECK(!stringV.isArray()); - CHECK(!stringV.isArrayOrNull()); - CHECK(!stringV.isObject()); - CHECK(!stringV.isObjectOrNull()); + EXPECT_FALSE(stringV.isNull()); + EXPECT_FALSE(stringV.isBool()); + EXPECT_FALSE(stringV.isInt()); + EXPECT_FALSE(stringV.isUInt()); + EXPECT_FALSE(stringV.isIntegral()); + EXPECT_FALSE(stringV.isDouble()); + EXPECT_FALSE(stringV.isNumeric()); + EXPECT_TRUE(stringV.isString()); + EXPECT_FALSE(stringV.isArray()); + EXPECT_FALSE(stringV.isArrayOrNull()); + EXPECT_FALSE(stringV.isObject()); + EXPECT_FALSE(stringV.isObjectOrNull()); } { Json::Value const staticStrV{staticStr}; { Json::Value cpy{staticStrV}; - CHECK(staticStrV.type() == Json::stringValue); - CHECK(cpy.type() == Json::stringValue); + EXPECT_EQ(staticStrV.type(), Json::stringValue); + EXPECT_EQ(cpy.type(), Json::stringValue); } - CHECK(!staticStrV.isNull()); - CHECK(!staticStrV.isBool()); - CHECK(!staticStrV.isInt()); - CHECK(!staticStrV.isUInt()); - CHECK(!staticStrV.isIntegral()); - CHECK(!staticStrV.isDouble()); - CHECK(!staticStrV.isNumeric()); - CHECK(staticStrV.isString()); - CHECK(!staticStrV.isArray()); - CHECK(!staticStrV.isArrayOrNull()); - CHECK(!staticStrV.isObject()); - CHECK(!staticStrV.isObjectOrNull()); + EXPECT_FALSE(staticStrV.isNull()); + EXPECT_FALSE(staticStrV.isBool()); + EXPECT_FALSE(staticStrV.isInt()); + EXPECT_FALSE(staticStrV.isUInt()); + EXPECT_FALSE(staticStrV.isIntegral()); + EXPECT_FALSE(staticStrV.isDouble()); + EXPECT_FALSE(staticStrV.isNumeric()); + EXPECT_TRUE(staticStrV.isString()); + EXPECT_FALSE(staticStrV.isArray()); + EXPECT_FALSE(staticStrV.isArrayOrNull()); + EXPECT_FALSE(staticStrV.isObject()); + EXPECT_FALSE(staticStrV.isObjectOrNull()); } { Json::Value const boolV{testCopy(Json::booleanValue)}; - CHECK(!boolV.isNull()); - CHECK(boolV.isBool()); - CHECK(!boolV.isInt()); - CHECK(!boolV.isUInt()); - CHECK(boolV.isIntegral()); - CHECK(!boolV.isDouble()); - CHECK(boolV.isNumeric()); - CHECK(!boolV.isString()); - CHECK(!boolV.isArray()); - CHECK(!boolV.isArrayOrNull()); - CHECK(!boolV.isObject()); - CHECK(!boolV.isObjectOrNull()); + EXPECT_FALSE(boolV.isNull()); + EXPECT_TRUE(boolV.isBool()); + EXPECT_FALSE(boolV.isInt()); + EXPECT_FALSE(boolV.isUInt()); + EXPECT_TRUE(boolV.isIntegral()); + EXPECT_FALSE(boolV.isDouble()); + EXPECT_TRUE(boolV.isNumeric()); + EXPECT_FALSE(boolV.isString()); + EXPECT_FALSE(boolV.isArray()); + EXPECT_FALSE(boolV.isArrayOrNull()); + EXPECT_FALSE(boolV.isObject()); + EXPECT_FALSE(boolV.isObjectOrNull()); } { Json::Value const arrayV{testCopy(Json::arrayValue)}; - CHECK(!arrayV.isNull()); - CHECK(!arrayV.isBool()); - CHECK(!arrayV.isInt()); - CHECK(!arrayV.isUInt()); - CHECK(!arrayV.isIntegral()); - CHECK(!arrayV.isDouble()); - CHECK(!arrayV.isNumeric()); - CHECK(!arrayV.isString()); - CHECK(arrayV.isArray()); - CHECK(arrayV.isArrayOrNull()); - CHECK(!arrayV.isObject()); - CHECK(!arrayV.isObjectOrNull()); + EXPECT_FALSE(arrayV.isNull()); + EXPECT_FALSE(arrayV.isBool()); + EXPECT_FALSE(arrayV.isInt()); + EXPECT_FALSE(arrayV.isUInt()); + EXPECT_FALSE(arrayV.isIntegral()); + EXPECT_FALSE(arrayV.isDouble()); + EXPECT_FALSE(arrayV.isNumeric()); + EXPECT_FALSE(arrayV.isString()); + EXPECT_TRUE(arrayV.isArray()); + EXPECT_TRUE(arrayV.isArrayOrNull()); + EXPECT_FALSE(arrayV.isObject()); + EXPECT_FALSE(arrayV.isObjectOrNull()); } { Json::Value const objectV{testCopy(Json::objectValue)}; - CHECK(!objectV.isNull()); - CHECK(!objectV.isBool()); - CHECK(!objectV.isInt()); - CHECK(!objectV.isUInt()); - CHECK(!objectV.isIntegral()); - CHECK(!objectV.isDouble()); - CHECK(!objectV.isNumeric()); - CHECK(!objectV.isString()); - CHECK(!objectV.isArray()); - CHECK(!objectV.isArrayOrNull()); - CHECK(objectV.isObject()); - CHECK(objectV.isObjectOrNull()); + EXPECT_FALSE(objectV.isNull()); + EXPECT_FALSE(objectV.isBool()); + EXPECT_FALSE(objectV.isInt()); + EXPECT_FALSE(objectV.isUInt()); + EXPECT_FALSE(objectV.isIntegral()); + EXPECT_FALSE(objectV.isDouble()); + EXPECT_FALSE(objectV.isNumeric()); + EXPECT_FALSE(objectV.isString()); + EXPECT_FALSE(objectV.isArray()); + EXPECT_FALSE(objectV.isArrayOrNull()); + EXPECT_TRUE(objectV.isObject()); + EXPECT_TRUE(objectV.isObjectOrNull()); } } -TEST_CASE("compare strings") +TEST(json_value, compare_strings) { auto doCompare = [&](Json::Value const& lhs, Json::Value const& rhs, bool lhsEqRhs, bool lhsLtRhs, int line) { - CAPTURE(line); - CHECK((lhs == rhs) == lhsEqRhs); - CHECK((lhs != rhs) != lhsEqRhs); - CHECK((lhs < rhs) == (!(lhsEqRhs || !lhsLtRhs))); - CHECK((lhs <= rhs) == (lhsEqRhs || lhsLtRhs)); - CHECK((lhs >= rhs) == (lhsEqRhs || !lhsLtRhs)); - CHECK((lhs > rhs) == (!(lhsEqRhs || lhsLtRhs))); + SCOPED_TRACE(line); + EXPECT_EQ((lhs == rhs), lhsEqRhs); + EXPECT_NE((lhs != rhs), lhsEqRhs); + EXPECT_EQ((lhs < rhs), (!(lhsEqRhs || !lhsLtRhs))); + EXPECT_EQ((lhs <= rhs), (lhsEqRhs || lhsLtRhs)); + EXPECT_EQ((lhs >= rhs), (lhsEqRhs || !lhsLtRhs)); + EXPECT_EQ((lhs > rhs), (!(lhsEqRhs || lhsLtRhs))); }; Json::Value const null0; @@ -556,40 +554,40 @@ TEST_CASE("compare strings") #pragma pop_macro("DO_COMPARE") } -TEST_CASE("bool") +TEST(json_value, bool) { - CHECK(!Json::Value()); + EXPECT_FALSE(Json::Value()); - CHECK(!Json::Value("")); + EXPECT_FALSE(Json::Value("")); - CHECK(bool(Json::Value("empty"))); - CHECK(bool(Json::Value(false))); - CHECK(bool(Json::Value(true))); - CHECK(bool(Json::Value(0))); - CHECK(bool(Json::Value(1))); + EXPECT_TRUE(bool(Json::Value("empty"))); + EXPECT_TRUE(bool(Json::Value(false))); + EXPECT_TRUE(bool(Json::Value(true))); + EXPECT_TRUE(bool(Json::Value(0))); + EXPECT_TRUE(bool(Json::Value(1))); Json::Value array(Json::arrayValue); - CHECK(!array); + EXPECT_FALSE(array); array.append(0); - CHECK(bool(array)); + EXPECT_TRUE(bool(array)); Json::Value object(Json::objectValue); - CHECK(!object); + EXPECT_FALSE(object); object[""] = false; - CHECK(bool(object)); + EXPECT_TRUE(bool(object)); } -TEST_CASE("bad json") +TEST(json_value, bad_json) { char const* s(R"({"method":"ledger","params":[{"ledger_index":1e300}]})"); Json::Value j; Json::Reader r; - CHECK(r.parse(s, j)); + EXPECT_TRUE(r.parse(s, j)); } -TEST_CASE("edge cases") +TEST(json_value, edge_cases) { std::uint32_t max_uint = std::numeric_limits::max(); std::int32_t max_int = std::numeric_limits::max(); @@ -611,28 +609,27 @@ TEST_CASE("edge cases") Json::Value j1; Json::Reader r1; - CHECK(r1.parse(json, j1)); - CHECK(j1["max_uint"].asUInt() == max_uint); - CHECK(j1["max_uint"].asAbsUInt() == max_uint); - CHECK(j1["max_int"].asInt() == max_int); - CHECK(j1["max_int"].asAbsUInt() == max_int); - CHECK(j1["min_int"].asInt() == min_int); - CHECK( - j1["min_int"].asAbsUInt() == - static_cast(min_int) * -1); - CHECK(j1["a_uint"].asUInt() == a_uint); - CHECK(j1["a_uint"].asAbsUInt() == a_uint); - CHECK(j1["a_uint"] > a_large_int); - CHECK(j1["a_uint"] > a_small_int); - CHECK(j1["a_large_int"].asInt() == a_large_int); - CHECK(j1["a_large_int"].asAbsUInt() == a_large_int); - CHECK(j1["a_large_int"].asUInt() == a_large_int); - CHECK(j1["a_large_int"] < a_uint); - CHECK(j1["a_small_int"].asInt() == a_small_int); - CHECK( - j1["a_small_int"].asAbsUInt() == + EXPECT_TRUE(r1.parse(json, j1)); + EXPECT_EQ(j1["max_uint"].asUInt(), max_uint); + EXPECT_EQ(j1["max_uint"].asAbsUInt(), max_uint); + EXPECT_EQ(j1["max_int"].asInt(), max_int); + EXPECT_EQ(j1["max_int"].asAbsUInt(), max_int); + EXPECT_EQ(j1["min_int"].asInt(), min_int); + EXPECT_EQ( + j1["min_int"].asAbsUInt(), static_cast(min_int) * -1); + EXPECT_EQ(j1["a_uint"].asUInt(), a_uint); + EXPECT_EQ(j1["a_uint"].asAbsUInt(), a_uint); + EXPECT_GT(j1["a_uint"], a_large_int); + EXPECT_GT(j1["a_uint"], a_small_int); + EXPECT_EQ(j1["a_large_int"].asInt(), a_large_int); + EXPECT_EQ(j1["a_large_int"].asAbsUInt(), a_large_int); + EXPECT_EQ(j1["a_large_int"].asUInt(), a_large_int); + EXPECT_LT(j1["a_large_int"], a_uint); + EXPECT_EQ(j1["a_small_int"].asInt(), a_small_int); + EXPECT_EQ( + j1["a_small_int"].asAbsUInt(), static_cast(a_small_int) * -1); - CHECK(j1["a_small_int"] < a_uint); + EXPECT_LT(j1["a_small_int"], a_uint); } std::uint64_t overflow = std::uint64_t(max_uint) + 1; @@ -644,7 +641,7 @@ TEST_CASE("edge cases") Json::Value j2; Json::Reader r2; - CHECK(!r2.parse(json, j2)); + EXPECT_FALSE(r2.parse(json, j2)); } std::int64_t underflow = std::int64_t(min_int) - 1; @@ -656,167 +653,167 @@ TEST_CASE("edge cases") Json::Value j3; Json::Reader r3; - CHECK(!r3.parse(json, j3)); + EXPECT_FALSE(r3.parse(json, j3)); } { Json::Value intString{std::to_string(overflow)}; - CHECK_THROWS_AS(intString.asUInt(), beast::BadLexicalCast); - CHECK_THROWS_AS(intString.asAbsUInt(), Json::error); + EXPECT_THROW(intString.asUInt(), beast::BadLexicalCast); + EXPECT_THROW(intString.asAbsUInt(), Json::error); intString = "4294967295"; - CHECK(intString.asUInt() == 4294967295u); - CHECK(intString.asAbsUInt() == 4294967295u); + EXPECT_EQ(intString.asUInt(), 4294967295u); + EXPECT_EQ(intString.asAbsUInt(), 4294967295u); intString = "0"; - CHECK(intString.asUInt() == 0); - CHECK(intString.asAbsUInt() == 0); + EXPECT_EQ(intString.asUInt(), 0); + EXPECT_EQ(intString.asAbsUInt(), 0); intString = "-1"; - CHECK_THROWS_AS(intString.asUInt(), beast::BadLexicalCast); - CHECK(intString.asAbsUInt() == 1); + EXPECT_THROW(intString.asUInt(), beast::BadLexicalCast); + EXPECT_EQ(intString.asAbsUInt(), 1); intString = "-4294967295"; - CHECK(intString.asAbsUInt() == 4294967295); + EXPECT_EQ(intString.asAbsUInt(), 4294967295); intString = "-4294967296"; - CHECK_THROWS_AS(intString.asAbsUInt(), Json::error); + EXPECT_THROW(intString.asAbsUInt(), Json::error); intString = "2147483648"; - CHECK_THROWS_AS(intString.asInt(), beast::BadLexicalCast); - CHECK(intString.asAbsUInt() == 2147483648); + EXPECT_THROW(intString.asInt(), beast::BadLexicalCast); + EXPECT_EQ(intString.asAbsUInt(), 2147483648); intString = "2147483647"; - CHECK(intString.asInt() == 2147483647); - CHECK(intString.asAbsUInt() == 2147483647); + EXPECT_EQ(intString.asInt(), 2147483647); + EXPECT_EQ(intString.asAbsUInt(), 2147483647); intString = "-2147483648"; - CHECK(intString.asInt() == -2147483648LL); // MSVC wants the LL - CHECK(intString.asAbsUInt() == 2147483648LL); + EXPECT_EQ(intString.asInt(), -2147483648LL); // MSVC wants the LL + EXPECT_EQ(intString.asAbsUInt(), 2147483648LL); intString = "-2147483649"; - CHECK_THROWS_AS(intString.asInt(), beast::BadLexicalCast); - CHECK(intString.asAbsUInt() == 2147483649); + EXPECT_THROW(intString.asInt(), beast::BadLexicalCast); + EXPECT_EQ(intString.asAbsUInt(), 2147483649); } { Json::Value intReal{4294967297.0}; - CHECK_THROWS_AS(intReal.asUInt(), Json::error); - CHECK_THROWS_AS(intReal.asAbsUInt(), Json::error); + EXPECT_THROW(intReal.asUInt(), Json::error); + EXPECT_THROW(intReal.asAbsUInt(), Json::error); intReal = 4294967295.0; - CHECK(intReal.asUInt() == 4294967295u); - CHECK(intReal.asAbsUInt() == 4294967295u); + EXPECT_EQ(intReal.asUInt(), 4294967295u); + EXPECT_EQ(intReal.asAbsUInt(), 4294967295u); intReal = 0.0; - CHECK(intReal.asUInt() == 0); - CHECK(intReal.asAbsUInt() == 0); + EXPECT_EQ(intReal.asUInt(), 0); + EXPECT_EQ(intReal.asAbsUInt(), 0); intReal = -1.0; - CHECK_THROWS_AS(intReal.asUInt(), Json::error); - CHECK(intReal.asAbsUInt() == 1); + EXPECT_THROW(intReal.asUInt(), Json::error); + EXPECT_EQ(intReal.asAbsUInt(), 1); intReal = -4294967295.0; - CHECK(intReal.asAbsUInt() == 4294967295); + EXPECT_EQ(intReal.asAbsUInt(), 4294967295); intReal = -4294967296.0; - CHECK_THROWS_AS(intReal.asAbsUInt(), Json::error); + EXPECT_THROW(intReal.asAbsUInt(), Json::error); intReal = 2147483648.0; - CHECK_THROWS_AS(intReal.asInt(), Json::error); - CHECK(intReal.asAbsUInt() == 2147483648); + EXPECT_THROW(intReal.asInt(), Json::error); + EXPECT_EQ(intReal.asAbsUInt(), 2147483648); intReal = 2147483647.0; - CHECK(intReal.asInt() == 2147483647); - CHECK(intReal.asAbsUInt() == 2147483647); + EXPECT_EQ(intReal.asInt(), 2147483647); + EXPECT_EQ(intReal.asAbsUInt(), 2147483647); intReal = -2147483648.0; - CHECK(intReal.asInt() == -2147483648LL); // MSVC wants the LL - CHECK(intReal.asAbsUInt() == 2147483648LL); + EXPECT_EQ(intReal.asInt(), -2147483648LL); // MSVC wants the LL + EXPECT_EQ(intReal.asAbsUInt(), 2147483648LL); intReal = -2147483649.0; - CHECK_THROWS_AS(intReal.asInt(), Json::error); - CHECK(intReal.asAbsUInt() == 2147483649); + EXPECT_THROW(intReal.asInt(), Json::error); + EXPECT_EQ(intReal.asAbsUInt(), 2147483649); } } -TEST_CASE("copy") +TEST(json_value, copy) { Json::Value v1{2.5}; - CHECK(v1.isDouble()); - CHECK(v1.asDouble() == 2.5); + EXPECT_TRUE(v1.isDouble()); + EXPECT_EQ(v1.asDouble(), 2.5); Json::Value v2 = v1; - CHECK(v1.isDouble()); - CHECK(v1.asDouble() == 2.5); - CHECK(v2.isDouble()); - CHECK(v2.asDouble() == 2.5); - CHECK(v1 == v2); + EXPECT_TRUE(v1.isDouble()); + EXPECT_EQ(v1.asDouble(), 2.5); + EXPECT_TRUE(v2.isDouble()); + EXPECT_EQ(v2.asDouble(), 2.5); + EXPECT_EQ(v1, v2); v1 = v2; - CHECK(v1.isDouble()); - CHECK(v1.asDouble() == 2.5); - CHECK(v2.isDouble()); - CHECK(v2.asDouble() == 2.5); - CHECK(v1 == v2); + EXPECT_TRUE(v1.isDouble()); + EXPECT_EQ(v1.asDouble(), 2.5); + EXPECT_TRUE(v2.isDouble()); + EXPECT_EQ(v2.asDouble(), 2.5); + EXPECT_EQ(v1, v2); } -TEST_CASE("move") +TEST(json_value, move) { Json::Value v1{2.5}; - CHECK(v1.isDouble()); - CHECK(v1.asDouble() == 2.5); + EXPECT_TRUE(v1.isDouble()); + EXPECT_EQ(v1.asDouble(), 2.5); Json::Value v2 = std::move(v1); - CHECK(!v1); - CHECK(v2.isDouble()); - CHECK(v2.asDouble() == 2.5); - CHECK(v1 != v2); + EXPECT_FALSE(v1); + EXPECT_TRUE(v2.isDouble()); + EXPECT_EQ(v2.asDouble(), 2.5); + EXPECT_NE(v1, v2); v1 = std::move(v2); - CHECK(v1.isDouble()); - CHECK(v1.asDouble() == 2.5); - CHECK(!v2); - CHECK(v1 != v2); + EXPECT_TRUE(v1.isDouble()); + EXPECT_EQ(v1.asDouble(), 2.5); + EXPECT_FALSE(v2); + EXPECT_NE(v1, v2); } -TEST_CASE("comparisons") +TEST(json_value, comparisons) { Json::Value a, b; auto testEquals = [&](std::string const& name) { - CHECK(a == b); - CHECK(a <= b); - CHECK(a >= b); + EXPECT_TRUE(a == b); + EXPECT_TRUE(a <= b); + EXPECT_TRUE(a >= b); - CHECK(!(a != b)); - CHECK(!(a < b)); - CHECK(!(a > b)); + EXPECT_FALSE(a != b); + EXPECT_FALSE(a < b); + EXPECT_FALSE(a > b); - CHECK(b == a); - CHECK(b <= a); - CHECK(b >= a); + EXPECT_TRUE(b == a); + EXPECT_TRUE(b <= a); + EXPECT_TRUE(b >= a); - CHECK(!(b != a)); - CHECK(!(b < a)); - CHECK(!(b > a)); + EXPECT_FALSE(b != a); + EXPECT_FALSE(b < a); + EXPECT_FALSE(b > a); }; auto testGreaterThan = [&](std::string const& name) { - CHECK(!(a == b)); - CHECK(!(a <= b)); - CHECK(a >= b); + EXPECT_FALSE(a == b); + EXPECT_FALSE(a <= b); + EXPECT_TRUE(a >= b); - CHECK(a != b); - CHECK(!(a < b)); - CHECK(a > b); + EXPECT_TRUE(a != b); + EXPECT_FALSE(a < b); + EXPECT_TRUE(a > b); - CHECK(!(b == a)); - CHECK(b <= a); - CHECK(!(b >= a)); + EXPECT_FALSE(b == a); + EXPECT_TRUE(b <= a); + EXPECT_FALSE(b >= a); - CHECK(b != a); - CHECK(b < a); - CHECK(!(b > a)); + EXPECT_TRUE(b != a); + EXPECT_TRUE(b < a); + EXPECT_FALSE(b > a); }; a["a"] = Json::UInt(0); @@ -835,7 +832,7 @@ TEST_CASE("comparisons") testGreaterThan("big"); } -TEST_CASE("compact") +TEST(json_value, compact) { Json::Value j; Json::Reader r; @@ -847,20 +844,20 @@ TEST_CASE("compact") }); }; - CHECK(r.parse(s, j)); + EXPECT_TRUE(r.parse(s, j)); { std::stringstream ss; ss << j; - CHECK(countLines(ss.str()) > 1); + EXPECT_GT(countLines(ss.str()), 1); } { std::stringstream ss; ss << Json::Compact(std::move(j)); - CHECK(countLines(ss.str()) == 1); + EXPECT_EQ(countLines(ss.str()), 1); } } -TEST_CASE("conversions") +TEST(json_value, conversions) { // We have Json::Int, but not Json::Double or Json::Real. // We have Json::Int, Json::Value::Int, and Json::ValueType::intValue. @@ -869,336 +866,336 @@ TEST_CASE("conversions") { // null Json::Value val; - CHECK(val.isNull()); + EXPECT_TRUE(val.isNull()); // val.asCString() should trigger an assertion failure - CHECK(val.asString() == ""); - CHECK(val.asInt() == 0); - CHECK(val.asUInt() == 0); - CHECK(val.asAbsUInt() == 0); - CHECK(val.asDouble() == 0.0); - CHECK(val.asBool() == false); + EXPECT_EQ(val.asString(), ""); + EXPECT_EQ(val.asInt(), 0); + EXPECT_EQ(val.asUInt(), 0); + EXPECT_EQ(val.asAbsUInt(), 0); + EXPECT_EQ(val.asDouble(), 0.0); + EXPECT_FALSE(val.asBool()); - CHECK(val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(val.isConvertibleTo(Json::arrayValue)); - CHECK(val.isConvertibleTo(Json::objectValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::objectValue)); } { // int Json::Value val = -1234; - CHECK(val.isInt()); + EXPECT_TRUE(val.isInt()); // val.asCString() should trigger an assertion failure - CHECK(val.asString() == "-1234"); - CHECK(val.asInt() == -1234); - CHECK_THROWS_AS(val.asUInt(), Json::error); - CHECK(val.asAbsUInt() == 1234u); - CHECK(val.asDouble() == -1234.0); - CHECK(val.asBool() == true); + EXPECT_EQ(val.asString(), "-1234"); + EXPECT_EQ(val.asInt(), -1234); + EXPECT_THROW(val.asUInt(), Json::error); + EXPECT_EQ(val.asAbsUInt(), 1234u); + EXPECT_EQ(val.asDouble(), -1234.0); + EXPECT_TRUE(val.asBool()); - CHECK(!val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(!val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // uint Json::Value val = 1234U; - CHECK(val.isUInt()); + EXPECT_TRUE(val.isUInt()); // val.asCString() should trigger an assertion failure - CHECK(val.asString() == "1234"); - CHECK(val.asInt() == 1234); - CHECK(val.asUInt() == 1234u); - CHECK(val.asAbsUInt() == 1234u); - CHECK(val.asDouble() == 1234.0); - CHECK(val.asBool() == true); + EXPECT_EQ(val.asString(), "1234"); + EXPECT_EQ(val.asInt(), 1234); + EXPECT_EQ(val.asUInt(), 1234u); + EXPECT_EQ(val.asAbsUInt(), 1234u); + EXPECT_EQ(val.asDouble(), 1234.0); + EXPECT_TRUE(val.asBool()); - CHECK(!val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // real Json::Value val = 2.0; - CHECK(val.isDouble()); + EXPECT_TRUE(val.isDouble()); // val.asCString() should trigger an assertion failure - CHECK(std::regex_match(val.asString(), std::regex("^2\\.0*$"))); - CHECK(val.asInt() == 2); - CHECK(val.asUInt() == 2u); - CHECK(val.asAbsUInt() == 2u); - CHECK(val.asDouble() == 2.0); - CHECK(val.asBool() == true); + EXPECT_TRUE(std::regex_match(val.asString(), std::regex("^2\\.0*$"))); + EXPECT_EQ(val.asInt(), 2); + EXPECT_EQ(val.asUInt(), 2u); + EXPECT_EQ(val.asAbsUInt(), 2u); + EXPECT_EQ(val.asDouble(), 2.0); + EXPECT_TRUE(val.asBool()); - CHECK(!val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // numeric string Json::Value val = "54321"; - CHECK(val.isString()); - CHECK(strcmp(val.asCString(), "54321") == 0); - CHECK(val.asString() == "54321"); - CHECK(val.asInt() == 54321); - CHECK(val.asUInt() == 54321u); - CHECK(val.asAbsUInt() == 54321); - CHECK_THROWS_AS(val.asDouble(), Json::error); - CHECK(val.asBool() == true); + EXPECT_TRUE(val.isString()); + EXPECT_EQ(strcmp(val.asCString(), "54321"), 0); + EXPECT_EQ(val.asString(), "54321"); + EXPECT_EQ(val.asInt(), 54321); + EXPECT_EQ(val.asUInt(), 54321u); + EXPECT_EQ(val.asAbsUInt(), 54321); + EXPECT_THROW(val.asDouble(), Json::error); + EXPECT_TRUE(val.asBool()); - CHECK(!val.isConvertibleTo(Json::nullValue)); - CHECK(!val.isConvertibleTo(Json::intValue)); - CHECK(!val.isConvertibleTo(Json::uintValue)); - CHECK(!val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(!val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::nullValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::intValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::uintValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // non-numeric string Json::Value val(Json::stringValue); - CHECK(val.isString()); - CHECK(val.asCString() == nullptr); - CHECK(val.asString() == ""); - CHECK_THROWS_AS(val.asInt(), std::exception); - CHECK_THROWS_AS(val.asUInt(), std::exception); - CHECK_THROWS_AS(val.asAbsUInt(), std::exception); - CHECK_THROWS_AS(val.asDouble(), std::exception); - CHECK(val.asBool() == false); + EXPECT_TRUE(val.isString()); + EXPECT_EQ(val.asCString(), nullptr); + EXPECT_EQ(val.asString(), ""); + EXPECT_THROW(val.asInt(), std::exception); + EXPECT_THROW(val.asUInt(), std::exception); + EXPECT_THROW(val.asAbsUInt(), std::exception); + EXPECT_THROW(val.asDouble(), std::exception); + EXPECT_TRUE(val.asBool() == false); - CHECK(val.isConvertibleTo(Json::nullValue)); - CHECK(!val.isConvertibleTo(Json::intValue)); - CHECK(!val.isConvertibleTo(Json::uintValue)); - CHECK(!val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(!val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::nullValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::intValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::uintValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // bool false Json::Value val = false; - CHECK(val.isBool()); + EXPECT_TRUE(val.isBool()); // val.asCString() should trigger an assertion failure - CHECK(val.asString() == "false"); - CHECK(val.asInt() == 0); - CHECK(val.asUInt() == 0); - CHECK(val.asAbsUInt() == 0); - CHECK(val.asDouble() == 0.0); - CHECK(val.asBool() == false); + EXPECT_EQ(val.asString(), "false"); + EXPECT_EQ(val.asInt(), 0); + EXPECT_EQ(val.asUInt(), 0); + EXPECT_EQ(val.asAbsUInt(), 0); + EXPECT_EQ(val.asDouble(), 0.0); + EXPECT_FALSE(val.asBool()); - CHECK(val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // bool true Json::Value val = true; - CHECK(val.isBool()); + EXPECT_TRUE(val.isBool()); // val.asCString() should trigger an assertion failure - CHECK(val.asString() == "true"); - CHECK(val.asInt() == 1); - CHECK(val.asUInt() == 1); - CHECK(val.asAbsUInt() == 1); - CHECK(val.asDouble() == 1.0); - CHECK(val.asBool() == true); + EXPECT_EQ(val.asString(), "true"); + EXPECT_EQ(val.asInt(), 1); + EXPECT_EQ(val.asUInt(), 1); + EXPECT_EQ(val.asAbsUInt(), 1); + EXPECT_EQ(val.asDouble(), 1.0); + EXPECT_TRUE(val.asBool()); - CHECK(!val.isConvertibleTo(Json::nullValue)); - CHECK(val.isConvertibleTo(Json::intValue)); - CHECK(val.isConvertibleTo(Json::uintValue)); - CHECK(val.isConvertibleTo(Json::realValue)); - CHECK(val.isConvertibleTo(Json::stringValue)); - CHECK(val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::nullValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::intValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::uintValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::realValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::stringValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // array type Json::Value val(Json::arrayValue); - CHECK(val.isArray()); + EXPECT_TRUE(val.isArray()); // val.asCString should trigger an assertion failure - CHECK_THROWS_AS(val.asString(), Json::error); - CHECK_THROWS_AS(val.asInt(), Json::error); - CHECK_THROWS_AS(val.asUInt(), Json::error); - CHECK_THROWS_AS(val.asAbsUInt(), Json::error); - CHECK_THROWS_AS(val.asDouble(), Json::error); - CHECK(val.asBool() == false); // empty or not + EXPECT_THROW(val.asString(), Json::error); + EXPECT_THROW(val.asInt(), Json::error); + EXPECT_THROW(val.asUInt(), Json::error); + EXPECT_THROW(val.asAbsUInt(), Json::error); + EXPECT_THROW(val.asDouble(), Json::error); + EXPECT_FALSE(val.asBool()); // empty or not - CHECK(val.isConvertibleTo(Json::nullValue)); - CHECK(!val.isConvertibleTo(Json::intValue)); - CHECK(!val.isConvertibleTo(Json::uintValue)); - CHECK(!val.isConvertibleTo(Json::realValue)); - CHECK(!val.isConvertibleTo(Json::stringValue)); - CHECK(!val.isConvertibleTo(Json::booleanValue)); - CHECK(val.isConvertibleTo(Json::arrayValue)); - CHECK(!val.isConvertibleTo(Json::objectValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::nullValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::intValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::uintValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::realValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::stringValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::objectValue)); } { // object type Json::Value val(Json::objectValue); - CHECK(val.isObject()); + EXPECT_TRUE(val.isObject()); // val.asCString should trigger an assertion failure - CHECK_THROWS_AS(val.asString(), Json::error); - CHECK_THROWS_AS(val.asInt(), Json::error); - CHECK_THROWS_AS(val.asUInt(), Json::error); - CHECK_THROWS_AS(val.asAbsUInt(), Json::error); - CHECK_THROWS_AS(val.asDouble(), Json::error); - CHECK(val.asBool() == false); // empty or not + EXPECT_THROW(val.asString(), Json::error); + EXPECT_THROW(val.asInt(), Json::error); + EXPECT_THROW(val.asUInt(), Json::error); + EXPECT_THROW(val.asAbsUInt(), Json::error); + EXPECT_THROW(val.asDouble(), Json::error); + EXPECT_FALSE(val.asBool()); // empty or not - CHECK(val.isConvertibleTo(Json::nullValue)); - CHECK(!val.isConvertibleTo(Json::intValue)); - CHECK(!val.isConvertibleTo(Json::uintValue)); - CHECK(!val.isConvertibleTo(Json::realValue)); - CHECK(!val.isConvertibleTo(Json::stringValue)); - CHECK(!val.isConvertibleTo(Json::booleanValue)); - CHECK(!val.isConvertibleTo(Json::arrayValue)); - CHECK(val.isConvertibleTo(Json::objectValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::nullValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::intValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::uintValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::realValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::stringValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::booleanValue)); + EXPECT_FALSE(val.isConvertibleTo(Json::arrayValue)); + EXPECT_TRUE(val.isConvertibleTo(Json::objectValue)); } } -TEST_CASE("access members") +TEST(json_value, access_members) { Json::Value val; - CHECK(val.type() == Json::nullValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::nullValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); { Json::Value const constVal = val; - CHECK(constVal[7u].type() == Json::nullValue); - CHECK(!constVal.isMember("key")); - CHECK(constVal["key"].type() == Json::nullValue); - CHECK(constVal.getMemberNames().empty()); - CHECK(constVal.get(1u, "default0") == "default0"); - CHECK(constVal.get(std::string("not"), "oh") == "oh"); - CHECK(constVal.get("missing", "default2") == "default2"); + EXPECT_EQ(constVal[7u].type(), Json::nullValue); + EXPECT_FALSE(constVal.isMember("key")); + EXPECT_EQ(constVal["key"].type(), Json::nullValue); + EXPECT_TRUE(constVal.getMemberNames().empty()); + EXPECT_EQ(constVal.get(1u, "default0"), "default0"); + EXPECT_EQ(constVal.get(std::string("not"), "oh"), "oh"); + EXPECT_EQ(constVal.get("missing", "default2"), "default2"); } val = -7; - CHECK(val.type() == Json::intValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::intValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); val = 42u; - CHECK(val.type() == Json::uintValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::uintValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); val = 3.14159; - CHECK(val.type() == Json::realValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::realValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); val = true; - CHECK(val.type() == Json::booleanValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::booleanValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); val = "string"; - CHECK(val.type() == Json::stringValue); - CHECK(val.size() == 0); - CHECK(!val.isValidIndex(0)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.type(), Json::stringValue); + EXPECT_EQ(val.size(), 0); + EXPECT_FALSE(val.isValidIndex(0)); + EXPECT_FALSE(val.isMember("key")); val = Json::Value(Json::objectValue); - CHECK(val.type() == Json::objectValue); - CHECK(val.size() == 0); + EXPECT_EQ(val.type(), Json::objectValue); + EXPECT_EQ(val.size(), 0); static Json::StaticString const staticThree("three"); val[staticThree] = 3; val["two"] = 2; - CHECK(val.size() == 2); - CHECK(val.isValidIndex(1)); - CHECK(!val.isValidIndex(2)); - CHECK(val[staticThree] == 3); - CHECK(val.isMember("two")); - CHECK(val.isMember(staticThree)); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.size(), 2); + EXPECT_TRUE(val.isValidIndex(1)); + EXPECT_FALSE(val.isValidIndex(2)); + EXPECT_EQ(val[staticThree], 3); + EXPECT_TRUE(val.isMember("two")); + EXPECT_TRUE(val.isMember(staticThree)); + EXPECT_FALSE(val.isMember("key")); { Json::Value const constVal = val; - CHECK(constVal["two"] == 2); - CHECK(constVal["four"].type() == Json::nullValue); - CHECK(constVal[staticThree] == 3); - CHECK(constVal.isMember("two")); - CHECK(constVal.isMember(staticThree)); - CHECK(!constVal.isMember("key")); - CHECK(val.get(std::string("two"), "backup") == 2); - CHECK(val.get("missing", "default2") == "default2"); + EXPECT_EQ(constVal["two"], 2); + EXPECT_EQ(constVal["four"].type(), Json::nullValue); + EXPECT_EQ(constVal[staticThree], 3); + EXPECT_TRUE(constVal.isMember("two")); + EXPECT_TRUE(constVal.isMember(staticThree)); + EXPECT_FALSE(constVal.isMember("key")); + EXPECT_EQ(val.get(std::string("two"), "backup"), 2); + EXPECT_EQ(val.get("missing", "default2"), "default2"); } val = Json::Value(Json::arrayValue); - CHECK(val.type() == Json::arrayValue); - CHECK(val.size() == 0); + EXPECT_EQ(val.type(), Json::arrayValue); + EXPECT_EQ(val.size(), 0); val[0u] = "zero"; val[1u] = "one"; - CHECK(val.size() == 2); - CHECK(val.isValidIndex(1)); - CHECK(!val.isValidIndex(2)); - CHECK(val[20u].type() == Json::nullValue); - CHECK(!val.isMember("key")); + EXPECT_EQ(val.size(), 2); + EXPECT_TRUE(val.isValidIndex(1)); + EXPECT_FALSE(val.isValidIndex(2)); + EXPECT_EQ(val[20u].type(), Json::nullValue); + EXPECT_FALSE(val.isMember("key")); { Json::Value const constVal = val; - CHECK(constVal[0u] == "zero"); - CHECK(constVal[2u].type() == Json::nullValue); - CHECK(!constVal.isMember("key")); - CHECK(val.get(1u, "default0") == "one"); - CHECK(val.get(3u, "default1") == "default1"); + EXPECT_EQ(constVal[0u], "zero"); + EXPECT_EQ(constVal[2u].type(), Json::nullValue); + EXPECT_FALSE(constVal.isMember("key")); + EXPECT_EQ(val.get(1u, "default0"), "one"); + EXPECT_EQ(val.get(3u, "default1"), "default1"); } } -TEST_CASE("remove members") +TEST(json_value, remove_members) { Json::Value val; - CHECK(val.removeMember(std::string("member")).type() == Json::nullValue); + EXPECT_EQ(val.removeMember(std::string("member")).type(), Json::nullValue); val = Json::Value(Json::objectValue); static Json::StaticString const staticThree("three"); val[staticThree] = 3; val["two"] = 2; - CHECK(val.size() == 2); + EXPECT_EQ(val.size(), 2); - CHECK(val.removeMember(std::string("six")).type() == Json::nullValue); - CHECK(val.size() == 2); + EXPECT_EQ(val.removeMember(std::string("six")).type(), Json::nullValue); + EXPECT_EQ(val.size(), 2); - CHECK(val.removeMember(staticThree) == 3); - CHECK(val.size() == 1); + EXPECT_EQ(val.removeMember(staticThree), 3); + EXPECT_EQ(val.size(), 1); - CHECK(val.removeMember(staticThree).type() == Json::nullValue); - CHECK(val.size() == 1); + EXPECT_EQ(val.removeMember(staticThree).type(), Json::nullValue); + EXPECT_EQ(val.size(), 1); - CHECK(val.removeMember(std::string("two")) == 2); - CHECK(val.size() == 0); + EXPECT_EQ(val.removeMember(std::string("two")), 2); + EXPECT_EQ(val.size(), 0); - CHECK(val.removeMember(std::string("two")).type() == Json::nullValue); - CHECK(val.size() == 0); + EXPECT_EQ(val.removeMember(std::string("two")).type(), Json::nullValue); + EXPECT_EQ(val.size(), 0); } -TEST_CASE("iterator") +TEST(json_value, iterator) { { // Iterating an array. @@ -1215,27 +1212,27 @@ TEST_CASE("iterator") Json::ValueIterator i2 = e; --i2; - // key(), index(), and memberName() on an object iterator. - CHECK(b != e); - CHECK(!(b == e)); - CHECK(i1.key() == 0); - CHECK(i2.key() == 3); - CHECK(i1.index() == 0); - CHECK(i2.index() == 3); - CHECK(std::strcmp(i1.memberName(), "") == 0); - CHECK(std::strcmp(i2.memberName(), "") == 0); + // key(), index(), and memberName() on an array iterator. + EXPECT_TRUE(b != e); + EXPECT_FALSE(b == e); + EXPECT_EQ(i1.key(), 0); + EXPECT_EQ(i2.key(), 3); + EXPECT_EQ(i1.index(), 0); + EXPECT_EQ(i2.index(), 3); + EXPECT_STREQ(i1.memberName(), ""); + EXPECT_STREQ(i2.memberName(), ""); // Pre and post increment and decrement. *i1++ = "0"; - CHECK(*i1 == "one"); + EXPECT_EQ(*i1, "one"); *i1 = "1"; ++i1; *i2-- = "3"; - CHECK(*i2 == "two"); - CHECK(i1 == i2); + EXPECT_EQ(*i2, "two"); + EXPECT_EQ(i1, i2); *i2 = "2"; - CHECK(*i1 == "2"); + EXPECT_EQ(*i1, "2"); } { // Iterating a const object. @@ -1253,38 +1250,38 @@ TEST_CASE("iterator") --i2; // key(), index(), and memberName() on an object iterator. - CHECK(i1 != i2); - CHECK(!(i1 == i2)); - CHECK(i1.key() == "0"); - CHECK(i2.key() == "3"); - CHECK(i1.index() == -1); - CHECK(i2.index() == -1); - CHECK(std::strcmp(i1.memberName(), "0") == 0); - CHECK(std::strcmp(i2.memberName(), "3") == 0); + EXPECT_TRUE(i1 != i2); + EXPECT_FALSE(i1 == i2); + EXPECT_EQ(i1.key(), "0"); + EXPECT_EQ(i2.key(), "3"); + EXPECT_EQ(i1.index(), -1); + EXPECT_EQ(i2.index(), -1); + EXPECT_STREQ(i1.memberName(), "0"); + EXPECT_STREQ(i2.memberName(), "3"); // Pre and post increment and decrement. - CHECK(*i1++ == 0); - CHECK(*i1 == 1); + EXPECT_EQ(*i1++, 0); + EXPECT_EQ(*i1, 1); ++i1; - CHECK(*i2-- == 3); - CHECK(*i2 == 2); - CHECK(i1 == i2); - CHECK(*i1 == 2); + EXPECT_EQ(*i2--, 3); + EXPECT_EQ(*i2, 2); + EXPECT_EQ(i1, i2); + EXPECT_EQ(*i1, 2); } { // Iterating a non-const null object. Json::Value nul{}; - CHECK(nul.begin() == nul.end()); + EXPECT_EQ(nul.begin(), nul.end()); } { // Iterating a const Int. Json::Value const i{-3}; - CHECK(i.begin() == i.end()); + EXPECT_EQ(i.begin(), i.end()); } } -TEST_CASE("nest limits") +TEST(json_value, nest_limits) { Json::Reader r; { @@ -1302,14 +1299,14 @@ TEST_CASE("nest limits") // Within object nest limit auto json{nest(std::min(10u, Json::Reader::nest_limit))}; Json::Value j; - CHECK(r.parse(json, j)); + EXPECT_TRUE(r.parse(json, j)); } { // Exceed object nest limit auto json{nest(Json::Reader::nest_limit + 1)}; Json::Value j; - CHECK(!r.parse(json, j)); + EXPECT_FALSE(r.parse(json, j)); } } @@ -1326,41 +1323,39 @@ TEST_CASE("nest limits") // Exceed array nest limit auto json{nest(Json::Reader::nest_limit + 1)}; Json::Value j; - CHECK(!r.parse(json, j)); + EXPECT_FALSE(r.parse(json, j)); } } -TEST_CASE("memory leak") +TEST(json_value, memory_leak) { // When run with the address sanitizer, this test confirms there is no // memory leak with the scenarios below. { Json::Value a; a[0u] = 1; - CHECK(a.type() == Json::arrayValue); - CHECK(a[0u].type() == Json::intValue); + EXPECT_EQ(a.type(), Json::arrayValue); + EXPECT_EQ(a[0u].type(), Json::intValue); a = std::move(a[0u]); - CHECK(a.type() == Json::intValue); + EXPECT_EQ(a.type(), Json::intValue); } { Json::Value b; Json::Value temp; temp["a"] = "Probably avoids the small string optimization"; temp["b"] = "Also probably avoids the small string optimization"; - CHECK(temp.type() == Json::objectValue); + EXPECT_EQ(temp.type(), Json::objectValue); b.append(temp); - CHECK(temp.type() == Json::objectValue); - CHECK(b.size() == 1); + EXPECT_EQ(temp.type(), Json::objectValue); + EXPECT_EQ(b.size(), 1); b.append(std::move(temp)); - CHECK(b.size() == 2); + EXPECT_EQ(b.size(), 2); // Note that the type() == nullValue check is implementation // specific and not guaranteed to be valid in the future. - CHECK(temp.type() == Json::nullValue); + EXPECT_EQ(temp.type(), Json::nullValue); } } -TEST_SUITE_END(); - } // namespace xrpl diff --git a/src/tests/libxrpl/json/Writer.cpp b/src/tests/libxrpl/json/Writer.cpp index 9637184c95..7016b4322d 100644 --- a/src/tests/libxrpl/json/Writer.cpp +++ b/src/tests/libxrpl/json/Writer.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include #include #include @@ -9,14 +9,14 @@ using namespace xrpl; using namespace Json; -TEST_SUITE_BEGIN("JsonWriter"); - -struct WriterFixture +class WriterFixture : public ::testing::Test { +protected: std::string output; std::unique_ptr writer; - WriterFixture() + void + SetUp() override { writer = std::make_unique(stringOutput(output)); } @@ -31,7 +31,7 @@ struct WriterFixture void expectOutput(std::string const& expected) const { - CHECK(output == expected); + EXPECT_EQ(output, expected); } void @@ -42,20 +42,20 @@ struct WriterFixture } }; -TEST_CASE_FIXTURE(WriterFixture, "trivial") +TEST_F(WriterFixture, trivial) { - CHECK(output.empty()); + EXPECT_TRUE(output.empty()); checkOutputAndReset(""); } -TEST_CASE_FIXTURE(WriterFixture, "near trivial") +TEST_F(WriterFixture, near_trivial) { - CHECK(output.empty()); + EXPECT_TRUE(output.empty()); writer->output(0); checkOutputAndReset("0"); } -TEST_CASE_FIXTURE(WriterFixture, "primitives") +TEST_F(WriterFixture, primitives) { writer->output(true); checkOutputAndReset("true"); @@ -79,7 +79,7 @@ TEST_CASE_FIXTURE(WriterFixture, "primitives") checkOutputAndReset("null"); } -TEST_CASE_FIXTURE(WriterFixture, "empty") +TEST_F(WriterFixture, empty) { writer->startRoot(Writer::array); writer->finish(); @@ -90,7 +90,7 @@ TEST_CASE_FIXTURE(WriterFixture, "empty") checkOutputAndReset("{}"); } -TEST_CASE_FIXTURE(WriterFixture, "escaping") +TEST_F(WriterFixture, escaping) { writer->output("\\"); checkOutputAndReset(R"("\\")"); @@ -108,7 +108,7 @@ TEST_CASE_FIXTURE(WriterFixture, "escaping") checkOutputAndReset(R"("\b\f\n\r\t")"); } -TEST_CASE_FIXTURE(WriterFixture, "array") +TEST_F(WriterFixture, array) { writer->startRoot(Writer::array); writer->append(12); @@ -116,7 +116,7 @@ TEST_CASE_FIXTURE(WriterFixture, "array") checkOutputAndReset("[12]"); } -TEST_CASE_FIXTURE(WriterFixture, "long array") +TEST_F(WriterFixture, long_array) { writer->startRoot(Writer::array); writer->append(12); @@ -126,7 +126,7 @@ TEST_CASE_FIXTURE(WriterFixture, "long array") checkOutputAndReset(R"([12,true,"hello"])"); } -TEST_CASE_FIXTURE(WriterFixture, "embedded array simple") +TEST_F(WriterFixture, embedded_array_simple) { writer->startRoot(Writer::array); writer->startAppend(Writer::array); @@ -135,7 +135,7 @@ TEST_CASE_FIXTURE(WriterFixture, "embedded array simple") checkOutputAndReset("[[]]"); } -TEST_CASE_FIXTURE(WriterFixture, "object") +TEST_F(WriterFixture, object) { writer->startRoot(Writer::object); writer->set("hello", "world"); @@ -143,7 +143,7 @@ TEST_CASE_FIXTURE(WriterFixture, "object") checkOutputAndReset(R"({"hello":"world"})"); } -TEST_CASE_FIXTURE(WriterFixture, "complex object") +TEST_F(WriterFixture, complex_object) { writer->startRoot(Writer::object); writer->set("hello", "world"); @@ -160,7 +160,7 @@ TEST_CASE_FIXTURE(WriterFixture, "complex object") R"({"hello":"world","array":[true,12,[{"goodbye":"cruel world.","subarray":[23.5]}]]})"); } -TEST_CASE_FIXTURE(WriterFixture, "json value") +TEST_F(WriterFixture, json_value) { Json::Value value(Json::objectValue); value["foo"] = 23; @@ -169,5 +169,3 @@ TEST_CASE_FIXTURE(WriterFixture, "json value") writer->finish(); checkOutputAndReset(R"({"hello":{"foo":23}})"); } - -TEST_SUITE_END(); diff --git a/src/tests/libxrpl/json/main.cpp b/src/tests/libxrpl/json/main.cpp index 0a3f254ea8..5142bbe08a 100644 --- a/src/tests/libxrpl/json/main.cpp +++ b/src/tests/libxrpl/json/main.cpp @@ -1,2 +1,8 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include + +int +main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/tests/libxrpl/net/HTTPClient.cpp b/src/tests/libxrpl/net/HTTPClient.cpp index 5a484c1f56..cfd206edde 100644 --- a/src/tests/libxrpl/net/HTTPClient.cpp +++ b/src/tests/libxrpl/net/HTTPClient.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -217,7 +217,7 @@ runHTTPTest( } // anonymous namespace -TEST_CASE("HTTPClient case insensitive Content-Length") +TEST(HTTPClient, case_insensitive_content_length) { // Test different cases of Content-Length header std::vector header_cases = { @@ -249,14 +249,14 @@ TEST_CASE("HTTPClient case insensitive Content-Length") result_error); // Verify results - CHECK(test_completed); - CHECK(!result_error); - CHECK(result_status == 200); - CHECK(result_data == test_body); + EXPECT_TRUE(test_completed); + EXPECT_FALSE(result_error); + EXPECT_EQ(result_status, 200); + EXPECT_EQ(result_data, test_body); } } -TEST_CASE("HTTPClient basic HTTP request") +TEST(HTTPClient, basic_http_request) { TestHTTPServer server; std::string test_body = "Test response body"; @@ -271,13 +271,13 @@ TEST_CASE("HTTPClient basic HTTP request") bool test_completed = runHTTPTest( server, "/basic", completed, result_status, result_data, result_error); - CHECK(test_completed); - CHECK(!result_error); - CHECK(result_status == 200); - CHECK(result_data == test_body); + EXPECT_TRUE(test_completed); + EXPECT_FALSE(result_error); + EXPECT_EQ(result_status, 200); + EXPECT_EQ(result_data, test_body); } -TEST_CASE("HTTPClient empty response") +TEST(HTTPClient, empty_response) { TestHTTPServer server; server.setResponseBody(""); // Empty body @@ -291,13 +291,13 @@ TEST_CASE("HTTPClient empty response") bool test_completed = runHTTPTest( server, "/empty", completed, result_status, result_data, result_error); - CHECK(test_completed); - CHECK(!result_error); - CHECK(result_status == 200); - CHECK(result_data.empty()); + EXPECT_TRUE(test_completed); + EXPECT_FALSE(result_error); + EXPECT_EQ(result_status, 200); + EXPECT_TRUE(result_data.empty()); } -TEST_CASE("HTTPClient different status codes") +TEST(HTTPClient, different_status_codes) { std::vector status_codes = {200, 404, 500}; @@ -320,8 +320,8 @@ TEST_CASE("HTTPClient different status codes") result_data, result_error); - CHECK(test_completed); - CHECK(!result_error); - CHECK(result_status == static_cast(status)); + EXPECT_TRUE(test_completed); + EXPECT_FALSE(result_error); + EXPECT_EQ(result_status, static_cast(status)); } } diff --git a/src/tests/libxrpl/net/main.cpp b/src/tests/libxrpl/net/main.cpp index 0a3f254ea8..5142bbe08a 100644 --- a/src/tests/libxrpl/net/main.cpp +++ b/src/tests/libxrpl/net/main.cpp @@ -1,2 +1,8 @@ -#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include + +int +main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} From 96d17b7f664e593fb8e7c10dfa65a3d655a1011d Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 15 Jan 2026 16:18:14 +0000 Subject: [PATCH 42/62] ci: Add sanitizers to CI builds (#5996) This change adds support for sanitizer build options in CI builds workflow. Currently `asan+ubsan` is enabled, while `tsan+ubsan` is left disabled as more changes are required. --- .config/cspell.config.yaml | 6 + .github/actions/build-deps/action.yml | 6 + .github/actions/setup-conan/action.yml | 2 +- .github/scripts/strategy-matrix/generate.py | 60 ++++- .../workflows/reusable-build-test-config.yml | 19 +- .github/workflows/reusable-build-test.yml | 1 + BUILD.md | 38 ++- CMakeLists.txt | 9 +- cmake/CompilationEnv.cmake | 54 ++++ cmake/XrplCompiler.cmake | 13 +- cmake/XrplInterface.cmake | 18 +- cmake/XrplSanitizers.cmake | 198 +++++++++++++++ cmake/XrplSanity.cmake | 13 +- cmake/XrplSettings.cmake | 35 +-- cmake/deps/Boost.cmake | 5 +- conan/profiles/ci | 1 + conan/profiles/sanitizers | 59 +++++ docs/build/sanitizers.md | 207 +++++++++++++++ sanitizers/suppressions/asan.supp | 29 +++ sanitizers/suppressions/lsan.supp | 16 ++ .../suppressions/sanitizer-ignorelist.txt | 29 +++ sanitizers/suppressions/tsan.supp | 102 ++++++++ sanitizers/suppressions/ubsan.supp | 237 ++++++++++++++++++ src/libxrpl/ledger/View.cpp | 10 +- src/libxrpl/protocol/BuildInfo.cpp | 10 +- 25 files changed, 1076 insertions(+), 101 deletions(-) create mode 100644 cmake/CompilationEnv.cmake create mode 100644 cmake/XrplSanitizers.cmake create mode 100644 conan/profiles/ci create mode 100644 conan/profiles/sanitizers create mode 100644 docs/build/sanitizers.md create mode 100644 sanitizers/suppressions/asan.supp create mode 100644 sanitizers/suppressions/lsan.supp create mode 100644 sanitizers/suppressions/sanitizer-ignorelist.txt create mode 100644 sanitizers/suppressions/tsan.supp create mode 100644 sanitizers/suppressions/ubsan.supp diff --git a/.config/cspell.config.yaml b/.config/cspell.config.yaml index 3bd295c14b..73b0417d79 100644 --- a/.config/cspell.config.yaml +++ b/.config/cspell.config.yaml @@ -28,6 +28,7 @@ ignoreRegExpList: - /[\['"`]-[DWw][a-zA-Z0-9_-]+['"`\]]/g # compile flags suggestWords: - xprl->xrpl + - xprld->xrpld - unsynched->unsynced - synched->synced - synch->sync @@ -61,6 +62,7 @@ words: - compr - conanfile - conanrun + - confs - connectability - coro - coros @@ -90,6 +92,7 @@ words: - finalizers - firewalled - fmtdur + - fsanitize - funclets - gcov - gcovr @@ -126,6 +129,7 @@ words: - lseq - lsmf - ltype + - mcmodel - MEMORYSTATUSEX - Merkle - Metafuncton @@ -235,6 +239,8 @@ words: - txn - txns - txs + - UBSAN + - ubsan - umant - unacquired - unambiguity diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml index d1fb980dac..9d52be1998 100644 --- a/.github/actions/build-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -18,6 +18,10 @@ inputs: description: "The logging verbosity." required: false default: "verbose" + sanitizers: + description: "The sanitizers to enable." + required: false + default: "" runs: using: composite @@ -29,9 +33,11 @@ runs: BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }} BUILD_TYPE: ${{ inputs.build_type }} LOG_VERBOSITY: ${{ inputs.log_verbosity }} + SANITIZERS: ${{ inputs.sanitizers }} run: | echo 'Installing dependencies.' conan install \ + --profile ci \ --build="${BUILD_OPTION}" \ --options:host='&:tests=True' \ --options:host='&:xrpld=True' \ diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml index 1184cfd3d9..dedf53f109 100644 --- a/.github/actions/setup-conan/action.yml +++ b/.github/actions/setup-conan/action.yml @@ -28,7 +28,7 @@ runs: shell: bash run: | echo 'Installing profile.' - conan config install conan/profiles/default -tf $(conan config home)/profiles/ + conan config install conan/profiles/ -tf $(conan config home)/profiles/ echo 'Conan profile:' conan profile show diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index c3d2da1f9f..bf5bf5d3ba 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -229,7 +229,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: if (n := os["compiler_version"]) != "": config_name += f"-{n}" config_name += ( - f"-{architecture['platform'][architecture['platform'].find('/') + 1 :]}" + f"-{architecture['platform'][architecture['platform'].find('/')+1:]}" ) config_name += f"-{build_type.lower()}" if "-Dcoverage=ON" in cmake_args: @@ -240,17 +240,53 @@ def generate_strategy_matrix(all: bool, config: Config) -> list: # Add the configuration to the list, with the most unique fields first, # so that they are easier to identify in the GitHub Actions UI, as long # names get truncated. - configurations.append( - { - "config_name": config_name, - "cmake_args": cmake_args, - "cmake_target": cmake_target, - "build_only": build_only, - "build_type": build_type, - "os": os, - "architecture": architecture, - } - ) + # Add Address and Thread (both coupled with UB) sanitizers for specific bookworm distros. + # GCC-Asan rippled-embedded tests are failing because of https://github.com/google/sanitizers/issues/856 + if ( + os["distro_version"] == "bookworm" + and f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20" + ): + # Add ASAN + UBSAN configuration. + configurations.append( + { + "config_name": config_name + "-asan-ubsan", + "cmake_args": cmake_args, + "cmake_target": cmake_target, + "build_only": build_only, + "build_type": build_type, + "os": os, + "architecture": architecture, + "sanitizers": "address,undefinedbehavior", + } + ) + # TSAN is deactivated due to seg faults with latest compilers. + activate_tsan = False + if activate_tsan: + configurations.append( + { + "config_name": config_name + "-tsan-ubsan", + "cmake_args": cmake_args, + "cmake_target": cmake_target, + "build_only": build_only, + "build_type": build_type, + "os": os, + "architecture": architecture, + "sanitizers": "thread,undefinedbehavior", + } + ) + else: + configurations.append( + { + "config_name": config_name, + "cmake_args": cmake_args, + "cmake_target": cmake_target, + "build_only": build_only, + "build_type": build_type, + "os": os, + "architecture": architecture, + "sanitizers": "", + } + ) return configurations diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index bc0717e1a5..b8c82aa94d 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -51,6 +51,12 @@ on: type: number default: 2 + sanitizers: + description: "The sanitizers to enable." + required: false + type: string + default: "" + secrets: CODECOV_TOKEN: description: "The Codecov token to use for uploading coverage reports." @@ -91,6 +97,7 @@ jobs: # Determine if coverage and voidstar should be enabled. COVERAGE_ENABLED: ${{ contains(inputs.cmake_args, '-Dcoverage=ON') }} VOIDSTAR_ENABLED: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }} + SANITIZERS_ENABLED: ${{ inputs.sanitizers != '' }} steps: - name: Cleanup workspace (macOS and Windows) if: ${{ runner.os == 'macOS' || runner.os == 'Windows' }} @@ -128,11 +135,13 @@ jobs: # Set the verbosity to "quiet" for Windows to avoid an excessive # amount of logs. For other OSes, the "verbose" logs are more useful. log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }} + sanitizers: ${{ inputs.sanitizers }} - name: Configure CMake working-directory: ${{ env.BUILD_DIR }} env: BUILD_TYPE: ${{ inputs.build_type }} + SANITIZERS: ${{ inputs.sanitizers }} CMAKE_ARGS: ${{ inputs.cmake_args }} run: | cmake \ @@ -174,7 +183,7 @@ jobs: if-no-files-found: error - name: Check linking (Linux) - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' && env.SANITIZERS_ENABLED == 'false' }} working-directory: ${{ env.BUILD_DIR }} run: | ldd ./xrpld @@ -191,6 +200,14 @@ jobs: run: | ./xrpld --version | grep libvoidstar + - name: Set sanitizer options + if: ${{ !inputs.build_only && env.SANITIZERS_ENABLED == 'true' }} + run: | + echo "ASAN_OPTIONS=print_stacktrace=1:detect_container_overflow=0:suppressions=${GITHUB_WORKSPACE}/sanitizers/suppressions/asan.supp" >> ${GITHUB_ENV} + echo "TSAN_OPTIONS=second_deadlock_stack=1:halt_on_error=0:suppressions=${GITHUB_WORKSPACE}/sanitizers/suppressions/tsan.supp" >> ${GITHUB_ENV} + echo "UBSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/sanitizers/suppressions/ubsan.supp" >> ${GITHUB_ENV} + echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/sanitizers/suppressions/lsan.supp" >> ${GITHUB_ENV} + - name: Run the separate tests if: ${{ !inputs.build_only }} working-directory: ${{ env.BUILD_DIR }} diff --git a/.github/workflows/reusable-build-test.yml b/.github/workflows/reusable-build-test.yml index 2b4d38da61..0086cbbfb5 100644 --- a/.github/workflows/reusable-build-test.yml +++ b/.github/workflows/reusable-build-test.yml @@ -57,5 +57,6 @@ jobs: runs_on: ${{ toJSON(matrix.architecture.runner) }} image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }} config_name: ${{ matrix.config_name }} + sanitizers: ${{ matrix.sanitizers }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/BUILD.md b/BUILD.md index 2d1ac9b134..b239b10be6 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,5 +1,5 @@ -| :warning: **WARNING** :warning: -|---| +| :warning: **WARNING** :warning: | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | These instructions assume you have a C++ development environment ready with Git, Python, Conan, CMake, and a C++ compiler. For help setting one up on Linux, macOS, or Windows, [see this guide](./docs/build/environment.md). | > These instructions also assume a basic familiarity with Conan and CMake. @@ -523,18 +523,32 @@ stored inside the build directory, as either of: - file named `coverage.`_extension_, with a suitable extension for the report format, or - directory named `coverage`, with the `index.html` and other files inside, for the `html-details` or `html-nested` report formats. +## Sanitizers + +To build dependencies and xrpld with sanitizer instrumentation, set the +`SANITIZERS` environment variable (only once before running conan and cmake) and use the `sanitizers` profile in conan: + +```bash +export SANITIZERS=address,undefinedbehavior + +conan install .. --output-folder . --profile:all sanitizers --build missing --settings build_type=Debug + +cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -Dxrpld=ON -Dtests=ON .. +``` + +See [Sanitizers docs](./docs/build/sanitizers.md) for more details. + ## Options -| Option | Default Value | Description | -| ---------- | ------------- | ------------------------------------------------------------------ | -| `assert` | OFF | Enable assertions. | -| `coverage` | OFF | Prepare the coverage report. | -| `san` | N/A | Enable a sanitizer with Clang. Choices are `thread` and `address`. | -| `tests` | OFF | Build tests. | -| `unity` | OFF | Configure a unity build. | -| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. | -| `werr` | OFF | Treat compilation warnings as errors | -| `wextra` | OFF | Enable additional compilation warnings | +| Option | Default Value | Description | +| ---------- | ------------- | -------------------------------------------------------------- | +| `assert` | OFF | Enable assertions. | +| `coverage` | OFF | Prepare the coverage report. | +| `tests` | OFF | Build tests. | +| `unity` | OFF | Configure a unity build. | +| `xrpld` | OFF | Build the xrpld application, and not just the libxrpl library. | +| `werr` | OFF | Treat compilation warnings as errors | +| `wextra` | OFF | Enable additional compilation warnings | [Unity builds][5] may be faster for the first build (at the cost of much more memory) since they concatenate sources into fewer diff --git a/CMakeLists.txt b/CMakeLists.txt index 26fc310d39..ee0484e79d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,14 +16,16 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +include(CompilationEnv) + +if(is_gcc) # GCC-specific fixes add_compile_options(-Wno-unknown-pragmas -Wno-subobject-linkage) # -Wno-subobject-linkage can be removed when we upgrade GCC version to at least 13.3 -elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +elseif(is_clang) # Clang-specific fixes add_compile_options(-Wno-unknown-warning-option) # Ignore unknown warning options -elseif(MSVC) +elseif(is_msvc) # MSVC-specific fixes add_compile_options(/wd4068) # Ignore unknown pragmas endif() @@ -77,6 +79,7 @@ if (packages_only) return () endif () include(XrplCompiler) +include(XrplSanitizers) include(XrplInterface) option(only_docs "Include only the docs target?" FALSE) diff --git a/cmake/CompilationEnv.cmake b/cmake/CompilationEnv.cmake new file mode 100644 index 0000000000..345e4cdd62 --- /dev/null +++ b/cmake/CompilationEnv.cmake @@ -0,0 +1,54 @@ + # Shared detection of compiler, operating system, and architecture. + # + # This module centralizes environment detection so that other + # CMake modules can use the same variables instead of repeating + # checks on CMAKE_* and built-in platform variables. + +# Only run once per configure step. +include_guard(GLOBAL) + +# -------------------------------------------------------------------- +# Compiler detection (C++) +# -------------------------------------------------------------------- +set(is_clang FALSE) +set(is_gcc FALSE) +set(is_msvc FALSE) + +if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang + set(is_clang TRUE) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(is_gcc TRUE) +elseif(MSVC) + set(is_msvc TRUE) +else() + message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER_ID}") +endif() + + +# -------------------------------------------------------------------- +# Operating system detection +# -------------------------------------------------------------------- +set(is_linux FALSE) +set(is_windows FALSE) +set(is_macos FALSE) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(is_linux TRUE) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(is_windows TRUE) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(is_macos TRUE) +endif() + +# -------------------------------------------------------------------- +# Architecture +# -------------------------------------------------------------------- +set(is_amd64 FALSE) +set(is_arm64 FALSE) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") + set(is_amd64 TRUE) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64") + set(is_arm64 TRUE) +else() + message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}") +endif() diff --git a/cmake/XrplCompiler.cmake b/cmake/XrplCompiler.cmake index 0777bf948c..a7c5ff0423 100644 --- a/cmake/XrplCompiler.cmake +++ b/cmake/XrplCompiler.cmake @@ -2,16 +2,23 @@ setup project-wide compiler settings #]===================================================================] +include(CompilationEnv) + #[=========================================================[ TODO some/most of these common settings belong in a toolchain file, especially the ABI-impacting ones #]=========================================================] add_library (common INTERFACE) add_library (Xrpl::common ALIAS common) +include(XrplSanitizers) # add a single global dependency on this interface lib link_libraries (Xrpl::common) +# Respect CMAKE_POSITION_INDEPENDENT_CODE setting (may be set by Conan toolchain) +if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() set_target_properties (common - PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ON) + PROPERTIES INTERFACE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE}) set(CMAKE_CXX_EXTENSIONS OFF) target_compile_definitions (common INTERFACE @@ -116,8 +123,8 @@ else () # link to static libc/c++ iff: # * static option set and # * NOT APPLE (AppleClang does not support static libc/c++) and - # * NOT san (sanitizers typically don't work with static libc/c++) - $<$,$>,$>>: + # * NOT SANITIZERS (sanitizers typically don't work with static libc/c++) + $<$,$>,$>>: -static-libstdc++ -static-libgcc >) diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index 9847f39fba..6e0203c099 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -2,6 +2,8 @@ xrpld compile options/settings via an interface library #]===================================================================] +include(CompilationEnv) + add_library (opts INTERFACE) add_library (Xrpl::opts ALIAS opts) target_compile_definitions (opts @@ -42,22 +44,6 @@ if(jemalloc) target_link_libraries(opts INTERFACE jemalloc::jemalloc) endif () -if (san) - target_compile_options (opts - INTERFACE - # sanitizers recommend minimum of -O1 for reasonable performance - $<$:-O1> - ${SAN_FLAG} - -fno-omit-frame-pointer) - target_compile_definitions (opts - INTERFACE - $<$:SANITIZER=ASAN> - $<$:SANITIZER=TSAN> - $<$:SANITIZER=MSAN> - $<$:SANITIZER=UBSAN>) - target_link_libraries (opts INTERFACE ${SAN_FLAG} ${SAN_LIB}) -endif () - #[===================================================================[ xrpld transitive library deps via an interface library #]===================================================================] diff --git a/cmake/XrplSanitizers.cmake b/cmake/XrplSanitizers.cmake new file mode 100644 index 0000000000..050a5ef6f0 --- /dev/null +++ b/cmake/XrplSanitizers.cmake @@ -0,0 +1,198 @@ +#[===================================================================[ + Configure sanitizers based on environment variables. + + This module reads the following environment variables: + - SANITIZERS: The sanitizers to enable. Possible values: + - "address" + - "address,undefinedbehavior" + - "thread" + - "thread,undefinedbehavior" + - "undefinedbehavior" + + The compiler type and platform are detected in CompilationEnv.cmake. + The sanitizer compile options are applied to the 'common' interface library + which is linked to all targets in the project. + + Internal flag variables set by this module: + + - SANITIZER_TYPES: List of sanitizer types to enable (e.g., "address", + "thread", "undefined"). And two more flags for undefined behavior sanitizer (e.g., "float-divide-by-zero", "unsigned-integer-overflow"). + This list is joined with commas and passed to -fsanitize=. + + - SANITIZERS_COMPILE_FLAGS: Compiler flags for sanitizer instrumentation. + Includes: + * -fno-omit-frame-pointer: Preserves frame pointers for stack traces + * -O1: Minimum optimization for reasonable performance + * -fsanitize=: Enables sanitizer instrumentation + * -fsanitize-ignorelist=: (Clang only) Compile-time ignorelist + * -mcmodel=large/medium: (GCC only) Code model for large binaries + * -Wno-stringop-overflow: (GCC only) Suppresses false positive warnings + * -Wno-tsan: (For GCC TSAN combination only) Suppresses atomic_thread_fence warnings + + - SANITIZERS_LINK_FLAGS: Linker flags for sanitizer runtime libraries. + Includes: + * -fsanitize=: Links sanitizer runtime libraries + * -mcmodel=large/medium: (GCC only) Matches compile-time code model + + - SANITIZERS_RELOCATION_FLAGS: (GCC only) Code model flags for linking. + Used to handle large instrumented binaries on x86_64: + * -mcmodel=large: For AddressSanitizer (prevents relocation errors) + * -mcmodel=medium: For ThreadSanitizer (large model is incompatible) +#]===================================================================] + +include(CompilationEnv) + +# Read environment variable +set(SANITIZERS $ENV{SANITIZERS}) + +# Set SANITIZERS_ENABLED flag for use in other modules +if(SANITIZERS MATCHES "address|thread|undefinedbehavior") + set(SANITIZERS_ENABLED TRUE) +else() + set(SANITIZERS_ENABLED FALSE) + return() +endif() + +# Sanitizers are not supported on Windows/MSVC +if(is_msvc) + message(FATAL_ERROR "Sanitizers are not supported on Windows/MSVC. " + "Please unset the SANITIZERS environment variable.") +endif() + +message(STATUS "Configuring sanitizers: ${SANITIZERS}") + +# Parse SANITIZERS value to determine which sanitizers to enable +set(enable_asan FALSE) +set(enable_tsan FALSE) +set(enable_ubsan FALSE) + +# Normalize SANITIZERS into a list +set(san_list "${SANITIZERS}") +string(REPLACE "," ";" san_list "${san_list}") +separate_arguments(san_list) + +foreach(san IN LISTS san_list) + if(san STREQUAL "address") + set(enable_asan TRUE) + elseif(san STREQUAL "thread") + set(enable_tsan TRUE) + elseif(san STREQUAL "undefinedbehavior") + set(enable_ubsan TRUE) + else() + message(FATAL_ERROR "Unsupported sanitizer type: ${san}" + "Supported: address, thread, undefinedbehavior and their combinations.") + endif() +endforeach() + +# Validate sanitizer compatibility +if(enable_asan AND enable_tsan) + message(FATAL_ERROR "AddressSanitizer and ThreadSanitizer are incompatible and cannot be enabled simultaneously. " + "Use 'address' or 'thread', optionally with 'undefinedbehavior'.") +endif() + +# Frame pointer is required for meaningful stack traces. Sanitizers recommend minimum of -O1 for reasonable performance +set(SANITIZERS_COMPILE_FLAGS "-fno-omit-frame-pointer" "-O1") + +# Build the sanitizer flags list +set(SANITIZER_TYPES) + +if(enable_asan) + list(APPEND SANITIZER_TYPES "address") +elseif(enable_tsan) + list(APPEND SANITIZER_TYPES "thread") +endif() + +if(enable_ubsan) + # UB sanitizer flags + list(APPEND SANITIZER_TYPES "undefined" "float-divide-by-zero") + if(is_clang) + # Clang supports additional UB checks. More info here https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html + list(APPEND SANITIZER_TYPES "unsigned-integer-overflow") + endif() +endif() + +# Configure code model for GCC on amd64 +# Use large code model for ASAN to avoid relocation errors +# Use medium code model for TSAN (large is not compatible with TSAN) +set(SANITIZERS_RELOCATION_FLAGS) + +# Compiler-specific configuration +if(is_gcc) + # Disable mold, gold and lld linkers for GCC with sanitizers + # Use default linker (bfd/ld) which is more lenient with mixed code models + # This is needed since the size of instrumented binary exceeds the limits set by mold, lld and gold linkers + set(use_mold OFF CACHE BOOL "Use mold linker" FORCE) + set(use_gold OFF CACHE BOOL "Use gold linker" FORCE) + set(use_lld OFF CACHE BOOL "Use lld linker" FORCE) + message(STATUS " Disabled mold, gold, and lld linkers for GCC with sanitizers") + + # Suppress false positive warnings in GCC with stringop-overflow + list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-stringop-overflow") + + if(is_amd64 AND enable_asan) + message(STATUS " Using large code model (-mcmodel=large)") + list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=large") + list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=large") + elseif(enable_tsan) + # GCC doesn't support atomic_thread_fence with tsan. Suppress warnings. + list(APPEND SANITIZERS_COMPILE_FLAGS "-Wno-tsan") + message(STATUS " Using medium code model (-mcmodel=medium)") + list(APPEND SANITIZERS_COMPILE_FLAGS "-mcmodel=medium") + list(APPEND SANITIZERS_RELOCATION_FLAGS "-mcmodel=medium") + endif() + + # Join sanitizer flags with commas for -fsanitize option + list(JOIN SANITIZER_TYPES "," SANITIZER_TYPES_STR) + + # Add sanitizer to compile and link flags + list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}") + set(SANITIZERS_LINK_FLAGS "${SANITIZERS_RELOCATION_FLAGS}" "-fsanitize=${SANITIZER_TYPES_STR}") + +elseif(is_clang) + # Add ignorelist for Clang (GCC doesn't support this) + # Use CMAKE_SOURCE_DIR to get the path to the ignorelist + set(IGNORELIST_PATH "${CMAKE_SOURCE_DIR}/sanitizers/suppressions/sanitizer-ignorelist.txt") + if(NOT EXISTS "${IGNORELIST_PATH}") + message(FATAL_ERROR "Sanitizer ignorelist not found: ${IGNORELIST_PATH}") + endif() + + list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize-ignorelist=${IGNORELIST_PATH}") + message(STATUS " Using sanitizer ignorelist: ${IGNORELIST_PATH}") + + # Join sanitizer flags with commas for -fsanitize option + list(JOIN SANITIZER_TYPES "," SANITIZER_TYPES_STR) + + # Add sanitizer to compile and link flags + list(APPEND SANITIZERS_COMPILE_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}") + set(SANITIZERS_LINK_FLAGS "-fsanitize=${SANITIZER_TYPES_STR}") +endif() + +message(STATUS " Compile flags: ${SANITIZERS_COMPILE_FLAGS}") +message(STATUS " Link flags: ${SANITIZERS_LINK_FLAGS}") + +# Apply the sanitizer flags to the 'common' interface library +# This is the same library used by XrplCompiler.cmake +target_compile_options(common INTERFACE + $<$:${SANITIZERS_COMPILE_FLAGS}> + $<$:${SANITIZERS_COMPILE_FLAGS}> +) + +# Apply linker flags +target_link_options(common INTERFACE ${SANITIZERS_LINK_FLAGS}) + +# Define SANITIZERS macro for BuildInfo.cpp +set(sanitizers_list) +if(enable_asan) + list(APPEND sanitizers_list "ASAN") +endif() +if(enable_tsan) + list(APPEND sanitizers_list "TSAN") +endif() +if(enable_ubsan) + list(APPEND sanitizers_list "UBSAN") +endif() + +if(sanitizers_list) + list(JOIN sanitizers_list "." sanitizers_str) + target_compile_definitions(common INTERFACE SANITIZERS=${sanitizers_str}) +endif() diff --git a/cmake/XrplSanity.cmake b/cmake/XrplSanity.cmake index db983da73d..7464ca396c 100644 --- a/cmake/XrplSanity.cmake +++ b/cmake/XrplSanity.cmake @@ -2,6 +2,8 @@ sanity checks #]===================================================================] +include(CompilationEnv) + get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) @@ -16,14 +18,12 @@ if (NOT is_multiconfig) endif () endif () -if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang - set (is_clang TRUE) +if (is_clang) # both Clang and AppleClang if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) message (FATAL_ERROR "This project requires clang 16 or later") endif () -elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set (is_gcc TRUE) +elseif (is_gcc) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0) message (FATAL_ERROR "This project requires GCC 12 or later") endif () @@ -40,11 +40,6 @@ if (MSVC AND CMAKE_GENERATOR_PLATFORM STREQUAL "Win32") message (FATAL_ERROR "Visual Studio 32-bit build is not supported.") endif () -if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) - message (FATAL_ERROR "Xrpld requires a 64 bit target architecture.\n" - "The most likely cause of this warning is trying to build xrpld with a 32-bit OS.") -endif () - if (APPLE AND NOT HOMEBREW) find_program (HOMEBREW brew) endif () diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index c3f013c575..647e95837d 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -2,11 +2,7 @@ declare options and variables #]===================================================================] -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set (is_linux TRUE) -else() - set(is_linux FALSE) -endif() +include(CompilationEnv) if("$ENV{CI}" STREQUAL "true" OR "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true") set(is_ci TRUE) @@ -62,7 +58,7 @@ else() set(wextra OFF CACHE BOOL "gcc/clang only" FORCE) endif() -if(is_linux) +if(is_linux AND NOT SANITIZER) option(BUILD_SHARED_LIBS "build shared xrpl libraries" OFF) option(static "link protobuf, openssl, libc++, and boost statically" ON) option(perf "Enables flags that assist with perf recording" OFF) @@ -107,33 +103,6 @@ option(local_protobuf option(local_grpc "Force a local build of gRPC instead of looking for an installed version." OFF) -# this one is a string and therefore can't be an option -set(san "" CACHE STRING "On gcc & clang, add sanitizer instrumentation") -set_property(CACHE san PROPERTY STRINGS ";undefined;memory;address;thread") -if(san) - string(TOLOWER ${san} san) - set(SAN_FLAG "-fsanitize=${san}") - set(SAN_LIB "") - if(is_gcc) - if(san STREQUAL "address") - set(SAN_LIB "asan") - elseif(san STREQUAL "thread") - set(SAN_LIB "tsan") - elseif(san STREQUAL "memory") - set(SAN_LIB "msan") - elseif(san STREQUAL "undefined") - set(SAN_LIB "ubsan") - endif() - endif() - set(_saved_CRL ${CMAKE_REQUIRED_LIBRARIES}) - set(CMAKE_REQUIRED_LIBRARIES "${SAN_FLAG};${SAN_LIB}") - check_cxx_compiler_flag(${SAN_FLAG} COMPILER_SUPPORTS_SAN) - set(CMAKE_REQUIRED_LIBRARIES ${_saved_CRL}) - if(NOT COMPILER_SUPPORTS_SAN) - message(FATAL_ERROR "${san} sanitizer does not seem to be supported by your compiler") - endif() -endif() - # the remaining options are obscure and rarely used option(beast_no_unit_test_inline "Prevents unit test definitions from being inserted into global table" diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index 19263e0ac9..b73698efd8 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -1,3 +1,6 @@ +include(CompilationEnv) +include(XrplSanitizers) + find_package(Boost REQUIRED COMPONENTS chrono @@ -32,7 +35,7 @@ target_link_libraries(xrpl_boost if(Boost_COMPILER) target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking) endif() -if(san AND is_clang) +if(SANITIZERS_ENABLED AND is_clang) # TODO: gcc does not support -fsanitize-blacklist...can we do something else # for gcc ? if(NOT Boost_INCLUDE_DIRS AND TARGET Boost::headers) diff --git a/conan/profiles/ci b/conan/profiles/ci new file mode 100644 index 0000000000..c4c0898ad5 --- /dev/null +++ b/conan/profiles/ci @@ -0,0 +1 @@ + include(sanitizers) diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers new file mode 100644 index 0000000000..d7a622359a --- /dev/null +++ b/conan/profiles/sanitizers @@ -0,0 +1,59 @@ +include(default) +{% set compiler, version, compiler_exe = detect_api.detect_default_compiler() %} +{% set sanitizers = os.getenv("SANITIZERS") %} + +[conf] +{% if sanitizers %} + {% if compiler == "gcc" %} + {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} + {% set sanitizer_list = [] %} + {% set model_code = "" %} + {% set extra_cxxflags = ["-fno-omit-frame-pointer", "-O1", "-Wno-stringop-overflow"] %} + + {% if "address" in sanitizers %} + {% set _ = sanitizer_list.append("address") %} + {% set model_code = "-mcmodel=large" %} + {% elif "thread" in sanitizers %} + {% set _ = sanitizer_list.append("thread") %} + {% set model_code = "-mcmodel=medium" %} + {% set _ = extra_cxxflags.append("-Wno-tsan") %} + {% endif %} + + {% if "undefinedbehavior" in sanitizers %} + {% set _ = sanitizer_list.append("undefined") %} + {% set _ = sanitizer_list.append("float-divide-by-zero") %} + {% endif %} + + {% set sanitizer_flags = "-fsanitize=" ~ ",".join(sanitizer_list) ~ " " ~ model_code %} + + tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] + tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] + tools.build:exelinkflags+=['{{sanitizer_flags}}'] + {% endif %} + {% elif compiler == "apple-clang" or compiler == "clang" %} + {% if "address" in sanitizers or "thread" in sanitizers or "undefinedbehavior" in sanitizers %} + {% set sanitizer_list = [] %} + {% set extra_cxxflags = ["-fno-omit-frame-pointer", "-O1"] %} + + {% if "address" in sanitizers %} + {% set _ = sanitizer_list.append("address") %} + {% elif "thread" in sanitizers %} + {% set _ = sanitizer_list.append("thread") %} + {% endif %} + + {% if "undefinedbehavior" in sanitizers %} + {% set _ = sanitizer_list.append("undefined") %} + {% set _ = sanitizer_list.append("float-divide-by-zero") %} + {% set _ = sanitizer_list.append("unsigned-integer-overflow") %} + {% endif %} + + {% set sanitizer_flags = "-fsanitize=" ~ ",".join(sanitizer_list) %} + + tools.build:cxxflags+=['{{sanitizer_flags}} {{" ".join(extra_cxxflags)}}'] + tools.build:sharedlinkflags+=['{{sanitizer_flags}}'] + tools.build:exelinkflags+=['{{sanitizer_flags}}'] + {% endif %} + {% endif %} +{% endif %} + +tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"] diff --git a/docs/build/sanitizers.md b/docs/build/sanitizers.md new file mode 100644 index 0000000000..3f9809ae98 --- /dev/null +++ b/docs/build/sanitizers.md @@ -0,0 +1,207 @@ +# Sanitizer Configuration for Rippled + +This document explains how to properly configure and run sanitizers (AddressSanitizer, undefinedbehaviorSanitizer, ThreadSanitizer) with the xrpld project. +Corresponding suppression files are located in the `sanitizers/suppressions` directory. + +- [Sanitizer Configuration for Rippled](#sanitizer-configuration-for-rippled) + - [Building with Sanitizers](#building-with-sanitizers) + - [Summary](#summary) + - [Build steps:](#build-steps) + - [Install dependencies](#install-dependencies) + - [Call CMake](#call-cmake) + - [Build](#build) + - [Running Tests with Sanitizers](#running-tests-with-sanitizers) + - [AddressSanitizer (ASAN)](#addresssanitizer-asan) + - [ThreadSanitizer (TSan)](#threadsanitizer-tsan) + - [LeakSanitizer (LSan)](#leaksanitizer-lsan) + - [UndefinedBehaviorSanitizer (UBSan)](#undefinedbehaviorsanitizer-ubsan) + - [Suppression Files](#suppression-files) + - [`asan.supp`](#asansupp) + - [`lsan.supp`](#lsansupp) + - [`ubsan.supp`](#ubsansupp) + - [`tsan.supp`](#tsansupp) + - [`sanitizer-ignorelist.txt`](#sanitizer-ignorelisttxt) + - [Troubleshooting](#troubleshooting) + - ["ASAN is ignoring requested \_\_asan_handle_no_return" warnings](#asan-is-ignoring-requested-__asan_handle_no_return-warnings) + - [Sanitizer Mismatch Errors](#sanitizer-mismatch-errors) + - [References](#references) + +## Building with Sanitizers + +### Summary + +Follow the same instructions as mentioned in [BUILD.md](../../BUILD.md) but with the following changes: + +1. Make sure you have a clean build directory. +2. Set the `SANITIZERS` environment variable before calling conan install and cmake. Only set it once. Make sure both conan and cmake read the same values. + Example: `export SANITIZERS=address,undefinedbehavior` +3. Optionally use `--profile:all sanitizers` with Conan to build dependencies with sanitizer instrumentation. [!NOTE]Building with sanitizer-instrumented dependencies is slower but produces fewer false positives. +4. Set `ASAN_OPTIONS`, `LSAN_OPTIONS`, `UBSAN_OPTIONS` and `TSAN_OPTIONS` environment variables to configure sanitizer behavior when running executables. [More details below](#running-tests-with-sanitizers). + +--- + +### Build steps: + +```bash +cd /path/to/rippled +rm -rf .build +mkdir .build +cd .build +``` + +#### Install dependencies + +The `SANITIZERS` environment variable is used by both Conan and CMake. + +```bash +export SANITIZERS=address,undefinedbehavior +# Standard build (without instrumenting dependencies) +conan install .. --output-folder . --build missing --settings build_type=Debug + +# Or with sanitizer-instrumented dependencies (takes longer but fewer false positives) +conan install .. --output-folder . --profile:all sanitizers --build missing --settings build_type=Debug +``` + +[!CAUTION] +Do not mix Address and Thread sanitizers - they are incompatible. + +Since you already set the `SANITIZERS` environment variable when running Conan, same values will be read for the next part. + +#### Call CMake + +```bash +cmake .. -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \ + -DCMAKE_BUILD_TYPE=Debug \ + -Dtests=ON -Dxrpld=ON +``` + +#### Build + +```bash +cmake --build . --parallel 4 +``` + +## Running Tests with Sanitizers + +### AddressSanitizer (ASAN) + +**IMPORTANT**: ASAN with Boost produces many false positives. Use these options: + +```bash +export ASAN_OPTIONS="print_stacktrace=1:detect_container_overflow=0:suppressions=path/to/asan.supp:halt_on_error=0:log_path=asan.log" +export LSAN_OPTIONS="suppressions=path/to/lsan.supp:halt_on_error=0:log_path=lsan.log" + +# Run tests +./xrpld --unittest --unittest-jobs=5 +``` + +**Why `detect_container_overflow=0`?** + +- Boost intrusive containers (used in `aged_unordered_container`) trigger false positives +- Boost context switching (used in `Workers.cpp`) confuses ASAN's stack tracking +- Since we usually don't build Boost (because we don't want to instrument Boost and detect issues in Boost code) with ASAN but use Boost containers in ASAN instrumented rippled code, it generates false positives. +- Building dependencies with ASAN instrumentation reduces false positives. But we don't want to instrument dependencies like Boost with ASAN because it is slow (to compile as well as run tests) and not necessary. +- See: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow +- More such flags are detailed [here](https://github.com/google/sanitizers/wiki/AddressSanitizerFlags) + +### ThreadSanitizer (TSan) + +```bash +export TSAN_OPTIONS="suppressions=path/to/tsan.supp halt_on_error=0 log_path=tsan.log" + +# Run tests +./xrpld --unittest --unittest-jobs=5 +``` + +More details [here](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual). + +### LeakSanitizer (LSan) + +LSan is automatically enabled with ASAN. To disable it: + +```bash +export ASAN_OPTIONS="detect_leaks=0" +``` + +More details [here](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer). + +### UndefinedBehaviorSanitizer (UBSan) + +```bash +export UBSAN_OPTIONS="suppressions=path/to/ubsan.supp:print_stacktrace=1:halt_on_error=0:log_path=ubsan.log" + +# Run tests +./xrpld --unittest --unittest-jobs=5 +``` + +More details [here](https://clang.llvm.org/docs/undefinedbehaviorSanitizer.html). + +## Suppression Files + +[!NOTE] Attached files contain more details. + +### [`asan.supp`](../../sanitizers/suppressions/asan.supp) + +- **Purpose**: Suppress AddressSanitizer (ASAN) errors only +- **Format**: `interceptor_name:` where pattern matches file names. Supported suppression types are: + - interceptor_name + - interceptor_via_fun + - interceptor_via_lib + - odr_violation +- **More info**: [AddressSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer) +- **Note**: Cannot suppress stack-buffer-overflow, container-overflow, etc. + +### [`lsan.supp`](../../sanitizers/suppressions/lsan.supp) + +- **Purpose**: Suppress LeakSanitizer (LSan) errors only +- **Format**: `leak:` where pattern matches function/file names +- **More info**: [LeakSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer) + +### [`ubsan.supp`](../../sanitizers/suppressions/ubsan.supp) + +- **Purpose**: Suppress undefinedbehaviorSanitizer errors +- **Format**: `:` (e.g., `unsigned-integer-overflow:protobuf`) +- **Covers**: Intentional overflows in sanitizers/suppressions libraries (protobuf, gRPC, stdlib) +- More info [UBSan suppressions](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html). + +### [`tsan.supp`](../../sanitizers/suppressions/tsan.supp) + +- **Purpose**: Suppress ThreadSanitizer data race warnings +- **Format**: `race:` where pattern matches function/file names +- **More info**: [ThreadSanitizer suppressions](https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions) + +### [`sanitizer-ignorelist.txt`](../../sanitizers/suppressions/sanitizer-ignorelist.txt) + +- **Purpose**: Compile-time ignorelist for all sanitizers +- **Usage**: Passed via `-fsanitize-ignorelist=absolute/path/to/sanitizer-ignorelist.txt` +- **Format**: `:` (e.g., `src:Workers.cpp`) + +## Troubleshooting + +### "ASAN is ignoring requested \_\_asan_handle_no_return" warnings + +These warnings appear when using Boost context switching and are harmless. They indicate potential false positives. + +### Sanitizer Mismatch Errors + +If you see undefined symbols like `___tsan_atomic_load` when building with ASAN: + +**Problem**: Dependencies were built with a different sanitizer than the main project. + +**Solution**: Rebuild everything with the same sanitizer: + +```bash +rm -rf .build +# Then follow the build instructions above +``` + +Then review the log files: `asan.log.*`, `ubsan.log.*`, `tsan.log.*` + +## References + +- [AddressSanitizer Wiki](https://github.com/google/sanitizers/wiki/AddressSanitizer) +- [AddressSanitizer Flags](https://github.com/google/sanitizers/wiki/AddressSanitizerFlags) +- [Container Overflow Detection](https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow) +- [UndefinedBehavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) +- [ThreadSanitizer](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual) diff --git a/sanitizers/suppressions/asan.supp b/sanitizers/suppressions/asan.supp new file mode 100644 index 0000000000..7ba98766bd --- /dev/null +++ b/sanitizers/suppressions/asan.supp @@ -0,0 +1,29 @@ +# The idea is to empty this file gradually by fixing the underlying issues and removing suppressions. +# +# ASAN_OPTIONS="print_stacktrace=1:detect_container_overflow=0:suppressions=sanitizers/suppressions/asan.supp:halt_on_error=0" +# +# The detect_container_overflow=0 option disables false positives from: +# - Boost intrusive containers (slist_iterator.hpp, hashtable.hpp, aged_unordered_container.h) +# - Boost context/coroutine stack switching (Workers.cpp, thread.h) +# +# See: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow + +# Boost +interceptor_name:boost/asio + +# Leaks in Doctest tests: xrpl.test.* +interceptor_name:src/libxrpl/net/HTTPClient.cpp +interceptor_name:src/libxrpl/net/RegisterSSLCerts.cpp +interceptor_name:src/tests/libxrpl/net/HTTPClient.cpp +interceptor_name:xrpl/net/AutoSocket.h +interceptor_name:xrpl/net/HTTPClient.h +interceptor_name:xrpl/net/HTTPClientSSLContext.h +interceptor_name:xrpl/net/RegisterSSLCerts.h + +# Suppress false positive stack-buffer errors in thread stack allocation +# Related to ASan's __asan_handle_no_return warnings (github.com/google/sanitizers/issues/189) +# These occur during multi-threaded test initialization on macOS +interceptor_name:memcpy +interceptor_name:__bzero +interceptor_name:__asan_memset +interceptor_name:__asan_memcpy diff --git a/sanitizers/suppressions/lsan.supp b/sanitizers/suppressions/lsan.supp new file mode 100644 index 0000000000..a81d7d89fa --- /dev/null +++ b/sanitizers/suppressions/lsan.supp @@ -0,0 +1,16 @@ +# The idea is to empty this file gradually by fixing the underlying issues and removing suppresions. + +# Suppress leaks detected by asan in rippled code. +leak:src/libxrpl/net/HTTPClient.cpp +leak:src/libxrpl/net/RegisterSSLCerts.cpp +leak:src/tests/libxrpl/net/HTTPClient.cpp +leak:xrpl/net/AutoSocket.h +leak:xrpl/net/HTTPClient.h +leak:xrpl/net/HTTPClientSSLContext.h +leak:xrpl/net/RegisterSSLCerts.h +leak:ripple::HTTPClient +leak:ripple::HTTPClientImp + +# Suppress leaks detected by asan in boost code. +leak:boost::asio +leak:boost/asio diff --git a/sanitizers/suppressions/sanitizer-ignorelist.txt b/sanitizers/suppressions/sanitizer-ignorelist.txt new file mode 100644 index 0000000000..5dbead48a2 --- /dev/null +++ b/sanitizers/suppressions/sanitizer-ignorelist.txt @@ -0,0 +1,29 @@ +# We were seeing some false positives and some repeated errors(since these are library files) in following files. +# Clang will skip instrumenting the files added here. +# We should fix the underlying issues(if any) and remove these entries. + +deadlock:libxrpl/beast/utility/beast_Journal.cpp +deadlock:libxrpl/beast/utility/beast_PropertyStream.cpp +deadlock:test/beast/beast_PropertyStream_test.cpp +deadlock:xrpld/core/detail/Workers.cpp +deadlock:xrpld/core/JobQueue.cpp + +race:libxrpl/beast/utility/beast_Journal.cpp +race:libxrpl/beast/utility/beast_PropertyStream.cpp +race:test/beast/beast_PropertyStream_test.cpp +race:xrpld/core/detail/Workers.cpp +race:xrpld/core/JobQueue.cpp + +signal:libxrpl/beast/utility/beast_Journal.cpp +signal:libxrpl/beast/utility/beast_PropertyStream.cpp +signal:test/beast/beast_PropertyStream_test.cpp +signal:xrpld/core/detail/Workers.cpp +signal:xrpld/core/JobQueue.cpp + +src:beast/utility/beast_Journal.cpp +src:beast/utility/beast_PropertyStream.cpp +src:core/detail/Workers.cpp +src:core/JobQueue.cpp +src:libxrpl/beast/utility/beast_Journal.cpp +src:test/beast/beast_PropertyStream_test.cpp +src:src/test/app/Invariants_test.cpp diff --git a/sanitizers/suppressions/tsan.supp b/sanitizers/suppressions/tsan.supp new file mode 100644 index 0000000000..74f3371e68 --- /dev/null +++ b/sanitizers/suppressions/tsan.supp @@ -0,0 +1,102 @@ +# The idea is to empty this file gradually by fixing the underlying issues and removing suppresions. + +# Suppress race in Boost ASIO scheduler detected by GCC-15 +# This is a false positive in Boost's internal pipe() synchronization +race:boost/asio/ +race:boost/context/ +race:boost/asio/executor.hpp +race:boost::asio + +# Suppress tsan related issues in rippled code. +race:src/libxrpl/basics/make_SSLContext.cpp +race:src/libxrpl/basics/Number.cpp +race:src/libxrpl/json/json_value.cpp +race:src/libxrpl/json/to_string.cpp +race:src/libxrpl/ledger/OpenView.cpp +race:src/libxrpl/net/HTTPClient.cpp +race:src/libxrpl/nodestore/backend/NuDBFactory.cpp +race:src/libxrpl/protocol/InnerObjectFormats.cpp +race:src/libxrpl/protocol/STParsedJSON.cpp +race:src/libxrpl/resource/ResourceManager.cpp +race:src/test/app/Flow_test.cpp +race:src/test/app/LedgerReplay_test.cpp +race:src/test/app/NFToken_test.cpp +race:src/test/app/Offer_test.cpp +race:src/test/app/ValidatorSite_test.cpp +race:src/test/consensus/NegativeUNL_test.cpp +race:src/test/jtx/impl/Env.cpp +race:src/test/jtx/impl/JSONRPCClient.cpp +race:src/test/jtx/impl/pay.cpp +race:src/test/jtx/impl/token.cpp +race:src/test/rpc/Book_test.cpp +race:src/xrpld/app/ledger/detail/InboundTransactions.cpp +race:src/xrpld/app/main/Application.cpp +race:src/xrpld/app/main/BasicApp.cpp +race:src/xrpld/app/main/GRPCServer.cpp +race:src/xrpld/app/misc/detail/AmendmentTable.cpp +race:src/xrpld/app/misc/FeeVoteImpl.cpp +race:src/xrpld/app/rdb/detail/Wallet.cpp +race:src/xrpld/overlay/detail/OverlayImpl.cpp +race:src/xrpld/peerfinder/detail/PeerfinderManager.cpp +race:src/xrpld/peerfinder/detail/SourceStrings.cpp +race:src/xrpld/rpc/detail/ServerHandler.cpp +race:xrpl/server/detail/Door.h +race:xrpl/server/detail/Spawn.h +race:xrpl/server/detail/ServerImpl.h +race:xrpl/nodestore/detail/DatabaseNodeImp.h +race:src/libxrpl/beast/utility/beast_Journal.cpp +race:src/test/beast/LexicalCast_test.cpp +race:ripple::ServerHandler + +# More suppressions in external library code. +race:crtstuff.c +race:pipe + +# Deadlock / lock-order-inversion suppressions +# Note: GCC's TSAN may not fully support all deadlock suppression patterns +deadlock:src/libxrpl/beast/utility/beast_Journal.cpp +deadlock:src/libxrpl/beast/utility/beast_PropertyStream.cpp +deadlock:src/test/beast/beast_PropertyStream_test.cpp +deadlock:src/xrpld/core/detail/Workers.cpp +deadlock:src/xrpld/app/misc/detail/Manifest.cpp +deadlock:src/xrpld/app/misc/detail/ValidatorList.cpp +deadlock:src/xrpld/app/misc/detail/ValidatorSite.cpp + +signal:src/libxrpl/beast/utility/beast_Journal.cpp +signal:src/xrpld/core/detail/Workers.cpp +signal:src/xrpld/core/JobQueue.cpp +signal:ripple::Workers::Worker + +# Aggressive suppressing of deadlock tsan errors +deadlock:pthread_create +deadlock:pthread_rwlock_rdlock +deadlock:boost::asio + +# Suppress SEGV crashes in TSAN itself during stringbuf operations +# This appears to be a GCC-15 TSAN instrumentation issue with basic_stringbuf::str() +# Commonly triggered in beast::Journal::ScopedStream destructor +signal:std::__cxx11::basic_stringbuf +signal:basic_stringbuf +signal:basic_ostringstream + +called_from_lib:libclang_rt +race:ostreambuf_iterator +race:basic_ostream + +# Suppress SEGV in Boost ASIO memory allocation with GCC-15 TSAN +signal:boost::asio::aligned_new +signal:boost::asio::detail::memory + +# Suppress SEGV in execute_native_thread_routine +signal:execute_native_thread_routine + +# Suppress data race in Boost Context fiber management +# This is a false positive in Boost's exception state management during fiber context switching +race:__cxxabiv1::manage_exception_state +race:boost::context::fiber::resume +race:boost::asio::detail::spawned_fiber_thread +race:boost::asio::detail::spawned_fiber_thread::suspend_with +race:boost::asio::detail::spawned_fiber_thread::destroy + +# Suppress data race in __tsan_memcpy called from Boost fiber operations +race:__tsan_memcpy diff --git a/sanitizers/suppressions/ubsan.supp b/sanitizers/suppressions/ubsan.supp new file mode 100644 index 0000000000..1504ef685f --- /dev/null +++ b/sanitizers/suppressions/ubsan.supp @@ -0,0 +1,237 @@ +# The idea is to empty this file gradually by fixing the underlying issues and removing suppresions. + +# Suppress UBSan errors in external code by source file path +# This matches any source file under the external/ directory +alignment:external +bool:external +bounds:external +cfi:external +enum:external +float-cast-overflow:external +float-divide-by-zero:external +function:external +implicit-integer-sign-change:external +implicit-signed-integer-truncation::external +implicit-signed-integer-truncation:external +implicit-unsigned-integer-truncation:external +integer-divide-by-zero:external +invalid-builtin-use:external +invalid-objc-cast:external +nonnull-attribute:external +null:external +nullability-arg:external +nullability-assign:external +nullability-return:external +object-size:external +pointer-overflow:external +return:external +returns-nonnull-attribute:external +shift-base:external +shift-exponent:external +signed-integer-overflow:external +undefined:external +unreachable:external +unsigned-integer-overflow:external +vla-bound:external +vptr_check:external +vptr:external + +# Suppress all UBSan errors in Boost libraries +# This matches any files containing "boost" in its path or name +alignment:boost +bool:boost +bounds:boost +cfi:boost +enum:boost +float-cast-overflow:boost +float-divide-by-zero:boost +function:boost +implicit-integer-sign-change:boost +implicit-signed-integer-truncation:boost +implicit-unsigned-integer-truncation:boost +integer-divide-by-zero:boost +invalid-builtin-use:boost +invalid-objc-cast:boost +nonnull-attribute:boost +null:boost +nullability-arg:boost +nullability-assign:boost +nullability-return:boost +object-size:boost +pointer-overflow:boost +return:boost +returns-nonnull-attribute:boost +shift-base:boost +shift-exponent:boost +signed-integer-overflow:boost +undefined:boost +unreachable:boost +unsigned-integer-overflow:boost +vla-bound:boost +vptr_check:boost +vptr:boost + +# Google protobuf +undefined:protobuf + +# Suppress UBSan errors in rippled code by source file path +undefined:src/libxrpl/basics/base64.cpp +undefined:src/libxrpl/basics/Number.cpp +undefined:src/libxrpl/beast/utility/beast_Journal.cpp +undefined:src/libxrpl/crypto/RFC1751.cpp +undefined:src/libxrpl/ledger/ApplyView.cpp +undefined:src/libxrpl/ledger/View.cpp +undefined:src/libxrpl/protocol/Permissions.cpp +undefined:src/libxrpl/protocol/STAmount.cpp +undefined:src/libxrpl/protocol/STPathSet.cpp +undefined:src/libxrpl/protocol/tokens.cpp +undefined:src/libxrpl/shamap/SHAMap.cpp +undefined:src/test/app/Batch_test.cpp +undefined:src/test/app/Invariants_test.cpp +undefined:src/test/app/NFToken_test.cpp +undefined:src/test/app/Offer_test.cpp +undefined:src/test/app/Path_test.cpp +undefined:src/test/basics/XRPAmount_test.cpp +undefined:src/test/beast/LexicalCast_test.cpp +undefined:src/test/jtx/impl/acctdelete.cpp +undefined:src/test/ledger/SkipList_test.cpp +undefined:src/test/rpc/Subscribe_test.cpp +undefined:src/tests/libxrpl/basics/RangeSet.cpp +undefined:src/xrpld/app/main/BasicApp.cpp +undefined:src/xrpld/app/main/BasicApp.cpp +undefined:src/xrpld/app/misc/detail/AmendmentTable.cpp +undefined:src/xrpld/app/misc/NetworkOPs.cpp +undefined:src/libxrpl/json/json_value.cpp +undefined:src/xrpld/app/paths/detail/StrandFlow.h +undefined:src/xrpld/app/tx/detail/NFTokenMint.cpp +undefined:src/xrpld/app/tx/detail/SetOracle.cpp +undefined:src/xrpld/core/detail/JobQueue.cpp +undefined:src/xrpld/core/detail/Workers.cpp +undefined:src/xrpld/rpc/detail/Role.cpp +undefined:src/xrpld/rpc/handlers/GetAggregatePrice.cpp +undefined:xrpl/basics/base_uint.h +undefined:xrpl/basics/DecayingSample.h +undefined:xrpl/beast/test/yield_to.h +undefined:xrpl/beast/xor_shift_engine.h +undefined:xrpl/nodestore/detail/varint.h +undefined:xrpl/peerfinder/detail/Counts.h +undefined:xrpl/protocol/nft.h + +# basic_string.h:483:51: runtime error: unsigned integer overflow +unsigned-integer-overflow:basic_string.h +unsigned-integer-overflow:bits/chrono.h +unsigned-integer-overflow:bits/random.h +unsigned-integer-overflow:bits/random.tcc +unsigned-integer-overflow:bits/stl_algobase.h +unsigned-integer-overflow:bits/uniform_int_dist.h +unsigned-integer-overflow:string_view + +# runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'std::size_t' (aka 'unsigned long') +unsigned-integer-overflow:src/libxrpl/basics/base64.cpp +unsigned-integer-overflow:src/libxrpl/basics/Number.cpp +unsigned-integer-overflow:src/libxrpl/crypto/RFC1751.cpp +unsigned-integer-overflow:rc/libxrpl/json/json_value.cpp +unsigned-integer-overflow:src/libxrpl/ledger/ApplyView.cpp +unsigned-integer-overflow:src/libxrpl/ledger/View.cpp +unsigned-integer-overflow:src/libxrpl/protocol/Permissions.cpp +unsigned-integer-overflow:src/libxrpl/protocol/STAmount.cpp +unsigned-integer-overflow:src/libxrpl/protocol/STPathSet.cpp +unsigned-integer-overflow:src/libxrpl/protocol/tokens.cpp +unsigned-integer-overflow:src/libxrpl/shamap/SHAMap.cpp +unsigned-integer-overflow:src/test/app/Batch_test.cpp +unsigned-integer-overflow:src/test/app/Invariants_test.cpp +unsigned-integer-overflow:src/test/app/NFToken_test.cpp +unsigned-integer-overflow:src/test/app/Offer_test.cpp +unsigned-integer-overflow:src/test/app/Path_test.cpp +unsigned-integer-overflow:src/test/basics/XRPAmount_test.cpp +unsigned-integer-overflow:src/test/beast/LexicalCast_test.cpp +unsigned-integer-overflow:src/test/jtx/impl/acctdelete.cpp +unsigned-integer-overflow:src/test/ledger/SkipList_test.cpp +unsigned-integer-overflow:src/test/rpc/Subscribe_test.cpp +unsigned-integer-overflow:src/tests/libxrpl/basics/RangeSet.cpp +unsigned-integer-overflow:src/xrpld/app/main/BasicApp.cpp +unsigned-integer-overflow:src/xrpld/app/misc/detail/AmendmentTable.cpp +unsigned-integer-overflow:src/xrpld/app/misc/NetworkOPs.cpp +unsigned-integer-overflow:src/xrpld/app/paths/detail/StrandFlow.h +unsigned-integer-overflow:src/xrpld/app/tx/detail/NFTokenMint.cpp +unsigned-integer-overflow:src/xrpld/app/tx/detail/SetOracle.cpp +unsigned-integer-overflow:src/xrpld/rpc/detail/Role.cpp +unsigned-integer-overflow:src/xrpld/rpc/handlers/GetAggregatePrice.cpp +unsigned-integer-overflow:xrpl/basics/base_uint.h +unsigned-integer-overflow:xrpl/basics/DecayingSample.h +unsigned-integer-overflow:xrpl/beast/test/yield_to.h +unsigned-integer-overflow:xrpl/beast/xor_shift_engine.h +unsigned-integer-overflow:xrpl/nodestore/detail/varint.h +unsigned-integer-overflow:xrpl/peerfinder/detail/Counts.h +unsigned-integer-overflow:xrpl/protocol/nft.h + +# Rippled intentional overflows and operations +# STAmount uses intentional negation of INT64_MIN and overflow in arithmetic +signed-integer-overflow:src/libxrpl/protocol/STAmount.cpp +unsigned-integer-overflow:src/libxrpl/protocol/STAmount.cpp + +# XRPAmount test intentional overflows +signed-integer-overflow:src/test/basics/XRPAmount_test.cpp + +# Peerfinder intentional overflow in counter arithmetic +unsigned-integer-overflow:src/xrpld/peerfinder/detail/Counts.h + +# Signed integer overflow suppressions +signed-integer-overflow:src/test/beast/LexicalCast_test.cpp + +# External library suppressions +unsigned-integer-overflow:nudb/detail/xxhash.hpp + +# Protobuf intentional overflows in hash functions +# Protobuf uses intentional unsigned overflow for hash computation (stringpiece.h:393) +unsigned-integer-overflow:google/protobuf/stubs/stringpiece.h + +# gRPC intentional overflows +# gRPC uses intentional overflow in timer calculations +unsigned-integer-overflow:grpc +unsigned-integer-overflow:timer_manager.cc + +# Standard library intentional overflows +# These are intentional overflows in random number generation and character conversion +unsigned-integer-overflow:__random/seed_seq.h +unsigned-integer-overflow:__charconv/traits.h + + +# Suppress errors in RocksDB +# RocksDB uses intentional unsigned integer overflows in hash functions and CRC calculations +unsigned-integer-overflow:rocks*/*/util/xxhash.h +unsigned-integer-overflow:rocks*/*/util/xxph3.h +unsigned-integer-overflow:rocks*/*/util/hash.cc +unsigned-integer-overflow:rocks*/*/util/crc32c.cc +unsigned-integer-overflow:rocks*/*/util/crc32c.h +unsigned-integer-overflow:rocks*/*/include/rocksdb/utilities/options_type.h +unsigned-integer-overflow:rocks*/*/table/format.h +unsigned-integer-overflow:rocks*/*/table/format.cc +unsigned-integer-overflow:rocks*/*/table/block_based/block_based_table_builder.cc +unsigned-integer-overflow:rocks*/*/table/block_based/reader_common.cc +unsigned-integer-overflow:rocks*/*/db/version_set.cc + +# RocksDB misaligned loads (intentional for performance on ARM64) +alignment:rocks*/*/util/crc32c_arm64.cc + +# nudb intentional overflows in hash functions +unsigned-integer-overflow:nudb/detail/xxhash.hpp +alignment:nudb/detail/xxhash.hpp + +# Snappy compression library intentional overflows +unsigned-integer-overflow:snappy.cc + +# Abseil intentional overflows +unsigned-integer-overflow:absl/strings/numbers.cc +unsigned-integer-overflow:absl/strings/internal/cord_rep_flat.h +unsigned-integer-overflow:absl/base/internal/low_level_alloc.cc +unsigned-integer-overflow:absl/hash/internal/hash.h +unsigned-integer-overflow:absl/container/internal/raw_hash_set.h + +# Standard library intentional overflows in chrono duration arithmetic +unsigned-integer-overflow:__chrono/duration.h + +# Suppress undefined errors in RocksDB and nudb +undefined:rocks.*/*/util/crc32c_arm64.cc +undefined:rocks.*/*/util/xxhash.h +undefined:nudb diff --git a/src/libxrpl/ledger/View.cpp b/src/libxrpl/ledger/View.cpp index 14246baf17..16ec23ffab 100644 --- a/src/libxrpl/ledger/View.cpp +++ b/src/libxrpl/ledger/View.cpp @@ -451,9 +451,8 @@ getTrustLineBalance( amount.clear(Issue{currency, issuer}); } - JLOG(j.trace()) << "getTrustLineBalance:" - << " account=" << to_string(account) - << " amount=" << amount.getFullText(); + JLOG(j.trace()) << "getTrustLineBalance:" << " account=" + << to_string(account) << " amount=" << amount.getFullText(); return view.balanceHook(account, issuer, amount); } @@ -700,8 +699,7 @@ xrpLiquid( STAmount const amount = (balance < reserve) ? STAmount{0} : balance - reserve; - JLOG(j.trace()) << "accountHolds:" - << " account=" << to_string(id) + JLOG(j.trace()) << "accountHolds:" << " account=" << to_string(id) << " amount=" << amount.getFullText() << " fullBalance=" << fullBalance.getFullText() << " balance=" << balance.getFullText() @@ -1107,7 +1105,7 @@ adjustOwnerCount( std::function describeOwnerDir(AccountID const& account) { - return [&account](std::shared_ptr const& sle) { + return [account](std::shared_ptr const& sle) { (*sle)[sfOwner] = account; }; } diff --git a/src/libxrpl/protocol/BuildInfo.cpp b/src/libxrpl/protocol/BuildInfo.cpp index dc56987f3a..b5e2354165 100644 --- a/src/libxrpl/protocol/BuildInfo.cpp +++ b/src/libxrpl/protocol/BuildInfo.cpp @@ -3,6 +3,8 @@ #include #include +#include + #include #include #include @@ -20,7 +22,7 @@ namespace BuildInfo { char const* const versionString = "3.2.0-b0" // clang-format on -#if defined(DEBUG) || defined(SANITIZER) +#if defined(DEBUG) || defined(SANITIZERS) "+" #ifdef GIT_COMMIT_HASH GIT_COMMIT_HASH @@ -28,13 +30,13 @@ char const* const versionString = "3.2.0-b0" #endif #ifdef DEBUG "DEBUG" -#ifdef SANITIZER +#ifdef SANITIZERS "." #endif #endif -#ifdef SANITIZER - BOOST_PP_STRINGIZE(SANITIZER) // cspell: disable-line +#ifdef SANITIZERS + BOOST_PP_STRINGIZE(SANITIZERS) // cspell: disable-line #endif #endif From 00d3cee6ccc5dd87c6005c55ace5bf3ce064a8c5 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Fri, 16 Jan 2026 13:26:30 -0400 Subject: [PATCH 43/62] Improve ledger_entry lookups for fee, amendments, NUNL, and hashes (#5644) These "fixed location" objects can be found in multiple ways: 1. The lookup parameters use the same format as other ledger objects, but the only valid value is true or the valid index of the object: - Amendments: "amendments" : true - FeeSettings: "fee" : true - NegativeUNL: "nunl" : true - LedgerHashes: "hashes" : true (For the "short" list. See below.) 2. With RPC API >= 3, using special case values to "index", such as "index" : "amendments". Uses the same names as above. Note that for "hashes", this option will only return the recent ledger hashes / "short" skip list. 3. LedgerHashes has two types: "short", which stores recent ledger hashes, and "long", which stores the flag ledger hashes for a particular ledger range. - To find a "long" LedgerHashes object, request '"hashes" : '. must be a number that evaluates to an unsigned integer. - To find the "short" LedgerHashes object, request "hashes": true as with the other fixed objects. The following queries are all functionally equivalent: - "amendments" : true - "index" : "amendments" (API >=3 only) - "amendments" : "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4" - "index" : "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4" Finally, whether the object is found or not, if a valid index is computed, that index will be returned. This can be used to confirm the query was valid, or to save the index for future use. --- src/test/rpc/LedgerEntry_test.cpp | 469 ++++++++++++++++++++++++- src/xrpld/rpc/handlers/LedgerEntry.cpp | 237 ++++++++++--- 2 files changed, 649 insertions(+), 57 deletions(-) diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 551e67dc5e..1b7079341c 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include #include #include @@ -30,6 +32,7 @@ enum class FieldType { CurrencyField, HashField, HashOrObjectField, + FixedHashField, IssueField, ObjectField, StringField, @@ -86,6 +89,7 @@ getTypeName(FieldType typeID) case FieldType::CurrencyField: return "Currency"; case FieldType::HashField: + case FieldType::FixedHashField: return "hex string"; case FieldType::HashOrObjectField: return "hex string or object"; @@ -202,6 +206,7 @@ class LedgerEntry_test : public beast::unit_test::suite static auto const& badBlobValues = remove({3, 7, 8, 16}); static auto const& badCurrencyValues = remove({14}); static auto const& badHashValues = remove({2, 3, 7, 8, 16}); + static auto const& badFixedHashValues = remove({1, 2, 3, 4, 7, 8, 16}); static auto const& badIndexValues = remove({12, 16, 18, 19}); static auto const& badUInt32Values = remove({2, 3}); static auto const& badUInt64Values = remove({2, 3}); @@ -222,6 +227,8 @@ class LedgerEntry_test : public beast::unit_test::suite return badHashValues; case FieldType::HashOrObjectField: return badIndexValues; + case FieldType::FixedHashField: + return badFixedHashValues; case FieldType::IssueField: return badIssueValues; case FieldType::UInt32Field: @@ -717,7 +724,12 @@ class LedgerEntry_test : public beast::unit_test::suite } // negative tests - runLedgerEntryTest(env, jss::amendments); + testMalformedField( + env, + Json::Value{}, + jss::amendments, + FieldType::FixedHashField, + "malformedRequest"); } void @@ -1538,7 +1550,12 @@ class LedgerEntry_test : public beast::unit_test::suite } // negative tests - runLedgerEntryTest(env, jss::fee); + testMalformedField( + env, + Json::Value{}, + jss::fee, + FieldType::FixedHashField, + "malformedRequest"); } void @@ -1561,7 +1578,12 @@ class LedgerEntry_test : public beast::unit_test::suite } // negative tests - runLedgerEntryTest(env, jss::hashes); + testMalformedField( + env, + Json::Value{}, + jss::hashes, + FieldType::FixedHashField, + "malformedRequest"); } void @@ -1686,7 +1708,12 @@ class LedgerEntry_test : public beast::unit_test::suite } // negative tests - runLedgerEntryTest(env, jss::nunl); + testMalformedField( + env, + Json::Value{}, + jss::nunl, + FieldType::FixedHashField, + "malformedRequest"); } void @@ -2343,6 +2370,438 @@ class LedgerEntry_test : public beast::unit_test::suite } } + /// Test the ledger entry types that don't take parameters + void + testFixed() + { + using namespace test::jtx; + + Account const alice{"alice"}; + Account const bob{"bob"}; + + Env env{*this, envconfig([](auto cfg) { + cfg->START_UP = Config::FRESH; + return cfg; + })}; + + env.close(); + + /** Verifies that the RPC result has the expected data + * + * @param good: Indicates that the request should have succeeded + * and returned a ledger object of `expectedType` type. + * @param jv: The RPC result Json value + * @param expectedType: The type that the ledger object should + * have if "good". + * @param expectedError: Optional. The expected error if not + * good. Defaults to "entryNotFound". + */ + auto checkResult = + [&](bool good, + Json::Value const& jv, + Json::StaticString const& expectedType, + std::optional const& expectedError = {}) { + if (good) + { + BEAST_EXPECTS( + jv.isObject() && jv.isMember(jss::result) && + !jv[jss::result].isMember(jss::error) && + jv[jss::result].isMember(jss::node) && + jv[jss::result][jss::node].isMember( + sfLedgerEntryType.jsonName) && + jv[jss::result][jss::node] + [sfLedgerEntryType.jsonName] == expectedType, + to_string(jv)); + } + else + { + BEAST_EXPECTS( + jv.isObject() && jv.isMember(jss::result) && + jv[jss::result].isMember(jss::error) && + !jv[jss::result].isMember(jss::node) && + jv[jss::result][jss::error] == + expectedError.value_or("entryNotFound"), + to_string(jv)); + } + }; + + /** Runs a series of tests for a given fixed-position ledger + * entry. + * + * @param field: The Json request field to use. + * @param expectedType: The type that the ledger object should + * have if "good". + * @param expectedKey: The keylet of the fixed object. + * @param good: Indicates whether the object is expected to + * exist. + */ + auto test = [&](Json::StaticString const& field, + Json::StaticString const& expectedType, + Keylet const& expectedKey, + bool good) { + testcase << expectedType.c_str() << (good ? "" : " not") + << " found"; + + auto const hexKey = strHex(expectedKey.key); + + { + // Test bad values + // "field":null + Json::Value params; + params[jss::ledger_index] = jss::validated; + params[field] = Json::nullValue; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, expectedType, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "field":"string" + params[jss::ledger_index] = jss::validated; + params[field] = "arbitrary string"; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, expectedType, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "field":false + params[jss::ledger_index] = jss::validated; + params[field] = false; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, expectedType, "invalidParams"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + + // "field":[incorrect index hash] + 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)); + checkResult(false, jv, expectedType, "entryNotFound"); + BEAST_EXPECTS( + jv[jss::result][jss::index] == badKey, to_string(jv)); + } + + { + Json::Value params; + // "index":"field" using API 2 + params[jss::ledger_index] = jss::validated; + params[jss::index] = field; + params[jss::api_version] = 2; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, expectedType, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + std::string const pdIdx = [&]() { + { + Json::Value params; + // Test good values + // Use the "field":true notation + params[jss::ledger_index] = jss::validated; + params[field] = true; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + // Index will always be returned for valid parameters. + std::string const pdIdx = + jv[jss::result][jss::index].asString(); + BEAST_EXPECTS(hexKey == pdIdx, to_string(jv)); + checkResult(good, jv, expectedType); + + return pdIdx; + } + }(); + + { + Json::Value params; + // "field":"[index hash]" + params[jss::ledger_index] = jss::validated; + params[field] = hexKey; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(good, jv, expectedType); + BEAST_EXPECT(jv[jss::result][jss::index].asString() == hexKey); + } + + { + // Bad value + // Use the "index":"field" notation with API 2 + Json::Value params; + params[jss::ledger_index] = jss::validated; + params[jss::index] = field; + params[jss::api_version] = 2; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, expectedType, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // Use the "index":"field" notation with API 3 + params[jss::ledger_index] = jss::validated; + params[jss::index] = field; + params[jss::api_version] = 3; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + // Index is correct either way + BEAST_EXPECT(jv[jss::result][jss::index].asString() == hexKey); + checkResult(good, jv, expectedType); + } + + { + Json::Value params; + // Use the "index":"[index hash]" notation + params[jss::ledger_index] = jss::validated; + params[jss::index] = pdIdx; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + // Index is correct either way + BEAST_EXPECT(jv[jss::result][jss::index].asString() == hexKey); + checkResult(good, jv, expectedType); + } + }; + + test(jss::amendments, jss::Amendments, keylet::amendments(), true); + test(jss::fee, jss::FeeSettings, keylet::fees(), true); + // There won't be an nunl + test(jss::nunl, jss::NegativeUNL, keylet::negativeUNL(), false); + // Can only get the short skip list this way + test(jss::hashes, jss::LedgerHashes, keylet::skip(), true); + } + + void + testHashes() + { + using namespace test::jtx; + + Account const alice{"alice"}; + Account const bob{"bob"}; + + Env env{*this, envconfig([](auto cfg) { + cfg->START_UP = Config::FRESH; + return cfg; + })}; + + env.close(); + + /** Verifies that the RPC result has the expected data + * + * @param good: Indicates that the request should have succeeded + * and returned a ledger object of `expectedType` type. + * @param jv: The RPC result Json value + * @param expectedCount: The number of Hashes expected in the + * object if "good". + * @param expectedError: Optional. The expected error if not + * good. Defaults to "entryNotFound". + */ + auto checkResult = + [&](bool good, + Json::Value const& jv, + int expectedCount, + std::optional const& expectedError = {}) { + if (good) + { + BEAST_EXPECTS( + jv.isObject() && jv.isMember(jss::result) && + !jv[jss::result].isMember(jss::error) && + jv[jss::result].isMember(jss::node) && + jv[jss::result][jss::node].isMember( + sfLedgerEntryType.jsonName) && + jv[jss::result][jss::node] + [sfLedgerEntryType.jsonName] == jss::LedgerHashes, + to_string(jv)); + BEAST_EXPECTS( + jv[jss::result].isMember(jss::node) && + jv[jss::result][jss::node].isMember("Hashes") && + jv[jss::result][jss::node]["Hashes"].size() == + expectedCount, + to_string(jv[jss::result][jss::node]["Hashes"].size())); + } + else + { + BEAST_EXPECTS( + jv.isObject() && jv.isMember(jss::result) && + jv[jss::result].isMember(jss::error) && + !jv[jss::result].isMember(jss::node) && + jv[jss::result][jss::error] == + expectedError.value_or("entryNotFound"), + to_string(jv)); + } + }; + + /** Runs a series of tests for a given ledger index. + * + * @param ledger: The ledger index value of the "hashes" request + * parameter. May not necessarily be a number. + * @param expectedKey: The expected keylet of the object. + * @param good: Indicates whether the object is expected to + * exist. + * @param expectedCount: The number of Hashes expected in the + * object if "good". + */ + auto test = [&](Json::Value ledger, + Keylet const& expectedKey, + bool good, + int expectedCount = 0) { + testcase << "LedgerHashes: seq: " << env.current()->header().seq + << " \"hashes\":" << to_string(ledger) + << (good ? "" : " not") << " found"; + + auto const hexKey = strHex(expectedKey.key); + + { + // Test bad values + // "hashes":null + Json::Value params; + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = Json::nullValue; + auto jv = env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, 0, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "hashes":"non-uint string" + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = "arbitrary string"; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, 0, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "hashes":"uint string" is invalid, too + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = "10"; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, 0, "malformedRequest"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "hashes":false + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = false; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, 0, "invalidParams"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + { + Json::Value params; + // "hashes":-1 + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = -1; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(false, jv, 0, "internal"); + BEAST_EXPECT(!jv[jss::result].isMember(jss::index)); + } + + // "hashes":[incorrect index hash] + { + Json::Value params; + 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)); + checkResult(false, jv, 0, "entryNotFound"); + BEAST_EXPECT(jv[jss::result][jss::index] == badKey); + } + + { + Json::Value params; + // Test good values + // Use the "hashes":ledger notation + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = ledger; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(good, jv, expectedCount); + // Index will always be returned for valid parameters. + std::string const pdIdx = + jv[jss::result][jss::index].asString(); + BEAST_EXPECTS(hexKey == pdIdx, strHex(pdIdx)); + } + + { + Json::Value params; + // "hashes":"[index hash]" + params[jss::ledger_index] = jss::validated; + params[jss::hashes] = hexKey; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(good, jv, expectedCount); + // Index is correct either way + BEAST_EXPECTS( + hexKey == jv[jss::result][jss::index].asString(), + strHex(jv[jss::result][jss::index].asString())); + } + + { + Json::Value params; + // Use the "index":"[index hash]" notation + params[jss::ledger_index] = jss::validated; + params[jss::index] = hexKey; + auto const jv = + env.rpc("json", "ledger_entry", to_string(params)); + checkResult(good, jv, expectedCount); + // Index is correct either way + BEAST_EXPECTS( + hexKey == jv[jss::result][jss::index].asString(), + strHex(jv[jss::result][jss::index].asString())); + } + }; + + // short skip list + test(true, keylet::skip(), true, 2); + // long skip list at index 0 + test(1, keylet::skip(1), false); + // long skip list at index 1 + test(1 << 17, keylet::skip(1 << 17), false); + + // Close more ledgers, but stop short of the flag ledger + for (auto i = env.current()->seq(); i <= 250; ++i) + env.close(); + + // short skip list + test(true, keylet::skip(), true, 249); + // long skip list at index 0 + test(1, keylet::skip(1), false); + // long skip list at index 1 + test(1 << 17, keylet::skip(1 << 17), false); + + // Close a flag ledger so the first "long" skip list is created + for (auto i = env.current()->seq(); i <= 260; ++i) + env.close(); + + // short skip list + test(true, keylet::skip(), true, 256); + // long skip list at index 0 + test(1, keylet::skip(1), true, 1); + // long skip list at index 1 + test(1 << 17, keylet::skip(1 << 17), false); + } + void testCLI() { @@ -2400,6 +2859,8 @@ public: testOracleLedgerEntry(); testMPT(); testPermissionedDomain(); + testFixed(); + testHashes(); testCLI(); } }; diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index d9ae357b1a..17d8e5e7bc 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -18,6 +18,32 @@ namespace xrpl { +using FunctionType = std::function( + Json::Value const&, + Json::StaticString const, + unsigned const apiVersion)>; + +static Expected +parseFixed( + Keylet const& keylet, + Json::Value const& params, + Json::StaticString const& fieldName, + unsigned const apiVersion); + +// Helper function to return FunctionType for objects that have a fixed +// location. That is, they don't take parameters to compute the index. +// e.g. amendments, fees, negative UNL, etc. +static FunctionType +fixed(Keylet const& keylet) +{ + return [keylet]( + Json::Value const& params, + Json::StaticString const fieldName, + unsigned const apiVersion) -> Expected { + return parseFixed(keylet, params, fieldName, apiVersion); + }; +} + static Expected parseObjectID( Json::Value const& params, @@ -33,13 +59,33 @@ parseObjectID( } static Expected -parseIndex(Json::Value const& params, Json::StaticString const fieldName) +parseIndex( + Json::Value const& params, + Json::StaticString const fieldName, + unsigned const apiVersion) { + if (apiVersion > 2u && params.isString()) + { + std::string const index = params.asString(); + if (index == jss::amendments.c_str()) + return keylet::amendments().key; + if (index == jss::fee.c_str()) + return keylet::fees().key; + if (index == jss::nunl) + return keylet::negativeUNL().key; + if (index == jss::hashes) + // Note this only finds the "short" skip list. Use "hashes":index to + // get the long list. + return keylet::skip().key; + } return parseObjectID(params, fieldName, "hex string"); } static Expected -parseAccountRoot(Json::Value const& params, Json::StaticString const fieldName) +parseAccountRoot( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (auto const account = LedgerEntryHelpers::parse(params)) { @@ -50,14 +96,13 @@ parseAccountRoot(Json::Value const& params, Json::StaticString const fieldName) "malformedAddress", fieldName, "AccountID"); } -static Expected -parseAmendments(Json::Value const& params, Json::StaticString const fieldName) -{ - return parseObjectID(params, fieldName, "hex string"); -} +auto const parseAmendments = fixed(keylet::amendments()); static Expected -parseAMM(Json::Value const& params, Json::StaticString const fieldName) +parseAMM( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -85,7 +130,10 @@ parseAMM(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseBridge(Json::Value const& params, Json::StaticString const fieldName) +parseBridge( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isMember(jss::bridge)) { @@ -116,13 +164,19 @@ parseBridge(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseCheck(Json::Value const& params, Json::StaticString const fieldName) +parseCheck( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { return parseObjectID(params, fieldName, "hex string"); } static Expected -parseCredential(Json::Value const& cred, Json::StaticString const fieldName) +parseCredential( + Json::Value const& cred, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!cred.isObject()) { @@ -153,7 +207,10 @@ parseCredential(Json::Value const& cred, Json::StaticString const fieldName) } static Expected -parseDelegate(Json::Value const& params, Json::StaticString const fieldName) +parseDelegate( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -244,7 +301,10 @@ parseAuthorizeCredentials(Json::Value const& jv) } static Expected -parseDepositPreauth(Json::Value const& dp, Json::StaticString const fieldName) +parseDepositPreauth( + Json::Value const& dp, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!dp.isObject()) { @@ -297,7 +357,10 @@ parseDepositPreauth(Json::Value const& dp, Json::StaticString const fieldName) } static Expected -parseDID(Json::Value const& params, Json::StaticString const fieldName) +parseDID( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { auto const account = LedgerEntryHelpers::parse(params); if (!account) @@ -312,7 +375,8 @@ parseDID(Json::Value const& params, Json::StaticString const fieldName) static Expected parseDirectoryNode( Json::Value const& params, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -365,7 +429,10 @@ parseDirectoryNode( } static Expected -parseEscrow(Json::Value const& params, Json::StaticString const fieldName) +parseEscrow( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -384,20 +451,53 @@ parseEscrow(Json::Value const& params, Json::StaticString const fieldName) return keylet::escrow(*id, *seq).key; } +auto const parseFeeSettings = fixed(keylet::fees()); + static Expected -parseFeeSettings(Json::Value const& params, Json::StaticString const fieldName) +parseFixed( + Keylet const& keylet, + Json::Value const& params, + Json::StaticString const& fieldName, + [[maybe_unused]] unsigned const apiVersion) { - return parseObjectID(params, fieldName, "hex string"); + if (!params.isBool()) + { + return parseObjectID(params, fieldName, "hex string"); + } + if (!params.asBool()) + { + return LedgerEntryHelpers::invalidFieldError( + "invalidParams", fieldName, "true"); + } + + return keylet.key; } static Expected -parseLedgerHashes(Json::Value const& params, Json::StaticString const fieldName) +parseLedgerHashes( + Json::Value const& params, + Json::StaticString const fieldName, + unsigned const apiVersion) { - return parseObjectID(params, fieldName, "hex string"); + if (params.isUInt() || params.isInt()) + { + // If the index doesn't parse as a UInt, throw + auto const index = params.asUInt(); + + // Return the "long" skip list for the given ledger index. + auto const keylet = keylet::skip(index); + return keylet.key; + } + // Return the key in `params` or the "short" skip list, which contains + // hashes since the last flag ledger. + return parseFixed(keylet::skip(), params, fieldName, apiVersion); } static Expected -parseLoanBroker(Json::Value const& params, Json::StaticString const fieldName) +parseLoanBroker( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -417,7 +517,10 @@ parseLoanBroker(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseLoan(Json::Value const& params, Json::StaticString const fieldName) +parseLoan( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -437,7 +540,10 @@ parseLoan(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseMPToken(Json::Value const& params, Json::StaticString const fieldName) +parseMPToken( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -460,7 +566,8 @@ parseMPToken(Json::Value const& params, Json::StaticString const fieldName) static Expected parseMPTokenIssuance( Json::Value const& params, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { auto const mptIssuanceID = LedgerEntryHelpers::parse(params); if (!mptIssuanceID) @@ -471,25 +578,30 @@ parseMPTokenIssuance( } static Expected -parseNFTokenOffer(Json::Value const& params, Json::StaticString const fieldName) +parseNFTokenOffer( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { return parseObjectID(params, fieldName, "hex string"); } static Expected -parseNFTokenPage(Json::Value const& params, Json::StaticString const fieldName) +parseNFTokenPage( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { return parseObjectID(params, fieldName, "hex string"); } -static Expected -parseNegativeUNL(Json::Value const& params, Json::StaticString const fieldName) -{ - return parseObjectID(params, fieldName, "hex string"); -} +auto const parseNegativeUNL = fixed(keylet::negativeUNL()); static Expected -parseOffer(Json::Value const& params, Json::StaticString const fieldName) +parseOffer( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -510,7 +622,10 @@ parseOffer(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseOracle(Json::Value const& params, Json::StaticString const fieldName) +parseOracle( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -531,7 +646,10 @@ parseOracle(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parsePayChannel(Json::Value const& params, Json::StaticString const fieldName) +parsePayChannel( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { return parseObjectID(params, fieldName, "hex string"); } @@ -539,7 +657,8 @@ parsePayChannel(Json::Value const& params, Json::StaticString const fieldName) static Expected parsePermissionedDomain( Json::Value const& pd, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (pd.isString()) { @@ -568,7 +687,8 @@ parsePermissionedDomain( static Expected parseRippleState( Json::Value const& jvRippleState, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { Currency uCurrency; @@ -618,13 +738,19 @@ parseRippleState( } static Expected -parseSignerList(Json::Value const& params, Json::StaticString const fieldName) +parseSignerList( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { return parseObjectID(params, fieldName, "hex string"); } static Expected -parseTicket(Json::Value const& params, Json::StaticString const fieldName) +parseTicket( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -645,7 +771,10 @@ parseTicket(Json::Value const& params, Json::StaticString const fieldName) } static Expected -parseVault(Json::Value const& params, Json::StaticString const fieldName) +parseVault( + Json::Value const& params, + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!params.isObject()) { @@ -668,7 +797,8 @@ parseVault(Json::Value const& params, Json::StaticString const fieldName) static Expected parseXChainOwnedClaimID( Json::Value const& claim_id, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!claim_id.isObject()) { @@ -693,7 +823,8 @@ parseXChainOwnedClaimID( static Expected parseXChainOwnedCreateAccountClaimID( Json::Value const& claim_id, - Json::StaticString const fieldName) + Json::StaticString const fieldName, + [[maybe_unused]] unsigned const apiVersion) { if (!claim_id.isObject()) { @@ -717,10 +848,6 @@ parseXChainOwnedCreateAccountClaimID( return keylet.key; } -using FunctionType = Expected (*)( - Json::Value const&, - Json::StaticString const); - struct LedgerEntry { Json::StaticString fieldName; @@ -753,7 +880,7 @@ doLedgerEntry(RPC::JsonContext& context) {jss::ripple_state, parseRippleState, ltRIPPLE_STATE}, }); - auto hasMoreThanOneMember = [&]() { + auto const hasMoreThanOneMember = [&]() { int count = 0; for (auto const& ledgerEntry : ledgerEntryParsers) @@ -797,8 +924,8 @@ doLedgerEntry(RPC::JsonContext& context) Json::Value const& params = ledgerEntry.fieldName == jss::bridge ? context.params : context.params[ledgerEntry.fieldName]; - auto const result = - ledgerEntry.parseFunction(params, ledgerEntry.fieldName); + auto const result = ledgerEntry.parseFunction( + params, ledgerEntry.fieldName, context.apiVersion); if (!result) return result.error(); @@ -829,9 +956,13 @@ doLedgerEntry(RPC::JsonContext& context) throw; } + // Return the computed index regardless of whether the node exists. + jvResult[jss::index] = to_string(uNodeIndex); + if (uNodeIndex.isZero()) { - return RPC::make_error(rpcENTRY_NOT_FOUND); + RPC::inject_error(rpcENTRY_NOT_FOUND, jvResult); + return jvResult; } auto const sleNode = lpLedger->read(keylet::unchecked(uNodeIndex)); @@ -843,12 +974,14 @@ doLedgerEntry(RPC::JsonContext& context) if (!sleNode) { // Not found. - return RPC::make_error(rpcENTRY_NOT_FOUND); + RPC::inject_error(rpcENTRY_NOT_FOUND, jvResult); + return jvResult; } if ((expectedType != ltANY) && (expectedType != sleNode->getType())) { - return RPC::make_error(rpcUNEXPECTED_LEDGER_TYPE); + RPC::inject_error(rpcUNEXPECTED_LEDGER_TYPE, jvResult); + return jvResult; } if (bNodeBinary) @@ -858,12 +991,10 @@ doLedgerEntry(RPC::JsonContext& context) sleNode->add(s); jvResult[jss::node_binary] = strHex(s.peekData()); - jvResult[jss::index] = to_string(uNodeIndex); } else { jvResult[jss::node] = sleNode->getJson(JsonOptions::none); - jvResult[jss::index] = to_string(uNodeIndex); } return jvResult; From 12c0d67ff62f141f4c1d25ece56800f22cb3861e Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 16 Jan 2026 15:01:53 -0500 Subject: [PATCH 44/62] ci: remove 'master' branch as a trigger (#6234) This change removes the `master` branch as a trigger for the CI pipelines, and updates comments accordingly. It also fixes the pre-commit workflow, so it will run on all release branches. --- .github/scripts/strategy-matrix/generate.py | 4 ++-- .github/workflows/on-pr.yml | 2 +- .github/workflows/on-trigger.yml | 20 +++++++++----------- .github/workflows/pre-commit.yml | 4 +++- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/scripts/strategy-matrix/generate.py b/.github/scripts/strategy-matrix/generate.py index bf5bf5d3ba..0e44b1be54 100755 --- a/.github/scripts/strategy-matrix/generate.py +++ b/.github/scripts/strategy-matrix/generate.py @@ -20,8 +20,8 @@ class Config: Generate a strategy matrix for GitHub Actions CI. On each PR commit we will build a selection of Debian, RHEL, Ubuntu, MacOS, and -Windows configurations, while upon merge into the develop, release, or master -branches, we will build all configurations, and test most of them. +Windows configurations, while upon merge into the develop or release branches, +we will build all configurations, and test most of them. We will further set additional CMake arguments as follows: - All builds will have the `tests`, `werr`, and `xrpld` options. diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 3aa48ac070..dad211f94f 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -125,7 +125,7 @@ jobs: needs: - should-run - build-test - if: ${{ needs.should-run.outputs.go == 'true' && (startsWith(github.base_ref, 'release') || github.base_ref == 'master') }} + if: ${{ needs.should-run.outputs.go == 'true' && startsWith(github.ref, 'refs/heads/release') }} uses: ./.github/workflows/reusable-notify-clio.yml secrets: clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }} diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index 2c63c2baa5..ef7bf41fa2 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -1,9 +1,8 @@ -# This workflow runs all workflows to build the dependencies required for the -# project on various Linux flavors, as well as on MacOS and Windows, on a -# scheduled basis, on merge into the 'develop', 'release', or 'master' branches, -# or manually. The missing commits check is only run when the code is merged -# into the 'develop' or 'release' branches, and the documentation is built when -# the code is merged into the 'develop' branch. +# This workflow runs all workflows to build and test the code on various Linux +# flavors, as well as on MacOS and Windows, on a scheduled basis, on merge into +# the 'develop' or 'release*' branches, or when requested manually. Upon +# successful completion, it also uploads the built libxrpl package to the Conan +# remote. name: Trigger on: @@ -11,7 +10,6 @@ on: branches: - "develop" - "release*" - - "master" paths: # These paths are unique to `on-trigger.yml`. - ".github/workflows/on-trigger.yml" @@ -70,10 +68,10 @@ jobs: with: # Enable ccache only for events targeting the XRPLF repository, since # other accounts will not have access to our remote cache storage. - # However, we do not enable ccache for events targeting the master or a - # release branch, to protect against the rare case that the output - # produced by ccache is not identical to a regular compilation. - ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !(github.base_ref == 'master' || startsWith(github.base_ref, 'release')) }} + # However, we do not enable ccache for events targeting a release branch, + # to protect against the rare case that the output produced by ccache is + # not identical to a regular compilation. + ccache_enabled: ${{ github.repository_owner == 'XRPLF' && !startsWith(github.ref, 'refs/heads/release') }} os: ${{ matrix.os }} strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }} secrets: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 00754e5eae..6b8fd9955e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,7 +3,9 @@ name: Run pre-commit hooks on: pull_request: push: - branches: [develop, release, master] + branches: + - "develop" + - "release*" workflow_dispatch: jobs: From 5e808794d875b9ea3fe894d17995a6f348dea148 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 21 Jan 2026 14:19:53 +0000 Subject: [PATCH 45/62] Limit reply size on `TMGetObjectByHash` queries (#6110) `PeerImp` processes `TMGetObjectByHash` queries with an unbounded per-request loop, which performs a `NodeStore` fetch and then appends retrieved data to the reply for each queried object without a local count cap or reply-byte budget. However, the `Nodestore` fetches are expensive when high in numbers, which might slow down the process overall. Hence this code change adds an upper cap on the response size. --- .../scripts/levelization/results/ordering.txt | 1 + src/test/overlay/TMGetObjectByHash_test.cpp | 211 ++++++++++++++++++ src/xrpld/overlay/detail/PeerImp.cpp | 14 +- 3 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 src/test/overlay/TMGetObjectByHash_test.cpp diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index c9c65fb0dd..8d17e1167f 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -104,6 +104,7 @@ test.overlay > xrpl.basics test.overlay > xrpld.app test.overlay > xrpld.overlay test.overlay > xrpld.peerfinder +test.overlay > xrpl.nodestore test.overlay > xrpl.protocol test.overlay > xrpl.shamap test.peerfinder > test.beast diff --git a/src/test/overlay/TMGetObjectByHash_test.cpp b/src/test/overlay/TMGetObjectByHash_test.cpp new file mode 100644 index 0000000000..71a485416d --- /dev/null +++ b/src/test/overlay/TMGetObjectByHash_test.cpp @@ -0,0 +1,211 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace xrpl { +namespace test { + +using namespace jtx; + +/** + * Test for TMGetObjectByHash reply size limiting. + * + * This verifies the fix that limits TMGetObjectByHash replies to + * Tuning::hardMaxReplyNodes to prevent excessive memory usage and + * potential DoS attacks from peers requesting large numbers of objects. + */ +class TMGetObjectByHash_test : public beast::unit_test::suite +{ + using middle_type = boost::beast::tcp_stream; + using stream_type = boost::beast::ssl_stream; + using socket_type = boost::asio::ip::tcp::socket; + using shared_context = std::shared_ptr; + /** + * Test peer that captures sent messages for verification. + */ + class PeerTest : public PeerImp + { + public: + PeerTest( + Application& app, + std::shared_ptr const& slot, + http_request_type&& request, + PublicKey const& publicKey, + ProtocolVersion protocol, + Resource::Consumer consumer, + std::unique_ptr&& stream_ptr, + OverlayImpl& overlay) + : PeerImp( + app, + id_++, + slot, + std::move(request), + publicKey, + protocol, + consumer, + std::move(stream_ptr), + overlay) + { + } + + ~PeerTest() = default; + + void + run() override + { + } + + void + send(std::shared_ptr const& m) override + { + lastSentMessage_ = m; + } + + std::shared_ptr + getLastSentMessage() const + { + return lastSentMessage_; + } + + static void + resetId() + { + id_ = 0; + } + + private: + inline static Peer::id_t id_ = 0; + std::shared_ptr lastSentMessage_; + }; + + shared_context context_{make_SSLContext("")}; + ProtocolVersion protocolVersion_{1, 7}; + + std::shared_ptr + createPeer(jtx::Env& env) + { + auto& overlay = dynamic_cast(env.app().overlay()); + boost::beast::http::request request; + auto stream_ptr = std::make_unique( + socket_type(env.app().getIOContext()), *context_); + + beast::IP::Endpoint local( + boost::asio::ip::make_address("172.1.1.1"), 51235); + beast::IP::Endpoint remote( + boost::asio::ip::make_address("172.1.1.2"), 51235); + + PublicKey key(std::get<0>(randomKeyPair(KeyType::ed25519))); + auto consumer = overlay.resourceManager().newInboundEndpoint(remote); + auto [slot, _] = overlay.peerFinder().new_inbound_slot(local, remote); + + auto peer = std::make_shared( + env.app(), + slot, + std::move(request), + key, + protocolVersion_, + consumer, + std::move(stream_ptr), + overlay); + + overlay.add_active(peer); + return peer; + } + + std::shared_ptr + createRequest(size_t const numObjects, Env& env) + { + // Store objects in the NodeStore that will be found during the query + auto& nodeStore = env.app().getNodeStore(); + + // Create and store objects + std::vector hashes; + hashes.reserve(numObjects); + for (int i = 0; i < numObjects; ++i) + { + uint256 hash(xrpl::sha512Half(i)); + hashes.push_back(hash); + + Blob data(100, static_cast(i % 256)); + nodeStore.store( + hotLEDGER, + std::move(data), + hash, + nodeStore.earliestLedgerSeq()); + } + + // Create a request with more objects than hardMaxReplyNodes + auto request = std::make_shared(); + request->set_type(protocol::TMGetObjectByHash_ObjectType_otLEDGER); + request->set_query(true); + + for (int i = 0; i < numObjects; ++i) + { + auto object = request->add_objects(); + object->set_hash(hashes[i].data(), hashes[i].size()); + object->set_ledgerseq(i); + } + return request; + } + + /** + * Test that reply is limited to hardMaxReplyNodes when more objects + * are requested than the limit allows. + */ + void + testReplyLimit(size_t const numObjects, int const expectedReplySize) + { + testcase("Reply Limit"); + + Env env(*this); + PeerTest::resetId(); + + auto peer = createPeer(env); + + auto request = createRequest(numObjects, env); + // Call the onMessage handler + peer->onMessage(request); + + // Verify that a reply was sent + auto sentMessage = peer->getLastSentMessage(); + BEAST_EXPECT(sentMessage != nullptr); + + // Parse the reply message + auto const& buffer = + sentMessage->getBuffer(compression::Compressed::Off); + + BEAST_EXPECT(buffer.size() > 6); + // Skip the message header (6 bytes: 4 for size, 2 for type) + protocol::TMGetObjectByHash reply; + BEAST_EXPECT( + reply.ParseFromArray(buffer.data() + 6, buffer.size() - 6) == true); + + // Verify the reply is limited to expectedReplySize + BEAST_EXPECT(reply.objects_size() == expectedReplySize); + } + + void + run() override + { + int const limit = static_cast(Tuning::hardMaxReplyNodes); + testReplyLimit(limit + 1, limit); + testReplyLimit(limit, limit); + testReplyLimit(limit - 1, limit - 1); + } +}; + +BEAST_DEFINE_TESTSUITE(TMGetObjectByHash, overlay, xrpl); + +} // namespace test +} // namespace xrpl diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 53237ed3ae..b64227288c 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -1351,8 +1351,8 @@ PeerImp::handleTransaction( { // If we've never been in synch, there's nothing we can do // with a transaction - JLOG(p_journal_.debug()) << "Ignoring incoming transaction: " - << "Need network ledger"; + JLOG(p_journal_.debug()) + << "Ignoring incoming transaction: Need network ledger"; return; } @@ -2618,6 +2618,16 @@ PeerImp::onMessage(std::shared_ptr const& m) newObj.set_ledgerseq(obj.ledgerseq()); // VFALCO NOTE "seq" in the message is obsolete + + // Check if by adding this object, reply has reached its + // limit + if (reply.objects_size() >= Tuning::hardMaxReplyNodes) + { + fee_.update( + Resource::feeModerateBurdenPeer, + " Reply limit reached. Truncating reply."); + break; + } } } } From a37c5560798cbe186c63c464bfc206cefb67ecd8 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 21 Jan 2026 17:31:44 -0500 Subject: [PATCH 46/62] ci: Upload Conan recipe for merges into develop and commits to release (#6235) This change uploads the `libxrpl` library as a Conan recipe to our remote when (i) merging into the `develop` branch, (ii) committing to a PR that targets a `release*` branch, and (iii) a versioned tag is applied. Clio is only notified in the second case. The user and channel are no longer used when uploading the recipe. Specific changes are: * A `generate-version` action is added, which extracts the build version from `BuildInfo.cpp` and appends the short 7-character commit hash to it for merges into the `develop` branch and for commits to a PR that targets a `release*` branch. When a tag is applied, however, the tag itself is used as the version. This functionality has been turned into a separate action as we will use the same versioning logic for creating .rpm and .deb packages, as well as Docker images. * An `upload-recipe` action is added, which calls the `generate-version` action and further handles the uploading of the recipe to Conan. * This action is called by both the `on-pr` and `on-trigger` workflows, and a new `on-tag` workflow. The reason for this change is that we have downstream uses for the `libxrpl` library, but currently only upload the recipe to check for compatibility with Clio when making commits to a PR that targets the release branch. --- .github/actions/generate-version/action.yml | 41 +++++++++ .github/actions/setup-conan/action.yml | 12 +-- .github/workflows/on-pr.yml | 39 +++++++-- .github/workflows/on-tag.yml | 25 ++++++ .github/workflows/on-trigger.yml | 15 +++- .github/workflows/reusable-notify-clio.yml | 91 -------------------- .github/workflows/reusable-upload-recipe.yml | 78 +++++++++++++++++ .github/workflows/upload-conan-deps.yml | 4 +- 8 files changed, 194 insertions(+), 111 deletions(-) create mode 100644 .github/actions/generate-version/action.yml create mode 100644 .github/workflows/on-tag.yml delete mode 100644 .github/workflows/reusable-notify-clio.yml create mode 100644 .github/workflows/reusable-upload-recipe.yml diff --git a/.github/actions/generate-version/action.yml b/.github/actions/generate-version/action.yml new file mode 100644 index 0000000000..f0a63f02df --- /dev/null +++ b/.github/actions/generate-version/action.yml @@ -0,0 +1,41 @@ +name: Generate build version number +description: "Generate build version number." + +outputs: + version: + description: "The generated build version number." + value: ${{ steps.version.outputs.version }} + +runs: + using: composite + steps: + # When a tag is pushed, the version is used as-is. + - name: Generate version for tag event + if: ${{ github.event_name == 'tag' }} + shell: bash + env: + VERSION: ${{ github.ref_name }} + run: echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" + + # When a tag is not pushed, then the version is extracted from the + # BuildInfo.cpp file and the shortened commit hash appended to it. + - name: Generate version for non-tag event + if: ${{ github.event_name != 'tag' }} + shell: bash + run: | + echo 'Extracting version from BuildInfo.cpp.' + VERSION="$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" + if [[ -z "${VERSION}" ]]; then + echo 'Unable to extract version from BuildInfo.cpp.' + exit 1 + fi + + echo 'Appending shortened commit hash to version.' + VERSION="${VERSION}-${COMMIT_HASH:0:7}" + + echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" + + - name: Output version + id: version + shell: bash + run: echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml index dedf53f109..37956c5f21 100644 --- a/.github/actions/setup-conan/action.yml +++ b/.github/actions/setup-conan/action.yml @@ -2,11 +2,11 @@ name: Setup Conan description: "Set up Conan configuration, profile, and remote." inputs: - conan_remote_name: + remote_name: description: "The name of the Conan remote to use." required: false default: xrplf - conan_remote_url: + remote_url: description: "The URL of the Conan endpoint to use." required: false default: https://conan.ripplex.io @@ -36,11 +36,11 @@ runs: - name: Set up Conan remote shell: bash env: - CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }} - CONAN_REMOTE_URL: ${{ inputs.conan_remote_url }} + REMOTE_NAME: ${{ inputs.remote_name }} + REMOTE_URL: ${{ inputs.remote_url }} run: | - echo "Adding Conan remote '${CONAN_REMOTE_NAME}' at '${CONAN_REMOTE_URL}'." - conan remote add --index 0 --force "${CONAN_REMOTE_NAME}" "${CONAN_REMOTE_URL}" + echo "Adding Conan remote '${REMOTE_NAME}' at '${REMOTE_URL}'." + conan remote add --index 0 --force "${REMOTE_NAME}" "${REMOTE_URL}" echo 'Listing Conan remotes.' conan remote list diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index dad211f94f..61639485d9 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -1,7 +1,8 @@ # This workflow runs all workflows to check, build and test the project on # various Linux flavors, as well as on MacOS and Windows, on every push to a # user branch. However, it will not run if the pull request is a draft unless it -# has the 'DraftRunCI' label. +# has the 'DraftRunCI' label. For commits to PRs that target a release branch, +# it also uploads the libxrpl recipe to the Conan remote. name: PR on: @@ -53,7 +54,6 @@ jobs: .github/scripts/rename/** .github/workflows/reusable-check-levelization.yml .github/workflows/reusable-check-rename.yml - .github/workflows/reusable-notify-clio.yml .github/workflows/on-pr.yml # Keep the paths below in sync with those in `on-trigger.yml`. @@ -66,6 +66,7 @@ jobs: .github/workflows/reusable-build-test.yml .github/workflows/reusable-strategy-matrix.yml .github/workflows/reusable-test.yml + .github/workflows/reusable-upload-recipe.yml .codecov.yml cmake/** conan/** @@ -121,22 +122,42 @@ jobs: secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - notify-clio: + upload-recipe: needs: - should-run - build-test - if: ${{ needs.should-run.outputs.go == 'true' && startsWith(github.ref, 'refs/heads/release') }} - uses: ./.github/workflows/reusable-notify-clio.yml + # Only run when committing to a PR that targets a release branch in the + # XRPLF repository. + if: ${{ github.repository_owner == 'XRPLF' && needs.should-run.outputs.go == 'true' && startsWith(github.ref, 'refs/heads/release') }} + uses: ./.github/workflows/reusable-upload-recipe.yml secrets: - clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }} - conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} - conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }} + remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} + remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }} + + notify-clio: + needs: upload-recipe + runs-on: ubuntu-latest + steps: + # Notify the Clio repository about the newly proposed release version, so + # it can be checked for compatibility before the release is actually made. + - name: Notify Clio + env: + GH_TOKEN: ${{ secrets.CLIO_NOTIFY_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + run: | + gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \ + -F "client_payload[ref]=${{ needs.upload-recipe.outputs.recipe_ref }}" \ + -F "client_payload[pr_url]=${PR_URL}" passed: if: failure() || cancelled() needs: - - build-test - check-levelization + - check-rename + - build-test + - upload-recipe + - notify-clio runs-on: ubuntu-latest steps: - name: Fail diff --git a/.github/workflows/on-tag.yml b/.github/workflows/on-tag.yml new file mode 100644 index 0000000000..c6361b4016 --- /dev/null +++ b/.github/workflows/on-tag.yml @@ -0,0 +1,25 @@ +# This workflow uploads the libxrpl recipe to the Conan remote when a versioned +# tag is pushed. +name: Tag + +on: + push: + tags: + - "v*" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + upload-recipe: + # Only run when a tag is pushed to the XRPLF repository. + if: ${{ github.repository_owner == 'XRPLF' }} + uses: ./.github/workflows/reusable-upload-recipe.yml + secrets: + remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} + remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }} diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index ef7bf41fa2..7f54a9977e 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -1,8 +1,7 @@ # This workflow runs all workflows to build and test the code on various Linux # flavors, as well as on MacOS and Windows, on a scheduled basis, on merge into -# the 'develop' or 'release*' branches, or when requested manually. Upon -# successful completion, it also uploads the built libxrpl package to the Conan -# remote. +# the 'develop' or 'release*' branches, or when requested manually. Upon pushes +# to the develop branch it also uploads the libxrpl recipe to the Conan remote. name: Trigger on: @@ -24,6 +23,7 @@ on: - ".github/workflows/reusable-build-test.yml" - ".github/workflows/reusable-strategy-matrix.yml" - ".github/workflows/reusable-test.yml" + - ".github/workflows/reusable-upload-recipe.yml" - ".codecov.yml" - "cmake/**" - "conan/**" @@ -76,3 +76,12 @@ jobs: strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + upload-recipe: + needs: build-test + # Only run when pushing to the develop branch in the XRPLF repository. + if: ${{ github.repository_owner == 'XRPLF' && github.event_name == 'push' && github.ref == 'refs/heads/develop' }} + uses: ./.github/workflows/reusable-upload-recipe.yml + secrets: + remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} + remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }} diff --git a/.github/workflows/reusable-notify-clio.yml b/.github/workflows/reusable-notify-clio.yml deleted file mode 100644 index 0941d5f2e3..0000000000 --- a/.github/workflows/reusable-notify-clio.yml +++ /dev/null @@ -1,91 +0,0 @@ -# This workflow exports the built libxrpl package to the Conan remote on a -# a channel named after the pull request, and notifies the Clio repository about -# the new version so it can check for compatibility. -name: Notify Clio - -# This workflow can only be triggered by other workflows. -on: - workflow_call: - inputs: - conan_remote_name: - description: "The name of the Conan remote to use." - required: false - type: string - default: xrplf - conan_remote_url: - description: "The URL of the Conan endpoint to use." - required: false - type: string - default: https://conan.ripplex.io - secrets: - clio_notify_token: - description: "The GitHub token to notify Clio about new versions." - required: true - conan_remote_username: - description: "The username for logging into the Conan remote." - required: true - conan_remote_password: - description: "The password for logging into the Conan remote." - required: true - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-clio - cancel-in-progress: true - -defaults: - run: - shell: bash - -jobs: - upload: - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - runs-on: ubuntu-latest - container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158 - steps: - - name: Checkout repository - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - - name: Generate outputs - id: generate - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - run: | - echo 'Generating user and channel.' - echo "user=clio" >> "${GITHUB_OUTPUT}" - echo "channel=pr_${PR_NUMBER}" >> "${GITHUB_OUTPUT}" - echo 'Extracting version.' - echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}" - - name: Calculate conan reference - id: conan_ref - run: | - echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}" - - name: Set up Conan - uses: ./.github/actions/setup-conan - with: - conan_remote_name: ${{ inputs.conan_remote_name }} - conan_remote_url: ${{ inputs.conan_remote_url }} - - name: Log into Conan remote - env: - CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }} - run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}" - - name: Upload package - env: - CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }} - run: | - conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} . - conan upload --confirm --check --remote="${CONAN_REMOTE_NAME}" xrpl/${{ steps.conan_ref.outputs.conan_ref }} - outputs: - conan_ref: ${{ steps.conan_ref.outputs.conan_ref }} - - notify: - needs: upload - runs-on: ubuntu-latest - steps: - - name: Notify Clio - env: - GH_TOKEN: ${{ secrets.clio_notify_token }} - PR_URL: ${{ github.event.pull_request.html_url }} - run: | - gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \ - -F "client_payload[conan_ref]=${{ needs.upload.outputs.conan_ref }}" \ - -F "client_payload[pr_url]=${PR_URL}" diff --git a/.github/workflows/reusable-upload-recipe.yml b/.github/workflows/reusable-upload-recipe.yml new file mode 100644 index 0000000000..9b25481f6a --- /dev/null +++ b/.github/workflows/reusable-upload-recipe.yml @@ -0,0 +1,78 @@ +# This workflow exports the built libxrpl package to the Conan remote. +name: Upload Conan recipe + +# This workflow can only be triggered by other workflows. +on: + workflow_call: + inputs: + remote_name: + description: "The name of the Conan remote to use." + required: false + type: string + default: xrplf + remote_url: + description: "The URL of the Conan endpoint to use." + required: false + type: string + default: https://conan.ripplex.io + + secrets: + remote_username: + description: "The username for logging into the Conan remote." + required: true + remote_password: + description: "The password for logging into the Conan remote." + required: true + + outputs: + recipe_ref: + description: "The Conan recipe reference ('name/version') that was uploaded." + value: ${{ jobs.upload.outputs.ref }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-upload-recipe + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + upload: + runs-on: ubuntu-latest + container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158 + steps: + - name: Checkout repository + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + + - name: Generate build version number + id: version + uses: ./.github/actions/generate-version + + - name: Determine recipe reference + id: ref + run: echo "ref=xrpl/${{ steps.version.outputs.version }}" >> "${GITHUB_OUTPUT}" + + - name: Set up Conan + uses: ./.github/actions/setup-conan + with: + remote_name: ${{ inputs.remote_name }} + remote_url: ${{ inputs.remote_url }} + + - name: Log into Conan remote + env: + REMOTE_NAME: ${{ inputs.remote_name }} + REMOTE_USERNAME: ${{ inputs.remote_username }} + REMOTE_PASSWORD: ${{ inputs.remote_password }} + run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}" + + - name: Upload Conan recipe + env: + RECIPE_REF: ${{ steps.ref.outputs.ref }} + REMOTE_NAME: ${{ inputs.remote_name }} + run: | + conan export . + conan upload --confirm --check --remote="${REMOTE_NAME}" ${RECIPE_REF} + + outputs: + ref: ${{ steps.ref.outputs.ref }} diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 29ae95fce5..711354d490 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -86,8 +86,8 @@ jobs: - name: Setup Conan uses: ./.github/actions/setup-conan with: - conan_remote_name: ${{ env.CONAN_REMOTE_NAME }} - conan_remote_url: ${{ env.CONAN_REMOTE_URL }} + remote_name: ${{ env.CONAN_REMOTE_NAME }} + remote_url: ${{ env.CONAN_REMOTE_URL }} - name: Build dependencies uses: ./.github/actions/build-deps From 4cd6cc3e01eac7c6437163cfe2173739fbc2e35f Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 21 Jan 2026 23:52:22 +0000 Subject: [PATCH 47/62] fix: Include `` header in `Number.h` (#6254) The `Number.h` header file now has `std::reference_wrapper` from ``, but the include is missing, causing downstream build problems. This change adds the header. --- include/xrpl/basics/Number.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index d1ef749784..2f467fb036 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include From 4fd4e93b3ec3774d5d22c41ef8d98457f2107e04 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 21 Jan 2026 19:17:05 -0500 Subject: [PATCH 48/62] ci: Add missing commit hash to Conan recipe version (#6256) During several iterations of development of https://github.com/XRPLF/rippled/pull/6235, the commit hash was supposed to be moved into the `run:` statement, but it slipped through the cracks and did not get added. This change adds the commit hash as suffix to the Conan recipe version. --- .github/actions/generate-version/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/generate-version/action.yml b/.github/actions/generate-version/action.yml index f0a63f02df..4f176fcb91 100644 --- a/.github/actions/generate-version/action.yml +++ b/.github/actions/generate-version/action.yml @@ -31,7 +31,8 @@ runs: fi echo 'Appending shortened commit hash to version.' - VERSION="${VERSION}-${COMMIT_HASH:0:7}" + SHA='${{ github.sha }}' + VERSION="${VERSION}-${SHA:0:7}" echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" From 211054baff6a344b8eda65c07b6a25dba8f42284 Mon Sep 17 00:00:00 2001 From: David Fuelling Date: Wed, 21 Jan 2026 17:55:56 -0700 Subject: [PATCH 49/62] docs: Update Ripple Bug Bounty public key (#6258) The Ripple Bug Bounty program recently changed the public keys that security researchers can use to encrypt vulnerabilities and messages for submission to the program. This information was updated on https://ripple.com/legal/bug-bounty/ and this PR updates the `SECURITY.md` to align. --- SECURITY.md | 113 ++++++++++++++++++++++++---------------------------- 1 file changed, 51 insertions(+), 62 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 18eec312ed..1be412ae2a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -78,72 +78,61 @@ To report a qualifying bug, please send a detailed report to: | Email Address | bugs@ripple.com | | :-----------: | :-------------------------------------------------- | -| Short Key ID | `0xC57929BE` | -| Long Key ID | `0xCD49A0AFC57929BE` | -| Fingerprint | `24E6 3B02 37E0 FA9C 5E96 8974 CD49 A0AF C579 29BE` | +| Short Key ID | `0xA9F514E0` | +| Long Key ID | `0xD900855AA9F514E0` | +| Fingerprint | `B72C 0654 2F2A E250 2763 A268 D900 855A A9F5 14E0` | The full PGP key for this address, which is also available on several key servers (e.g. on [keyserver.ubuntu.com](https://keyserver.ubuntu.com)), is: ``` -----BEGIN PGP PUBLIC KEY BLOCK----- -mQINBFUwGHYBEAC0wpGpBPkd8W1UdQjg9+cEFzeIEJRaoZoeuJD8mofwI5Ejnjdt -kCpUYEDal0ygkKobu8SzOoATcDl18iCrScX39VpTm96vISFZMhmOryYCIp4QLJNN -4HKc2ZdBj6W4igNi6vj5Qo6JMyGpLY2mz4CZskbt0TNuUxWrGood+UrCzpY8x7/N -a93fcvNw+prgCr0rCH3hAPmAFfsOBbtGzNnmq7xf3jg5r4Z4sDiNIF1X1y53DAfV -rWDx49IKsuCEJfPMp1MnBSvDvLaQ2hKXs+cOpx1BCZgHn3skouEUxxgqbtTzBLt1 -xXpmuijsaltWngPnGO7mOAzbpZSdBm82/Emrk9bPMuD0QaLQjWr7HkTSUs6ZsKt4 -7CLPdWqxyY/QVw9UaxeHEtWGQGMIQGgVJGh1fjtUr5O1sC9z9jXcQ0HuIHnRCTls -GP7hklJmfH5V4SyAJQ06/hLuEhUJ7dn+BlqCsT0tLmYTgZYNzNcLHcqBFMEZHvHw -9GENMx/tDXgajKql4bJnzuTK0iGU/YepanANLd1JHECJ4jzTtmKOus9SOGlB2/l1 -0t0ADDYAS3eqOdOcUvo9ElSLCI5vSVHhShSte/n2FMWU+kMUboTUisEG8CgQnrng -g2CvvQvqDkeOtZeqMcC7HdiZS0q3LJUWtwA/ViwxrVlBDCxiTUXCotyBWwARAQAB -tDBSaXBwbGUgTGFicyBCdWcgQm91bnR5IFByb2dyYW0gPGJ1Z3NAcmlwcGxlLmNv -bT6JAjcEEwEKACEFAlUwGHYCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQ -zUmgr8V5Kb6R0g//SwY/mVJY59k87iL26/KayauSoOcz7xjcST26l4ZHVVX85gOY -HYZl8k0+m8X3zxeYm9a3QAoAml8sfoaFRFQP8ynnefRrLUPaZ2MjbJ0SACMwZNef -T6o7Mi8LBAaiNZdYVyIfX1oM6YXtqYkuJdav6ZCyvVYqc9OvMJPY2ZzJYuI/ZtvQ -/lTndxCeg9ALNX/iezOLGdfMpf4HuIFVwcPPlwGi+HDlB9/bggDEHC8z434SXVFc -aQatXAPcDkjMUweU7y0CZtYEj00HITd4pSX6MqGiHrxlDZTqinCOPs1Ieqp7qufs -MzlM6irLGucxj1+wa16ieyYvEtGaPIsksUKkywx0O7cf8N2qKg+eIkUk6O0Uc6eO -CszizmiXIXy4O6OiLlVHGKkXHMSW9Nwe9GE95O8G9WR8OZCEuDv+mHPAutO+IjdP -PDAAUvy+3XnkceO+HGWRpVvJZfFP2YH4A33InFL5yqlJmSoR/yVingGLxk55bZDM -+HYGR3VeMb8Xj1rf/02qERsZyccMCFdAvKDbTwmvglyHdVLu5sPmktxbBYiemfyJ -qxMxmYXCc9S0hWrWZW7edktBa9NpE58z1mx+hRIrDNbS2sDHrib9PULYCySyVYcF -P+PWEe1CAS5jqkR2ker5td2/pHNnJIycynBEs7l6zbc9fu+nktFJz0q2B+GJAhwE -EAEKAAYFAlUwGaQACgkQ+tiY1qQ2QkjMFw//f2hNY3BPNe+1qbhzumMDCnbTnGif -kLuAGl9OKt81VHG1f6RnaGiLpR696+6Ja45KzH15cQ5JJl5Bgs1YkR/noTGX8IAD -c70eNwiFu8JXTaaeeJrsmFkF9Tueufb364risYkvPP8tNUD3InBFEZT3WN7JKwix -coD4/BwekUwOZVDd/uCFEyhlhZsROxdKNisNo3VtAq2s+3tIBAmTrriFUl0K+ZC5 -zgavcpnPN57zMtW9aK+VO3wXqAKYLYmtgxkVzSLUZt2M7JuwOaAdyuYWAneKZPCu -1AXkmyo+d84sd5mZaKOr5xArAFiNMWPUcZL4rkS1Fq4dKtGAqzzR7a7hWtA5o27T -6vynuxZ1n0PPh0er2O/zF4znIjm5RhTlfjp/VmhZdQfpulFEQ/dMxxGkQ9z5IYbX -mTlSDbCSb+FMsanRBJ7Drp5EmBIudVGY6SHI5Re1RQiEh7GoDfUMUwZO+TVDII5R -Ra7WyuimYleJgDo/+7HyfuIyGDaUCVj6pwVtYtYIdOI3tTw1R1Mr0V8yaNVnJghL -CHcEJQL+YHSmiMM3ySil3O6tm1By6lFz8bVe/rgG/5uklQrnjMR37jYboi1orCC4 -yeIoQeV0ItlxeTyBwYIV/o1DBNxDevTZvJabC93WiGLw2XFjpZ0q/9+zI2rJUZJh -qxmKP+D4e27lCI65Ag0EVTAYdgEQAMvttYNqeRNBRpSX8fk45WVIV8Fb21fWdwk6 -2SkZnJURbiC0LxQnOi7wrtii7DeFZtwM2kFHihS1VHekBnIKKZQSgGoKuFAQMGyu -a426H4ZsSmA9Ufd7kRbvdtEcp7/RTAanhrSL4lkBhaKJrXlxBJ27o3nd7/rh7r3a -OszbPY6DJ5bWClX3KooPTDl/RF2lHn+fweFk58UvuunHIyo4BWJUdilSXIjLun+P -Qaik4ZAsZVwNhdNz05d+vtai4AwbYoO7adboMLRkYaXSQwGytkm+fM6r7OpXHYuS -cR4zB/OK5hxCVEpWfiwN71N2NMvnEMaWd/9uhqxJzyvYgkVUXV9274TUe16pzXnW -ZLfmitjwc91e7mJBBfKNenDdhaLEIlDRwKTLj7k58f9srpMnyZFacntu5pUMNblB -cjXwWxz5ZaQikLnKYhIvrIEwtWPyjqOzNXNvYfZamve/LJ8HmWGCKao3QHoAIDvB -9XBxrDyTJDpxbog6Qu4SY8AdgVlan6c/PsLDc7EUegeYiNTzsOK+eq3G5/E92eIu -TsUXlciypFcRm1q8vLRr+HYYe2mJDo4GetB1zLkAFBcYJm/x9iJQbu0hn5NxJvZO -R0Y5nOJQdyi+muJzKYwhkuzaOlswzqVXkq/7+QCjg7QsycdcwDjiQh3OrsgXHrwl -M7gyafL9ABEBAAGJAh8EGAEKAAkFAlUwGHYCGwwACgkQzUmgr8V5Kb50BxAAhj9T -TwmNrgRldTHszj+Qc+v8RWqV6j+R+zc0cn5XlUa6XFaXI1OFFg71H4dhCPEiYeN0 -IrnocyMNvCol+eKIlPKbPTmoixjQ4udPTR1DC1Bx1MyW5FqOrsgBl5t0e1VwEViM -NspSStxu5Hsr6oWz2GD48lXZWJOgoL1RLs+uxjcyjySD/em2fOKASwchYmI+ezRv -plfhAFIMKTSCN2pgVTEOaaz13M0U+MoprThqF1LWzkGkkC7n/1V1f5tn83BWiagG -2N2Q4tHLfyouzMUKnX28kQ9sXfxwmYb2sA9FNIgxy+TdKU2ofLxivoWT8zS189z/ -Yj9fErmiMjns2FzEDX+bipAw55X4D/RsaFgC+2x2PDbxeQh6JalRA2Wjq32Ouubx -u+I4QhEDJIcVwt9x6LPDuos1F+M5QW0AiUhKrZJ17UrxOtaquh/nPUL9T3l2qPUn -1ChrZEEEhHO6vA8+jn0+cV9n5xEz30Str9iHnDQ5QyR5LyV4UBPgTdWyQzNVKA69 -KsSr9lbHEtQFRzGuBKwt6UlSFv9vPWWJkJit5XDKAlcKuGXj0J8OlltToocGElkF -+gEBZfoOWi/IBjRLrFW2cT3p36DTR5O1Ud/1DLnWRqgWNBLrbs2/KMKE6EnHttyD -7Tz8SQkuxltX/yBXMV3Ddy0t6nWV2SZEfuxJAQI= -=spg4 +mQINBGkSZAQBEACprU199OhgdsOsygNjiQV4msuN3vDOUooehL+NwfsGfW79Tbqq +Q2u7uQ3NZjW+M2T4nsDwuhkr7pe7xSReR5W8ssaczvtUyxkvbMClilcgZ2OSCAuC +N9tzJsqOqkwBvXoNXkn//T2jnPz0ZU2wSF+NrEibq5FeuyGdoX3yXXBxq9pW9HzK +HkQll63QSl6BzVSGRQq+B6lGgaZGLwf3mzmIND9Z5VGLNK2jKynyz9z091whNG/M +kV+E7/r/bujHk7WIVId07G5/COTXmSr7kFnNEkd2Umw42dkgfiNKvlmJ9M7c1wLK +KbL9Eb4ADuW6rRc5k4s1e6GT8R4/VPliWbCl9SE32hXH8uTkqVIFZP2eyM5WRRHs +aKzitkQG9UK9gcb0kdgUkxOvvgPHAe5IuZlcHFzU4y0dBbU1VEFWVpiLU0q+IuNw +5BRemeHc59YNsngkmAZ+/9zouoShRusZmC8Wzotv75C2qVBcjijPvmjWAUz0Zunm +Lsr+O71vqHE73pERjD07wuD/ISjiYRYYE/bVrXtXLZijC7qAH4RE3nID+2ojcZyO +/2jMQvt7un56RsGH4UBHi3aBHi9bUoDGCXKiQY981cEuNaOxpou7Mh3x/ONzzSvk +sTV6nl1LOZHykN1JyKwaNbTSAiuyoN+7lOBqbV04DNYAHL88PrT21P83aQARAQAB +tB1SaXBwbGUgTGFicyA8YnVnc0ByaXBwbGUuY29tPokCTgQTAQgAOBYhBLcsBlQv +KuJQJ2OiaNkAhVqp9RTgBQJpEmQEAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA +AAoJENkAhVqp9RTgBzgP/i7y+aDWl1maig1XMdyb+o0UGusumFSW4Hmj278wlKVv +usgLPihYgHE0PKrv6WRyKOMC1tQEcYYN93M+OeQ1vFhS2YyURq6RCMmh4zq/awXG +uZbG36OURB5NH8lGBOHiN/7O+nY0CgenBT2JWm+GW3nEOAVOVm4+r5GlpPlv+Dp1 +NPBThcKXFMnH73++NpSQoDzTfRYHPxhDAX3jkLi/moXfSanOLlR6l94XNNN0jBHW +Quao0rzf4WSXq9g6AS224xhAA5JyIcFl8TX7hzj5HaFn3VWo3COoDu4U7H+BM0fl +85yqiMQypp7EhN2gxpMMWaHY5TFM85U/bFXFYfEgihZ4/gt4uoIzsNI9jlX7mYvG +KFdDij+oTlRsuOxdIy60B3dKcwOH9nZZCz0SPsN/zlRWgKzK4gDKdGhFkU9OlvPu +94ZqscanoiWKDoZkF96+sjgfjkuHsDK7Lwc1Xi+T4drHG/3aVpkYabXox+lrKB/S +yxZjeqOIQzWPhnLgCaLyvsKo5hxKzL0w3eURu8F3IS7RgOOlljv4M+Me9sEVcdNV +aN3/tQwbaomSX1X5D5YXqhBwC3rU3wXwamsscRTGEpkV+JCX6KUqGP7nWmxCpAly +FL05XuOd5SVHJjXLeuje0JqLUpN514uL+bThWwDbDTdAdwW3oK/2WbXz7IfJRLBj +uQINBGkSZAQBEADdI3SL2F72qkrgFqXWE6HSRBu9bsAvTE5QrRPWk7ux6at537r4 +S4sIw2dOwLvbyIrDgKNq3LQ5wCK88NO/NeCOFm4AiCJSl3pJHXYnTDoUxTrrxx+o +vSRI4I3fHEql/MqzgiAb0YUezjgFdh3vYheMPp/309PFbOLhiFqEcx80Mx5h06UH +gDzu1qNj3Ec+31NLic5zwkrAkvFvD54d6bqYR3SEgMau6aYEewpGHbWBi2pLqSi2 +lQcAeOFixqGpTwDmAnYR8YtjBYepy0MojEAdTHcQQlOYSDk4q4elG+io2N8vECfU +rD6ORecN48GXdZINYWTAdslrUeanmBdgQrYkSpce8TSghgT9P01SNaXxmyaehVUO +lqI4pcg5G2oojAE8ncNS3TwDtt7daTaTC3bAdr4PXDVAzNAiewjMNZPB7xidkDGQ +Y4W1LxTMXyJVWxehYOH7tsbBRKninlfRnLgYzmtIbNRAAvNcsxU6ihv3AV0WFknN +YbSzotEv1Xq/5wk309x8zCDe+sP0cQicvbXafXmUzPAZzeqFg+VLFn7F9MP1WGlW +B1u7VIvBF1Mp9Nd3EAGBAoLRdRu+0dVWIjPTQuPIuD9cCatJA0wVaKUrjYbBMl88 +a12LixNVGeSFS9N7ADHx0/o7GNT6l88YbaLP6zggUHpUD/bR+cDN7vllIQARAQAB +iQI2BBgBCAAgFiEEtywGVC8q4lAnY6Jo2QCFWqn1FOAFAmkSZAQCGwwACgkQ2QCF +Wqn1FOAfAA/8CYq4p0p4bobY20CKEMsZrkBTFJyPDqzFwMeTjgpzqbD7Y3Qq5QCK +OBbvY02GWdiIsNOzKdBxiuam2xYP9WHZj4y7/uWEvT0qlPVmDFu+HXjoJ43oxwFd +CUp2gMuQ4cSL3X94VRJ3BkVL+tgBm8CNY0vnTLLOO3kum/R69VsGJS1JSGUWjNM+ +4qwS3mz+73xJu1HmERyN2RZF/DGIZI2PyONQQ6aH85G1Dd2ohu2/DBAkQAMBrPbj +FrbDaBLyFhODxU3kTWqnfLlaElSm2EGdIU2yx7n4BggEa//NZRMm5kyeo4vzhtlQ +YIVUMLAOLZvnEqDnsLKp+22FzNR/O+htBQC4lPywl53oYSALdhz1IQlcAC1ru5KR +XPzhIXV6IIzkcx9xNkEclZxmsuy5ERXyKEmLbIHAlzFmnrldlt2ZgXDtzaorLmxj +klKibxd5tF50qOpOivz+oPtFo7n+HmFa1nlVAMxlDCUdM0pEVeYDKI5zfVwalyhZ +NnjpakdZSXMwgc7NP/hH9buF35hKDp7EckT2y3JNYwHsDdy1icXN2q40XZw5tSIn +zkPWdu3OUY8PISohN6Pw4h0RH4ZmoX97E8sEfmdKaT58U4Hf2aAv5r9IWCSrAVqY +u5jvac29CzQR9Kal0A+8phHAXHNFD83SwzIC0syaT9ficAguwGH8X6Q= +=nGuD -----END PGP PUBLIC KEY BLOCK----- ``` From 68c9d5ca0f5329a96aebce642687ae4e08644cf5 Mon Sep 17 00:00:00 2001 From: Valentin Balaschenko <13349202+vlntb@users.noreply.github.com> Date: Thu, 22 Jan 2026 13:19:29 +0000 Subject: [PATCH 50/62] refactor: Enforce 15-char limit and simplify labels for thread naming (#6212) This change continues the thread naming work from #5691 and #5758, which enables more useful lock contention profiling by ensuring threads/jobs have short, stable, human-readable names (rather than being truncated/failing due to OS limits). This changes diagnostic naming only (thread names and job/load-event labels), not behavior. Specific modifications are: * Shortens all thread/job names used with `beast::setCurrentThreadName`, so the effective Linux thread name stays within the 15-character limit. * Removes per-ledger sequence numbers from job/thread names to avoid long labels. This improves aggregation in lock contention profiling for short-lived job executions. --- src/libxrpl/beast/core/CurrentThreadName.cpp | 6 + src/libxrpl/core/detail/Job.cpp | 2 +- .../beast/beast_CurrentThreadName_test.cpp | 15 +-- src/test/core/Coroutine_test.cpp | 10 +- src/xrpld/app/consensus/RCLConsensus.cpp | 6 +- src/xrpld/app/consensus/RCLValidations.cpp | 12 +- src/xrpld/app/ledger/ConsensusTransSetSF.cpp | 2 +- src/xrpld/app/ledger/OrderBookDB.cpp | 6 +- src/xrpld/app/ledger/detail/InboundLedger.cpp | 2 +- .../app/ledger/detail/InboundLedgers.cpp | 4 +- .../app/ledger/detail/LedgerDeltaAcquire.cpp | 4 +- src/xrpld/app/ledger/detail/LedgerMaster.cpp | 12 +- .../app/ledger/detail/LedgerReplayTask.cpp | 2 +- .../app/ledger/detail/SkipListAcquire.cpp | 2 +- .../app/ledger/detail/TransactionAcquire.cpp | 4 +- src/xrpld/app/main/Main.cpp | 3 +- src/xrpld/app/main/NodeStoreScheduler.cpp | 5 +- src/xrpld/app/misc/NetworkOPs.cpp | 23 ++-- src/xrpld/overlay/detail/PeerImp.cpp | 118 ++++++++---------- src/xrpld/rpc/detail/RPCSub.cpp | 2 +- 20 files changed, 107 insertions(+), 133 deletions(-) diff --git a/src/libxrpl/beast/core/CurrentThreadName.cpp b/src/libxrpl/beast/core/CurrentThreadName.cpp index e8f7b629a7..34e8603afa 100644 --- a/src/libxrpl/beast/core/CurrentThreadName.cpp +++ b/src/libxrpl/beast/core/CurrentThreadName.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -95,6 +96,11 @@ setCurrentThreadNameImpl(std::string_view name) std::cerr << "WARNING: Thread name \"" << name << "\" (length " << name.size() << ") exceeds maximum of " << maxThreadNameLength << " characters on Linux.\n"; + + XRPL_ASSERT( + false, + "beast::detail::setCurrentThreadNameImpl : Thread name exceeds " + "maximum length for Linux"); } #endif } diff --git a/src/libxrpl/core/detail/Job.cpp b/src/libxrpl/core/detail/Job.cpp index 3968c3ede4..358441010b 100644 --- a/src/libxrpl/core/detail/Job.cpp +++ b/src/libxrpl/core/detail/Job.cpp @@ -41,7 +41,7 @@ Job::queue_time() const void Job::doJob() { - beast::setCurrentThreadName("doJob: " + mName); + beast::setCurrentThreadName("j:" + mName); m_loadEvent->start(); m_loadEvent->setName(mName); diff --git a/src/test/beast/beast_CurrentThreadName_test.cpp b/src/test/beast/beast_CurrentThreadName_test.cpp index dc12883a63..918d426979 100644 --- a/src/test/beast/beast_CurrentThreadName_test.cpp +++ b/src/test/beast/beast_CurrentThreadName_test.cpp @@ -88,20 +88,15 @@ public: BEAST_EXPECT(stateB == 2); } #if BOOST_OS_LINUX - // On Linux, verify that thread names longer than 15 characters - // are truncated to 15 characters (the 16th character is reserved for - // the null terminator). + // On Linux, verify that thread names within the 15 character limit + // are set correctly (the 16th character is reserved for the null + // terminator). { testName( "123456789012345", - "123456789012345"); // 15 chars, no truncation - testName( - "1234567890123456", "123456789012345"); // 16 chars, truncated - testName( - "ThisIsAVeryLongThreadNameExceedingLimit", - "ThisIsAVeryLong"); // 39 chars, truncated + "123456789012345"); // 15 chars, maximum allowed testName("", ""); // empty name - testName("short", "short"); // short name, no truncation + testName("short", "short"); // short name } #endif } diff --git a/src/test/core/Coroutine_test.cpp b/src/test/core/Coroutine_test.cpp index 72a4c02434..761fd46915 100644 --- a/src/test/core/Coroutine_test.cpp +++ b/src/test/core/Coroutine_test.cpp @@ -56,7 +56,7 @@ public: gate g1, g2; std::shared_ptr c; env.app().getJobQueue().postCoro( - jtCLIENT, "Coroutine-Test", [&](auto const& cr) { + jtCLIENT, "CoroTest", [&](auto const& cr) { c = cr; g1.signal(); c->yield(); @@ -83,7 +83,7 @@ public: gate g; env.app().getJobQueue().postCoro( - jtCLIENT, "Coroutine-Test", [&](auto const& c) { + jtCLIENT, "CoroTest", [&](auto const& c) { c->post(); c->yield(); g.signal(); @@ -109,7 +109,7 @@ public: BEAST_EXPECT(*lv == -1); gate g; - jq.addJob(jtCLIENT, "LocalValue-Test", [&]() { + jq.addJob(jtCLIENT, "LocalValTest", [&]() { this->BEAST_EXPECT(*lv == -1); *lv = -2; this->BEAST_EXPECT(*lv == -2); @@ -120,7 +120,7 @@ public: for (int i = 0; i < N; ++i) { - jq.postCoro(jtCLIENT, "Coroutine-Test", [&, id = i](auto const& c) { + jq.postCoro(jtCLIENT, "CoroTest", [&, id = i](auto const& c) { a[id] = c; g.signal(); c->yield(); @@ -148,7 +148,7 @@ public: c->join(); } - jq.addJob(jtCLIENT, "LocalValue-Test", [&]() { + jq.addJob(jtCLIENT, "LocalValTest", [&]() { this->BEAST_EXPECT(*lv == -2); g.signal(); }); diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 99cc140056..654c2a8990 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -119,9 +119,7 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& hash) acquiringLedger_ = hash; app_.getJobQueue().addJob( - jtADVANCE, - "getConsensusLedger1", - [id = hash, &app = app_, this]() { + jtADVANCE, "GetConsL1", [id = hash, &app = app_, this]() { JLOG(j_.debug()) << "JOB advanceLedger getConsensusLedger1 started"; app.getInboundLedgers().acquireAsync( @@ -420,7 +418,7 @@ RCLConsensus::Adaptor::onAccept( { app_.getJobQueue().addJob( jtACCEPT, - "acceptLedger", + "AcceptLedger", [=, this, cj = std::move(consensusJson)]() mutable { // Note that no lock is held or acquired during this job. // This is because generic Consensus guarantees that once a ledger diff --git a/src/xrpld/app/consensus/RCLValidations.cpp b/src/xrpld/app/consensus/RCLValidations.cpp index eb10765ba3..6438334106 100644 --- a/src/xrpld/app/consensus/RCLValidations.cpp +++ b/src/xrpld/app/consensus/RCLValidations.cpp @@ -122,13 +122,11 @@ RCLValidationsAdaptor::acquire(LedgerHash const& hash) Application* pApp = &app_; - app_.getJobQueue().addJob( - jtADVANCE, "getConsensusLedger2", [pApp, hash, this]() { - JLOG(j_.debug()) - << "JOB advanceLedger getConsensusLedger2 started"; - pApp->getInboundLedgers().acquireAsync( - hash, 0, InboundLedger::Reason::CONSENSUS); - }); + app_.getJobQueue().addJob(jtADVANCE, "GetConsL2", [pApp, hash, this]() { + JLOG(j_.debug()) << "JOB advanceLedger getConsensusLedger2 started"; + pApp->getInboundLedgers().acquireAsync( + hash, 0, InboundLedger::Reason::CONSENSUS); + }); return std::nullopt; } diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index b52cee2927..6678ee6334 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -46,7 +46,7 @@ ConsensusTransSetSF::gotNode( "xrpl::ConsensusTransSetSF::gotNode : transaction hash " "match"); auto const pap = &app_; - app_.getJobQueue().addJob(jtTRANSACTION, "TXS->TXN", [pap, stx]() { + app_.getJobQueue().addJob(jtTRANSACTION, "TxsToTxn", [pap, stx]() { pap->getOPs().submitTransaction(stx); }); } diff --git a/src/xrpld/app/ledger/OrderBookDB.cpp b/src/xrpld/app/ledger/OrderBookDB.cpp index 47b04f3d2c..5963c00c5a 100644 --- a/src/xrpld/app/ledger/OrderBookDB.cpp +++ b/src/xrpld/app/ledger/OrderBookDB.cpp @@ -48,9 +48,9 @@ OrderBookDB::setup(std::shared_ptr const& ledger) update(ledger); else app_.getJobQueue().addJob( - jtUPDATE_PF, - "OrderBookDB::update: " + std::to_string(ledger->seq()), - [this, ledger]() { update(ledger); }); + jtUPDATE_PF, "OrderBookUpd", [this, ledger]() { + update(ledger); + }); } } diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index 1f5e5cc7b6..710173cd17 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -454,7 +454,7 @@ InboundLedger::done() // We hold the PeerSet lock, so must dispatch app_.getJobQueue().addJob( - jtLEDGER_DATA, "AcquisitionDone", [self = shared_from_this()]() { + jtLEDGER_DATA, "AcqDone", [self = shared_from_this()]() { if (self->complete_ && !self->failed_) { self->app_.getLedgerMaster().checkAccept(self->getLedger()); diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 445786eb63..fd2cde698e 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -192,7 +192,7 @@ public: // dispatch if (ledger->gotData(std::weak_ptr(peer), packet)) app_.getJobQueue().addJob( - jtLEDGER_DATA, "processLedgerData", [ledger]() { + jtLEDGER_DATA, "ProcessLData", [ledger]() { ledger->runData(); }); @@ -207,7 +207,7 @@ public: if (packet->type() == protocol::liAS_NODE) { app_.getJobQueue().addJob( - jtLEDGER_DATA, "gotStaleData", [this, packet]() { + jtLEDGER_DATA, "GotStaleData", [this, packet]() { gotStaleData(packet); }); } diff --git a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp index 5b642ba3db..6909c45328 100644 --- a/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp +++ b/src/xrpld/app/ledger/detail/LedgerDeltaAcquire.cpp @@ -21,7 +21,7 @@ LedgerDeltaAcquire::LedgerDeltaAcquire( ledgerHash, LedgerReplayParameters::SUB_TASK_TIMEOUT, {jtREPLAY_TASK, - "LedgerReplayDelta", + "LedReplDelta", LedgerReplayParameters::MAX_QUEUED_TASKS}, app.journal("LedgerReplayDelta")) , inboundLedgers_(inboundLedgers) @@ -225,7 +225,7 @@ LedgerDeltaAcquire::onLedgerBuilt( } app_.getJobQueue().addJob( jtREPLAY_TASK, - "onLedgerBuilt", + "OnLedBuilt", [=, ledger = this->fullLedger_, &app = this->app_]() { for (auto reason : reasons) { diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index d176e85645..65421c9bd8 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -1344,7 +1344,7 @@ LedgerMaster::tryAdvance() if (!mAdvanceThread && !mValidLedger.empty()) { mAdvanceThread = true; - app_.getJobQueue().addJob(jtADVANCE, "advanceLedger", [this]() { + app_.getJobQueue().addJob(jtADVANCE, "AdvanceLedger", [this]() { std::unique_lock sl(m_mutex); XRPL_ASSERT( @@ -1482,7 +1482,7 @@ bool LedgerMaster::newPathRequest() { std::unique_lock ml(m_mutex); - mPathFindNewRequest = newPFWork("pf:newRequest", ml); + mPathFindNewRequest = newPFWork("PthFindNewReq", ml); return mPathFindNewRequest; } @@ -1503,7 +1503,7 @@ LedgerMaster::newOrderBookDB() std::unique_lock ml(m_mutex); mPathLedger.reset(); - return newPFWork("pf:newOBDB", ml); + return newPFWork("PthFindOBDB", ml); } /** A thread needs to be dispatched to handle pathfinding work of some kind. @@ -1841,7 +1841,7 @@ LedgerMaster::fetchForHistory( mFillInProgress = seq; } app_.getJobQueue().addJob( - jtADVANCE, "tryFill", [this, ledger]() { + jtADVANCE, "TryFill", [this, ledger]() { tryFill(ledger); }); } @@ -1980,7 +1980,7 @@ LedgerMaster::doAdvance(std::unique_lock& sl) } app_.getOPs().clearNeedNetworkLedger(); - progress = newPFWork("pf:newLedger", sl); + progress = newPFWork("PthFindNewLed", sl); } if (progress) mAdvanceWork = true; @@ -2011,7 +2011,7 @@ LedgerMaster::gotFetchPack(bool progress, std::uint32_t seq) { if (!mGotFetchPackThread.test_and_set(std::memory_order_acquire)) { - app_.getJobQueue().addJob(jtLEDGER_DATA, "gotFetchPack", [&]() { + app_.getJobQueue().addJob(jtLEDGER_DATA, "GotFetchPack", [&]() { app_.getInboundLedgers().gotFetchPack(); mGotFetchPackThread.clear(std::memory_order_release); }); diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index cd174b098f..c31aba6c43 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -77,7 +77,7 @@ LedgerReplayTask::LedgerReplayTask( parameter.finishHash_, LedgerReplayParameters::TASK_TIMEOUT, {jtREPLAY_TASK, - "LedgerReplayTask", + "LedReplTask", LedgerReplayParameters::MAX_QUEUED_TASKS}, app.journal("LedgerReplayTask")) , inboundLedgers_(inboundLedgers) diff --git a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp index 5f4b0dc339..09d0ba1ea6 100644 --- a/src/xrpld/app/ledger/detail/SkipListAcquire.cpp +++ b/src/xrpld/app/ledger/detail/SkipListAcquire.cpp @@ -16,7 +16,7 @@ SkipListAcquire::SkipListAcquire( ledgerHash, LedgerReplayParameters::SUB_TASK_TIMEOUT, {jtREPLAY_TASK, - "SkipListAcquire", + "SkipListAcq", LedgerReplayParameters::MAX_QUEUED_TASKS}, app.journal("LedgerReplaySkipList")) , inboundLedgers_(inboundLedgers) diff --git a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp index 3cd0e84ef0..6b22c6ca8b 100644 --- a/src/xrpld/app/ledger/detail/TransactionAcquire.cpp +++ b/src/xrpld/app/ledger/detail/TransactionAcquire.cpp @@ -27,7 +27,7 @@ TransactionAcquire::TransactionAcquire( app, hash, TX_ACQUIRE_TIMEOUT, - {jtTXN_DATA, "TransactionAcquire", {}}, + {jtTXN_DATA, "TxAcq", {}}, app.journal("TransactionAcquire")) , mHaveRoot(false) , mPeerSet(std::move(peerSet)) @@ -60,7 +60,7 @@ TransactionAcquire::done() // just updates the consensus and related structures when we acquire // a transaction set. No need to update them if we're shutting down. app_.getJobQueue().addJob( - jtTXN_DATA, "completeAcquire", [pap, hash, map]() { + jtTXN_DATA, "ComplAcquire", [pap, hash, map]() { pap->getInboundTransactions().giveSet(hash, map, true); }); } diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index 7c138168e4..d8bc601744 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -331,8 +331,7 @@ run(int argc, char** argv) { using namespace std; - beast::setCurrentThreadName( - "rippled: main " + BuildInfo::getVersionString()); + beast::setCurrentThreadName("main"); po::variables_map vm; diff --git a/src/xrpld/app/main/NodeStoreScheduler.cpp b/src/xrpld/app/main/NodeStoreScheduler.cpp index 221c1f098e..0e02a092f8 100644 --- a/src/xrpld/app/main/NodeStoreScheduler.cpp +++ b/src/xrpld/app/main/NodeStoreScheduler.cpp @@ -12,9 +12,8 @@ NodeStoreScheduler::scheduleTask(NodeStore::Task& task) if (jobQueue_.isStopped()) return; - if (!jobQueue_.addJob(jtWRITE, "NodeObject::store", [&task]() { - task.performScheduledTask(); - })) + if (!jobQueue_.addJob( + jtWRITE, "NObjStore", [&task]() { task.performScheduledTask(); })) { // Job not added, presumably because we're shutting down. // Recover by executing the task synchronously. diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 2422ec4ae6..696512b5f4 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -981,7 +981,7 @@ NetworkOPsImp::setHeartbeatTimer() heartbeatTimer_, mConsensus.parms().ledgerGRANULARITY, [this]() { - m_job_queue.addJob(jtNETOP_TIMER, "NetOPs.heartbeat", [this]() { + m_job_queue.addJob(jtNETOP_TIMER, "NetHeart", [this]() { processHeartbeatTimer(); }); }, @@ -997,7 +997,7 @@ NetworkOPsImp::setClusterTimer() clusterTimer_, 10s, [this]() { - m_job_queue.addJob(jtNETOP_CLUSTER, "NetOPs.cluster", [this]() { + m_job_queue.addJob(jtNETOP_CLUSTER, "NetCluster", [this]() { processClusterTimer(); }); }, @@ -1225,7 +1225,7 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) auto tx = std::make_shared(trans, reason, app_); - m_job_queue.addJob(jtTRANSACTION, "submitTxn", [this, tx]() { + m_job_queue.addJob(jtTRANSACTION, "SubmitTxn", [this, tx]() { auto t = tx; processTransaction(t, false, false, FailHard::no); }); @@ -1323,7 +1323,7 @@ NetworkOPsImp::doTransactionAsync( if (mDispatchState == DispatchState::none) { if (m_job_queue.addJob( - jtBATCH, "transactionBatch", [this]() { transactionBatch(); })) + jtBATCH, "TxBatchAsync", [this]() { transactionBatch(); })) { mDispatchState = DispatchState::scheduled; } @@ -1370,7 +1370,7 @@ NetworkOPsImp::doTransactionSyncBatch( if (mTransactions.size()) { // More transactions need to be applied, but by another job. - if (m_job_queue.addJob(jtBATCH, "transactionBatch", [this]() { + if (m_job_queue.addJob(jtBATCH, "TxBatchSync", [this]() { transactionBatch(); })) { @@ -3208,19 +3208,16 @@ NetworkOPsImp::reportFeeChange() if (f != mLastFeeSummary) { m_job_queue.addJob( - jtCLIENT_FEE_CHANGE, "reportFeeChange->pubServer", [this]() { - pubServer(); - }); + jtCLIENT_FEE_CHANGE, "PubFee", [this]() { pubServer(); }); } } void NetworkOPsImp::reportConsensusStateChange(ConsensusPhase phase) { - m_job_queue.addJob( - jtCLIENT_CONSENSUS, - "reportConsensusStateChange->pubConsensus", - [this, phase]() { pubConsensus(phase); }); + m_job_queue.addJob(jtCLIENT_CONSENSUS, "PubCons", [this, phase]() { + pubConsensus(phase); + }); } inline void @@ -3728,7 +3725,7 @@ NetworkOPsImp::addAccountHistoryJob(SubAccountHistoryInfoWeak subInfo) app_.getJobQueue().addJob( jtCLIENT_ACCT_HIST, - "AccountHistoryTxStream", + "HistTxStream", [this, dbType = databaseType, subInfo]() { auto const& accountId = subInfo.index_->accountId_; auto& lastLedgerSeq = subInfo.index_->historyLastLedgerSeq_; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index b64227288c..327a5a4f21 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -1158,7 +1158,7 @@ PeerImp::onMessage(std::shared_ptr const& m) fee_.update(Resource::feeModerateBurdenPeer, "oversize"); app_.getJobQueue().addJob( - jtMANIFEST, "receiveManifests", [this, that = shared_from_this(), m]() { + jtMANIFEST, "RcvManifests", [this, that = shared_from_this(), m]() { overlay_.onManifests(m, that); }); } @@ -1452,7 +1452,7 @@ PeerImp::handleTransaction( { app_.getJobQueue().addJob( jtTRANSACTION, - "recvTransaction->checkTransaction", + "RcvCheckTx", [weak = std::weak_ptr(shared_from_this()), flags, checkSignature, @@ -1555,7 +1555,7 @@ PeerImp::onMessage(std::shared_ptr const& m) // Queue a job to process the request std::weak_ptr weak = shared_from_this(); - app_.getJobQueue().addJob(jtLEDGER_REQ, "recvGetLedger", [weak, m]() { + app_.getJobQueue().addJob(jtLEDGER_REQ, "RcvGetLedger", [weak, m]() { if (auto peer = weak.lock()) peer->processLedgerRequest(m); }); @@ -1575,29 +1575,27 @@ PeerImp::onMessage(std::shared_ptr const& m) fee_.update( Resource::feeModerateBurdenPeer, "received a proof path request"); std::weak_ptr weak = shared_from_this(); - app_.getJobQueue().addJob( - jtREPLAY_REQ, "recvProofPathRequest", [weak, m]() { - if (auto peer = weak.lock()) + app_.getJobQueue().addJob(jtREPLAY_REQ, "RcvProofPReq", [weak, m]() { + if (auto peer = weak.lock()) + { + auto reply = + peer->ledgerReplayMsgHandler_.processProofPathRequest(m); + if (reply.has_error()) { - auto reply = - peer->ledgerReplayMsgHandler_.processProofPathRequest(m); - if (reply.has_error()) - { - if (reply.error() == protocol::TMReplyError::reBAD_REQUEST) - peer->charge( - Resource::feeMalformedRequest, - "proof_path_request"); - else - peer->charge( - Resource::feeRequestNoReply, "proof_path_request"); - } + if (reply.error() == protocol::TMReplyError::reBAD_REQUEST) + peer->charge( + Resource::feeMalformedRequest, "proof_path_request"); else - { - peer->send(std::make_shared( - reply, protocol::mtPROOF_PATH_RESPONSE)); - } + peer->charge( + Resource::feeRequestNoReply, "proof_path_request"); } - }); + else + { + peer->send(std::make_shared( + reply, protocol::mtPROOF_PATH_RESPONSE)); + } + } + }); } void @@ -1629,30 +1627,27 @@ PeerImp::onMessage(std::shared_ptr const& m) fee_.fee = Resource::feeModerateBurdenPeer; std::weak_ptr weak = shared_from_this(); - app_.getJobQueue().addJob( - jtREPLAY_REQ, "recvReplayDeltaRequest", [weak, m]() { - if (auto peer = weak.lock()) + app_.getJobQueue().addJob(jtREPLAY_REQ, "RcvReplDReq", [weak, m]() { + if (auto peer = weak.lock()) + { + auto reply = + peer->ledgerReplayMsgHandler_.processReplayDeltaRequest(m); + if (reply.has_error()) { - auto reply = - peer->ledgerReplayMsgHandler_.processReplayDeltaRequest(m); - if (reply.has_error()) - { - if (reply.error() == protocol::TMReplyError::reBAD_REQUEST) - peer->charge( - Resource::feeMalformedRequest, - "replay_delta_request"); - else - peer->charge( - Resource::feeRequestNoReply, - "replay_delta_request"); - } + if (reply.error() == protocol::TMReplyError::reBAD_REQUEST) + peer->charge( + Resource::feeMalformedRequest, "replay_delta_request"); else - { - peer->send(std::make_shared( - reply, protocol::mtREPLAY_DELTA_RESPONSE)); - } + peer->charge( + Resource::feeRequestNoReply, "replay_delta_request"); } - }); + else + { + peer->send(std::make_shared( + reply, protocol::mtREPLAY_DELTA_RESPONSE)); + } + } + }); } void @@ -1748,7 +1743,7 @@ PeerImp::onMessage(std::shared_ptr const& m) { std::weak_ptr weak{shared_from_this()}; app_.getJobQueue().addJob( - jtTXN_DATA, "recvPeerData", [weak, ledgerHash, m]() { + jtTXN_DATA, "RcvPeerData", [weak, ledgerHash, m]() { if (auto peer = weak.lock()) { peer->app_.getInboundTransactions().gotData( @@ -1876,7 +1871,7 @@ PeerImp::onMessage(std::shared_ptr const& m) std::weak_ptr weak = shared_from_this(); app_.getJobQueue().addJob( isTrusted ? jtPROPOSAL_t : jtPROPOSAL_ut, - "recvPropose->checkPropose", + "checkPropose", [weak, isTrusted, m, proposal]() { if (auto peer = weak.lock()) peer->checkPropose(isTrusted, m, proposal); @@ -2490,18 +2485,7 @@ PeerImp::onMessage(std::shared_ptr const& m) } else if (isTrusted || !app_.getFeeTrack().isLoadedLocal()) { - std::string const name = [isTrusted, val]() { - std::string ret = - isTrusted ? "Trusted validation" : "Untrusted validation"; - -#ifdef DEBUG - ret += " " + - std::to_string(val->getFieldU32(sfLedgerSequence)) + ": " + - to_string(val->getNodeID()); -#endif - - return ret; - }(); + std::string const name = isTrusted ? "ChkTrust" : "ChkUntrust"; std::weak_ptr weak = shared_from_this(); app_.getJobQueue().addJob( @@ -2561,11 +2545,10 @@ PeerImp::onMessage(std::shared_ptr const& m) } std::weak_ptr weak = shared_from_this(); - app_.getJobQueue().addJob( - jtREQUESTED_TXN, "doTransactions", [weak, m]() { - if (auto peer = weak.lock()) - peer->doTransactions(m); - }); + app_.getJobQueue().addJob(jtREQUESTED_TXN, "DoTxs", [weak, m]() { + if (auto peer = weak.lock()) + peer->doTransactions(m); + }); return; } @@ -2705,11 +2688,10 @@ PeerImp::onMessage(std::shared_ptr const& m) } std::weak_ptr weak = shared_from_this(); - app_.getJobQueue().addJob( - jtMISSING_TXN, "handleHaveTransactions", [weak, m]() { - if (auto peer = weak.lock()) - peer->handleHaveTransactions(m); - }); + app_.getJobQueue().addJob(jtMISSING_TXN, "HandleHaveTxs", [weak, m]() { + if (auto peer = weak.lock()) + peer->handleHaveTransactions(m); + }); } void diff --git a/src/xrpld/rpc/detail/RPCSub.cpp b/src/xrpld/rpc/detail/RPCSub.cpp index 616911fdfa..877b894885 100644 --- a/src/xrpld/rpc/detail/RPCSub.cpp +++ b/src/xrpld/rpc/detail/RPCSub.cpp @@ -72,7 +72,7 @@ public: JLOG(j_.info()) << "RPCCall::fromNetwork start"; mSending = m_jobQueue.addJob( - jtCLIENT_SUBSCRIBE, "RPCSub::sendThread", [this]() { + jtCLIENT_SUBSCRIBE, "RPCSubSendThr", [this]() { sendThread(); }); } From 8695313565188f549277ed418cc832af199671fb Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 22 Jan 2026 08:48:50 -0500 Subject: [PATCH 51/62] ci: Run on-trigger and on-pr when generate-version is modified (#6257) This change ensures that the `on-pr` and `on-trigger` workflows run when the generate-version action is modified. --- .github/workflows/on-pr.yml | 1 + .github/workflows/on-trigger.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 61639485d9..46f6b7500a 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -59,6 +59,7 @@ jobs: # Keep the paths below in sync with those in `on-trigger.yml`. .github/actions/build-deps/** .github/actions/build-test/** + .github/actions/generate-version/** .github/actions/setup-conan/** .github/scripts/strategy-matrix/** .github/workflows/reusable-build.yml diff --git a/.github/workflows/on-trigger.yml b/.github/workflows/on-trigger.yml index 7f54a9977e..210670f5a1 100644 --- a/.github/workflows/on-trigger.yml +++ b/.github/workflows/on-trigger.yml @@ -16,6 +16,7 @@ on: # Keep the paths below in sync with those in `on-pr.yml`. - ".github/actions/build-deps/**" - ".github/actions/build-test/**" + - ".github/actions/generate-version/**" - ".github/actions/setup-conan/**" - ".github/scripts/strategy-matrix/**" - ".github/workflows/reusable-build.yml" From a4f8aa623fe2fc20218644ce7a847fa70746b3b3 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 22 Jan 2026 16:16:18 +0000 Subject: [PATCH 52/62] chore: Detect uninitialized variables in CMake files (#6247) There were a few uninitialized variables in CMake files. This change will make sure we always check if a variable has been initialized before using them, or in come cases initialize them by default. This change will raise an error on CI if a developer introduced an uninitialized variable in CMake files. --- CMakeLists.txt | 4 +++- cmake/CompilationEnv.cmake | 6 ++++++ cmake/XrplCore.cmake | 8 ++++---- cmake/XrplInstall.cmake | 6 ++++++ cmake/XrplInterface.cmake | 13 +++++++++---- cmake/XrplSanitizers.cmake | 5 ++++- cmake/XrplSettings.cmake | 9 +++++---- 7 files changed, 37 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee0484e79d..c24b27adb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,9 @@ if(POLICY CMP0077) endif() # Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows. -file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH) +if(DEFINED CMAKE_MODULE_PATH) + file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH) +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") project(xrpl) diff --git a/cmake/CompilationEnv.cmake b/cmake/CompilationEnv.cmake index 345e4cdd62..2d97f94615 100644 --- a/cmake/CompilationEnv.cmake +++ b/cmake/CompilationEnv.cmake @@ -13,6 +13,7 @@ include_guard(GLOBAL) set(is_clang FALSE) set(is_gcc FALSE) set(is_msvc FALSE) +set(is_xcode FALSE) if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # Clang or AppleClang set(is_clang TRUE) @@ -24,6 +25,11 @@ else() message(FATAL_ERROR "Unsupported C++ compiler: ${CMAKE_CXX_COMPILER_ID}") endif() +# Xcode generator detection +if(CMAKE_GENERATOR STREQUAL "Xcode") + set(is_xcode TRUE) +endif() + # -------------------------------------------------------------------- # Operating system detection diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 0689fbe7b6..2e50cd2f7a 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -32,14 +32,14 @@ target_protobuf_sources(xrpl.libpb xrpl/proto target_compile_options(xrpl.libpb PUBLIC - $<$:-wd4996> - $<$: + $<$:-wd4996> + $<$: --system-header-prefix="google/protobuf" -Wno-deprecated-dynamic-exception-spec > PRIVATE - $<$:-wd4065> - $<$>:-Wno-deprecated-declarations> + $<$:-wd4065> + $<$>:-Wno-deprecated-declarations> ) target_link_libraries(xrpl.libpb diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index 310436998d..0599a8268c 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -4,6 +4,12 @@ include(create_symbolic_link) +# If no suffix is defined for executables (e.g. Windows uses .exe but Linux +# and macOS use none), then explicitly set it to the empty string. +if(NOT DEFINED suffix) + set(suffix "") +endif() + install ( TARGETS common diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index 6e0203c099..f53b2dac26 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -4,6 +4,11 @@ include(CompilationEnv) +# Set defaults for optional variables to avoid uninitialized variable warnings +if(NOT DEFINED voidstar) + set(voidstar OFF) +endif() + add_library (opts INTERFACE) add_library (Xrpl::opts ALIAS opts) target_compile_definitions (opts @@ -52,7 +57,7 @@ add_library (xrpl_syslibs INTERFACE) add_library (Xrpl::syslibs ALIAS xrpl_syslibs) target_link_libraries (xrpl_syslibs INTERFACE - $<$: + $<$: legacy_stdio_definitions.lib Shlwapi kernel32 @@ -69,10 +74,10 @@ target_link_libraries (xrpl_syslibs odbccp32 crypt32 > - $<$>:dl> - $<$,$>>:rt>) + $<$>:dl> + $<$,$>>:rt>) -if (NOT MSVC) +if (NOT is_msvc) set (THREADS_PREFER_PTHREAD_FLAG ON) find_package (Threads) target_link_libraries (xrpl_syslibs INTERFACE Threads::Threads) diff --git a/cmake/XrplSanitizers.cmake b/cmake/XrplSanitizers.cmake index 050a5ef6f0..fc31e4a3ec 100644 --- a/cmake/XrplSanitizers.cmake +++ b/cmake/XrplSanitizers.cmake @@ -43,7 +43,10 @@ include(CompilationEnv) # Read environment variable -set(SANITIZERS $ENV{SANITIZERS}) +set(SANITIZERS "") +if(DEFINED ENV{SANITIZERS}) + set(SANITIZERS "$ENV{SANITIZERS}") +endif() # Set SANITIZERS_ENABLED flag for use in other modules if(SANITIZERS MATCHES "address|thread|undefinedbehavior") diff --git a/cmake/XrplSettings.cmake b/cmake/XrplSettings.cmake index 647e95837d..3724ea2b4f 100644 --- a/cmake/XrplSettings.cmake +++ b/cmake/XrplSettings.cmake @@ -4,10 +4,11 @@ include(CompilationEnv) -if("$ENV{CI}" STREQUAL "true" OR "$ENV{CONTINUOUS_INTEGRATION}" STREQUAL "true") - set(is_ci TRUE) -else() - set(is_ci FALSE) +set(is_ci FALSE) +if(DEFINED ENV{CI}) + if("$ENV{CI}" STREQUAL "true") + set(is_ci TRUE) + endif() endif() get_directory_property(has_parent PARENT_DIRECTORY) From 4e3f953fc49d832e18271be148d5c78118188fd3 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 22 Jan 2026 11:42:53 -0500 Subject: [PATCH 53/62] ci: Use plus instead of hyphen for Conan recipe version suffix (#6261) Conan recipes use semantic versioning, and since our version already contains a hyphen the second hyphen causes Conan to ignore it. The plus sign is a valid separator we can use instead, so this change uses a `+` to separate a version suffix (commit hash) instead of a `-`. --- .github/actions/generate-version/action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/generate-version/action.yml b/.github/actions/generate-version/action.yml index 4f176fcb91..6b84aac2f3 100644 --- a/.github/actions/generate-version/action.yml +++ b/.github/actions/generate-version/action.yml @@ -17,8 +17,10 @@ runs: VERSION: ${{ github.ref_name }} run: echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" - # When a tag is not pushed, then the version is extracted from the - # BuildInfo.cpp file and the shortened commit hash appended to it. + # When a tag is not pushed, then the version (e.g. 1.2.3-b0) is extracted + # from the BuildInfo.cpp file and the shortened commit hash appended to it. + # We use a plus sign instead of a hyphen because Conan recipe versions do + # not support two hyphens. - name: Generate version for non-tag event if: ${{ github.event_name != 'tag' }} shell: bash @@ -32,7 +34,7 @@ runs: echo 'Appending shortened commit hash to version.' SHA='${{ github.sha }}' - VERSION="${VERSION}-${SHA:0:7}" + VERSION="${VERSION}+${SHA:0:7}" echo "VERSION=${VERSION}" >> "${GITHUB_ENV}" From c57ffdbcb874db3a1c61c83cceda7faeef0a9008 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 22 Jan 2026 14:05:59 -0500 Subject: [PATCH 54/62] ci: Explicitly set version when exporting the Conan recipe (#6264) By default the Conan recipe extracts the version from `BuildInfo.cpp`, but in some of the cases we want to upload a recipe with a suffix derived from the commit hash. This currently then results in the uploading to fail, since there is a version mismatch. Here we explicitly set the version, and then simplify the steps in the upload workflow since we now need the recipe name (embedded within the conanfile.py but also needed when uploading), the recipe version, and the recipe ref (name/version). --- .github/workflows/reusable-upload-recipe.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/reusable-upload-recipe.yml b/.github/workflows/reusable-upload-recipe.yml index 9b25481f6a..b5b8798f09 100644 --- a/.github/workflows/reusable-upload-recipe.yml +++ b/.github/workflows/reusable-upload-recipe.yml @@ -49,10 +49,6 @@ jobs: id: version uses: ./.github/actions/generate-version - - name: Determine recipe reference - id: ref - run: echo "ref=xrpl/${{ steps.version.outputs.version }}" >> "${GITHUB_OUTPUT}" - - name: Set up Conan uses: ./.github/actions/setup-conan with: @@ -68,11 +64,10 @@ jobs: - name: Upload Conan recipe env: - RECIPE_REF: ${{ steps.ref.outputs.ref }} REMOTE_NAME: ${{ inputs.remote_name }} run: | - conan export . - conan upload --confirm --check --remote="${REMOTE_NAME}" ${RECIPE_REF} + conan export . --version=${{ steps.version.outputs.version }} + conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/${{ steps.version.outputs.version }} outputs: - ref: ${{ steps.ref.outputs.ref }} + ref: xrpl/${{ steps.version.outputs.version }} From 66158d786f309a64fc85a86eacf3c269c17eae28 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 22 Jan 2026 16:05:15 -0500 Subject: [PATCH 55/62] ci: Properly propagate Conan credentials (#6265) The export and upload steps were initially in a separate action, where GitHub Actions does not support the `secrets` keyword, but only `inputs` for the credentials. After they were moved to a reusable workflow, only part of the references to the credentials were updated. This change correctly references to the Conan credentials via `secrets` instead of `inputs`. --- .github/workflows/reusable-upload-recipe.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-upload-recipe.yml b/.github/workflows/reusable-upload-recipe.yml index b5b8798f09..156659392e 100644 --- a/.github/workflows/reusable-upload-recipe.yml +++ b/.github/workflows/reusable-upload-recipe.yml @@ -58,8 +58,8 @@ jobs: - name: Log into Conan remote env: REMOTE_NAME: ${{ inputs.remote_name }} - REMOTE_USERNAME: ${{ inputs.remote_username }} - REMOTE_PASSWORD: ${{ inputs.remote_password }} + REMOTE_USERNAME: ${{ secrets.remote_username }} + REMOTE_PASSWORD: ${{ secrets.remote_password }} run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}" - name: Upload Conan recipe From 0586b5678e6f4051f89402c7873a94a4c139a5f5 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 23 Jan 2026 06:40:55 -0500 Subject: [PATCH 56/62] ci: Pass missing sanitizers input to actions (#6266) The `upload-conan-deps` workflow that's triggered on push is supposed to upload the Conan dependencies to our remote, so future PR commits can pull those dependencies from the remote. However, as the `sanitize` argument is missing, it was building different dependencies than what the PRs are building for the asan/tsan/ubsan job, so the latter would not find anything in the remote that they could use. This change sets the missing `sanitizers` input variable when running the `build-deps` action. Separately, the `setup-conan` action showed the default profile, while we are using the `ci` profile. To ensure the profile is correctly printed when sanitizers are enabled, the environment variable the profile uses is set before calling the action. --- .github/actions/setup-conan/action.yml | 2 +- .github/workflows/reusable-build-test-config.yml | 2 ++ .github/workflows/upload-conan-deps.yml | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-conan/action.yml b/.github/actions/setup-conan/action.yml index 37956c5f21..9d834884d2 100644 --- a/.github/actions/setup-conan/action.yml +++ b/.github/actions/setup-conan/action.yml @@ -31,7 +31,7 @@ runs: conan config install conan/profiles/ -tf $(conan config home)/profiles/ echo 'Conan profile:' - conan profile show + conan profile show --profile ci - name: Set up Conan remote shell: bash diff --git a/.github/workflows/reusable-build-test-config.yml b/.github/workflows/reusable-build-test-config.yml index b8c82aa94d..d298c85726 100644 --- a/.github/workflows/reusable-build-test-config.yml +++ b/.github/workflows/reusable-build-test-config.yml @@ -125,6 +125,8 @@ jobs: subtract: ${{ inputs.nproc_subtract }} - name: Setup Conan + env: + SANITIZERS: ${{ inputs.sanitizers }} uses: ./.github/actions/setup-conan - name: Build dependencies diff --git a/.github/workflows/upload-conan-deps.yml b/.github/workflows/upload-conan-deps.yml index 711354d490..2dada1ef08 100644 --- a/.github/workflows/upload-conan-deps.yml +++ b/.github/workflows/upload-conan-deps.yml @@ -84,6 +84,8 @@ jobs: subtract: ${{ env.NPROC_SUBTRACT }} - name: Setup Conan + env: + SANITIZERS: ${{ matrix.sanitizers }} uses: ./.github/actions/setup-conan with: remote_name: ${{ env.CONAN_REMOTE_NAME }} @@ -98,6 +100,7 @@ jobs: # Set the verbosity to "quiet" for Windows to avoid an excessive # amount of logs. For other OSes, the "verbose" logs are more useful. log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }} + sanitizers: ${{ matrix.sanitizers }} - name: Log into Conan remote if: ${{ github.repository_owner == 'XRPLF' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }} From 778da954b4c38274fce90fef6e876fa0cc207eb9 Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 23 Jan 2026 14:09:00 -0500 Subject: [PATCH 57/62] refactor: clean up uses of `std::source_location` (#6272) Since the minimum Clang version we support is 16, the checks for version < 15 are no longer necessary. This change therefore removes the macros checking if the clang version is < 15 and simplifies uses of `std::source_location`. --- src/test/jtx/TestHelpers.h | 11 ++--------- src/test/rpc/LedgerEntry_test.cpp | 16 +++++----------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 3096a902b1..8149c2d464 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -15,15 +15,8 @@ #include #include -#include - -#if (defined(__clang_major__) && __clang_major__ < 15) -#include -using source_location = std::experimental::source_location; -#else #include -using std::source_location; -#endif +#include namespace xrpl { namespace test { @@ -640,7 +633,7 @@ checkMetrics( std::size_t expectedPerLedger, std::uint64_t expectedMinFeeLevel = baseFeeLevel.fee(), std::uint64_t expectedMedFeeLevel = minEscalationFeeLevel.fee(), - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { int line = location.line(); char const* file = location.file_name(); diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 1b7079341c..cc6d958a2d 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -14,13 +14,7 @@ #include #include -#if (defined(__clang_major__) && __clang_major__ < 15) -#include -using source_location = std::experimental::source_location; -#else #include -using std::source_location; -#endif namespace xrpl { namespace test { @@ -114,7 +108,7 @@ class LedgerEntry_test : public beast::unit_test::suite Json::Value const& jv, std::string const& err, std::string const& msg, - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { if (BEAST_EXPECT(jv.isMember(jss::status))) BEAST_EXPECTS( @@ -297,7 +291,7 @@ class LedgerEntry_test : public beast::unit_test::suite FieldType const typeID, std::string const& expectedError, bool required = true, - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { forAllApiVersions([&, this](unsigned apiVersion) { if (required) @@ -350,7 +344,7 @@ class LedgerEntry_test : public beast::unit_test::suite FieldType typeID, std::string const& expectedError, bool required = true, - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { forAllApiVersions([&, this](unsigned apiVersion) { if (required) @@ -407,7 +401,7 @@ class LedgerEntry_test : public beast::unit_test::suite runLedgerEntryTest( test::jtx::Env& env, Json::StaticString const& parentField, - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { testMalformedField( env, @@ -431,7 +425,7 @@ class LedgerEntry_test : public beast::unit_test::suite test::jtx::Env& env, Json::StaticString const& parentField, std::vector const& subfields, - source_location const location = source_location::current()) + std::source_location const location = std::source_location::current()) { testMalformedField( env, From 847e87563571ea88333f9440bba1df5cd9443110 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 26 Jan 2026 18:54:43 +0000 Subject: [PATCH 58/62] refactor: Update Boost to 1.90 (#6280) Upcoming feature work requires functionality present in a newer Boost version. These newer versions also have improvements for sanitizers. --- BUILD.md | 4 ++-- cmake/deps/Boost.cmake | 1 - conan.lock | 14 +++++++++----- conanfile.py | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/BUILD.md b/BUILD.md index b239b10be6..f90aa0c148 100644 --- a/BUILD.md +++ b/BUILD.md @@ -148,8 +148,8 @@ function extract_version { } # Define which recipes to export. -recipes=('ed25519' 'grpc' 'openssl' 'secp256k1' 'snappy' 'soci') -folders=('all' 'all' '3.x.x' 'all' 'all' 'all') +recipes=('ed25519' 'grpc' 'nudb' 'openssl' 'secp256k1' 'snappy' 'soci') +folders=('all' 'all' 'all' '3.x.x' 'all' 'all' 'all') # Selectively check out the recipes from our CCI fork. cd external diff --git a/cmake/deps/Boost.cmake b/cmake/deps/Boost.cmake index b73698efd8..49025ae342 100644 --- a/cmake/deps/Boost.cmake +++ b/cmake/deps/Boost.cmake @@ -30,7 +30,6 @@ target_link_libraries(xrpl_boost Boost::process Boost::program_options Boost::regex - Boost::system Boost::thread) if(Boost_COMPILER) target_link_libraries(xrpl_boost INTERFACE Boost::disable_autolinking) diff --git a/conan.lock b/conan.lock index f3fa1e5f6e..64def2e916 100644 --- a/conan.lock +++ b/conan.lock @@ -11,7 +11,7 @@ "re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103", "protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038", "openssl/3.5.4#1b986e61b38fdfda3b40bebc1b234393%1768312656.257", - "nudb/2.0.9#fb8dfd1a5557f5e0528114c2da17721e%1765850143.957", + "nudb/2.0.9#0432758a24204da08fee953ec9ea03cb%1769436073.32", "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914", "libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492", "libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03", @@ -23,7 +23,7 @@ "date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772", "c-ares/1.34.5#5581c2b62a608b40bb85d965ab3ec7c8%1765850144.336", "bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837", - "boost/1.88.0#8852c0b72ce8271fb8ff7c53456d4983%1765850172.862", + "boost/1.90.0#d5e8defe7355494953be18524a7f135b%1765955095.179", "abseil/20250127.0#99262a368bd01c0ccca8790dfced9719%1766517936.993" ], "build_requires": [ @@ -42,18 +42,22 @@ ], "python_requires": [], "overrides": { + "boost/1.90.0#d5e8defe7355494953be18524a7f135b": [ + null, + "boost/1.90.0" + ], "protobuf/5.27.0": [ "protobuf/6.32.1" ], "lz4/1.9.4": [ "lz4/1.10.0" ], - "boost/1.83.0": [ - "boost/1.88.0" - ], "sqlite3/3.44.2": [ "sqlite3/3.49.1" ], + "boost/1.83.0": [ + "boost/1.90.0" + ], "lz4/[>=1.9.4 <2]": [ "lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504" ] diff --git a/conanfile.py b/conanfile.py index 8501909ce3..84ef1e2aa7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -131,7 +131,7 @@ class Xrpl(ConanFile): transitive_headers_opt = ( {"transitive_headers": True} if conan_version.split(".")[0] == "2" else {} ) - self.requires("boost/1.88.0", force=True, **transitive_headers_opt) + self.requires("boost/1.90.0", force=True, **transitive_headers_opt) self.requires("date/3.0.4", **transitive_headers_opt) self.requires("lz4/1.10.0", force=True) self.requires("protobuf/6.32.1", force=True) From a2f1973574d4a370ffbbcad8e8d6590425657924 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Mon, 26 Jan 2026 15:58:12 -0400 Subject: [PATCH 59/62] fix: Remove DEFAULT fields that change to the default in associateAsset (#6259) (#6273) - Add Vault creation tests for showing valid range for AssetsMaximum --- include/xrpl/protocol/STObject.h | 3 + src/libxrpl/protocol/STAmount.cpp | 2 + src/libxrpl/protocol/STObject.cpp | 6 + src/libxrpl/protocol/STTakesAsset.cpp | 18 ++ src/test/app/Vault_test.cpp | 258 ++++++++++++++++++++++++++ 5 files changed, 287 insertions(+) diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index c6ca133e89..d282e9bf01 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -397,6 +397,9 @@ public: void delField(int index); + SOEStyle + getStyle(SField const& field) const; + bool hasMatchingEntry(STBase const&); diff --git a/src/libxrpl/protocol/STAmount.cpp b/src/libxrpl/protocol/STAmount.cpp index ec60971e63..91ad029dda 100644 --- a/src/libxrpl/protocol/STAmount.cpp +++ b/src/libxrpl/protocol/STAmount.cpp @@ -100,6 +100,8 @@ areComparable(STAmount const& v1, STAmount const& v2) return false; } +static_assert(INITIAL_XRP.drops() == STAmount::cMaxNativeN); + STAmount::STAmount(SerialIter& sit, SField const& name) : STBase(name) { std::uint64_t value = sit.get64(); diff --git a/src/libxrpl/protocol/STObject.cpp b/src/libxrpl/protocol/STObject.cpp index 6007753ed1..a45eb4b7c7 100644 --- a/src/libxrpl/protocol/STObject.cpp +++ b/src/libxrpl/protocol/STObject.cpp @@ -580,6 +580,12 @@ STObject::delField(int index) v_.erase(v_.begin() + index); } +SOEStyle +STObject::getStyle(SField const& field) const +{ + return mType ? mType->style(field) : soeINVALID; +} + unsigned char STObject::getFieldU8(SField const& field) const { diff --git a/src/libxrpl/protocol/STTakesAsset.cpp b/src/libxrpl/protocol/STTakesAsset.cpp index d43e7b04a1..9167c6ace0 100644 --- a/src/libxrpl/protocol/STTakesAsset.cpp +++ b/src/libxrpl/protocol/STTakesAsset.cpp @@ -18,10 +18,28 @@ associateAsset(SLE& sle, Asset const& asset) // If the field is not set or present, skip it. if (type == STI_NOTPRESENT) continue; + // If the type doesn't downcast, then the flag shouldn't be on the // SField auto& ta = entry.downcast(); + auto const style = sle.getStyle(ta.getFName()); + XRPL_ASSERT_PARTS( + style != soeINVALID, + "xrpl::associateAsset", + "valid template element style"); + + XRPL_ASSERT_PARTS( + style != soeDEFAULT || !ta.isDefault(), + "xrpl::associateAsset", + "non-default value"); ta.associateAsset(asset); + + // associateAsset in derived classes may change the underlying + // value, but it won't know anything about how the value relates to + // the SLE. If the template element is soeDEFAULT, and the value + // changed to the default value, remove the field. + if (style == soeDEFAULT && ta.isDefault()) + sle.makeFieldAbsent(field); } } } diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index 41a4fc2b3b..d8bfa71d46 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -5782,6 +5782,263 @@ class Vault_test : public beast::unit_test::suite testCase(MPT, "MPT", owner, depositor, issuer); } + void + testAssetsMaximum() + { + testcase("Assets Maximum"); + + using namespace test::jtx; + + Env env{*this, testable_amendments() | featureSingleAssetVault}; + Account const owner{"owner"}; + Account const issuer{"issuer"}; + + Vault vault{env}; + env.fund(XRP(1'000'000), issuer, owner); + env.close(); + + auto const maxInt64 = + std::to_string(std::numeric_limits::max()); + BEAST_EXPECT(maxInt64 == "9223372036854775807"); + + // Naming things is hard + auto const maxInt64Plus1 = std::to_string( + static_cast( + std::numeric_limits::max()) + + 1); + BEAST_EXPECT(maxInt64Plus1 == "9223372036854775808"); + + auto const initialXRP = to_string(INITIAL_XRP); + BEAST_EXPECT(initialXRP == "100000000000000000"); + + auto const initialXRPPlus1 = to_string(INITIAL_XRP + 1); + BEAST_EXPECT(initialXRPPlus1 == "100000000000000001"); + + { + testcase("Assets Maximum: XRP"); + + PrettyAsset const xrpAsset = xrpIssue(); + + auto [tx, keylet] = + vault.create({.owner = owner, .asset = xrpAsset}); + tx[sfData] = "4D65746144617461"; + + tx[sfAssetsMaximum] = maxInt64; + env(tx, ter(tefEXCEPTION), THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRPPlus1; + env(tx, ter(tefEXCEPTION), THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRP; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = maxInt64Plus1; + env(tx, ter(tefEXCEPTION), THISLINE); + env.close(); + + // This value will be rounded + auto const insertAt = maxInt64Plus1.size() - 3; + auto const decimalTest = maxInt64Plus1.substr(0, insertAt) + "." + + maxInt64Plus1.substr(insertAt); // (max int64+1) / 1000 + BEAST_EXPECT(decimalTest == "9223372036854775.808"); + tx[sfAssetsMaximum] = decimalTest; + auto const newKeylet = keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT(vaultSle->at(sfAssetsMaximum) == 9223372036854776); + } + + { + testcase("Assets Maximum: MPT"); + + PrettyAsset const mptAsset = [&]() { + MPTTester mptt{env, issuer, mptInitNoFund}; + mptt.create( + {.flags = + tfMPTCanClawback | tfMPTCanTransfer | tfMPTCanLock}); + env.close(); + PrettyAsset const mptAsset = mptt["MPT"]; + mptt.authorize({.account = owner}); + env.close(); + return mptAsset; + }(); + + env(pay(issuer, owner, mptAsset(100'000)), THISLINE); + env.close(); + + auto [tx, keylet] = + vault.create({.owner = owner, .asset = mptAsset}); + tx[sfData] = "4D65746144617461"; + + tx[sfAssetsMaximum] = maxInt64; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRPPlus1; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRP; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = maxInt64Plus1; + env(tx, ter(tefEXCEPTION), THISLINE); + env.close(); + + // This value will be rounded + auto const insertAt = maxInt64Plus1.size() - 1; + auto const decimalTest = maxInt64Plus1.substr(0, insertAt) + "." + + maxInt64Plus1.substr(insertAt); // (max int64+1) / 10 + BEAST_EXPECT(decimalTest == "922337203685477580.8"); + tx[sfAssetsMaximum] = decimalTest; + auto const newKeylet = keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT(vaultSle->at(sfAssetsMaximum) == 922337203685477581); + } + + { + testcase("Assets Maximum: IOU"); + + // Almost anything goes with IOUs + PrettyAsset iouAsset = issuer["IOU"]; + env.trust(iouAsset(1000), owner); + env(pay(issuer, owner, iouAsset(200))); + env.close(); + + auto [tx, keylet] = + vault.create({.owner = owner, .asset = iouAsset}); + tx[sfData] = "4D65746144617461"; + + tx[sfAssetsMaximum] = maxInt64; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRPPlus1; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = initialXRP; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = maxInt64Plus1; + env(tx, THISLINE); + env.close(); + + tx[sfAssetsMaximum] = "1000000000000000e80"; + env.close(); + + tx[sfAssetsMaximum] = "1000000000000000e-96"; + env.close(); + + // These values will be rounded to 15 significant digits + { + auto const insertAt = maxInt64Plus1.size() - 1; + auto const decimalTest = maxInt64Plus1.substr(0, insertAt) + + "." + maxInt64Plus1.substr(insertAt); // (max int64+1) / 10 + BEAST_EXPECT(decimalTest == "922337203685477580.8"); + tx[sfAssetsMaximum] = decimalTest; + auto const newKeylet = + keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT( + (vaultSle->at(sfAssetsMaximum) == + Number{9223372036854776, 2, Number::normalized{}})); + } + { + tx[sfAssetsMaximum] = + "9223372036854775807e40"; // max int64 * 10^40 + auto const newKeylet = + keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT( + (vaultSle->at(sfAssetsMaximum) == + Number{9223372036854776, 43, Number::normalized{}})); + } + { + tx[sfAssetsMaximum] = + "9223372036854775807e-40"; // max int64 * 10^-40 + auto const newKeylet = + keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT( + (vaultSle->at(sfAssetsMaximum) == + Number{9223372036854776, -37, Number::normalized{}})); + } + { + tx[sfAssetsMaximum] = + "9223372036854775807e-100"; // max int64 * 10^-100 + auto const newKeylet = + keylet::vault(owner.id(), env.seq(owner)); + env(tx, THISLINE); + env.close(); + + // Field 'AssetsMaximum' may not be explicitly set to default. + auto const vaultSle = env.le(newKeylet); + if (!BEAST_EXPECT(vaultSle)) + return; + + BEAST_EXPECT(vaultSle->at(sfAssetsMaximum) == numZero); + } + + // What _can't_ IOUs do? + // 1. Exceed maximum exponent / offset + tx[sfAssetsMaximum] = "1000000000000000e81"; + env(tx, ter(tefEXCEPTION), THISLINE); + env.close(); + + // 2. Mantissa larger than uint64 max + try + { + tx[sfAssetsMaximum] = + "18446744073709551617e5"; // uint64 max + 1 + env(tx, THISLINE); + BEAST_EXPECT(false); + } + catch (parse_error const& e) + { + using namespace std::string_literals; + BEAST_EXPECT( + e.what() == + "invalidParamsField 'tx_json.AssetsMaximum' has invalid " + "data."s); + } + } + } + public: void run() override @@ -5802,6 +6059,7 @@ public: testDelegate(); testVaultClawbackBurnShares(); testVaultClawbackAssets(); + testAssetsMaximum(); } }; From bb529d03175fc988a9d7b593bf60e21b6803cbb7 Mon Sep 17 00:00:00 2001 From: Jingchen Date: Mon, 26 Jan 2026 21:39:28 +0000 Subject: [PATCH 60/62] fix: Stop embedded tests from hanging on ARM by using `atomic_flag` (#6248) This change replaces the mutex `stoppingMutex_`, the `atomic_bool` variable `isTimeToStop`, and the conditional variable `stoppingCondition_` with an `atomic_flag` variable. When `xrpld` is running the embedded tests as a child process, it has a control thread (the app bundle thread) that starts the application, and an application thread (the thread that executes `app_->run()`). Due to the relaxed memory ordering on ARM, it's not guaranteed that the application thread can see the change of the value resulting from the `isTimeToStop.exchange(true)` call before it is notified by `stoppingCondition_.notify_all()`, even though they do happen in the right order in the app bundle thread in `ApplicationImp::signalStop`. We therefore often get into the situation where `isTimeToStop` is `true`, but the application thread is waiting for `stoppingCondition_` to notify, because the app bundle thread may have already notified before the application thread actually starts waiting. Switching to a single `atomic_flag` variable makes sure that there's only one synchronisation object and then the memory order guarantee provided by c++ can make sure that `notify_all` gets synchronised after `test_and_set` does. Fixing this issue will stop the unit tests hanging forever and then we should see less (or hopefully no) time out errors in daily github action runs --- src/xrpld/app/main/Application.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 15abff9b14..785b02dbb8 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -203,11 +203,7 @@ public: boost::asio::signal_set m_signals; - // Once we get C++20, we could use `std::atomic_flag` for `isTimeToStop` - // and eliminate the need for the condition variable and the mutex. - std::condition_variable stoppingCondition_; - mutable std::mutex stoppingMutex_; - std::atomic isTimeToStop = false; + std::atomic_flag isTimeToStop; std::atomic checkSigs_; @@ -1539,10 +1535,7 @@ ApplicationImp::run() getLoadManager().activateStallDetector(); } - { - std::unique_lock lk{stoppingMutex_}; - stoppingCondition_.wait(lk, [this] { return isTimeToStop.load(); }); - } + isTimeToStop.wait(false, std::memory_order_relaxed); JLOG(m_journal.debug()) << "Application stopping"; @@ -1629,14 +1622,14 @@ ApplicationImp::run() void ApplicationImp::signalStop(std::string msg) { - if (!isTimeToStop.exchange(true)) + if (!isTimeToStop.test_and_set(std::memory_order_acquire)) { if (msg.empty()) JLOG(m_journal.warn()) << "Server stopping"; else JLOG(m_journal.warn()) << "Server stopping: " << msg; - stoppingCondition_.notify_all(); + isTimeToStop.notify_all(); } } @@ -1655,7 +1648,7 @@ ApplicationImp::checkSigs(bool check) bool ApplicationImp::isStopping() const { - return isTimeToStop.load(); + return isTimeToStop.test(std::memory_order_relaxed); } int From b90a843dddeb6df2acdc6a04b74386cbb892e8ff Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 28 Jan 2026 10:02:34 +0000 Subject: [PATCH 61/62] ci: Upload Conan recipes for develop, release candidates, and releases (#6286) To allow developers to consume the latest unstable and (near-)stable versions of our `xrpl` Conan recipe, we should export and upload it whenever a push occurs to the corresponding branch or a release tag has been created. This way, developers do not have to figure out themselves what the most recent shortened commit hash was to determine the latest unstable recipe version (e.g. `3.2.0-b0+a1b2c3d`) or what the most recent release (candidate) was to determine the latest (near-)stable recipe version (e.g. `3.1.0-rc2`). Now, pushes to the `develop` branch will produce the `develop` recipe version, pushes to the `release` branch will produce the `rc` recipe version, and creation of versioned tags will produce the `release` recipe version. --- .github/workflows/reusable-upload-recipe.yml | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable-upload-recipe.yml b/.github/workflows/reusable-upload-recipe.yml index 156659392e..79af516fb3 100644 --- a/.github/workflows/reusable-upload-recipe.yml +++ b/.github/workflows/reusable-upload-recipe.yml @@ -62,12 +62,36 @@ jobs: REMOTE_PASSWORD: ${{ secrets.remote_password }} run: conan remote login "${REMOTE_NAME}" "${REMOTE_USERNAME}" --password "${REMOTE_PASSWORD}" - - name: Upload Conan recipe + - name: Upload Conan recipe (version) env: REMOTE_NAME: ${{ inputs.remote_name }} run: | conan export . --version=${{ steps.version.outputs.version }} conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/${{ steps.version.outputs.version }} + - name: Upload Conan recipe (develop) + if: ${{ github.ref == 'refs/heads/develop' }} + env: + REMOTE_NAME: ${{ inputs.remote_name }} + run: | + conan export . --version=develop + conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/develop + + - name: Upload Conan recipe (rc) + if: ${{ startsWith(github.ref, 'refs/heads/release') }} + env: + REMOTE_NAME: ${{ inputs.remote_name }} + run: | + conan export . --version=rc + conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/rc + + - name: Upload Conan recipe (release) + if: ${{ github.event_name == 'tag' }} + env: + REMOTE_NAME: ${{ inputs.remote_name }} + run: | + conan export . --version=release + conan upload --confirm --check --remote="${REMOTE_NAME}" xrpl/release + outputs: ref: xrpl/${{ steps.version.outputs.version }} From 92046785d1fea5f9efe5a770d636792ea6cab78b Mon Sep 17 00:00:00 2001 From: Jingchen Date: Wed, 28 Jan 2026 15:14:35 +0000 Subject: [PATCH 62/62] test: Fix the `xrpl.net` unit test using async read (#6241) This change makes the `read` function call in `handleConnection` async, adds a new class `TestSink` to help debugging, and adds a new target `xrpl.tests.helpers` to put the helper class in. --- src/tests/libxrpl/CMakeLists.txt | 12 +- src/tests/libxrpl/helpers/TestSink.cpp | 127 ++++++++++++ src/tests/libxrpl/helpers/TestSink.h | 27 +++ src/tests/libxrpl/net/HTTPClient.cpp | 273 ++++++++++++++----------- 4 files changed, 313 insertions(+), 126 deletions(-) create mode 100644 src/tests/libxrpl/helpers/TestSink.cpp create mode 100644 src/tests/libxrpl/helpers/TestSink.h diff --git a/src/tests/libxrpl/CMakeLists.txt b/src/tests/libxrpl/CMakeLists.txt index 74dc184700..72d7d0fa92 100644 --- a/src/tests/libxrpl/CMakeLists.txt +++ b/src/tests/libxrpl/CMakeLists.txt @@ -6,9 +6,19 @@ find_package(GTest REQUIRED) # Custom target for all tests defined in this file add_custom_target(xrpl.tests) +# Test helpers +add_library(xrpl.helpers.test STATIC) +target_sources(xrpl.helpers.test PRIVATE + helpers/TestSink.cpp +) +target_include_directories(xrpl.helpers.test PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) +target_link_libraries(xrpl.helpers.test PRIVATE xrpl.libxrpl) + # Common library dependencies for the rest of the tests. add_library(xrpl.imports.test INTERFACE) -target_link_libraries(xrpl.imports.test INTERFACE gtest::gtest xrpl.libxrpl) +target_link_libraries(xrpl.imports.test INTERFACE gtest::gtest xrpl.libxrpl xrpl.helpers.test) # One test for each module. xrpl_add_test(basics) diff --git a/src/tests/libxrpl/helpers/TestSink.cpp b/src/tests/libxrpl/helpers/TestSink.cpp new file mode 100644 index 0000000000..a71e9f7cc0 --- /dev/null +++ b/src/tests/libxrpl/helpers/TestSink.cpp @@ -0,0 +1,127 @@ +#include + +#include + +#include // for getenv + +#if BOOST_OS_WINDOWS +#include // for _isatty, _fileno +#include // for stdout +#else +#include // for isatty, STDOUT_FILENO +#endif + +#include + +namespace xrpl { + +TestSink::TestSink(beast::severities::Severity threshold) + : Sink(threshold, false) +{ +} + +void +TestSink::write(beast::severities::Severity level, std::string const& text) +{ + if (level < threshold()) + return; + writeAlways(level, text); +} + +void +TestSink::writeAlways( + beast::severities::Severity level, + std::string const& text) +{ + auto supportsColor = [] { + // 1. Check for "NO_COLOR" environment variable (Standard convention) + if (std::getenv("NO_COLOR") != nullptr) + { + return false; + } + + // 2. Check for "CLICOLOR_FORCE" (Force color) + if (std::getenv("CLICOLOR_FORCE") != nullptr) + { + return true; + } + + // 3. Platform-specific check to see if stdout is a terminal +#if BOOST_OS_WINDOWS + // Windows: Check if the output handle is a character device + // _fileno(stdout) is usually 1 + // _isatty returns non-zero if the handle is a character device, 0 + // otherwise. + return _isatty(_fileno(stdout)) != 0; +#else + // Linux/macOS: Check if file descriptor 1 (stdout) is a TTY + // STDOUT_FILENO is 1 + // isatty returns 1 if the file descriptor is a TTY, 0 otherwise. + return isatty(STDOUT_FILENO) != 0; +#endif + }(); + + auto color = [level]() { + switch (level) + { + case beast::severities::kTrace: + return "\033[34m"; // blue + case beast::severities::kDebug: + return "\033[32m"; // green + case beast::severities::kInfo: + return "\033[36m"; // cyan + case beast::severities::kWarning: + return "\033[33m"; // yellow + case beast::severities::kError: + return "\033[31m"; // red + case beast::severities::kFatal: + default: + break; + } + return "\033[31m"; // red + }(); + + auto prefix = [level]() { + switch (level) + { + case beast::severities::kTrace: + return "TRC:"; + case beast::severities::kDebug: + return "DBG:"; + case beast::severities::kInfo: + return "INF:"; + case beast::severities::kWarning: + return "WRN:"; + case beast::severities::kError: + return "ERR:"; + case beast::severities::kFatal: + default: + break; + } + return "FTL:"; + }(); + + auto& stream = [level]() -> std::ostream& { + switch (level) + { + case beast::severities::kError: + case beast::severities::kFatal: + return std::cerr; + default: + return std::cout; + } + }(); + + constexpr auto reset = "\033[0m"; + + if (supportsColor) + { + stream << color << prefix << " " << text << reset << std::endl; + } + else + { + stream << prefix << " " << text << std::endl; + } +} + +} // namespace xrpl diff --git a/src/tests/libxrpl/helpers/TestSink.h b/src/tests/libxrpl/helpers/TestSink.h new file mode 100644 index 0000000000..fc3223b04b --- /dev/null +++ b/src/tests/libxrpl/helpers/TestSink.h @@ -0,0 +1,27 @@ +#ifndef XRPL_DEBUGSINK_H +#define XRPL_DEBUGSINK_H + +#include + +namespace xrpl { +class TestSink : public beast::Journal::Sink +{ +public: + static TestSink& + instance() + { + static TestSink sink{}; + return sink; + } + + TestSink(beast::severities::Severity threshold = beast::severities::kDebug); + + void + write(beast::severities::Severity level, std::string const& text) override; + + void + writeAlways(beast::severities::Severity level, std::string const& text) + override; +}; +} // namespace xrpl +#endif // XRPL_DEBUGSINK_H diff --git a/src/tests/libxrpl/net/HTTPClient.cpp b/src/tests/libxrpl/net/HTTPClient.cpp index cfd206edde..5ff0bfc336 100644 --- a/src/tests/libxrpl/net/HTTPClient.cpp +++ b/src/tests/libxrpl/net/HTTPClient.cpp @@ -2,15 +2,22 @@ #include #include +#include +#include #include +#include +#include #include #include #include #include +#include #include #include +#include +#include #include using namespace xrpl; @@ -24,16 +31,19 @@ private: boost::asio::io_context ioc_; boost::asio::ip::tcp::acceptor acceptor_; boost::asio::ip::tcp::endpoint endpoint_; - std::atomic running_{true}; + bool running_{true}; + bool finished_{false}; unsigned short port_; // Custom headers to return - std::map custom_headers_; - std::string response_body_; - unsigned int status_code_{200}; + std::map customHeaders_; + std::string responseBody_; + unsigned int statusCode_{200}; + + beast::Journal j_; public: - TestHTTPServer() : acceptor_(ioc_), port_(0) + TestHTTPServer() : acceptor_(ioc_), port_(0), j_(TestSink::instance()) { // Bind to any available port endpoint_ = {boost::asio::ip::tcp::v4(), 0}; @@ -45,12 +55,19 @@ public: // Get the actual port that was assigned port_ = acceptor_.local_endpoint().port(); - accept(); + // Start the accept coroutine + boost::asio::co_spawn(ioc_, accept(), boost::asio::detached); } + TestHTTPServer(TestHTTPServer&&) = delete; + TestHTTPServer& + operator=(TestHTTPServer&&) = delete; + ~TestHTTPServer() { - stop(); + XRPL_ASSERT( + finished(), + "xrpl::TestHTTPServer::~TestHTTPServer : accept future ready"); } boost::asio::io_context& @@ -68,22 +85,21 @@ public: void setHeader(std::string const& name, std::string const& value) { - custom_headers_[name] = value; + customHeaders_[name] = value; } void setResponseBody(std::string const& body) { - response_body_ = body; + responseBody_ = body; } void setStatusCode(unsigned int code) { - status_code_ = code; + statusCode_ = code; } -private: void stop() { @@ -91,78 +107,84 @@ private: acceptor_.close(); } - void - accept() + bool + finished() const { - if (!running_) - return; - - acceptor_.async_accept( - ioc_, - endpoint_, - [&](boost::system::error_code const& error, - boost::asio::ip::tcp::socket peer) { - if (!running_) - return; - - if (!error) - { - handleConnection(std::move(peer)); - } - }); + return finished_; } - void +private: + boost::asio::awaitable + accept() + { + while (running_) + { + try + { + auto socket = + co_await acceptor_.async_accept(boost::asio::use_awaitable); + + if (!running_) + break; + + // Handle this connection + co_await handleConnection(std::move(socket)); + } + catch (std::exception const& e) + { + // Accept or handle failed, stop accepting + JLOG(j_.debug()) << "Error: " << e.what(); + break; + } + } + + finished_ = true; + } + + boost::asio::awaitable handleConnection(boost::asio::ip::tcp::socket socket) { try { - // Read the HTTP request boost::beast::flat_buffer buffer; boost::beast::http::request req; - boost::beast::http::read(socket, buffer, req); + + // Read the HTTP request asynchronously + co_await boost::beast::http::async_read( + socket, buffer, req, boost::asio::use_awaitable); // Create response boost::beast::http::response res; res.version(req.version()); - res.result(status_code_); + res.result(statusCode_); res.set(boost::beast::http::field::server, "TestServer"); - // Add custom headers - for (auto const& [name, value] : custom_headers_) + // Set body and prepare payload first + res.body() = responseBody_; + res.prepare_payload(); + + // Override Content-Length with custom headers after + // prepare_payload. This allows us to test case-insensitive + // header parsing. + for (auto const& [name, value] : customHeaders_) { res.set(name, value); } - // Set body and prepare payload first - res.body() = response_body_; - res.prepare_payload(); - - // Override Content-Length with custom headers after prepare_payload - // This allows us to test case-insensitive header parsing - for (auto const& [name, value] : custom_headers_) - { - if (boost::iequals(name, "Content-Length")) - { - res.erase(boost::beast::http::field::content_length); - res.set(name, value); - } - } - - // Send response - boost::beast::http::write(socket, res); + // Send response asynchronously + co_await boost::beast::http::async_write( + socket, res, boost::asio::use_awaitable); // Shutdown socket gracefully - boost::system::error_code ec; - socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec); + boost::system::error_code shutdownEc; + socket.shutdown( + boost::asio::ip::tcp::socket::shutdown_send, shutdownEc); } - catch (std::exception const&) + catch (std::exception const& e) { - // Connection handling errors are expected + // Error reading or writing, just close the connection + JLOG(j_.debug()) << "Connection error: " << e.what(); } - - if (running_) - accept(); } }; @@ -171,13 +193,13 @@ bool runHTTPTest( TestHTTPServer& server, std::string const& path, - std::atomic& completed, - std::atomic& result_status, - std::string& result_data, - boost::system::error_code& result_error) + bool& completed, + int& resultStatus, + std::string& resultData, + boost::system::error_code& resultError) { // Create a null journal for testing - beast::Journal j{beast::Journal::getNullSink()}; + beast::Journal j{TestSink::instance()}; // Initialize HTTPClient SSL context HTTPClient::initializeSSLContext("", "", false, j); @@ -193,9 +215,9 @@ runHTTPTest( [&](boost::system::error_code const& ec, int status, std::string const& data) -> bool { - result_error = ec; - result_status = status; - result_data = data; + resultError = ec; + resultStatus = status; + resultData = data; completed = true; return false; // don't retry }, @@ -203,13 +225,19 @@ runHTTPTest( // Run the IO context until completion auto start = std::chrono::steady_clock::now(); - while (!completed && - std::chrono::steady_clock::now() - start < std::chrono::seconds(10)) + while (server.ioc().run_one() != 0) { - if (server.ioc().run_one() == 0) + if (std::chrono::steady_clock::now() - start >= + std::chrono::seconds(10) || + server.finished()) { break; } + + if (completed) + { + server.stop(); + } } return completed; @@ -220,7 +248,7 @@ runHTTPTest( TEST(HTTPClient, case_insensitive_content_length) { // Test different cases of Content-Length header - std::vector header_cases = { + std::vector headerCases = { "Content-Length", // Standard case "content-length", // Lowercase - this tests the regex icase fix "CONTENT-LENGTH", // Uppercase @@ -228,53 +256,48 @@ TEST(HTTPClient, case_insensitive_content_length) "content-Length" // Mixed case 2 }; - for (auto const& header_name : header_cases) + for (auto const& headerName : headerCases) { TestHTTPServer server; - std::string test_body = "Hello World!"; - server.setResponseBody(test_body); - server.setHeader(header_name, std::to_string(test_body.size())); + std::string testBody = "Hello World!"; + server.setResponseBody(testBody); + server.setHeader(headerName, std::to_string(testBody.size())); - std::atomic completed{false}; - std::atomic result_status{0}; - std::string result_data; - boost::system::error_code result_error; + bool completed{false}; + int resultStatus{0}; + std::string resultData; + boost::system::error_code resultError; - bool test_completed = runHTTPTest( - server, - "/test", - completed, - result_status, - result_data, - result_error); + bool testCompleted = runHTTPTest( + server, "/test", completed, resultStatus, resultData, resultError); // Verify results - EXPECT_TRUE(test_completed); - EXPECT_FALSE(result_error); - EXPECT_EQ(result_status, 200); - EXPECT_EQ(result_data, test_body); + EXPECT_TRUE(testCompleted); + EXPECT_FALSE(resultError); + EXPECT_EQ(resultStatus, 200); + EXPECT_EQ(resultData, testBody); } } TEST(HTTPClient, basic_http_request) { TestHTTPServer server; - std::string test_body = "Test response body"; - server.setResponseBody(test_body); + std::string testBody = "Test response body"; + server.setResponseBody(testBody); server.setHeader("Content-Type", "text/plain"); - std::atomic completed{false}; - std::atomic result_status{0}; - std::string result_data; - boost::system::error_code result_error; + bool completed{false}; + int resultStatus{0}; + std::string resultData; + boost::system::error_code resultError; - bool test_completed = runHTTPTest( - server, "/basic", completed, result_status, result_data, result_error); + bool testCompleted = runHTTPTest( + server, "/basic", completed, resultStatus, resultData, resultError); - EXPECT_TRUE(test_completed); - EXPECT_FALSE(result_error); - EXPECT_EQ(result_status, 200); - EXPECT_EQ(result_data, test_body); + EXPECT_TRUE(testCompleted); + EXPECT_FALSE(resultError); + EXPECT_EQ(resultStatus, 200); + EXPECT_EQ(resultData, testBody); } TEST(HTTPClient, empty_response) @@ -283,45 +306,45 @@ TEST(HTTPClient, empty_response) server.setResponseBody(""); // Empty body server.setHeader("Content-Length", "0"); - std::atomic completed{false}; - std::atomic result_status{0}; - std::string result_data; - boost::system::error_code result_error; + bool completed{false}; + int resultStatus{0}; + std::string resultData; + boost::system::error_code resultError; - bool test_completed = runHTTPTest( - server, "/empty", completed, result_status, result_data, result_error); + bool testCompleted = runHTTPTest( + server, "/empty", completed, resultStatus, resultData, resultError); - EXPECT_TRUE(test_completed); - EXPECT_FALSE(result_error); - EXPECT_EQ(result_status, 200); - EXPECT_TRUE(result_data.empty()); + EXPECT_TRUE(testCompleted); + EXPECT_FALSE(resultError); + EXPECT_EQ(resultStatus, 200); + EXPECT_TRUE(resultData.empty()); } TEST(HTTPClient, different_status_codes) { - std::vector status_codes = {200, 404, 500}; + std::vector statusCodes = {200, 404, 500}; - for (auto status : status_codes) + for (auto status : statusCodes) { TestHTTPServer server; server.setStatusCode(status); server.setResponseBody("Status " + std::to_string(status)); - std::atomic completed{false}; - std::atomic result_status{0}; - std::string result_data; - boost::system::error_code result_error; + bool completed{false}; + int resultStatus{0}; + std::string resultData; + boost::system::error_code resultError; - bool test_completed = runHTTPTest( + bool testCompleted = runHTTPTest( server, "/status", completed, - result_status, - result_data, - result_error); + resultStatus, + resultData, + resultError); - EXPECT_TRUE(test_completed); - EXPECT_FALSE(result_error); - EXPECT_EQ(result_status, static_cast(status)); + EXPECT_TRUE(testCompleted); + EXPECT_FALSE(resultError); + EXPECT_EQ(resultStatus, static_cast(status)); } }