Skip to content

Add timelocked legal-hold clearing to prevent instant compliance override #247

@mikewheeleer

Description

@mikewheeleer

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

Metadata

Metadata

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions