fix(wallet): window activity getLogs under Fuji's 2048 cap + log raw flow errors - #91
Conversation
… raw flow errors Fuji's public RPC rejects eth_getLogs over 2048 blocks (-32000), which viem surfaces as InvalidInputRpcError; the activity scan window defaulted to 10000, so the activity feed always failed to refresh. Drop the default to 2000. Also log the raw error in the send/shield/unshield catch blocks before mapError() replaces it with a friendly message, so real failures (revert, rate limit, rpc) are visible in dev tools.
📝 WalkthroughWalkthroughThe wallet lowers the default EERC activity log window to 2000 blocks and adds raw console error logging to send and shield stream failure paths. ChangesEERC RPC Window
Stream Error Logging
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/wallet/src/lib/useSendStream.ts`:
- Around line 64-65: Guard the raw error logging in the catch flows of
useSendStream and useShieldStream with import.meta.env.DEV, or redact the error
payload for production. Apply the change in apps/wallet/src/lib/useSendStream.ts
lines 64-65 and apps/wallet/src/lib/useShieldStream.ts lines 83-85, while
preserving the existing friendly mapError handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e6b90905-8517-4fc2-9a76-f7a546e35958
📒 Files selected for processing (3)
apps/wallet/src/lib/network.tsapps/wallet/src/lib/useSendStream.tsapps/wallet/src/lib/useShieldStream.ts
| // Raw error to dev tools before the friendly mapping hides the cause. | ||
| console.error("[benzo] send failed:", err); |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the relevant files and inspect the exact surrounding code.
printf '\n## useSendStream outline\n'
ast-grep outline apps/wallet/src/lib/useSendStream.ts --view expanded || true
printf '\n## useShieldStream outline\n'
ast-grep outline apps/wallet/src/lib/useShieldStream.ts --view expanded || true
printf '\n## useSendStream excerpt\n'
sed -n '1,180p' apps/wallet/src/lib/useSendStream.ts | cat -n
printf '\n## useShieldStream excerpt\n'
sed -n '1,220p' apps/wallet/src/lib/useShieldStream.ts | cat -n
# Search for DEV guards and console stripping config.
printf '\n## search for import.meta.env.DEV and console stripping\n'
rg -n "import\.meta\.env\.DEV|drop_console|console\.error|console\.log|console\.warn" apps/wallet packages . --glob '!**/node_modules/**' --glob '!**/dist/**' || trueRepository: Miny-Labs/benzo-wallet
Length of output: 15196
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## search build/tooling config for console stripping or env gating\n'
rg -n "drop_console|drop-console|keep_console|console stripping|import\.meta\.env\.PROD|import\.meta\.env\.DEV|defineConfig|terser|esbuild|minify" \
apps/wallet packages . \
--glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' || true
printf '\n## likely Vite config files\n'
fd -a 'vite.config.*' apps/wallet packages . || true
fd -a 'vite.*config.*' apps/wallet packages . || trueRepository: Miny-Labs/benzo-wallet
Length of output: 4866
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## apps/wallet/vite.config.ts\n'
cat -n apps/wallet/vite.config.ts
printf '\n## apps/wallet/package.json\n'
cat -n apps/wallet/package.json
printf '\n## root package.json\n'
cat -n package.json
printf '\n## search for removeConsole/console stripping in wallet config area\n'
rg -n "removeConsole|drop_console|console.*strip|esbuild.*drop|build\.minify|terser" apps/wallet package.json pnpm-workspace.yaml --glob '!**/node_modules/**' || trueRepository: Miny-Labs/benzo-wallet
Length of output: 4509
Guard raw flow-error logs from production builds.
mapError() already hides the underlying RPC/revert details, but these catch blocks still print the full error object to the browser console. Add a import.meta.env.DEV guard or redact the payload in:
apps/wallet/src/lib/useSendStream.ts#L64-L65apps/wallet/src/lib/useShieldStream.ts#L83-L85
📍 Affects 2 files
apps/wallet/src/lib/useSendStream.ts#L64-L65(this comment)apps/wallet/src/lib/useShieldStream.ts#L83-L85
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/wallet/src/lib/useSendStream.ts` around lines 64 - 65, Guard the raw
error logging in the catch flows of useSendStream and useShieldStream with
import.meta.env.DEV, or redact the error payload for production. Apply the
change in apps/wallet/src/lib/useSendStream.ts lines 64-65 and
apps/wallet/src/lib/useShieldStream.ts lines 83-85, while preserving the
existing friendly mapError handling.
Fuji's public RPC caps
eth_getLogsat 2048 blocks (-32000); the activity scan window defaulted to 10000, so the feed always failed (InvalidInputRpcError: Missing or invalid parameters). Drop the default to 2000. Also log the raw error in the send/shield/unshield catches beforemapError()masks it — needed to diagnose flow failures. Build ✓ · lint ✓ · tests ✓.Summary by CodeRabbit
Greptile Summary
This PR adjusts wallet activity scanning and adds flow diagnostics.
Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(wallet): window eERC activity getLog..." | Re-trigger Greptile