|
| 1 | +# PCZT Creation Error - Reproduction Test Plan |
| 2 | + |
| 3 | +## Changes Made |
| 4 | +✅ **Error Handling Improvements Applied** |
| 5 | +- `error.rs`: Changed `PcztCreate` to include error details: `PcztCreate(String)` |
| 6 | +- `wallet.rs:569`: Updated `pczt_shield` to log and capture error details |
| 7 | +- `wallet.rs:657-660`: Updated `pczt_create` to log and capture error details |
| 8 | +- **Build Status**: ✅ Compiled successfully |
| 9 | + |
| 10 | +## Error Will Now Show Details |
| 11 | +Previously: `"Failed to create PCZT"` (no details) |
| 12 | +Now: `"Failed to create PCZT: <actual error from librustzcash>"` (includes root cause) |
| 13 | + |
| 14 | +## Testing Scenarios |
| 15 | + |
| 16 | +### Scenario 1: Transaction with Memo (PRIORITY - Never Tested) |
| 17 | + |
| 18 | +**Setup:** |
| 19 | +1. Open http://localhost:3000 |
| 20 | +2. Connect MetaMask snap |
| 21 | +3. Ensure wallet is fully synced |
| 22 | +4. Attempt to send ZEC with a memo |
| 23 | + |
| 24 | +**Steps:** |
| 25 | +``` |
| 26 | +To: <any_valid_zcash_address> |
| 27 | +Amount: 0.001 ZEC |
| 28 | +Memo: "Test memo for NU6.1" |
| 29 | +``` |
| 30 | + |
| 31 | +**Expected Behaviors:** |
| 32 | +- ✅ **Success**: Transaction creates PCZT successfully |
| 33 | +- ❌ **Failure**: Console shows detailed error message |
| 34 | + |
| 35 | +**Check Console For:** |
| 36 | +- `pczt_create: create_pczt_from_proposal failed: <details>` |
| 37 | +- Look for: memo-related errors, encoding issues, or validation failures |
| 38 | + |
| 39 | +### Scenario 2: Shielding Operation |
| 40 | + |
| 41 | +**Setup:** |
| 42 | +1. Ensure wallet has transparent balance |
| 43 | +2. Attempt to shield funds to Sapling/Orchard |
| 44 | + |
| 45 | +**Steps:** |
| 46 | +``` |
| 47 | +Shield Amount: <available_transparent_balance> |
| 48 | +Target Pool: Orchard |
| 49 | +``` |
| 50 | + |
| 51 | +**Check Console For:** |
| 52 | +- `pczt_shield: create_pczt_from_proposal failed: <details>` |
| 53 | +- Look for: anchor mismatch, tree state issues |
| 54 | + |
| 55 | +### Scenario 3: Multiple Small Transactions (Note Fragmentation) |
| 56 | + |
| 57 | +**Hypothesis:** Wallet with many small notes might trigger input selection issues |
| 58 | + |
| 59 | +**Setup:** |
| 60 | +1. Create multiple small notes by receiving several small transactions |
| 61 | +2. Attempt to spend more than any single note |
| 62 | +3. Forces wallet to combine notes |
| 63 | + |
| 64 | +**Check For:** |
| 65 | +- Input selection failures |
| 66 | +- "insufficient balance" despite having enough total |
| 67 | + |
| 68 | +### Scenario 4: Transaction After Partial Sync |
| 69 | + |
| 70 | +**Hypothesis:** Wallet not fully synced might have stale anchor |
| 71 | + |
| 72 | +**Setup:** |
| 73 | +1. Stop sync before completion (close browser mid-sync) |
| 74 | +2. Reload and attempt transaction without re-syncing |
| 75 | +3. See if pre-sync validation catches it or if PCZT creation fails |
| 76 | + |
| 77 | +**Check For:** |
| 78 | +- "Wallet not fully synced" warning triggers auto-sync (line 598-605) |
| 79 | +- OR anchor mismatch in PCZT creation |
| 80 | + |
| 81 | +### Scenario 5: Pre-NU6.1 Notes (If Available) |
| 82 | + |
| 83 | +**Hypothesis:** Notes received before block 3,146,400 might have compatibility issues |
| 84 | + |
| 85 | +**Check:** |
| 86 | +- Look at transaction history for any notes from before Jan 2026 |
| 87 | +- Try to spend these specific notes |
| 88 | +- Check if serialization format causes issues |
| 89 | + |
| 90 | +## What to Look For in Console |
| 91 | + |
| 92 | +With our improved error handling, you should now see: |
| 93 | + |
| 94 | +```javascript |
| 95 | +// Console output will show: |
| 96 | +ERROR pczt_create: create_pczt_from_proposal failed: <ACTUAL ERROR> |
| 97 | + |
| 98 | +// Examples of what might appear: |
| 99 | +// - "anchor not found in commitment tree" |
| 100 | +// - "insufficient balance after selecting inputs" |
| 101 | +// - "note value exceeds maximum" |
| 102 | +// - "invalid memo encoding" |
| 103 | +// - "transaction would create negative balance" |
| 104 | +``` |
| 105 | + |
| 106 | +## Debugging Steps |
| 107 | + |
| 108 | +1. **Open Browser Console** (F12) before any transaction attempt |
| 109 | +2. **Enable verbose logging** if available |
| 110 | +3. **Copy full error message** including the new detailed part |
| 111 | +4. **Note wallet state**: |
| 112 | + - Current block height |
| 113 | + - Number of notes |
| 114 | + - Total balance |
| 115 | + - Last sync time |
| 116 | + |
| 117 | +## Expected Results |
| 118 | + |
| 119 | +If the forum user's error is reproducible: |
| 120 | +- You'll see the SAME detailed error message |
| 121 | +- Can then determine if it's: |
| 122 | + - ✅ A memo-specific issue |
| 123 | + - ✅ A tree/anchor sync issue |
| 124 | + - ✅ A NU6.1 compatibility issue |
| 125 | + - ✅ An input selection bug |
| 126 | + |
| 127 | +If NO error occurs: |
| 128 | +- The issue might be environment-specific |
| 129 | +- Or related to a specific wallet state we haven't replicated |
| 130 | +- Request more details from the forum user about their setup |
| 131 | + |
| 132 | +## Next Steps After Testing |
| 133 | + |
| 134 | +1. **If error reproduced**: Analyze the detailed error message to identify fix |
| 135 | +2. **If error NOT reproduced**: Deploy this improved error logging to production so users can report detailed errors |
| 136 | +3. **Check forum**: Ask user to update snap and provide new detailed error message |
| 137 | + |
| 138 | +## Quick Commands |
| 139 | + |
| 140 | +```bash |
| 141 | +# Start dev servers |
| 142 | +cd /home/skynet/ztest/WebZjs && yarn dev |
| 143 | + |
| 144 | +# Check build status |
| 145 | +cd /home/skynet/ztest/WebZjs && just build |
| 146 | + |
| 147 | +# View console logs in browser |
| 148 | +# F12 → Console tab → Look for "pczt_create" or "pczt_shield" errors |
| 149 | +``` |
0 commit comments