Skip to content

fix(wallet): retry flaky Fuji RPC calls - #95

Merged
hitakshiA merged 2 commits into
mainfrom
fix/wallet-rpc-retry-resilience
Jul 12, 2026
Merged

fix(wallet): retry flaky Fuji RPC calls#95
hitakshiA merged 2 commits into
mainfrom
fix/wallet-rpc-retry-resilience

Conversation

@hitakshiA

@hitakshiA hitakshiA commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Fuji's public RPC intermittently fails ('HTTP request failed', rate limits). Give the eERC clients retryCount 5 + 25s timeout so transient failures self-heal. Build ✓ · lint ✓.

Summary by CodeRabbit

  • Bug Fixes
    • Improved RPC reliability by adding retry behavior, configured delays, and longer request timeouts for wallet and public network interactions.
    • Ensured consistent RPC connection settings across the wallet and its public-chain client.
  • Tests
    • Updated the USDC transfer test to verify the RPC request includes the new connection options (retries, delay, and timeout).

Greptile Summary

This PR improves Fuji RPC reliability for wallet eERC calls. The main changes are:

  • Added retry and timeout options to viem public clients.
  • Added the same transport settings to wallet clients.
  • Updated the eERC test to expect retry configuration.

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/eerc.ts Adds retry and timeout options to the viem transports used by eERC wallet and public clients.
apps/wallet/src/lib/eerc.test.ts Updates the transport expectation for the new retry configuration.

Reviews (2): Last reviewed commit: "fix(wallet): retry flaky Fuji RPC calls ..." | Re-trigger Greptile

Fuji's public RPC intermittently returns HTTP errors / rate limits, which
surfaced as 'HTTP request failed' mid-shield and stalled balance reads. Give the
eERC viem clients retryCount 5 + a 25s timeout so transient RPC failures self-heal
instead of failing the flow.
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

RPC transport configuration now applies retry and timeout settings to public and wallet clients, including the memoized public client rebuild path. Tests verify the configured retry count.

Changes

RPC transport resilience

Layer / File(s) Summary
Configure RPC transport options
apps/wallet/src/lib/eerc.ts, apps/wallet/src/lib/eerc.test.ts
Public and wallet client transports use five retries, an 800 ms retry delay, and a 25-second timeout; the transfer test verifies the retry count.

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

🚥 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 main change: adding retry handling for flaky Fuji RPC calls in the wallet.
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-rpc-retry-resilience

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

@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/eerc.ts`:
- Around line 81-85: Update the existing mocks.http expectation in the
transferPublicUsdc test to include the retryCount, retryDelay, and timeout
options now passed by the publicClient and walletClient transports, while
preserving the expected RPC URL and both client setup calls.
🪄 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: 50d0861b-2845-4aa5-92a6-ccca0fe90f97

📥 Commits

Reviewing files that changed from the base of the PR and between e7d0199 and 433cca4.

📒 Files selected for processing (1)
  • apps/wallet/src/lib/eerc.ts

Comment on lines +81 to +85
publicClient: createPublicClient({ chain: ACTIVE_CHAIN, transport: http(RPC_URL, { retryCount: 5, retryDelay: 800, timeout: 25_000 }) }),
walletClient: createWalletClient({
account: viemAccount,
chain: ACTIVE_CHAIN,
transport: http(RPC_URL),
transport: http(RPC_URL, { retryCount: 5, retryDelay: 800, timeout: 25_000 }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Update the existing http mock expectation.

Lines 81-85 now pass transport options, but apps/wallet/src/lib/eerc.test.ts still expects mocks.http to be called with only "https://rpc.example". The transferPublicUsdc test will therefore fail.

- expect(mocks.http).toHaveBeenCalledWith("https://rpc.example");
+ expect(mocks.http).toHaveBeenCalledWith("https://rpc.example", {
+   retryCount: 5,
+   retryDelay: 800,
+   timeout: 25_000,
+ });
🤖 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/eerc.ts` around lines 81 - 85, Update the existing
mocks.http expectation in the transferPublicUsdc test to include the retryCount,
retryDelay, and timeout options now passed by the publicClient and walletClient
transports, while preserving the expected RPC URL and both client setup calls.

Fuji's public RPC intermittently returns HTTP errors / rate limits, surfacing as
'HTTP request failed' mid-shield and stalled balance reads. Give the eERC viem
clients retryCount 5 + a 25s timeout so transient RPC failures self-heal instead
of failing the flow.
@hitakshiA
hitakshiA merged commit 0a855a2 into main Jul 12, 2026
3 checks passed
@hitakshiA
hitakshiA deleted the fix/wallet-rpc-retry-resilience branch July 12, 2026 03:37

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

🧹 Nitpick comments (1)
apps/wallet/src/lib/eerc.test.ts (1)

60-60: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the complete transport configuration.

This expectation only protects retryCount; retryDelay: 800 and timeout: 25_000 from apps/wallet/src/lib/eerc.ts:78-87 and apps/wallet/src/lib/eerc.ts:94-102 could regress without failing the test.

Suggested assertion
-    expect(mocks.http).toHaveBeenCalledWith("https://rpc.example", expect.objectContaining({ retryCount: 5 }));
+    expect(mocks.http).toHaveBeenCalledWith(
+      "https://rpc.example",
+      expect.objectContaining({ retryCount: 5, retryDelay: 800, timeout: 25_000 }),
+    );
🤖 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/eerc.test.ts` at line 60, Update the HTTP mock assertion
in the eerc test to verify the complete transport configuration, including
retryCount 5, retryDelay 800, and timeout 25_000, while preserving the existing
RPC URL check.
🤖 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.

Nitpick comments:
In `@apps/wallet/src/lib/eerc.test.ts`:
- Line 60: Update the HTTP mock assertion in the eerc test to verify the
complete transport configuration, including retryCount 5, retryDelay 800, and
timeout 25_000, while preserving the existing RPC URL check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ca4fa2a-da08-494e-82e4-3b412de8ee4a

📥 Commits

Reviewing files that changed from the base of the PR and between 433cca4 and 7381f42.

📒 Files selected for processing (1)
  • apps/wallet/src/lib/eerc.test.ts

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