Skip to content

refactor: Use shared ledger and tx type tables from rpcspec - #3174

Merged
godexsoft merged 25 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-shared-leaf-util
Sep 8, 2026
Merged

refactor: Use shared ledger and tx type tables from rpcspec#3174
godexsoft merged 25 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-shared-leaf-util

Conversation

@godexsoft

@godexsoft godexsoft commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

PR 4 out of many. Based on #3171 .

util::LedgerTypes becomes a thin facade over rpcspec's ledger-types table, and util/TxUtils.{hpp,cpp} is deleted in favour of the shared tx-type set.

Two notes:

  • AccountTx.hpp is repointed at the shared tx-type function, since the legacy spec still needs it. Same signature, one-line swap.
  • TxUtilTests.cpp is kept and retargeted rather than deleted — it validates the set against the real xrpl::TxFormats, which the spec repo can't do (its tests run against a mocked xrpl).

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.hpp inclusions/usages with rpcspec/Errors.hpp and rename ETL forwarding errors to the shared RpcForwarding* variants.
  • Replace local ledger/tx type tables with rpcspec’s shared tables; delete util/TxUtils.{hpp,cpp} and util/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.

Comment thread src/etl/LoadBalancer.cpp
Comment thread src/util/LedgerUtils.hpp Outdated
@godexsoft
godexsoft changed the base branch from develop to refactor/consteval-specs-move-errors September 8, 2026 13:12
@godexsoft
godexsoft requested a review from a team as a code owner September 8, 2026 13:12
@godexsoft
godexsoft requested a review from bthomee September 8, 2026 13:30

@mathbunnyru mathbunnyru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has lots of unrelated changes, so I think you need to do something with your branches

@godexsoft
godexsoft changed the base branch from refactor/consteval-specs-move-errors to develop September 8, 2026 13:53
bthomee
bthomee previously approved these changes Sep 8, 2026
Comment thread src/rpc/handlers/AccountTx.hpp
mathbunnyru
mathbunnyru previously approved these changes Sep 8, 2026
Comment thread src/rpc/common/Validators.cpp Outdated
@godexsoft
godexsoft merged commit 08255c4 into XRPLF:develop Sep 8, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants