Description
set_legal_hold(active=false) clears a compliance hold instantly with a single admin auth. The module rustdoc notes the contract has no embedded timelock and relies entirely on off-chain governance. Add an optional configurable clear-delay so a hold cannot be lifted until a minimum ledger time after a request_clear_legal_hold call, giving compliance an on-chain cooling-off window.
Requirements and context
- Scoped to the LiquiFact
escrow Soroban contract.
- Add
DataKey::LegalHoldClearableAt; request_clear_legal_hold sets it to now + delay, and set_legal_hold(false) asserts now >= LegalHoldClearableAt.
- Delay configured at
init (optional, default 0 to preserve current behavior); use Env::ledger().timestamp() per docs/escrow-ledger-time.md.
- Invariant: enabling a hold is always immediate; clearing respects the delay; admin auth required for both.
- Reference ADR-004 legal-hold.
- Must be secure, tested, and documented.
Suggested execution
- Fork the repo and create a branch:
git checkout -b feature/legal-hold-timelock
- Implement changes:
escrow/src/lib.rs
- Tests:
escrow/src/tests/legal_hold.rs
- Docs:
docs/escrow-legal-hold.md
- Include rustdoc/NatSpec-style doc comments on public functions
- Validate security assumptions (auth, overflow, storage TTL, double-spend)
Test and commit
- Run tests:
cargo test
- Cover edge cases (zero amounts, overflow, unauthorized callers, double-spend, state-machine misuse)
- Include test output and security notes in the PR
Example commit message
feat(escrow): timelocked legal-hold clearing window
Guidelines
- Minimum 95% test coverage on new/changed code
- Clear documentation
- Timeframe: 96 hours from assignment
Description
set_legal_hold(active=false)clears a compliance hold instantly with a single admin auth. The module rustdoc notes the contract has no embedded timelock and relies entirely on off-chain governance. Add an optional configurable clear-delay so a hold cannot be lifted until a minimum ledger time after arequest_clear_legal_holdcall, giving compliance an on-chain cooling-off window.Requirements and context
escrowSoroban contract.DataKey::LegalHoldClearableAt;request_clear_legal_holdsets it tonow + delay, andset_legal_hold(false)assertsnow >= LegalHoldClearableAt.init(optional, default 0 to preserve current behavior); useEnv::ledger().timestamp()perdocs/escrow-ledger-time.md.Suggested execution
git checkout -b feature/legal-hold-timelockescrow/src/lib.rsescrow/src/tests/legal_hold.rsdocs/escrow-legal-hold.mdTest and commit
cargo testExample commit message
Guidelines