Skip to content

test: add partial_settle dual-caller and snapshot-capture coverage#2

Open
tebney wants to merge 1 commit into
mainfrom
test/contracts-partial-settle-coverage
Open

test: add partial_settle dual-caller and snapshot-capture coverage#2
tebney wants to merge 1 commit into
mainfrom
test/contracts-partial-settle-coverage

Conversation

@tebney

@tebney tebney commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Closes Liquifact#408.

Adds the missing partial_settle test scenarios required by the issue:

Test Scenario
test_partial_settle_snapshot_not_overwritten Snapshot is stable after close; second call panics on the status guard
test_partial_settle_investor_payout_via_snapshot compute_investor_payout produces correct pro-rata payout using the early snapshot after partial_settle + settle
test_partial_settle_auth_required require_auth() is enforced — verified via mock_auths(&[])

The following tests were already present and provide the remaining coverage:

  • SME caller succeeds (test_partial_settle_sme_happy_path)
  • Admin caller succeeds (test_partial_settle_admin_happy_path)
  • Third-party caller panics (test_partial_settle_unauthorized_caller_panics)
  • Legal hold blocks (test_partial_settle_blocked_by_legal_hold)
  • Non-open status blocks (test_partial_settle_rejected_if_not_open)
  • Snapshot values correct (test_partial_settle_writes_correct_snapshot)
  • Funding blocked after close (test_funding_blocked_after_partial_settle)

Docs

docs/escrow-snapshot.md — added partial_settle and Early Snapshot Capture section cross-linking all 9 test scenarios and documenting the write-once guarantee.

Security notes

  • Only SME or Admin can call partial_settle (require_auth() + address check).
  • Snapshot is write-once: the if !has(FundingCloseSnapshot) guard plus the status == 0 pre-condition together make overwrite impossible.
  • No production code changes were required.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for partial_settle early-funding promotion and snapshot capture

1 participant