Skip to content

Prevent issue_reputation self-rating and add SelfRating enforcement #338

@mikewheeleer

Description

@mikewheeleer

Description

EscrowError::SelfRating is defined in types.rs but never used. issue_reputation checks caller == contract.client and freelancer == contract.freelancer, but does not explicitly prevent a degenerate contract where roles were migrated such that client and freelancer collapse to the same address from self-inflating reputation. Enforce the SelfRating guard.

Requirements and context

  • Scoped to TalentTrust escrow Soroban contract (contracts/escrow).
  • In issue_reputation, reject with EscrowError::SelfRating if contract.client == contract.freelancer (defense-in-depth alongside create-time InvalidParticipant).
  • Confirm the guard interacts correctly with any future client-migration feature.
  • Invariant: a single principal can never both issue and receive reputation on the same contract.
  • Must be secure, tested, and documented.

Suggested execution

  • Fork the repo and create a branch:
    • git checkout -b enhancement/reputation-self-rating-guard
  • Implement changes:
    • contracts/escrow/src/lib.rs
    • Tests: contracts/escrow/src/test/reputation.rs
    • Docs: docs/escrow/REPUTATION.md
    • Include rustdoc/NatSpec-style doc comments on public functions
    • Validate security assumptions (auth, overflow, fail-closed state machine, storage TTL, fee accounting)

Test and commit

  • Run tests: cargo test
  • Cover edge cases (unauthorized callers, double release/refund, expired approvals, fee rounding, paused state)
  • Include test output and security notes in the PR

Example commit message

feat(escrow): enforce SelfRating guard in issue_reputation

Guidelines

  • Minimum 95% test coverage on new/changed code
  • Clear documentation
  • Timeframe: 96 hours from assignment

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions