Context
User-facing deposit/withdraw paths return VaultError, but DAO governance helpers in lib.rs use panic! for validation failures.
Problem / Gap
Functions like vote_on_proposal, execute_strategy_proposal, create_strategy_proposal, and set_dao_threshold panic on duplicate votes, failed quorum, or invalid weights. Panics are harder for indexers/wallets to decode than structured VaultError or contracterror enums.
Proposed approach
- Extend
VaultError with governance-specific codes (e.g., DuplicateVote, ProposalExecuted, QuorumNotReached).
- Replace
panic! calls in governance flow with Result<(), VaultError> returns.
- Update
permissions.rs matrix and add tests for each error path.
Files/areas affected
contracts/vault/src/lib.rs
contracts/vault/src/permissions.rs
contracts/vault/src/test.rs
Context
User-facing deposit/withdraw paths return
VaultError, but DAO governance helpers inlib.rsusepanic!for validation failures.Problem / Gap
Functions like
vote_on_proposal,execute_strategy_proposal,create_strategy_proposal, andset_dao_thresholdpanic on duplicate votes, failed quorum, or invalid weights. Panics are harder for indexers/wallets to decode than structuredVaultErrororcontracterrorenums.Proposed approach
VaultErrorwith governance-specific codes (e.g.,DuplicateVote,ProposalExecuted,QuorumNotReached).panic!calls in governance flow withResult<(), VaultError>returns.permissions.rsmatrix and add tests for each error path.Files/areas affected
contracts/vault/src/lib.rscontracts/vault/src/permissions.rscontracts/vault/src/test.rs