refactor: Use shared ledger and tx type tables from rpcspec - #3174
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…al-specs-move-errors
…steval-specs-shared-leaf-util
…steval-specs-shared-leaf-util
There was a problem hiding this comment.
🟡 Changes recommended
It introduces at least one correctness/robustness risk (forwarding error selection relying on external enum ordering) that should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Refactors Clio’s RPC/ETL/web layers to consume shared error, ledger-type, and tx-type definitions from xrpl-rpc-spec (bumping the dependency to 0.1.7), removing local duplicates and retargeting unit tests accordingly.
Changes:
- Replace many
rpc/Errors.hppinclusions/usages withrpcspec/Errors.hppand rename ETL forwarding errors to the sharedRpcForwarding*variants. - Replace local ledger/tx type tables with
rpcspec’s shared tables; deleteutil/TxUtils.{hpp,cpp}andutil/LedgerUtils.cpp. - Update unit tests to validate the shared spec tables and updated warning/error strings.
File summaries
| File | Description |
|---|---|
| tests/unit/web/RPCServerHandlerTests.cpp | Use rpcspec errors; update warning message expectation to “xrpld”. |
| tests/unit/web/ng/RPCServerHandlerTests.cpp | Use rpcspec errors include. |
| tests/unit/web/ng/impl/ErrorHandlingTests.cpp | Use rpcspec errors include. |
| tests/unit/web/LoadWarningTests.cpp | Use rpcspec errors include. |
| tests/unit/web/impl/ErrorHandlingTests.cpp | Use rpcspec errors include. |
| tests/unit/util/TxUtilTests.cpp | Retarget tx-type test to rpc::spec::txTypesInLowercase(). |
| tests/unit/util/LedgerUtilsTests.cpp | Retarget type-from-string tests to rpc::spec functions; include shared ledger types. |
| tests/unit/rpc/RPCHelpersTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/RPCEngineTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/VaultInfoTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/UnsubscribeTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/TxTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/TestHandlerTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/SubscribeTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/ServerInfoTests.cpp | Use rpcspec errors include; update forwarding error enum names in expectations. |
| tests/unit/rpc/handlers/LedgerTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/LedgerEntryTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/LedgerDataTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/CredentialHelpersTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/AccountOffersTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/AccountLinesTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/AccountInfoTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/handlers/AccountCurrenciesTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/ForwardingProxyTests.cpp | Use rpcspec errors include; update forwarding error enum names in expectations. |
| tests/unit/rpc/ErrorTests.cpp | Include rpcspec errors; update warning string and forwarding error enum names in expectations. |
| tests/unit/rpc/common/TypesTests.cpp | Drop direct rpc/Errors.hpp include. |
| tests/unit/rpc/common/SpecsTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/common/CheckersTests.cpp | Use rpcspec errors include. |
| tests/unit/rpc/BaseTests.cpp | Use rpcspec errors include. |
| tests/unit/etl/SourceImplTests.cpp | Use rpcspec errors include. |
| tests/unit/etl/LoadBalancerTests.cpp | Use rpcspec errors include; update forwarding error enum names in expectations. |
| tests/unit/etl/ForwardingSourceTests.cpp | Use rpcspec errors include; update forwarding error enum names in expectations. |
| tests/unit/etl/ETLStateTests.cpp | Use rpcspec errors include; update forwarding error enum names in expectations. |
| tests/unit/app/WebHandlersTests.cpp | Use rpcspec errors include. |
| tests/common/util/MockSource.hpp | Use rpcspec errors include. |
| src/web/ng/impl/ErrorHandling.cpp | Include rpcspec errors; update switch cases to RpcForwarding* names. |
| src/web/impl/ErrorHandling.hpp | Update switch cases to RpcForwarding* names. |
| src/web/CMakeLists.txt | Link clio_web with rpcspec::rpcspec. |
| src/util/TxUtils.hpp | Deleted (tx-type set moved to rpcspec). |
| src/util/TxUtils.cpp | Deleted (tx-type set moved to rpcspec). |
| src/util/LedgerUtils.hpp | Make util::LedgerTypes a thin facade over rpcspec ledger-types table. |
| src/util/LedgerUtils.cpp | Deleted (string-to-type moved to rpcspec). |
| src/util/CMakeLists.txt | Remove deleted sources; link clio_util with rpcspec::rpcspec. |
| src/rpc/RPCHelpers.cpp | Use rpcspec errors include. |
| src/rpc/handlers/VaultInfo.cpp | Use rpcspec errors include. |
| src/rpc/handlers/Unsubscribe.cpp | Use rpcspec errors include. |
| src/rpc/handlers/TransactionEntry.cpp | Use rpcspec errors include. |
| src/rpc/handlers/Subscribe.cpp | Use rpcspec errors include. |
| src/rpc/handlers/NoRippleCheck.cpp | Use rpcspec errors include. |
| src/rpc/handlers/NFTsByIssuer.cpp | Use rpcspec errors include. |
| src/rpc/handlers/NFTOffersCommon.cpp | Use rpcspec errors include. |
| src/rpc/handlers/NFTInfo.cpp | Use rpcspec errors include. |
| src/rpc/handlers/NFTHistory.cpp | Use rpcspec errors include. |
| src/rpc/handlers/MPTokenIssuanceHistory.hpp | Switch tx-type validator input set to rpc::spec::txTypesInLowercase(). |
| src/rpc/handlers/MPTokenIssuanceHistory.cpp | Use rpcspec errors include. |
| src/rpc/handlers/MPTHolders.cpp | Use rpcspec errors include. |
| src/rpc/handlers/LedgerIndex.cpp | Use rpcspec errors include. |
| src/rpc/handlers/LedgerEntry.cpp | Use rpcspec errors include. |
| src/rpc/handlers/LedgerData.cpp | Use rpcspec errors + ledger types; use spec::ledgerEntryTypeFromStr. |
| src/rpc/handlers/GetAggregatePrice.cpp | Drop direct rpc/Errors.hpp include. |
| src/rpc/handlers/GatewayBalances.cpp | Use rpcspec errors include. |
| src/rpc/handlers/Feature.cpp | Use rpcspec errors include. |
| src/rpc/handlers/DepositAuthorized.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AMMInfo.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountTx.hpp | Switch tx-type set to rpc::spec::txTypesInLowercase() (legacy handler). |
| src/rpc/handlers/AccountTx.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountOffers.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountObjects.cpp | Use rpcspec errors + ledger types; use spec::accountOwnedLedgerTypeFromStr. |
| src/rpc/handlers/AccountNFTs.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountMPTokens.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountMPTokenIssuances.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountLines.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountInfo.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountCurrencies.cpp | Use rpcspec errors include. |
| src/rpc/handlers/AccountChannels.cpp | Use rpcspec errors include. |
| src/rpc/Factories.cpp | Use rpcspec errors include. |
| src/rpc/Errors.hpp | Make Clio’s errors header largely a facade over rpcspec errors types. |
| src/rpc/Errors.cpp | Remove warning-table impl; update Clio error-info table; implement Status streaming with shared types. |
| src/rpc/CredentialHelpers.cpp | Use rpcspec errors include. |
| src/rpc/common/Validators.cpp | Use rpcspec errors + ledger types; switch validators to spec::*FromStr. |
| src/rpc/common/Specs.hpp | Minor doc comment tweak (“@ref Status” → “Status”). |
| src/rpc/common/Specs.cpp | Use rpcspec errors include (warnings/build JSON). |
| src/rpc/common/MetaProcessors.cpp | Use rpcspec errors include. |
| src/rpc/common/AnyHandler.hpp | Minor doc comment tweak (“@ref Status” → “Status”). |
| src/feed/CMakeLists.txt | Link clio_feed with rpcspec::rpcspec. |
| src/etl/Source.hpp | Use rpcspec errors include. |
| src/etl/LoadBalancer.cpp | Update default forwarding error enum to RpcForwardingConnectionError. |
| src/etl/impl/SourceImpl.hpp | Use rpcspec errors include. |
| src/etl/impl/ForwardingSource.hpp | Use rpcspec errors include. |
| src/etl/impl/ForwardingSource.cpp | Update forwarding failure returns to RpcForwarding* errors; use rpcspec errors include. |
| src/etl/CMakeLists.txt | Link clio_etl with rpcspec::rpcspec. |
| src/app/WebHandlers.cpp | Include rpcspec errors. |
| conanfile.py | Bump xrpl-rpc-spec dependency to 0.1.7. |
| conan.lock | Update lock entry for xrpl-rpc-spec/0.1.7. |
Review details
- Files reviewed: 93/94 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
mathbunnyru
left a comment
There was a problem hiding this comment.
This has lots of unrelated changes, so I think you need to do something with your branches
…al-specs-shared-leaf-util
PR 4 out of many. Based on #3171 .
util::LedgerTypesbecomes a thin facade overrpcspec's ledger-types table, andutil/TxUtils.{hpp,cpp}is deleted in favour of the shared tx-type set.Two notes:
AccountTx.hppis repointed at the shared tx-type function, since the legacy spec still needs it. Same signature, one-line swap.TxUtilTests.cppis kept and retargeted rather than deleted — it validates the set against the realxrpl::TxFormats, which the spec repo can't do (its tests run against a mocked xrpl).