Description
lib.rs defines two conflicting caps: MAX_TOTAL_ESCROW_STROOPS = 10_000_000_000_000 (enforced in create_contract) and MAINNET_MAX_TOTAL_ESCROW_PER_CONTRACT_STROOPS = 1_000_000_000_000_000 (reported by get_mainnet_readiness_info but never enforced). amount_validation.rs adds a third bound MAX_SINGLE_AMOUNT_STROOPS. Consolidate to one enforced, governable cap to avoid silent mismatch between reported and enforced limits.
Requirements and context
- Scoped to TalentTrust
escrow Soroban contract (contracts/escrow).
- Choose a single canonical per-contract cap, enforce it in
create_contract and as the ceiling in deposit_funds, and have get_mainnet_readiness_info report the same value.
- Document the relationship between per-contract cap and
amount_validation::MAX_SINGLE_AMOUNT_STROOPS.
- Invariant: the cap reported by readiness equals the cap enforced at create/deposit time.
- Must be secure, tested, and documented.
Suggested execution
- Fork the repo and create a branch:
git checkout -b security/canonical-escrow-cap
- Implement changes:
contracts/escrow/src/lib.rs
- Tests:
contracts/escrow/src/test/mainnet_readiness.rs
- Docs:
docs/escrow/mainnet-readiness.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
fix(escrow): unify enforced and reported escrow caps
Guidelines
- Minimum 95% test coverage on new/changed code
- Clear documentation
- Timeframe: 96 hours from assignment
Description
lib.rsdefines two conflicting caps:MAX_TOTAL_ESCROW_STROOPS = 10_000_000_000_000(enforced increate_contract) andMAINNET_MAX_TOTAL_ESCROW_PER_CONTRACT_STROOPS = 1_000_000_000_000_000(reported byget_mainnet_readiness_infobut never enforced).amount_validation.rsadds a third boundMAX_SINGLE_AMOUNT_STROOPS. Consolidate to one enforced, governable cap to avoid silent mismatch between reported and enforced limits.Requirements and context
escrowSoroban contract (contracts/escrow).create_contractand as the ceiling indeposit_funds, and haveget_mainnet_readiness_inforeport the same value.amount_validation::MAX_SINGLE_AMOUNT_STROOPS.Suggested execution
git checkout -b security/canonical-escrow-capcontracts/escrow/src/lib.rscontracts/escrow/src/test/mainnet_readiness.rsdocs/escrow/mainnet-readiness.mdTest and commit
cargo testExample commit message
Guidelines