Description
init guards against usdc_token/revenue_pool/authorized_caller being the vault itself, but set_settlement and set_revenue_pool perform no such self-reference or cross-equality checks. An admin could set the settlement address equal to the USDC token or to the vault, misrouting deduct transfers into the token contract or back into the vault. Add validation to both setters.
Requirements and Context
- In
set_settlement/set_revenue_pool, reject the vault address, the USDC token address, and equality with each other.
- Reuse the panic-string conventions from
init.
- Add tests for each invalid combination.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b bug/vault-address-setter-validation
- Implement changes
contracts/vault/src/lib.rs — validation in both setters
docs/CONTRACT_ADDRESS_CONFIGURATION.md — document constraints
- Test and commit
cargo test -p callora-vault
- Test setting settlement = usdc, = vault, = revenue_pool all revert
- Include test output and notes in the PR
Example commit message
fix: validate settlement/revenue_pool addresses in vault setters
Acceptance Criteria
Guidelines
.rs under contracts/vault/src/, cargo test, /// docs, minimum 95% line coverage, no unwrap() in prod paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
initguards againstusdc_token/revenue_pool/authorized_callerbeing the vault itself, butset_settlementandset_revenue_poolperform no such self-reference or cross-equality checks. An admin could set the settlement address equal to the USDC token or to the vault, misrouting deduct transfers into the token contract or back into the vault. Add validation to both setters.Requirements and Context
set_settlement/set_revenue_pool, reject the vault address, the USDC token address, and equality with each other.init.Suggested Execution
contracts/vault/src/lib.rs— validation in both settersdocs/CONTRACT_ADDRESS_CONFIGURATION.md— document constraintscargo test -p callora-vaultExample commit message
Acceptance Criteria
Guidelines
.rsundercontracts/vault/src/,cargo test,///docs, minimum 95% line coverage, nounwrap()in prod paths