forked from Talenttrust/Talenttrust-Contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOMMIT_MESSAGE.txt
More file actions
50 lines (42 loc) · 2.2 KB
/
Copy pathCOMMIT_MESSAGE.txt
File metadata and controls
50 lines (42 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
feat(escrow): add milestone approval expiry flow
Implement comprehensive milestone approval system with TTL-based expiry
for secure, time-limited approvals in the TalentTrust escrow contract.
## Features
- Four authorization modes (ClientOnly, ArbiterOnly, ClientAndArbiter, MultiSig)
- TTL-based approval expiry (~7 days) in temporary storage
- Fail-closed design: missing/expired approvals prevent release
- Approval clearing after release prevents reuse
- Comprehensive test suite with 20+ tests
## Security
- Role-based access control enforced at approval and release
- Automatic expiry via Soroban temporary storage TTL
- Arbiter validation prevents role overlap with client/freelancer
- Balance and state checks maintained
- Duplicate approval prevention
- Authorization mode enforcement
## Implementation Details
- MilestoneApprovals stored in temporary storage with PENDING_APPROVAL_TTL_LEDGERS (120,960 ledgers ≈ 7 days)
- Approvals auto-expire via TTL and are treated as absent
- Release requires valid, non-expired approvals based on ReleaseAuthorization mode
- Approvals cleared after successful release to prevent reuse
## Files Added
- contracts/escrow/src/ttl.rs - TTL constants for approval expiry
- contracts/escrow/src/approvals.rs - Core approval logic
- contracts/escrow/src/test/approval_expiry.rs - Comprehensive test suite
## Files Modified
- contracts/escrow/src/types.rs - Added MilestoneApprovals, ReleaseAuthorization, extended Contract and Error
- contracts/escrow/src/lib.rs - Updated contract functions with approval flow
- contracts/escrow/src/test.rs - Added test helpers and module includes
- contracts/escrow/src/test/access_control.rs - Updated to use Error enum
- docs/escrow/milestone-validation.md - Comprehensive approval flow documentation
## Testing
- 20+ integration tests covering all authorization modes
- Unit tests for approval logic
- Edge case coverage (expiry, duplicates, unauthorized, invalid state)
- Multiple milestone approval scenarios
## Security Assumptions
- Fail-closed: missing or expired approvals prevent release
- TTL enforcement via Soroban temporary storage
- Role-based authorization enforced
- Approvals are single-use (cleared after release)
- State machine integrity maintained