docs(test/escrow): document Error catalog and add security tests (Iss…#370
Open
spartan124 wants to merge 1 commit into
Open
docs(test/escrow): document Error catalog and add security tests (Iss…#370spartan124 wants to merge 1 commit into
spartan124 wants to merge 1 commit into
Conversation
Talenttrust#344) - Add docs/escrow/ERROR_CATALOG.md documenting all codes in `types::Error` (1..=23), with entrypoints, trigger conditions, and live vs reserved status. - Update docs/escrow/SECURITY.md with security assumptions, entrypoint→error mapping, and integration guidance. - Implement contracts/escrow/src/test/security.rs using existing test harness helpers (register_client/create_contract/complete_contract/assert_contract_error). - Add fail-closed and atomicity checks (no state mutation on rejected refund/release). - Add edge case coverage: unauthorized deposit, double release/refund, invalid index, empty/duplicate refund list; placeholders/ignored tests for TTL approvals and fees. Note: rustfmt/cargo tooling requires resolving duplicate module path for `mod test;` (src/test.rs vs src/test/mod.rs). This change keeps the directory module and removes/ renames the duplicate file to unblock formatting. Co-authored-by: Copilot <copilot@github.com>
|
@spartan124 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #344
PR Title
docs(test/escrow): add ordered Escrow error catalog + security tests (Issue #344)
Summary
This PR delivers the documentation + test scaffolding requested in
@Talenttrust/Talenttrust-Contracts/issues/344, scoped strictly to the escrow Soroban
contract in
contracts/escrow.It includes:
types::Errorvariant (codes 1..=23)with entrypoints + trigger conditions, and clearly marking reserved/unused codes.
contracts/escrow/src/test/security.rstest suite written against the existing test harness(
contracts/escrow/src/test/mod.rs) to validate security assumptions and error paths when the crateis buildable.
Changes
Documentation
docs/escrow/ERROR_CATALOG.mdcontracts/escrow/src/types.rs(Error,#[repr(u32)])docs/escrow/SECURITY.mdTests
contracts/escrow/src/test/security.rsregister_client,create_contract,complete_contract,assert_contract_error)crate::types::Errorvariants (not numeric literals)Notes: Formatting / Build Blockers
While preparing this work,
cargo fmt --checkfailed due to a module path collision:contracts/escrow/src/test.rscontracts/escrow/src/test/mod.rsRust (and rustfmt) cannot resolve
mod test;when both exist. This PR removes/renames the redundantmodule file so formatting and compilation can proceed consistently.
Test Output
Local Commands
cargo fmt cargo fmt --check cargo testCurrent Status
At time of writing,
cargo testis blocked by pre-existing compilation failures in:contracts/escrow/src/lib.rscontracts/escrow/src/proptest.rsThese failures are unrelated to the documentation and test additions in this PR. This PR does not
attempt to refactor beyond the escrow scope, but it does include the tests so they can run once
the compile blockers are resolved.
If/when the escrow crate compiles, the security tests are expected to run under:
cargo test -p escrowSecurity Notes (Reviewer Focus)
refund state and contract totals do not change on validation failure.
UnauthorizedRoleand should notmutate balance/state.
Created, release only inFunded; tests validate expected failures.supports setting
ReleaseAuthorizationin tests.test for future implementation.
Checklist (Issue #344)
contracts/escrow/src/test/security.rsusing existing harnesscontracts/escrow+docs/escrow)