Description
InvoiceEscrow.sme_address is fixed at init and is the sole authority for withdraw, settle, and record_sme_collateral_commitment, yet docs/ESCROW_BENEFICIARY_ROTATION.md describes a rotation flow that has no on-chain entrypoint. Add a governed rotate_beneficiary so the SME beneficiary can be updated (e.g. for assignment/factoring) without redeploying.
Requirements and context
- Scoped to the LiquiFact
escrow Soroban contract.
- Require dual consent: current
sme_address auth and admin auth; only allowed in non-terminal states (status 0 or 1).
- Reject rotation to the same address; emit a
BeneficiaryRotated #[contractevent].
- Invariant: after rotation, only the new SME may
withdraw/settle; collateral metadata ownership transfers with it.
- Align behavior with
docs/ESCROW_BENEFICIARY_ROTATION.md.
- Must be secure, tested, and documented.
Suggested execution
- Fork the repo and create a branch:
git checkout -b feature/rotate-beneficiary
- Implement changes:
escrow/src/lib.rs
- Tests:
escrow/src/tests/admin.rs
- Docs:
docs/ESCROW_BENEFICIARY_ROTATION.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): governed beneficiary rotation entrypoint
Guidelines
- Minimum 95% test coverage on new/changed code
- Clear documentation
- Timeframe: 96 hours from assignment
Description
InvoiceEscrow.sme_addressis fixed atinitand is the sole authority forwithdraw,settle, andrecord_sme_collateral_commitment, yetdocs/ESCROW_BENEFICIARY_ROTATION.mddescribes a rotation flow that has no on-chain entrypoint. Add a governedrotate_beneficiaryso the SME beneficiary can be updated (e.g. for assignment/factoring) without redeploying.Requirements and context
escrowSoroban contract.sme_addressauth and admin auth; only allowed in non-terminal states (status0 or 1).BeneficiaryRotated#[contractevent].withdraw/settle; collateral metadata ownership transfers with it.docs/ESCROW_BENEFICIARY_ROTATION.md.Suggested execution
git checkout -b feature/rotate-beneficiaryescrow/src/lib.rsescrow/src/tests/admin.rsdocs/ESCROW_BENEFICIARY_ROTATION.mdTest and commit
cargo testExample commit message
Guidelines