Contracts - Add get_user_commitments returning full records to match backend read path
Description
The backend tries get_user_commitments (full records) before falling back to get_user_commitment_ids, but contracts/escrow/src/lib.rs only exposes get_owner_commitments (ids). Add a get_user_commitments(owner) reader returning full Commitment records to satisfy the primary backend read path.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Add
get_user_commitments returning a Vec<Commitment>
- Keep the id-only reader for the fallback path
- Bound the returned size to stay within limits
- Add tests in
contracts/escrow/src/test.rs for the full-record read
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/get-user-commitments-full-records
- Implement changes
- Add
get_user_commitments in contracts/escrow/src/lib.rs
- Add tests in
contracts/escrow/src/test.rs
- Document the reader in
contracts/README.md
- Add size-bound comments
- Test and commit
- Run tests, cover edge cases
- Include test output and notes
Example commit message
feat: add get_user_commitments full-record reader
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Contracts - Add get_user_commitments returning full records to match backend read path
Description
The backend tries
get_user_commitments(full records) before falling back toget_user_commitment_ids, butcontracts/escrow/src/lib.rsonly exposesget_owner_commitments(ids). Add aget_user_commitments(owner)reader returning fullCommitmentrecords to satisfy the primary backend read path.Requirements and context
get_user_commitmentsreturning aVec<Commitment>contracts/escrow/src/test.rsfor the full-record readSuggested execution
git checkout -b feature/get-user-commitments-full-recordsget_user_commitmentsincontracts/escrow/src/lib.rscontracts/escrow/src/test.rscontracts/README.mdExample commit message
feat: add get_user_commitments full-record readerGuidelines