Skip to content

refactor(monero-rpc-pool): ureq -> raw hyper#487

Merged
binarybaron merged 10 commits intomasterfrom
refactor/rpc-pool-hyper
Aug 1, 2025
Merged

refactor(monero-rpc-pool): ureq -> raw hyper#487
binarybaron merged 10 commits intomasterfrom
refactor/rpc-pool-hyper

Conversation

@binarybaron
Copy link
Copy Markdown

@binarybaron binarybaron commented Jul 30, 2025

missing connection pooling

not sure how we are handling https and http and self-signed https certificates

Summary by CodeRabbit

  • New Features

    • Added optional support for routing Monero wallet traffic through Tor, controllable via a new setting in both the backend and the user interface.
    • Introduced bandwidth monitoring and reporting for the Monero RPC pool, with real-time bandwidth statistics now visible in the health summary and wallet sync progress UI.
    • Enhanced sync progress display with more accurate calculations and estimated time remaining based on current bandwidth.
  • Improvements

    • Refactored backend proxy logic to use asynchronous HTTP/TLS connections, supporting both clearnet and Tor routing for improved performance and reliability.
    • Streamlined Tor client initialization and bootstrapping for more robust and flexible Tor integration.
    • Improved wallet UI layout for clearer separation of balances and sync status, and added bandwidth-based sync speed estimation.
  • Settings

    • Added a new toggle in the settings panel to enable or disable Monero-over-Tor routing.
  • Bug Fixes

    • Improved sync progress accuracy and UI responsiveness when bandwidth is low or unknown.
  • Chores

    • Updated dependencies and internal configuration to support new asynchronous networking and Tor features.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces comprehensive support for Tor routing and bandwidth tracking in the Monero RPC pool and its associated GUI and backend systems. The backend transitions from synchronous to asynchronous HTTP proxying with hyper, adds optional Tor integration, and tracks bandwidth usage. The GUI and settings are extended to allow toggling Monero-over-Tor routing and display bandwidth statistics.

Changes

Cohort / File(s) Change Summary
Cargo Dependency Refactor
monero-rpc-pool/Cargo.toml
Replaces ureq with async HTTP/TLS dependencies (hyper, arti-client, tokio-native-tls, etc.) to enable async proxying and Tor support.
Config and AppState Tor Integration
monero-rpc-pool/src/config.rs, monero-rpc-pool/src/lib.rs, monero-rpc-pool/src/main.rs
Adds optional Tor client field to config and app state; updates constructors and command-line options to support Tor routing.
Bandwidth Tracking and Pool Status
monero-rpc-pool/src/pool.rs
Implements bandwidth tracking in NodePool; adds bandwidth stats to pool status and reporting.
Async Proxy Refactor with Tor
monero-rpc-pool/src/proxy.rs
Replaces blocking HTTP with async hyper-based proxying; supports Tor, TLS, and detailed error handling; updates stats handler.
Monero-over-Tor GUI Settings
src-gui/src/renderer/components/pages/help/SettingsBox.tsx, src-gui/src/store/features/settingsSlice.ts, src-gui/src/renderer/rpc.ts, swap/src/cli/api/tauri_bindings.rs, src-tauri/src/lib.rs
Adds Monero-over-Tor toggle in settings, Redux state, and passes the setting to backend and tauri context.
Bandwidth and Sync UI Enhancements
src-gui/src/renderer/components/pages/help/MoneroPoolHealthBox.tsx, src-gui/src/renderer/components/pages/monero/components/WalletOverview.tsx, src-gui/src/store/features/walletSlice.ts
Displays bandwidth in the health box; improves sync progress calculation and estimation using bandwidth; tracks lowest block in wallet state.
Wallet Loading UI Layout
src-gui/src/renderer/components/pages/monero/components/WalletPageLoadingState.tsx
Refactors balance section layout from grid to flexbox for improved alignment.
Tor Client Lifecycle Refactor
swap/src/common/tor.rs, swap/src/cli/api.rs, swap/src/bin/asb.rs
Splits Tor client init into creation and bootstrapping; updates usage throughout swap CLI and binary.
Backend Context and Pool Tor Routing
swap/src/cli/api.rs, src-tauri/src/lib.rs
Adds enable_monero_tor flag to context builder; conditionally routes Monero wallet traffic via Tor.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GUI
    participant Backend
    participant MoneroRPCPool
    participant TorClient

    User->>GUI: Enable "Monero over Tor" in settings
    GUI->>Backend: Pass enable_monero_tor flag via Tauri
    Backend->>MoneroRPCPool: Start with config (tor_client: Option)
    MoneroRPCPool->>TorClient: (If enabled) Bootstrap Tor client in background
    GUI->>MoneroRPCPool: Proxy Monero wallet request
    MoneroRPCPool->>TorClient: (If enabled and not whitelisted) Open connection via Tor
    MoneroRPCPool->>Monero Node: Proxy request (via Tor or clearnet)
    Monero Node-->>MoneroRPCPool: Response
    MoneroRPCPool->>GUI: Return response, update bandwidth stats
    GUI->>User: Show bandwidth and sync progress
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • feat(gui): Monero wallet #442: Implements Monero wallet functionality with wallet listener support and event propagation, closely related to the Monero wallet integration and event forwarding in this PR.

Poem

🐇
Through tunnels of Tor, our packets now dash,
Bandwidth is measured—no more a wild guess!
With toggles and chips, the UI feels new,
Sync bars grow smarter, as progress shines through.
Async and hidden, our Monero hops free,
A rabbit’s delight in secure privacy!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 cd12d17 and 7897743.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • monero-rpc-pool/Cargo.toml (1 hunks)
  • monero-rpc-pool/src/config.rs (1 hunks)
  • monero-rpc-pool/src/lib.rs (4 hunks)
  • monero-rpc-pool/src/main.rs (2 hunks)
  • monero-rpc-pool/src/pool.rs (9 hunks)
  • monero-rpc-pool/src/proxy.rs (2 hunks)
  • src-gui/src/renderer/components/pages/help/MoneroPoolHealthBox.tsx (1 hunks)
  • src-gui/src/renderer/components/pages/help/SettingsBox.tsx (3 hunks)
  • src-gui/src/renderer/components/pages/monero/components/WalletOverview.tsx (2 hunks)
  • src-gui/src/renderer/components/pages/monero/components/WalletPageLoadingState.tsx (1 hunks)
  • src-gui/src/renderer/rpc.ts (2 hunks)
  • src-gui/src/store/features/settingsSlice.ts (4 hunks)
  • src-gui/src/store/features/walletSlice.ts (3 hunks)
  • src-tauri/src/lib.rs (1 hunks)
  • swap/src/bin/asb.rs (3 hunks)
  • swap/src/cli/api.rs (6 hunks)
  • swap/src/cli/api/tauri_bindings.rs (1 hunks)
  • swap/src/common/tor.rs (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/rpc-pool-hyper

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 generate unit tests to generate unit tests 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.

@binarybaron
Copy link
Copy Markdown
Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@binarybaron
Copy link
Copy Markdown
Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@binarybaron
Copy link
Copy Markdown
Author

bugbot run

cursor[bot]

This comment was marked as outdated.

@binarybaron binarybaron marked this pull request as ready for review August 1, 2025 10:02
@binarybaron binarybaron merged commit d21baa8 into master Aug 1, 2025
8 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.

1 participant