Skip to content

fix(wallet): window activity getLogs under Fuji's 2048 cap + log raw flow errors - #91

Merged
hitakshiA merged 1 commit into
mainfrom
fix/wallet-getlogs-window-and-error-logging
Jul 11, 2026
Merged

fix(wallet): window activity getLogs under Fuji's 2048 cap + log raw flow errors#91
hitakshiA merged 1 commit into
mainfrom
fix/wallet-getlogs-window-and-error-logging

Conversation

@hitakshiA

@hitakshiA hitakshiA commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Fuji's public RPC caps eth_getLogs at 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 before mapError() masks it — needed to diagnose flow failures. Build ✓ · lint ✓ · tests ✓.

Summary by CodeRabbit

  • Bug Fixes
    • Improved wallet activity scanning reliability on networks with RPC log-range limits.
    • Enhanced error diagnostics for send and shield operations while preserving user-friendly failure messages.

Greptile Summary

This PR adjusts wallet activity scanning and adds flow diagnostics.

  • Lowers the default activity log scan window to 2,000 blocks.
  • Keeps the activity window configurable through the existing env value.
  • Logs raw send, shield, and unshield errors before friendly error mapping.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/wallet/src/lib/network.ts Changed the default activity log window from 10,000 to 2,000 blocks while keeping env overrides.
apps/wallet/src/lib/useSendStream.ts Adds raw console logging before send failures are mapped to the user-facing error.
apps/wallet/src/lib/useShieldStream.ts Adds raw console logging before shield and unshield failures are mapped to user-facing errors.

Reviews (1): Last reviewed commit: "fix(wallet): window eERC activity getLog..." | Re-trigger Greptile

… 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.
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The wallet lowers the default EERC activity log window to 2000 blocks and adds raw console error logging to send and shield stream failure paths.

Changes

EERC RPC Window

Layer / File(s) Summary
Configure EERC activity log window
apps/wallet/src/lib/network.ts
The fallback EERC_ACTIVITY_LOG_WINDOW_BLOCKS value is reduced from 10000 to 2000, with documentation for the Fuji RPC limit and environment override.

Stream Error Logging

Layer / File(s) Summary
Log send and shield failures
apps/wallet/src/lib/useSendStream.ts, apps/wallet/src/lib/useShieldStream.ts
Raw errors are logged before user-facing error mapping and failure-state dispatch in send and shield flows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: shrinking the wallet log scan window for Fuji and logging raw flow errors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wallet-getlogs-window-and-error-logging

Comment @coderabbitai help to get the list of available commands.

@hitakshiA
hitakshiA merged commit 064df69 into main Jul 11, 2026
3 checks passed
@hitakshiA
hitakshiA deleted the fix/wallet-getlogs-window-and-error-logging branch July 11, 2026 13:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a9bb62f and a767826.

📒 Files selected for processing (3)
  • apps/wallet/src/lib/network.ts
  • apps/wallet/src/lib/useSendStream.ts
  • apps/wallet/src/lib/useShieldStream.ts

Comment on lines +64 to +65
// Raw error to dev tools before the friendly mapping hides the cause.
console.error("[benzo] send failed:", err);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 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/**' || true

Repository: 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 . || true

Repository: 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/**' || true

Repository: 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-L65
  • apps/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant