test(fuzz): add lifecycle and conservation property testing harness - #350
Merged
josephchimebuka merged 7 commits intoAug 5, 2026
Merged
Conversation
… and cancel parity
Contributor
|
@Oyinkans0la12 Pls can you fix Conflicts and send a message in the group saying you've fixed them so I can merge |
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 #285
Summary
Introduce a property-based fuzz testing harness that exercises randomized protocol lifecycle operations while continuously validating conservation and protocol invariants. The harness supports deterministic replay through reproducible random seeds and provides both CI-friendly and extended execution modes.
Problem
Handwritten tests cover expected execution paths but often miss rare action orderings and edge-case state transitions. As new protocol features are added, subtle lifecycle bugs and invariant violations can escape traditional test coverage.
Solution
This PR adds a reusable property-based fuzz testing framework that generates randomized lifecycle sequences, validates protocol invariants after every operation, and records sufficient diagnostics to reproduce failures deterministically.
Implementation Details
Lifecycle Action Generator
Implemented a configurable randomized action generator capable of exercising the protocol through realistic lifecycle operations, including creation, updates, disputes, cancellations, settlements, withdrawals, and other supported transitions.
Generated sequences respect protocol preconditions while maximizing state-space exploration.
Property-Based Harness
Added a reusable fuzz/property testing harness that:
Protocol Invariants
The harness continuously validates multiple protocol correctness properties, including:
along with additional protocol-specific invariants where applicable.
Failure Diagnostics
Invariant failures now report:
The reported seed enables deterministic reproduction of the exact failing execution.
Execution Modes
Two execution modes are provided:
Fast Mode
Extended Mode
Documentation
Added documentation covering:
Testing
Validated:
Behavioral Changes
None.
This PR improves testing infrastructure only and does not modify production protocol behavior.
Benefits
Checklist