Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f682dea
docs: update README for escrow closure finalization
gloskull Mar 25, 2026
e4bf643
feat: add escrow finalize_contract and state fields
gloskull Mar 25, 2026
eb1a8e5
test: add finalize_contract tests
gloskull Mar 25, 2026
afd1be5
test: snapshot commit test_approve_milestone_release_already_approved
gloskull Mar 25, 2026
0a8202c
test: snapshot commit test_approve_milestone_release_client_and_arbiter
gloskull Mar 25, 2026
d14883d
test: snapshot commit test_approve_milestone_release_client_only
gloskull Mar 25, 2026
0ddd2ed
test: snapshot commit test_approve_milestone_release_invalid_id
gloskull Mar 25, 2026
45b1591
test: snapshot commit test_approve_milestone_release_unauthorized
gloskull Mar 25, 2026
5e1873d
test: snapshot commit test_contract_completion_all_milestones_released
gloskull Mar 25, 2026
27d3f5e
test: snapshot commit test_create_contract
gloskull Mar 25, 2026
7cf2a39
test: snapshot commit test_create_contract_with_arbiter
gloskull Mar 25, 2026
5f92289
test: snapshot commit test_deposit_funds
gloskull Mar 25, 2026
7c34e01
test: snapshot commit test_deposit_funds_wrong_amount
gloskull Mar 25, 2026
12b08fb
test: snapshot commit test_dispute_contract_transitions
gloskull Mar 25, 2026
daa6bc9
test: snapshot commit test_disputed_contract_cannot_release_milestone
gloskull Mar 25, 2026
fbb3469
test: snapshot commit test_edge_cases
gloskull Mar 25, 2026
5d997f4
test: snapshot commit test_invalid_status_transition_from_completed_t…
gloskull Mar 25, 2026
07e0f7a
test: snapshot commit test_release_milestone_already_released
gloskull Mar 25, 2026
849fe10
test: snapshot commit test_release_milestone_arbiter_only
gloskull Mar 25, 2026
1e5bc47
test: snapshot commit test_release_milestone_client_only
gloskull Mar 25, 2026
4e40068
test: snapshot commit test_release_milestone_multi_sig
gloskull Mar 25, 2026
d28ac25
test: snapshot commit test_release_milestone_no_approval
gloskull Mar 25, 2026
75d5cd5
test: snapshot commit test_finalize_contract_already_finalized
gloskull Mar 25, 2026
d38c62f
test: snapshot commit test_finalize_contract_not_ready
gloskull Mar 25, 2026
4a1ed5f
test: snapshot commit test_finalize_contract_success_and_immutable
gloskull Mar 25, 2026
cc0e5fc
test: snapshot commit test_finalize_contract_unauthorized
gloskull Mar 25, 2026
498fb11
docs: finalize transition guardrail docs
gloskull Mar 25, 2026
9247b29
docs: add PR summary file
gloskull Mar 25, 2026
ce8ee46
fix: arranged merge conflicts
gloskull Mar 30, 2026
f361117
fixed conflicts
gloskull Mar 30, 2026
480916b
fixed conflicts
gloskull Mar 30, 2026
6cabd65
Merge branch 'main' into feature/contracts-35-escrow-closure-finaliza…
mikewheeleer Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions PULL_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# PR: feat/contracts-35-escrow-closure-finalization

## Summary

Implements Escrow contract closure finalization with immutable close records and summary metadata.

### What changed

- `contracts/escrow/src/lib.rs`
- `EscrowContract` now includes:
- `finalized_at: Option<u64>`
- `finalized_by: Option<Address>`
- `close_summary: Option<Symbol>`
- Added `finalize_contract` method with:
- status precondition (Completed | Disputed)
- one-time finalization guard (immutable once performed)
- participant authorization guard (client/freelancer/arbiter)
- Added read helpers:
- `is_finalized`
- `get_close_summary`
- `get_finalizer`

- `contracts/escrow/src/test.rs`
- Added tests:
- `test_finalize_contract_success_and_immutable`
- `test_finalize_contract_already_finalized`
- `test_finalize_contract_not_ready`
- `test_finalize_contract_unauthorized`

- `README.md` and `docs/escrow/status-transition-guardrails.md`
- Documented finalization workflow and guardrails

## Security notes

- Finalization allowed only after final applicant status; prevents premature closure.
- Finalization is immutable after the first call.
- Caller must be a known contract participant.

## Testing

Run:
```bash
cargo test
```

Result: 27 passed, 0 failed.

## Attachment

**Proof of successful build/tests**

![test-output-screenshot](attachment-placeholder.png)

To attach proof, run the test command locally and capture terminal output screenshot or log file, then add it here:
- `cargo test -- --nocapture` (if needed)
- Save screenshot or copy output to file
- Attach the file via GitHub PR UI (choose image or link)

## Next steps

1. Review API naming and usability (e.g., contract ID usage as symbolic key currently simplified).
2. Merge; pipeline should run fmt/build/test automatically.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ Escrow contract status transitions are enforced using a guarded matrix to preven

Invalid transitions cause a contract panic during execution.

## Escrow closure finalization

- `finalize_contract` records immutable close metadata (timestamp, finalizer, summary)
- Finalization allowed only from `Completed` or `Disputed` status
- Finalization can only be executed by contract parties (client/freelancer/arbiter)
- Once finalized, the contract summary and record are immutable

## CI/CD

On every push and pull request to `main`, GitHub Actions:
Expand Down
Loading
Loading