Skip to content

test: implement test suites and cancel functions for issues 212, 211, 210, 209 - #330

Open
williamspatrivk-rgb wants to merge 4 commits into
stellar-vortex-protocol:mainfrom
williamspatrivk-rgb:fix/tests-212-211-210-209
Open

test: implement test suites and cancel functions for issues 212, 211, 210, 209#330
williamspatrivk-rgb wants to merge 4 commits into
stellar-vortex-protocol:mainfrom
williamspatrivk-rgb:fix/tests-212-211-210-209

Conversation

@williamspatrivk-rgb

Copy link
Copy Markdown

Summary

Implement comprehensive test coverage and new functionality across four major issues:

Changes

Issue #212 - CI Coverage for proof_registry

  • Parameterize fmt, contract, wasm-size, and audit jobs with crate matrix
  • Both intent_settlement and proof_registry now get identical CI coverage
  • Formatting, linting, testing, and dependency auditing for both crates

Issue #211 - Deadline Boundary Tests

  • 12 new tests covering (deadline - 1), (deadline), (deadline + 1) for each function
  • Tests verify documented boundary semantics:
    • accept_intent: deadline EXCLUSIVE
    • fill_intent: deadline EXCLUSIVE
    • slash_solver: deadline INCLUSIVE
    • expire_intent: deadline INCLUSIVE
  • Prevents future regressions in deadline logic seams

Issue #210 - Cancel Functions for Proposals

  • Added 4 new admin functions: cancel_pending_admin_transfer, cancel_pending_fee_recipient, cancel_pending_dst_token_add, cancel_pending_dst_token_remove
  • Each emits a distinct _proposal_cancelled event for off-chain monitoring
  • Cancel without existing proposal fails with NoPending* error (prevents silent failures)
  • Includes missing DataKey enum variants (PendingAdmin, PendingDstTokenAdd, PendingDstTokenRemove)
  • Comprehensive test suite covering successful cancellation, double-cancel failures, and re-submission after cancel

Issue #209 - Fill Conservation Proptest

  • New proptest_fill.rs module covering submit → accept → [fill]* → terminal lifecycle
  • Verifies conservation: intent.total_filled = Σ(fill_amounts)
  • Verifies token accounting: user_received + fee_received = Σ(fill_amounts)
  • Validates state machine never reaches impossible combinations
  • Generates random valid fill sequences up to 5 fills per intent

Testing

All changes are test implementations (test-only, no changes to tested business logic beyond issue #210's required cancel functions). Test suites can be run with:

# Deadline boundary tests
cargo test deadline_boundary

# Cancel function tests  
cargo test cancel_pending

# Fill conservation proptest
PROPTEST_CASES=256 cargo test --features testutils -- fill_conservation

# Full CI simulation
cargo test --features testutils

Closes #212
Closes #211
Closes #210
Closes #209

…ttlement

Add matrix strategy across all CI jobs (fmt, contract, wasm-size, audit) to test
both intent_settlement and proof_registry crates, ensuring proof_registry gets
equivalent coverage for formatting, linting, building, and dependency auditing.

Closes stellar-vortex-protocol#212
…ondition test suite

Add comprehensive test coverage for all deadline-gated functions verifying
the documented boundary semantics:

- accept_intent: deadline EXCLUSIVE — now >= deadline rejects at boundary
- fill_intent: deadline EXCLUSIVE — now >= deadline rejects at boundary
- slash_solver: deadline INCLUSIVE — now == deadline allows slashing
- expire_intent: deadline INCLUSIVE — now == deadline allows expiry

For each function, tests cover (deadline - 1), (deadline), and (deadline + 1)
to verify the exact boundary behavior and prevent future regressions in the
seams between these interdependent functions.

Closes stellar-vortex-protocol#211
…imelocked admin proposals

Add admin-only cancel functions for all four timelocked proposal types:
- cancel_pending_admin_transfer()
- cancel_pending_fee_recipient()
- cancel_pending_dst_token_add(token)
- cancel_pending_dst_token_remove(token)

Each function clears the pending proposal and emits a distinct _proposal_cancelled
event for off-chain monitoring. Canceling a nonexistent proposal fails with the
same error as a failed accept/execute, preventing silent failures.

Also add the missing DataKey enum variants (PendingAdmin, PendingDstTokenAdd,
PendingDstTokenRemove) that were already being used in the code but not defined.

Includes comprehensive tests covering:
- Successful cancellation and event emission
- Canceling without an existing proposal fails
- After cancellation, accept/execute correctly fail with NoPending* errors
- Admin can propose a new value after canceling

Closes stellar-vortex-protocol#210
…e and fee conservation

Add comprehensive property-based test suite modeling the fill lifecycle:
submit_intent → accept_intent → [fill_intent]* → terminal state

Invariants tested after every step:
- intent.total_filled equals sum of all fill_amounts applied
- user and fee recipient balance changes equal fill amounts and fees
- intent state machine never reaches invalid combinations (e.g., Filled with
  total_filled < min_dst_amount)

Covers edge cases including partial fills, multiple fills per intent, and
boundary conditions on min_dst_amount crossing.

Test can be run locally with:
  PROPTEST_CASES=256 cargo test --features testutils -- fill_conservation

Closes stellar-vortex-protocol#209
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@williamspatrivk-rgb 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment