Skip to content

Comments

fix/PRO-3396/userOp-errors-fix#331

Merged
RanaBug merged 2 commits intostagingfrom
fix/PRO-3396/userOp-errors-fix
Jun 5, 2025
Merged

fix/PRO-3396/userOp-errors-fix#331
RanaBug merged 2 commits intostagingfrom
fix/PRO-3396/userOp-errors-fix

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Jun 4, 2025

Description

  • Fix to increase gas fee if error of fee too low
  • Update error message to not show the full error from sdk

How Has This Been Tested?

  • Existing Unit Tests and Manual Testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of transaction and batch sending by enabling automatic retries with increased fees in case of failures.
    • Enhanced user experience by replacing technical error messages with clear, user-friendly guidance for transaction failures.
  • Chores

    • Updated a dependency to the latest version for improved stability.

@RanaBug RanaBug requested review from IAmKio and vignesha22 June 4, 2025 18:11
@RanaBug RanaBug self-assigned this Jun 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The retry logic for sending transactions and batches in two modal components was refactored to use built-in retry options of the send function, removing manual retry loops. Error messages shown to users on failure were standardized to generic, user-friendly messages. The @etherspot/transaction-kit dependency was updated in package.json.

Changes

File(s) Change Summary
package.json Updated @etherspot/transaction-kit dependency from ^1.1.0 to ^1.1.1.
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx,
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx
Refactored retry logic to use send function's retry options; replaced detailed error messages with generic ones.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (SendModal)
    participant Send Function

    User->>UI (SendModal): Initiate Send
    UI (SendModal)->>Send Function: send({ retryOnFeeTooLow: true, maxRetries: 3, feeMultiplier: 1.2 })
    alt Success
        Send Function-->>UI (SendModal): Success
        UI (SendModal)-->>User: Show Success
    else Failure
        Send Function-->>UI (SendModal): Error
        UI (SendModal)-->>User: Show Generic Error Message
    end
Loading

Possibly related PRs

Suggested reviewers

  • IAmKio

Poem

In the warren of code, retries once hopped,
Now with built-in logic, the old loops have stopped.
Errors are gentle, support's just a call,
The kit's version's newer, no need to stall.
🐇✨ Sending with ease, for one and for all!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcb00f8 and 3222ce1.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (2 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (6)
package.json (1)

23-23:

Details

❓ Verification inconclusive

Verify that the package version supports the new retry features.

The dependency update aligns with the retry logic changes in the modal components. However, ensure that version "^1.1.1" of @etherspot/transaction-kit actually exists and includes the retryOnFeeTooLow, maxRetries, and feeMultiplier options used in the updated code.


🏁 Script executed:

#!/bin/bash
# Description: Verify the package version exists and check for retry-related features

# Check if the package version exists on npm
npm view @etherspot/transaction-kit@1.1.1 --json | jq '.version'

# Check available versions to see if 1.1.1 is valid
npm view @etherspot/transaction-kit versions --json | jq '.[-5:]'

Length of output: 198


🏁 Script executed:

#!/bin/bash
# Verify that the 1.1.1 release mentions the new retry options in its documentation
npm view @etherspot/transaction-kit@1.1.1 readme \
  | grep -E "retryOnFeeTooLow|maxRetries|feeMultiplier" -n

Length of output: 107


Confirm retry options in @etherspot/transaction-kit v1.1.1

The README for v1.1.1 doesn’t mention retryOnFeeTooLow, maxRetries, or feeMultiplier. Please manually verify—by reviewing the published package code or release notes—that these retry options are indeed implemented in the 1.1.1 release.

src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (3)

129-133: Excellent refactoring of retry logic using built-in capabilities.

The replacement of manual retry loops with the built-in retry options is a significant improvement. The configuration looks appropriate:

  • retryOnFeeTooLow: true directly addresses the PR objective
  • maxRetries: 3 provides reasonable retry attempts
  • feeMultiplier: 1.2 (20% increase) should help overcome gas fee issues

This approach is cleaner and delegates the retry complexity to the library.


137-138: Good standardization of error messages for better UX.

The generic error message provides a consistent user experience without exposing technical implementation details. This is a good practice for user-facing applications.


170-172: Consistent error message for estimation failures.

The standardized error message maintains consistency with the sending error messages, providing a uniform user experience across different failure scenarios.

src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (2)

300-304: Consistent retry logic implementation across components.

The retry configuration matches exactly with the BatchesTabView component, which is excellent for consistency. The same parameters (3 retries, 20% fee increase) should work well for individual token transactions.


308-309: Standardized error messaging improves user experience.

The generic error message is consistent with the batch sending component and provides a better user experience than exposing technical error details.

Comment on lines +179 to +183
setErrorMessage((prev) => ({
...prev,
[chainId]:
'Something went wrong while sending the assets, please try again later. If the problem persists, contact the PillarX team for support.',
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify error handling completeness.

The error message standardization is good, but ensure that all the technical error details that were previously shown to users are still being logged for debugging purposes. The debug logs should capture the original error messages for troubleshooting.


🏁 Script executed:

#!/bin/bash
# Description: Check if debug logging captures the original error details

# Search for transactionDebugLog calls in the error handling sections
ast-grep --pattern $'catch (error: any) {
  $$$
  transactionDebugLog($$$)
  $$$
}'

# Also check if console.warn or similar logging exists for original error details
rg -A 3 -B 1 "console\.(warn|error|log)" src/components/BottomMenuModal/SendModal/

Length of output: 1790


Add logging of original errors in SendModalBatchesTabView

It looks like you’ve standardized the user-facing error message in the fallback branch, but you’re not emitting the raw error anywhere in that path. To preserve full technical details for debugging, please log the caught error before setting the generic message. For example, you can use your existing transactionDebugLog helper or console.error.

• File: src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx
• Around lines ~179–183, in the fallback branch where you call setErrorMessage with the static string

Suggested change:

catch (error: any) {
+  transactionDebugLog('SendModalBatchesTabView final send error', error);
  setErrorMessage((prev) => ({
    ...prev,
    [chainId]:
      'Something went wrong while sending the assets, please try again later. If the problem persists, contact the PillarX team for support.',
  }));
  setIsSending((prev) => ({ ...prev, [chainId]: false }));
  return;
}

If you prefer built-in logging:

catch (error: any) {
+  console.error('SendModalBatchesTabView final send error:', error);
  // …
}

This ensures the full error stack/message is captured for troubleshooting while keeping the user-facing text consistent.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setErrorMessage((prev) => ({
...prev,
[chainId]:
'Something went wrong while sending the assets, please try again later. If the problem persists, contact the PillarX team for support.',
}));
catch (error: any) {
transactionDebugLog('SendModalBatchesTabView final send error', error);
setErrorMessage((prev) => ({
...prev,
[chainId]:
'Something went wrong while sending the assets, please try again later. If the problem persists, contact the PillarX team for support.',
}));
setIsSending((prev) => ({ ...prev, [chainId]: false }));
return;
}
🤖 Prompt for AI Agents
In src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx around
lines 179 to 183, you have set a generic user-facing error message but are not
logging the original caught error for debugging. To fix this, add a logging
statement before the setErrorMessage call to output the full error details using
either the existing transactionDebugLog helper or console.error. This will
preserve the technical error information for troubleshooting while keeping the
user message standardized.

Comment on lines +339 to +341
setErrorMessage(
'Something went wrong while estimating the asset transfer. Please try again later. If the problem persists, contact the PillarX team for support.'
);
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify consistent error handling patterns.

The error message standardization is good and consistent across different failure scenarios. Ensure that the original error details are still being captured in debug logs for troubleshooting purposes, similar to the batch component.

Also applies to: 372-374


🏁 Script executed:

#!/bin/bash
# Description: Verify that both modal components have consistent error handling and logging

# Compare error handling patterns between the two files
echo "=== Checking retry options consistency ==="
rg "retryOnFeeTooLow|maxRetries|feeMultiplier" src/components/BottomMenuModal/SendModal/

echo "=== Checking error message consistency ==="
rg "Something went wrong while.*contact the PillarX team" src/components/BottomMenuModal/SendModal/

echo "=== Checking debug logging in error scenarios ==="
rg -A 2 "catch.*error" src/components/BottomMenuModal/SendModal/

Length of output: 3296


Ensure debug logging for error details in SendModal

The generic error messages in both tokens and batches tabs are consistent, but neither catch block currently logs the caught error. To aid troubleshooting, please capture the original error details in debug logs (e.g., via console.error(error) or your existing logger) before setting the user-facing message.

Locations to update:

  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (catch block around line 339–341)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (catch block around line 372–374)

Example adjustment:

} catch (error: any) {
  console.error(error);
  setErrorMessage(
    'Something went wrong while estimating the asset transfer. Please try again later. If the problem persists, contact the PillarX team for support.'
  );
}
🤖 Prompt for AI Agents
In src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx around
lines 339 to 341, the catch block sets a generic error message but does not log
the caught error details. To fix this, add a debug log statement such as
console.error(error) or use the existing logger to capture the original error
before calling setErrorMessage. This will help with troubleshooting while
keeping the user-facing message consistent.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 4, 2025

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 87c4686
Status: ✅  Deploy successful!
Preview URL: https://9a616a90.x-e62.pages.dev
Branch Preview URL: https://fix-pro-3396-userop-errors-f.x-e62.pages.dev

View logs

Copy link
Contributor

@vignesha22 vignesha22 left a comment

Choose a reason for hiding this comment

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

LGTM

@RanaBug RanaBug merged commit 4b8c4f8 into staging Jun 5, 2025
7 checks passed
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.

2 participants