Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

High Level Overview of Change

Removes an incorrect assertion that assumed fetchBatch results size matches input hash count. The assertion fails for NullBackend which intentionally returns an empty vector.

Context of Change

The assertion was added in commit 4495952 based on a misunderstanding of move assignment semantics:

auto results = backend_->fetchBatch(batch).first;
XRPL_ASSERT(hashes.size() == results.size(), "...");  // WRONG

Move assignment replaces the entire vector, ignoring any initial size. The original code never pre-sized results, so the assertion assumption was invalid.

Production backends (MemoryFactory, RocksDBFactory, NuDBFactory) do return results.size() == hashes.size(), but NullBackend returns an empty vector by design. The assertion breaks for this valid implementation.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

API Impact

None.

Before / After

Before:

auto results = backend_->fetchBatch(batch).first;
XRPL_ASSERT(hashes.size() == results.size(), "number of input hashes matches number of output objects");
for (size_t i = 0; i < results.size(); ++i) { ... }

After:

auto results = backend_->fetchBatch(batch).first;
for (size_t i = 0; i < results.size(); ++i) { ... }

Restores original behavior before the assertion was introduced.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

bthomee and others added 30 commits March 28, 2025 13:21
Co-authored-by: Ed Hennis <ed@ripple.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This change adds `cmake-format` as. a pre-commit hook. The style file closely matches that in Clio, and they will be made to be equivalent over time. For now, some files have been excluded, as those need some manual adjustments, which will be done in future changes.
This updates the hashes of all XRPLF/actions to their latest versions.
When support was added for `xrpld.cfg` in addition to `rippled.cfg` in #6098, as part of an effort to rename occurrences of ripple(d) to xrpl(d), the clearing and creation of the data directory were modified for what, at the time, seemed to result in an equivalent code flow. This has turned out to not be true, which is why this change restores two modifications to `Config.cpp` that currently break running the binary in standalone mode.
)

This change cleans up the `API-CHANGELOG.md` file. It moves the version-specific documentation to other files and fleshes out the changelog with all the API-related changes in each version.
Co-authored-by: ximinez <6757714+ximinez@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cache removal and assertion behavior based on feedback Remove incorrect assertion in fetchBatch Feb 3, 2026
Copilot AI requested a review from ximinez February 3, 2026 21:04
Base automatically changed from bthomee/disable-cache to develop February 6, 2026 14:42
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.

5 participants