Feat(contracts): implement subscription contract invariant testing suite#320
Merged
Smartdevs17 merged 3 commits intomainfrom Apr 25, 2026
Merged
Feat(contracts): implement subscription contract invariant testing suite#320Smartdevs17 merged 3 commits intomainfrom
Smartdevs17 merged 3 commits intomainfrom
Conversation
Closes #221 - Define 10 key invariants covering plan/subscription count monotonicity, total_paid conservation, plan subscriber count accuracy, paused_at consistency, refund amount bounds, total_collected non-negativity, and user subscription index consistency - Implement deterministic scenario tests for all lifecycle transitions: basic flow, multi-plan/subscriber, cancel, pause/resume, auto-resume, refund approve/reject, subscription transfer, plan deactivation, multiple charges, all billing intervals, and authorization rules - Add property-based fuzz tests using proptest (50 cases each): random action sequences, plan count equals create_plan calls, subscription count equals subscribe calls, total_paid equals price x charge_count - Add state-machine invariant tests (30 cases) covering the full lifecycle with weighted random actions including pause, resume, cancel, refund, and time advancement - Register real Stellar asset token contracts in ContractHandler so charge_subscription token transfers succeed in tests - Add [[test]] entries in Cargo.toml for invariants and integration_soroban - Add .github/workflows/invariant-tests.yml CI job running invariant tests on every contracts/ change, with an extended 1000-case fuzz run on pushes to main/dev - Update contracts/.gitignore to exclude generated test_snapshots/ and *.proptest-regressions files
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 #292