Skip to content

Return backwards compatible configuration with 2.1.x versions #6655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Teebor-Choka
Copy link
Contributor

@Teebor-Choka Teebor-Choka commented Nov 20, 2024

The configuration created a behavior different from 2.1.x which unnecessarily complicated the node interactions. The configuration will be revisited in 3.0 to set proper new values.

@ausias-armesto FYI.

@Teebor-Choka Teebor-Choka added this to the 2.2.0-rc.1 milestone Nov 20, 2024
@Teebor-Choka Teebor-Choka requested a review from a team November 20, 2024 14:19
@Teebor-Choka Teebor-Choka self-assigned this Nov 20, 2024
Copy link
Contributor

coderabbitai bot commented Nov 20, 2024

📝 Walkthrough

Walkthrough

The pull request introduces modifications to the HOPR protocol's configuration and network handling. Key changes include the adjustment of the ignore_timeframe parameter from 600 seconds to 1 second in the example_cfg.yaml file, which affects node responsiveness. Additionally, the NetworkConfig struct in config.rs has been updated to reflect this new default value. The build_p2p_network function in swarm.rs has been simplified to streamline the configuration of the maximum number of streams for the Yamux protocol.

Changes

File Path Change Summary
hoprd/hoprd/example_cfg.yaml Updated ignore_timeframe in network_options from 600 to 1 second.
transport/network/src/config.rs Changed default value of pub ignore_timeframe in NetworkConfig from duration_10_min to duration_1_s; removed duration_10_min function; added duration_1_s function.
transport/p2p/src/swarm.rs Simplified build_p2p_network function to directly parse HOPR_INTERNAL_LIBP2P_YAMUX_MAX_NUM_STREAMS with a default of 1024.
transport/network/Cargo.toml Updated version from 0.6.2 to 0.6.3.
transport/p2p/Cargo.toml Updated version from 0.5.0 to 0.5.1.

Possibly related PRs

Suggested labels

release, crate:hoprd-api

Suggested reviewers

  • NumberFour8
  • Teebor-Choka

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 38514ea and 180bb92.

📒 Files selected for processing (2)
  • transport/network/Cargo.toml (1 hunks)
  • transport/p2p/Cargo.toml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • transport/network/Cargo.toml
  • transport/p2p/Cargo.toml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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

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

@tolbrino tolbrino left a comment

Choose a reason for hiding this comment

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

Cargo version bump missing

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

🧹 Outside diff range and nitpick comments (3)
transport/network/src/config.rs (1)

51-52: Standardize duration function naming.

There's an inconsistency in the naming convention. The file uses both duration_1_s() and duration_1_sec() for 1-second durations. Consider standardizing to use one naming pattern throughout the codebase.

-    #[serde(default = "duration_1_sec")]
-    #[default(duration_1_sec())]
+    #[serde(default = "duration_1_s")]
+    #[default(duration_1_s())]
hoprd/hoprd/example_cfg.yaml (1)

212-212: Consider adding a configuration comment

Since this configuration will be revisited in 3.0, consider adding a comment to document this as a temporary backwards compatibility measure.

+    # Note: Set to 1s for 2.1.x backwards compatibility. Will be revised in 3.0
     ignore_timeframe: 1
transport/p2p/src/swarm.rs (1)

51-54: Consider improving error handling transparency.

The implementation is correct and maintains backwards compatibility. However, the error handling could be more transparent by distinguishing between missing variables and parse errors in logs.

Consider this alternative implementation:

-            let num_streams = std::env::var("HOPR_INTERNAL_LIBP2P_YAMUX_MAX_NUM_STREAMS")
-                .and_then(|v| v.parse::<usize>().map_err(|_e| std::env::VarError::NotPresent))
-                .unwrap_or(1024);
+            let num_streams = match std::env::var("HOPR_INTERNAL_LIBP2P_YAMUX_MAX_NUM_STREAMS") {
+                Ok(v) => match v.parse::<usize>() {
+                    Ok(n) => n,
+                    Err(e) => {
+                        debug!("Failed to parse HOPR_INTERNAL_LIBP2P_YAMUX_MAX_NUM_STREAMS: {}, using default", e);
+                        1024
+                    }
+                },
+                Err(_) => 1024,
+            };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2b1bb5c and 38514ea.

📒 Files selected for processing (3)
  • hoprd/hoprd/example_cfg.yaml (1 hunks)
  • transport/network/src/config.rs (2 hunks)
  • transport/p2p/src/swarm.rs (1 hunks)
🔇 Additional comments (2)
hoprd/hoprd/example_cfg.yaml (1)

212-212: LGTM: Change aligns with backwards compatibility goal

The reduction of ignore_timeframe from 600s to 1s restores the 2.1.x behavior, allowing for more responsive node interactions. The potential impact of frequent retries is adequately controlled by the existing backoff and quality parameters.

transport/p2p/src/swarm.rs (1)

51-54: LGTM! Changes align with backwards compatibility goals.

The modifications to the Yamux configuration are well-contained and maintain backwards compatibility with 2.1.x versions. The default value of 1024 streams matches the Mplex configuration, ensuring consistent behavior across protocols.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Nov 20, 2024
@Teebor-Choka Teebor-Choka merged commit 6aeede6 into master Nov 20, 2024
27 of 28 checks passed
@Teebor-Choka Teebor-Choka deleted the kauki/compatibility/add-compatibility-config-with-2.1 branch November 20, 2024 17:56
@coderabbitai coderabbitai bot mentioned this pull request Dec 18, 2024
1 task
@coderabbitai coderabbitai bot mentioned this pull request Jan 14, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants