Error Codes
Common revert reasons and how to resolve them.
PoolController
| Error | Cause | Resolution |
|---|---|---|
| InvalidAmount | Deposit amount is 0 | Ensure amount > 0 |
| CommitmentAlreadyUsed | Commitment was already deposited | Generate new secret/nullifier pair |
| NullifierAlreadyUsed | Nullifier was already spent | This deposit was already withdrawn |
| InvalidProof | ZK proof verification failed | Check inputs match original deposit |
| InsufficientBalance | Pool has less than withdrawal amount | Wait for rebalance or reduce amount |
| TransferFailed | WETH transfer reverted | Check WETH approval and balance |
AIRecommendationCommitment
| Error | Cause | Resolution |
|---|---|---|
| OnlyAIService | Caller is not authorized AI service | Use correct AI service address |
| RecommendationNotFound | Invalid recommendation ID | Check ID from commitment event |
| RecommendationExpired | Recommendation too old to execute | Generate new recommendation |
| AlreadyExecuted | Recommendation was already used | Each recommendation single-use |
| CommitmentMismatch | Provided allocations don't match hash | Use exact values from commitment |
DAOConstraintManager
| Error | Cause | Resolution |
|---|---|---|
| ExceedsMaxAllocation | Single protocol > max limit | Reduce allocation to comply with policy |
| InsufficientDiversification | Too few protocols with allocation | Spread across more protocols |
| VolatilityTooHigh | Risk score exceeds threshold | Wait for market conditions to improve |
| ManualApprovalRequired | Policy requires governance vote | Submit to DAO for approval |
| OnlyGovernance | Caller is not governance contract | Policy changes require governance |
Frontend / Client Errors
| Error | Cause | Resolution |
|---|---|---|
| ChunkLoadError | Failed to load circomlibjs WASM | Refresh page, check network |
| DecryptionFailed | Wrong wallet for encrypted note | Connect original deposit wallet |
| ProofGenerationFailed | Invalid inputs to circuit | Verify secret/nullifier match deposit |
| NetworkMismatch | Wallet on wrong chain | Switch to Anvil (31337) |
| UserRejected | User rejected transaction | Approve transaction in wallet |
Debugging Tips
Check Contract State
# Check if commitment exists cast call $POOL_CONTROLLER "commitments(bytes32)" $COMMITMENT # Check if nullifier is spent cast call $POOL_CONTROLLER "nullifierUsed(bytes32)" $NULLIFIER # Get current allocation weights cast call $STRATEGY_ROUTER "getAllocationBreakdown()" # Get DAO policy cast call $DAO_MANAGER "getActivePolicy()"
Trace Failed Transaction
# Get revert reason from Anvil cast run $TX_HASH --rpc-url http://localhost:8545 # Or use Foundry's trace forge script --debug script/SomeScript.s.sol
Verify Proof Locally
# Using snarkjs CLI snarkjs groth16 verify \ public/circuits/keys/verification_key.json \ public_signals.json \ proof.json