Repository navigation
Description
Fix: Enforce Non-Zero Address Invariant for Fee Collector and Treasury Queued Updates
Description
Architectural Motivation: In queue_set_fee_collector and queue_set_treasury, the address parameter is serialized into params_hash. In execute_set_fee_collector and execute_set_treasury, the contract deserializes the address and updates storage. If an admin accidentally provides a dummy, empty, or zeroed address, protocol fees will be routed to a black hole upon subsequent settlements. Enforcing address validation before queueing and execution prevents configuration bricking.
Integration & Backend Considerations: Affects admin.rs::queue_set_fee_collector and queue_set_treasury. Reverts with ContractError::InvalidAddress if target address matches system zero or current contract address.
Requirements & Context
contracts/escrow/src/admin.rs (lines 1015-1080). Address parameters are not validated prior to hashing.
Tasks:
Part A — Address Invariant Validation
- In
queue_set_fee_collector, checknew_collector != env.current_contract_address(). - Verify
new_collector != read_admin_address(&env).unwrap()to prevent role confusion. - Apply identical checks in
queue_set_treasury.
Part B — Execution-Time Re-Verification
- In
execute_set_fee_collector, re-validate address before updatingGlobalConfig.fee_collector. - Return
ContractError::InvalidAddresson violation.
Part C — Test Address Validation
- Add test in
test_admin.rsattempting to set fee collector to contract's own address. - Assert call reverts with
ContractError::InvalidAddress.
Acceptance Criteria
-
queue_set_fee_collectorrejects contract address or invalid roles withInvalidAddress. -
queue_set_treasuryrejects contract address withInvalidAddress. - Addresses are validated at both queue time and execution time.
Suggested Execution
git checkout -b fix/validate-fee-collector-addressSuggested Commit Message
fix: enforce non-zero and valid role address checks for fee collector and treasury
Testing Notes
- Run
cargo test --lib test_admin. - Verify error codes match
ContractError::InvalidAddress.
References
contracts/escrow/src/admin.rs#L1015-L1080
contracts/escrow/src/errors.rs#L47-L48
Definition of Done
- Ready for review.
Activity
Kaybee973 commentedon Nov 23, 2026
@Kaybee973 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Kaybee973 to this issue.
keshav2800 commentedon Nov 25, 2026
@keshav2800 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @keshav2800 to this issue.
drips-wave commentedon Nov 25, 2026
Congratulations, @Kaybee973! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @Kaybee973: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
drips-wave commentedon Nov 28, 2026
This issue has been marked as completed by a Drips Wave moderator for @Kaybee973 as part of the Stellar Wave Program's 11th Wave 🥳
Moderator's reason: [Auto-assessed] The contributor's PR #1379 correctly implements the requested address-invariant checks for both fee collector and treasury queued updates in contracts/escrow/src/admin.rs and internal validation helpers, and adds comprehensive unit test coverage in test_admin.rs verifying that zero, contract, and admin addresses are correctly rejected with ContractError::InvalidAddress.
😎 @Kaybee973: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.
ℹ️ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.