Description
We migrated most panics to VaultError but a few sites still call panic!("...") (notably in the withdraw_to path and some metadata setters). Sweep contracts/vault/src/lib.rs for any remaining panic! invocations and replace with the appropriate VaultError variant, adding new ones if needed.
Requirements and Context
- Inventory every
panic! and unwrap site under contracts/vault/src/lib.rs
- Replace with typed errors; add
VaultError variants where none fit
- 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 audit/vault-panic-sweep
- Implement changes
contracts/vault/src/lib.rs
contracts/vault/src/test.rs (assert new codes)
- Test and commit
cargo test -p callora-vault
- Cover edge cases: every replaced path tested
- Include test output and notes in the PR
Example commit message
audit(vault): replace remaining string panics with VaultError variants
Acceptance Criteria
Guidelines
.rs only under contracts/.../src/, NatSpec-style /// doc comments, 95% coverage
- Use real Soroban SDK idioms; no
unwrap() in production paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
We migrated most panics to
VaultErrorbut a few sites still callpanic!("...")(notably in thewithdraw_topath and some metadata setters). Sweepcontracts/vault/src/lib.rsfor any remainingpanic!invocations and replace with the appropriateVaultErrorvariant, adding new ones if needed.Requirements and Context
panic!andunwrapsite undercontracts/vault/src/lib.rsVaultErrorvariants where none fitSuggested Execution
contracts/vault/src/lib.rscontracts/vault/src/test.rs(assert new codes)cargo test -p callora-vaultExample commit message
Acceptance Criteria
panic!(in production paths undercontracts/vault/src/lib.rsVaultErrorvariants documented inlineGuidelines
.rsonly undercontracts/.../src/, NatSpec-style///doc comments, 95% coverageunwrap()in production paths