Repository navigation
feat: add invoice event filtering and state validation (#1219, #1220) - #1224
Merged
Kingsman-99 merged 2 commits intoNov 25, 2026
Conversation
|
@adebayoahmad78-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1219
Closes #1220
Summary
Two self-contained "first slice" modules, each plain helpers plus inline unit
tests, with its own error enum and a single
modline inlib.rs. Neitheris wired to contract storage or entrypoints, following the established
first-slice pattern.
#1219 —
contracts/split/src/invoice_event_filtering.rsNormalised view (
InvoiceEvent/InvoiceEventType) of the events emitted byevents.rs, with a bounded in-memoryInvoiceEventLogand a compositeEventFilter(event type, invoice id, inclusive date range,offset/limit),where every set field is AND-ed.
querycollects matches withoffset/limitand early-exits once the limit is reached;
countcounts withoutmaterialising.
filter_by_type/filter_by_date_rangeare shorthands(inverted range rejected). 7 unit tests.
#1220 —
contracts/split/src/contract_state_validation.rsContractStatelifecycle,is_valid_transition/validate_transition(explicit allowed edges; a transition must change state,
Archivedisterminal),
check_invariants/is_valid_state(non-negative total,fundedwithin
[0, total_due], recipients and deadline required off-draft, andfunding-consistency per state), a bounded append-only
StateChangeLog, andapply_transitionwhich validates the edge, checks the prospective snapshot'sinvariants, records the change, and commits the state only once logging
succeeds (atomic; a full log leaves the snapshot untouched). 6 unit tests.
Tests
Modules verified in isolation: 14/14 unit tests pass,
cargo fmt --checkandcargo clippyclean. Not run against the full workspace build.Scope / known gaps
in, not read live.
full invoice option surface.