A new MethodNames.h gives every RPC method a string_view constant,
shared by the handler table and the command-line parser table so the
two cannot drift apart. That lets a handler carry its name as a
string_view, and both tables become sorted constexpr arrays found by
binary search, replacing the HandlerTable singleton and its multimap
and RPCParser's runtime table. Their invariants -- a unique name, a
method, and a valid API version range -- are now a static_assert rather
than a logicError on the first request of the process. Handler::Method
becomes a plain function pointer: every method is a free function known
at compile time, so the std::function never captured anything, and
dropping it makes Handler a literal type, which is what a constexpr
table needs; it also makes doCommand's null-method branch dead, since
an empty std::function is no longer representable.
The names being program-lifetime constants removes work throughout.
getHandlerNames and commandLineMethodNames return a span over a
constexpr array instead of building a fresh std::set per call, one of
those on the startup path; PerfLogImp's rpc map keys on string_view, so
it needs neither a transparent hasher nor a string copy per key, and
reports counters through json::StaticString rather than duplicating
each key into the object. Command parameter counts become unsigned with
a named kUnlimitedParams; as ints with -1 for unlimited they were
compared against an unsigned size, so `count < minParams` promoted -1
and was always true, and only the `>= 0` guards kept that from being
reachable.
PerfLog no longer reaches into the RPC layer to learn which methods to
count: makePerfLog takes the names, so xrpld.perflog stops depending on
xrpld.rpc, and PerfLog_test uses five made-up labels, which drops
test.basics > xrpld.rpc as well. Both edges are gone from levelization.
Handler_test's benchmark now asks for kApiMinimumSupportedVersion
instead of a hardcoded 1 and fails if a lookup misses -- once API
versions 1 and 2 retire, getHandler(1, ...) would return at its bounds
check and the benchmark would have silently reported timings for that
check.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This change deletes the `SecretKey` equality/inequality operators from the public library header and moves the comparison logic into test-only code.
Specifically, the `operator==` and `operator!=` free functions on `SecretKey` have been removed from `include/xrpl/protocol/SecretKey.h` and have been replaced with explicitly deleted member functions to prevent accidental use in production code. A named `test::equal()` helper has also been added in `src/test/unit_test/utils.h` for test assertions that need to compare secret keys.
The rdb module was not properly designed, which is fixed in this change. The module had three classes:
1) The abstract class `RelationalDB`.
2) The abstract class `SQLiteDatabase`, which inherited from `RelationalDB` and added some pure virtual methods.
3) The concrete class `SQLiteDatabaseImp`, which inherited from `SQLiteDatabase` and implemented all methods.
The updated code simplifies this as follows:
* The `SQLiteDatabaseImp` has become `SQLiteDatabase`, and
* The former `SQLiteDatabase `has merged with `RelationalDatabase`.
This change modularizes the `WalletDB` and `Manifest`. Note that the wallet db has nothing to do with account wallets and it stores node configuration, which is why it depends on the manifest code.
Currently we're passing the `Application` object around, whereby the `Application` class acts more like a service registry that gives other classes access to other services. In order to allow modularization, we should replace `Application` with a service registry class so that modules depending on `Application` for other services can be moved easily. This change adds the `ServiceRegistry` class.
`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.
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.
This change makes the regex in `HttpClient.cpp` that matches the content-length http header case insensitive to improve compatibility, as http headers are case insensitive.