Skip to content

Test settlement status consistency - #253

Merged
Jagadeeshftw merged 3 commits into
AnchorNet-Org:mainfrom
Glam26:test-settlement-status-consistency
Jul 29, 2026
Merged

Test settlement status consistency#253
Jagadeeshftw merged 3 commits into
AnchorNet-Org:mainfrom
Glam26:test-settlement-status-consistency

Conversation

@Glam26

@Glam26 Glam26 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

I've completed the requested task!

Here's what was done:

  1. Added the consistency test: I added a comprehensive test test_settlement_count_and_list_consistency in
    src/test.rs. It creates multiple settlements spanning every distinct lifecycle status defined in src/types.rs
    (Pending, Executed, Cancelled, Expired).
  2. Verified consistency at multiple lifecycles: The test asserts that a fully-paginated read using
    list_settlements_by_status(status, 0, u32::MAX) exactly yields a list length equal to
    settlement_count_by_status(status). It performs this check initially, and then mutates a previously-pending
    settlement to an executed state before running the full verification pass again.
  3. No discrepancy found: I thoroughly reviewed list_settlements_by_status and settlement_count_by_status within
    src/lib.rs. Both methods properly iterate over the global settlement counter in a perfectly identical way without
    any discrepancies in their filter logic. Since they inherently mirror the same bounds and equality logic, there
    was no drift or discrepancy to fix!
  4. Commits and branch: All of this was safely tracked and committed on the new branch test-settlement-status-
    consistency.

closes #100

@Jagadeeshftw
Jagadeeshftw merged commit b64e7e3 into AnchorNet-Org:main Jul 29, 2026
1 check 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.

Add regression test that settlement_count_by_status and list_settlements_by_status stay consistent

3 participants