From 04d5f79c723cef2e6fb065ef52c021f22338454b Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Mon, 5 Oct 2026 16:04:36 +0100 Subject: [PATCH] fix: Wire format regression in rpc-spec (#3242) --- conan.lock | 2 +- conanfile.py | 2 +- src/rpc/handlers/AccountCurrencies.cpp | 2 +- src/rpc/handlers/AccountOffers.cpp | 2 +- .../rpc/handlers/GetAggregatePriceTests.cpp | 90 +++++++++++++++++++ 5 files changed, 94 insertions(+), 4 deletions(-) diff --git a/conan.lock b/conan.lock index 924e442c0..d0352df1b 100644 --- a/conan.lock +++ b/conan.lock @@ -3,7 +3,7 @@ "requires": [ "zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1782392402.122708", "xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1782392402.420688", - "xrpl-rpc-spec/0.1.21#d536f87a2ae7d313452746cfa3ac4404%1790869005.122975", + "xrpl-rpc-spec/0.1.23#56e8946f5b3fb949a3732e1a51135ca2%1790977482.197086", "xrpl/3.4.0#e06b127b3ba92806a43fc7a53fc05fd3%1789577552.219154", "sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1782392403.185447", "spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1782736610.443882", diff --git a/conanfile.py b/conanfile.py index 8db0b9dda..aeab6dfda 100644 --- a/conanfile.py +++ b/conanfile.py @@ -17,7 +17,7 @@ class ClioConan(ConanFile): "fmt/12.1.0", "libbacktrace/cci.20210118", "spdlog/1.17.0", - "xrpl-rpc-spec/0.1.21", + "xrpl-rpc-spec/0.1.23", "xrpl/3.4.0", ] diff --git a/src/rpc/handlers/AccountCurrencies.cpp b/src/rpc/handlers/AccountCurrencies.cpp index 0cf70b607..928fd3ba8 100644 --- a/src/rpc/handlers/AccountCurrencies.cpp +++ b/src/rpc/handlers/AccountCurrencies.cpp @@ -42,7 +42,7 @@ AccountCurrenciesHandler::process( return Error{expectedLgrInfo.error()}; auto const& lgrInfo = *expectedLgrInfo; - auto const& accountID = input.account; + auto const& accountID = *input.account; auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject( xrpl::keylet::account(accountID).key, lgrInfo.seq, ctx.yield diff --git a/src/rpc/handlers/AccountOffers.cpp b/src/rpc/handlers/AccountOffers.cpp index a94826d5b..0adb8c0b8 100644 --- a/src/rpc/handlers/AccountOffers.cpp +++ b/src/rpc/handlers/AccountOffers.cpp @@ -60,7 +60,7 @@ AccountOffersHandler::process(AccountOffersHandler::Input const& input, Context return Error{expectedLgrInfo.error()}; auto const& lgrInfo = *expectedLgrInfo; - auto const& accountID = input.account; + auto const& accountID = *input.account; auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject( xrpl::keylet::account(accountID).key, lgrInfo.seq, ctx.yield ); diff --git a/tests/unit/rpc/handlers/GetAggregatePriceTests.cpp b/tests/unit/rpc/handlers/GetAggregatePriceTests.cpp index 4a0855082..857ecdb7c 100644 --- a/tests/unit/rpc/handlers/GetAggregatePriceTests.cpp +++ b/tests/unit/rpc/handlers/GetAggregatePriceTests.cpp @@ -350,6 +350,96 @@ generateTestValuesForParametersTest() .expectedError = "invalidParams", .expectedErrorMessage = "Invalid parameters." }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdNegative", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": -1 + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdNull", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": null + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdFloat", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": 2.3 + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdBool", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": true + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdObject", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": {} + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, + GetAggregatePriceParamTestCaseBundle{ + .testName = "oracleDocumentIdTooLarge", + .testJson = R"JSON({ + "base_asset": "USD", + "quote_asset": "XRP", + "oracles": [ + { + "account": "rGh1VZCRBJY6rJiaFpD4LZtyHiuCkC8aeD", + "oracle_document_id": 4294967296 + } + ] + })JSON", + .expectedError = "invalidParams", + .expectedErrorMessage = "Invalid parameters." + }, GetAggregatePriceParamTestCaseBundle{ .testName = "oracleMissingAccount", .testJson = R"JSON({