Skip to content

send transaction batch speed improvement#263

Merged
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes
Mar 20, 2025
Merged

send transaction batch speed improvement#263
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Mar 20, 2025

Description

  • Removed double estimation for sending transactions batches

How Has This Been Tested?

  • 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

  • Refactor
    • Streamlined the transaction sending process by removing an earlier cost estimation step.
    • Updated the messaging to provide direct feedback on transaction performance and error handling.

@RanaBug RanaBug requested a review from IAmKio March 20, 2025 10:54
@RanaBug RanaBug self-assigned this Mar 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

This pull request modifies the SendModalBatchesTabView component by removing the use of the estimate function from the useEtherspotTransactions hook. The onSend function now invokes the send function directly, with variable updates reflecting this change from estimated to sent. Error handling and logging have been updated accordingly to capture responses directly from the send function, and redundant code has been cleaned up.

Changes

File(s) Change Summary
src/components/BottomMenuModal/SendModal/…BatchesTabView.tsx Removed the call to the estimate function from useEtherspotTransactions; updated the onSend function to call send directly; replaced estimated variable with sent; refined error handling and logging; eliminated redundant variable declarations.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as SendModalBatchesTabView
    participant T as useEtherspotTransactions

    U->>C: Trigger onSend()
    C->>T: Call send() without estimating cost
    T-->>C: Return sent response (cost, error details)
    C-->>U: Display transaction result based on sent response
Loading

Possibly related PRs

  • fix/wallet-connect-qa-fixes #254: Introduces getTransactionHash in SendModalTokensTabView and involves transaction handling changes, which correlate with the modifications in the current PR.
  • sending transaction speed improvements #262: Involves similar changes to the SendModalBatchesTabView component, including the removal of the estimate function and renaming of variables to sent.

Suggested reviewers

  • IAmKio

Poem

I'm a happy rabbit, leaping through the code,
Hopping over removed lines on my little road,
No more estimating, just sending with cheer,
Debug logs now clear, crystal, and dear!
ASCII bunnies dance in the rhythm of the change —
CodeRabbit brings joy, never out of range!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 41d0f3a and 869f23d.

📒 Files selected for processing (1)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: unit-tests
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (6)

55-55: Great optimization removing the unnecessary estimate function.

This change simplifies the hook usage by only extracting the needed send function, which aligns with the PR objective of removing the double estimation process.


92-92: Performance improvement by directly calling send without pre-estimation.

The code now directly calls send instead of first estimating the transaction, eliminating a redundant step and improving the batch transaction performance.


94-98: Successfully adapted cost estimation logic to use send response.

The code now correctly retrieves the estimated cost from the send function response instead of a separate estimation step, maintaining the same functionality but with improved performance.


108-108: Updated warning message to correctly reference sent response.

The warning message has been properly updated to log the sent response instead of the previously logged estimated response.


111-120: Error handling updated to use sent response data.

The error handling logic is correctly updated to extract error information from the sent response, ensuring that error reporting works as expected with the new workflow.


86-141:

Details

❓ Verification inconclusive

Verify that all transaction batch scenarios are still covered after the optimization.

The onSend function has been significantly simplified by removing the separate estimation step. Please ensure that all edge cases continue to work as expected, particularly for complex transaction batches or networks with unusual fee structures.


🏁 Script executed:

#!/bin/bash
# Search for usage of useEtherspotTransactions hook to verify similar patterns
rg -A 5 $'useEtherspotTransactions' --type=typescript

Length of output: 87


I'll re-run the verification using a corrected search flag for TSX files. Please run the following script:

Once we have the output for this command, we can verify whether similar patterns or edge cases for transaction batches are implemented elsewhere, ensuring that all scenarios are covered even after the optimization in onSend.


🏁 Script executed:

#!/bin/bash
rg -A 5 "useEtherspotTransactions" -g "*.tsx"

Length of output: 3784


Action: Verify Transaction Batch Edge Cases

Please ensure that the recent optimization in the onSend function covers all scenarios for transaction batches. In particular:

  • Missing Estimated Cost: Confirm the fallback behavior when estimatedBatches[0].cost is absent (e.g., logging the warning and proceeding) works correctly on networks with unusual fee structures.
  • Estimation and Send Errors: Verify that both the estimation error (estimatedBatches[0].errorMessage) and the sending error (sentBatches[0].errorMessage) branches trigger correct UI updates and state resets.
  • User Operation Hash: Ensure that the scenario where userOpHash is missing properly informs the user through error.failedToGetTransactionHashReachSupport.
  • Test Coverage: Check that the tests—such as those in SendModal.test.skip.tsx and the usage of useEtherspotTransactions in both SendModalBatchesTabView.tsx and SendModalTokensTabView.tsx—adequately simulate these cases or add additional tests if needed.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 869f23d
Status: ✅  Deploy successful!
Preview URL: https://64d9fa70.x-e62.pages.dev
Branch Preview URL: https://fix-wallet-connect-qa-fixes.x-e62.pages.dev

View logs

@RanaBug RanaBug merged commit 5db57d5 into staging Mar 20, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jun 4, 2025
3 tasks
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