Skip to content

Add full balance-flow test coverage for release_funds in tests/lifecycle.rs #226

@1nonlypiece

Description

@1nonlypiece

📌 Description

COVERAGE_ANALYSIS.md reports 92.16% line coverage with the event-publish lines
in release_funds showing as uncovered, and the integration suite in
tests/lifecycle.rs only loosely asserts the escrow balance movement. We need
explicit balance-delta assertions proving that on release_funds the
contract address is debited and success_destination is credited by exactly
vault.amount.

Goal: add focused tests asserting the exact USDC balance changes of the
contract, creator, and success_destination across every release_funds path.

🎯 Requirements and Context

  • Must be deterministic and isolated.
  • Cover both release triggers: validated-before-deadline and deadline-reached.
  • Assert pre/post balances on the contract address and success_destination.
  • Confirm the funds_released event is emitted with the correct amount via
    env.events().

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b feature/release-funds-balance-tests

2. Implement changes

  • Tests: extend tests/lifecycle.rs with balance-delta assertions using
    TokenClient::balance before/after release_funds.
  • Assert the funds_released event with env.events().all().
  • Docs: update TESTING_GUIDE.md and COVERAGE_ANALYSIS.md with the new cases.
  • Add comments explaining each balance assertion.

3. Test and commit

  • Run cargo test and regenerate coverage with the tarpaulin.toml config.
  • Cover edge cases: validated release, deadline release, contract balance reaches
    zero post-release, double-release rejection leaves balances unchanged.

Example commit message

test: explicit balance-flow coverage for release_funds in lifecycle suite

✅ Guidelines

  • Minimum 95% test coverage on release_funds lines.
  • Clear documentation of the new cases in TESTING_GUIDE.md.
  • All tests deterministic and passing.
  • Timeframe: 96 hours.

🏷️ Labels

type-testing · area-contracts · MAYBE REWARDED · GRANTFOX OSS ·
OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the Disciplr contributor Discord to coordinate, ask questions, and get
    unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself before you start so we can avoid duplicate work,
    pair you with a reviewer, and merge your PR quickly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GRANTFOX OSSGrantFox open-source campaignMAYBE REWARDEDEligible for GrantFox rewardOFFICIAL CAMPAIGNOfficial GrantFox campaign issuearea-contractsSmart contract (Soroban/Rust) worktype-testingTests and test coverage

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions