Skip to content

Expand escrow contract test coverage to include edge cases.#549

Closed
code3ks wants to merge 4 commits into
MettaChain:mainfrom
code3ks:main
Closed

Expand escrow contract test coverage to include edge cases.#549
code3ks wants to merge 4 commits into
MettaChain:mainfrom
code3ks:main

Conversation

@code3ks

@code3ks code3ks commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds edge case test coverage for escrow contract.

Tests Added

  • Large-transfer request expires before sufficient approvals
  • Multiple signers approving simultaneously
  • Cancelling a large-transfer request and creating a new one
  • Escrow with fee enabled and disabled
  • Partial release followed by full refund
  • Tax withholding scenarios
  • Dispute resolution status changes
  • Emergency override with and without tax withholding

Closes #484

code3ks added 4 commits June 23, 2026 18:40
Add comprehensive edge case tests for escrow contract including:
- Large-transfer request expiry before sufficient approvals
- Concurrent multi-signer approvals
- Large-transfer cancellation and recreation
- Fee enabled/disabled scenarios
- Partial release followed by refund attempts
- Tax withholding with compliance contract
- Dispute resolution status changes
- Emergency override with/without tax withholding

Resolves MettaChain#484

Copy link
Copy Markdown
Contributor

Hi @code3ks 👋 thanks for picking up issue #484 — the edge cases listed there (large-transfer expiration, concurrent signer approvals, fee-on/off flows, partial release/full refund, tax withholding, dispute resolution, emergency override) are exactly what the escrow contract needs.

Quick heads-up before this can land: this PR's diff is the opposite of what the title and description claim.

What the API actually reports

  • 1 file changed: contracts/escrow/src/tests.rs
  • +0 / −576 lines
  • Net effect: the entire file — including the existing tests the repo has carried (test_new_contract, test_set_tax_compliance_contract, etc.) and the new edge-case tests you added — ends up deleted, not expanded.

Why this happened (commit chain on this PR)

The PR's head is currently 8191667. Its commits, in chronological order:

30d03f3  test: expand escrow contract test coverage with edge cases   ← your additive work
7c7bc86  Merge branch 'MettaChain:main' into main                     ← sync of upstream main
757a292  fix: apply rustfmt formatting to escrow tests                ← formatting pass
8191667  Merge remote-tracking branch 'origin/main'                   ← second sync of upstream main

Because baseRefName and headRefName are both main, every "Merge … MettaChain:main into main" / "Merge remote-tracking branch 'origin/main'" inside the PR head effectively rebases your additive commit 30d03f3 against upstream main, and the file collapses to the upstream copy of tests.rs — which is the pre-expansion version. Net result: the additions from 30d03f3 are thrown away and the file gets deleted because the upstream main head was behind when the merge conflict was (silently) resolved to "take upstream."

Why merging it would be destructive

Merging this would silently remove the existing escrow test suite from main, plus all the new edge-case tests you wrote. That's the opposite of issue #484's goal.

What I'd suggest instead

  1. Close this PR with the destructive diff.
  2. Open a fresh branch off current main, e.g. feat/issue-484-escrow-edge-cases.
  3. Recommit the additive edge-case tests from 30d03f3 (large-transfer expiration, concurrent signer approvals, transfer cancellation cycles, fee-enabled/disabled escrow, partial release / full refund, tax withholding, dispute resolution status changes, emergency override) onto that feature branch — not on a branch that itself is main.
  4. Open a new PR with base: main and head: feat/issue-484-escrow-edge-cases. You'll then have a clean +N / −0 additive diff and no merge-of-main into your PR head.

If you'd like, I can sketch a non-destructive recovery branch locally (or open an accompanying PR that carries the new edge-case tests forward) — just say the word.

Reference: issue #484, which is still OPEN for this work.

@code3ks

code3ks commented Jun 24, 2026 via email

Copy link
Copy Markdown
Contributor Author

@code3ks code3ks closed this Jun 24, 2026
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.

test: Expand escrow contract test coverage to include edge cases

2 participants