Skip to content

Vault: validate revenue_pool and settlement are distinct contracts in setters #356

@greatest0fallt1me

Description

@greatest0fallt1me

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

  1. Fork the repo and create a branch
    git checkout -b bug/vault-address-setter-validation
  2. Implement changes
    • contracts/vault/src/lib.rs — validation in both setters
    • docs/CONTRACT_ADDRESS_CONFIGURATION.md — document constraints
  3. 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

  • Self-address and USDC-equality rejected in both setters
  • Settlement and revenue pool cannot be set equal
  • Tests cover each invalid combination
  • Operator doc updated

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programauditSecurity audit/reviewsecuritySecurity hardeningsmart-contractSoroban smart-contract work

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions