Skip to content

Conversation

NumberFour8
Copy link
Contributor

@NumberFour8 NumberFour8 commented Jul 16, 2025

Adds HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS and HOPR_TRANSPORT_STREAM_OPEN_TIMEOUT_MS environment variables.

Closes #7304

…m open timeout

Adds `HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS` and `HOPR_TRANSPORT_STREAM_OPEN_TIMEOUT_MS` environment variables.

Closes #7304
@NumberFour8 NumberFour8 added this to the 3.0.0-temporary milestone Jul 16, 2025
@NumberFour8 NumberFour8 requested a review from a team July 16, 2025 19:41
@NumberFour8 NumberFour8 self-assigned this Jul 16, 2025
Copy link
Contributor

coderabbitai bot commented Jul 16, 2025

📝 Walkthrough

Walkthrough

The changes introduce two new environment variables to allow dynamic configuration of the maximum concurrent packets and stream open timeout in the HOPR transport protocol. Documentation was updated to describe these variables, and the code now reads their values at runtime, overriding previous hardcoded constants.

Changes

File(s) Change Summary
README.md Added documentation for HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS and HOPR_TRANSPORT_STREAM_OPEN_TIMEOUT_MS environment variables.
transport/protocol/Cargo.toml Bumped version from 0.8.0 to 0.8.1.
transport/protocol/src/stream.rs Replaced hardcoded constants for max concurrent packets and stream open timeout with env var lookups.

Sequence Diagram(s)

sequenceDiagram
    participant Env as Environment
    participant Stream as stream.rs
    participant Peer as Peer Connection

    Env->>Stream: Provide HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS
    Env->>Stream: Provide HOPR_TRANSPORT_STREAM_OPEN_TIMEOUT_MS
    Stream->>Stream: Parse env vars or fallback to defaults
    Stream->>Peer: Open stream with configured timeout
    Stream->>Peer: Process packets with configured concurrency
Loading

Assessment against linked issues

Objective Addressed Explanation
Make GLOBAL_STREAM_OPEN_TIMEOUT and MAX_CONCURRENT_PACKETS configurable (#7304)

Suggested labels

crate:hopr-transport

Suggested reviewers

  • tolbrino
✨ 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.
    • 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.

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.

@NumberFour8 NumberFour8 marked this pull request as ready for review July 16, 2025 19:41
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Jul 16, 2025
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: 0

🧹 Nitpick comments (2)
transport/protocol/src/stream.rs (2)

150-153: Environment variable parsing looks good but consider logging invalid values.

The parsing logic correctly handles missing variables and falls back to defaults. However, consider logging a warning when the environment variable is present but contains an invalid value to aid debugging.

 let max_concurrent_packets = std::env::var("HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS")
     .ok()
-    .and_then(|v| v.parse().ok())
+    .and_then(|v| v.parse().map_err(|e| {
+        tracing::warn!("Invalid HOPR_TRANSPORT_MAX_CONCURRENT_PACKETS value '{}': {}, using default {}", v, e, MAX_CONCURRENT_PACKETS);
+        e
+    }).ok())
     .unwrap_or(MAX_CONCURRENT_PACKETS);

19-20: Consider updating the TODO comment.

Since these constants are now configurable via environment variables, the TODO comment about making them configurable could be updated to reflect this improvement.

-// TODO: see if these constants should be configurable instead
+// Default values for configurable constants (see environment variables below)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6dcbb00 and f7ba83e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • README.md (1 hunks)
  • transport/protocol/Cargo.toml (1 hunks)
  • transport/protocol/src/stream.rs (2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6546
File: transport/p2p/src/lib.rs:224-228
Timestamp: 2024-10-11T13:09:01.392Z
Learning: In the HOPR project, basic libp2p transport configurations should be configurable via environment variables.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6244
File: transport/protocol/src/ack/processor.rs:31-32
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The GitHub issue to standardize the usage of `METRIC_TICKETS_COUNT` across the codebase was successfully created and can be tracked at https://github.com/hoprnet/hoprnet/issues/6245.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6244
File: transport/protocol/src/ack/processor.rs:31-32
Timestamp: 2024-10-09T06:16:18.170Z
Learning: The GitHub issue to standardize the usage of `METRIC_TICKETS_COUNT` across the codebase was successfully created and can be tracked at https://github.com/hoprnet/hoprnet/issues/6245.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6630
File: crypto/packet/src/por.rs:84-84
Timestamp: 2024-11-13T17:56:37.536Z
Learning: In PR #6630, the changes include the removal of ticket validation from the last hop and fixes for Index Offset handling as specified in the PR objectives.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#7088
File: transport/session/src/manager.rs:217-226
Timestamp: 2025-05-08T11:12:14.009Z
Learning: When reviewing SURB flow control logic in hoprnet, each keep-alive message can carry MAX_SURBS_IN_PACKET SURBs. The flow rate is correctly controlled by passing the desired surbs_per_sec while scaling the time unit by MAX_SURBS_IN_PACKET.
Learnt from: QYuQianchen
PR: hoprnet/hoprnet#7150
File: chain/actions/src/payload.rs:0-0
Timestamp: 2025-05-28T08:54:37.585Z
Learning: For multisend transactions in the HOPR protocol, removing explicit gas limits allows RPC providers to automatically estimate appropriate gas based on transaction complexity, which is preferred over fixed gas limits that may be insufficient for large batches.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6531
File: hopr/hopr-lib/src/lib.rs:1110-1132
Timestamp: 2024-11-03T20:57:55.015Z
Learning: In `hopr/hopr-lib/src/lib.rs`, the `establish_max_retries` field is of type `u32`, so it cannot be negative. Therefore, handling negative values for this configuration parameter is unnecessary.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7312
File: docs/changelog/changelog-3.0.0-rc.1.md:39-46
Timestamp: 2025-07-15T15:28:59.124Z
Learning: The changelog files in the hoprnet/hoprnet project are auto-generated from PRs, so manual editing suggestions for deduplication are not appropriate. Any improvements to prevent duplicate entries would need to be handled at the generation level.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7142
File: README.md:154-157
Timestamp: 2025-05-22T21:00:05.773Z
Learning: The HOPR codebase follows a specific naming convention where CLI flags use camelCase (e.g., --noKeepLogs), Rust struct fields use snake_case (e.g., no_keep_logs), and environment variables use uppercase with underscores (e.g., HOPRD_INDEXER_DISABLE_KEEP_LOGS).
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6313
File: hopr/hopr-lib/src/lib.rs:0-0
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The types `IndexerTransportEvent`, `Network`, `PeerEligibility`, and `PeerOrigin` in the `hopr/hopr-lib/src/lib.rs` file are internal to the transport mechanism and do not require public documentation.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7297
File: deploy/Formula/hoprd.rb:427-427
Timestamp: 2025-07-10T11:37:58.562Z
Learning: In the HOPR Homebrew formula (deploy/Formula/hoprd.rb), the API endpoint display intentionally uses HOPRD_HOST (which includes the P2P address and port) rather than HOPRD_API_HOST in the installation summary, as confirmed by maintainer ausias-armesto.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7142
File: transport/probe/src/content.rs:66-66
Timestamp: 2025-05-26T21:39:38.133Z
Learning: In the HOPR transport probe implementation, telemetry messages can use arbitrary tags rather than requiring specific reserved tags. This design choice provides flexibility for application-specific telemetry handling.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6546
File: transport/p2p/src/lib.rs:224-224
Timestamp: 2024-10-11T11:35:22.595Z
Learning: Yamux and mplex are unrelated multiplexing protocols in the HOPR codebase; configurations for yamux do not need to align with mplex configurations.
transport/protocol/Cargo.toml (14)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: db/entity/Cargo.toml:4-4
Timestamp: 2024-10-21T14:58:45.665Z
Learning: In the HOPR project, crate versions are intentionally kept separate and do not need to be aligned across related packages.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: common/primitive-types/Cargo.toml:24-24
Timestamp: 2024-11-01T09:32:55.651Z
Learning: In the hoprnet project, dependency versions are defined in the workspace Cargo.toml, so it's not necessary to specify them in individual package Cargo.toml files.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6795
File: Cargo.toml:62-64
Timestamp: 2025-01-22T09:55:51.820Z
Learning: The axum WebSocket message handling changes for version 0.8.2 (switching from Vec<u8> to Bytes for binary messages) are covered by end-to-end tests in the hoprnet project.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6313
File: hopr/hopr-lib/src/lib.rs:0-0
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The types `IndexerTransportEvent`, `Network`, `PeerEligibility`, and `PeerOrigin` in the `hopr/hopr-lib/src/lib.rs` file are internal to the transport mechanism and do not require public documentation.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7312
File: docs/changelog/changelog-3.0.0-rc.1.md:39-46
Timestamp: 2025-07-15T15:28:59.124Z
Learning: The changelog files in the hoprnet/hoprnet project are auto-generated from PRs, so manual editing suggestions for deduplication are not appropriate. Any improvements to prevent duplicate entries would need to be handled at the generation level.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6366
File: hoprd/rest-api/src/network.rs:32-49
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Error messages in the `price` function within `hoprd/rest-api/src/network.rs` must remain unchanged to maintain backwards-compatibility.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6546
File: transport/p2p/src/lib.rs:224-228
Timestamp: 2024-10-11T13:09:01.392Z
Learning: In the HOPR project, basic libp2p transport configurations should be configurable via environment variables.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6630
File: crypto/packet/src/por.rs:84-84
Timestamp: 2024-11-13T17:56:37.536Z
Learning: In PR #6630, the changes include the removal of ticket validation from the last hop and fixes for Index Offset handling as specified in the PR objectives.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:66-68
Timestamp: 2025-06-19T10:10:00.368Z
Learning: In the HOPR packaging workflow (.github/workflows/package.yaml), the `just package` command creates a single distribution package that includes all binaries (hoprd and hopli) for the target architecture. The workflow downloads both hoprd and hopli artifacts, extracts them to ./dist/bin, and nfpm packages both binaries together into one .deb, .rpm, or .apk file per target.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: .github/workflows/package.yaml:0-0
Timestamp: 2025-06-19T11:37:27.410Z
Learning: In the HOPR packaging workflow (.github/workflows/package.yaml), both hoprd and hopli binaries are downloaded and used together in a single package creation process. The `just package` command creates one distribution package (.deb, .rpm, or .apk) per target that contains both binaries, which is why the workflow only uploads one package per format rather than separate packages for each binary.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7297
File: deploy/Formula/hoprd.rb:427-427
Timestamp: 2025-07-10T11:37:58.562Z
Learning: In the HOPR Homebrew formula (deploy/Formula/hoprd.rb), the API endpoint display intentionally uses HOPRD_HOST (which includes the P2P address and port) rather than HOPRD_API_HOST in the installation summary, as confirmed by maintainer ausias-armesto.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6972
File: .github/workflows/audit-pr.yaml:25-32
Timestamp: 2025-04-02T11:36:56.281Z
Learning: For HOPR projects, auditing tools like cargo-audit should be managed through the Nix environment rather than installed separately to ensure consistency and reproducibility.
README.md (13)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6546
File: transport/p2p/src/lib.rs:224-228
Timestamp: 2024-10-11T13:09:01.392Z
Learning: In the HOPR project, basic libp2p transport configurations should be configurable via environment variables.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7312
File: docs/changelog/changelog-3.0.0-rc.1.md:39-46
Timestamp: 2025-07-15T15:28:59.124Z
Learning: The changelog files in the hoprnet/hoprnet project are auto-generated from PRs, so manual editing suggestions for deduplication are not appropriate. Any improvements to prevent duplicate entries would need to be handled at the generation level.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6313
File: hopr/hopr-lib/src/lib.rs:0-0
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The types `IndexerTransportEvent`, `Network`, `PeerEligibility`, and `PeerOrigin` in the `hopr/hopr-lib/src/lib.rs` file are internal to the transport mechanism and do not require public documentation.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7142
File: README.md:154-157
Timestamp: 2025-05-22T21:00:05.773Z
Learning: The HOPR codebase follows a specific naming convention where CLI flags use camelCase (e.g., --noKeepLogs), Rust struct fields use snake_case (e.g., no_keep_logs), and environment variables use uppercase with underscores (e.g., HOPRD_INDEXER_DISABLE_KEEP_LOGS).
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6630
File: crypto/packet/src/por.rs:84-84
Timestamp: 2024-11-13T17:56:37.536Z
Learning: In PR #6630, the changes include the removal of ticket validation from the last hop and fixes for Index Offset handling as specified in the PR objectives.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7297
File: deploy/Formula/hoprd.rb:427-427
Timestamp: 2025-07-10T11:37:58.562Z
Learning: In the HOPR Homebrew formula (deploy/Formula/hoprd.rb), the API endpoint display intentionally uses HOPRD_HOST (which includes the P2P address and port) rather than HOPRD_API_HOST in the installation summary, as confirmed by maintainer ausias-armesto.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6576
File: hoprd/rest-api/src/lib.rs:251-251
Timestamp: 2024-10-28T14:29:25.598Z
Learning: In the HOPRd project, the path `/api-docs2/openapi.json` is used instead of `/api-docs/openapi.json` to avoid conflicts.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7142
File: transport/probe/src/content.rs:66-66
Timestamp: 2025-05-26T21:39:38.133Z
Learning: In the HOPR transport probe implementation, telemetry messages can use arbitrary tags rather than requiring specific reserved tags. This design choice provides flexibility for application-specific telemetry handling.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#7142
File: README.md:154-157
Timestamp: 2025-05-22T21:00:05.773Z
Learning: The flag naming convention in the HOPR codebase intentionally uses camelCase for certain flags (like --noKeepLogs and --noFastSync) rather than kebab-case. Suggestions to change these to kebab-case are incorrect.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#7088
File: transport/session/src/manager.rs:217-226
Timestamp: 2025-05-08T11:12:14.009Z
Learning: When reviewing SURB flow control logic in hoprnet, each keep-alive message can carry MAX_SURBS_IN_PACKET SURBs. The flow rate is correctly controlled by passing the desired surbs_per_sec while scaling the time unit by MAX_SURBS_IN_PACKET.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6765
File: hopr/hopr-lib/src/lib.rs:828-829
Timestamp: 2025-01-15T14:53:42.143Z
Learning: In the HOPR codebase, `peer.id` in peer-related logging statements is a tuple-like structure that supports indexing, where `peer.id.1` is a valid field access.
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#7251
File: deploy/nfpm/install.sh:68-68
Timestamp: 2025-06-19T10:11:36.259Z
Learning: In the HOPR project, the user ausias-armesto prefers interactive installation prompts that give users full control over configuration rather than automated defaults, especially for initial versions of installation scripts.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6542
File: hoprd/hoprd/Cargo.toml:74-74
Timestamp: 2024-10-11T09:28:07.406Z
Learning: In `hoprd/hoprd/src/main.rs`, within the `init_logger` function, the Rust code checks the `HOPRD_LOG_FORMAT` environment variable and configures the `tracing_subscriber` to output logs in JSON format when it is set to `"json"`.
transport/protocol/src/stream.rs (14)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6546
File: transport/p2p/src/lib.rs:224-228
Timestamp: 2024-10-11T13:09:01.392Z
Learning: In the HOPR project, basic libp2p transport configurations should be configurable via environment variables.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6531
File: hopr/hopr-lib/src/lib.rs:1110-1132
Timestamp: 2024-11-03T20:57:55.015Z
Learning: In `hopr/hopr-lib/src/lib.rs`, the `establish_max_retries` field is of type `u32`, so it cannot be negative. Therefore, handling negative values for this configuration parameter is unnecessary.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6580
File: hoprd/rest-api/src/lib.rs:2529-2530
Timestamp: 2024-10-30T11:46:41.005Z
Learning: In `hoprd/rest-api/src/lib.rs`, avoid logging connected peers to prevent potential data exposure. Remove unnecessary logging statements that might reveal sensitive information.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6313
File: hopr/hopr-lib/src/lib.rs:0-0
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The types `IndexerTransportEvent`, `Network`, `PeerEligibility`, and `PeerOrigin` in the `hopr/hopr-lib/src/lib.rs` file are internal to the transport mechanism and do not require public documentation.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6701
File: transport/api/src/lib.rs:361-361
Timestamp: 2024-12-05T15:16:42.369Z
Learning: In `transport/api/src/lib.rs`, unbounded channels like `msg_to_send_tx` and `msg_to_send_rx` are acceptable for internal use, as memory is not an issue, and external channels have been changed to bounded channels.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6619
File: crypto/packet/benches/packet_crypto.rs:74-120
Timestamp: 2024-11-11T18:29:26.659Z
Learning: In the `crypto/packet/benches/packet_crypto.rs` benchmarks, generalizing initialization code to reduce duplication is preferred, but alternative approaches are favored over the previously suggested fixture pattern.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6457
File: transport/protocol/src/ticket_aggregation/processor.rs:549-549
Timestamp: 2024-08-19T12:26:45.078Z
Learning: In the `transport/protocol/src/ticket_aggregation/processor.rs` file, the hardcoded value `1` is necessary for specific test scenarios.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6457
File: transport/protocol/src/ticket_aggregation/processor.rs:549-549
Timestamp: 2024-10-09T06:16:18.170Z
Learning: In the `transport/protocol/src/ticket_aggregation/processor.rs` file, the hardcoded value `1` is necessary for specific test scenarios.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: hopr/hopr-lib/src/lib.rs:564-564
Timestamp: 2024-10-21T15:15:11.701Z
Learning: In `hopr/hopr-lib/src/lib.rs`, when adding configuration options like `fast_sync` to `IndexerConfig`, inline code comments are not necessary if the feature is documented elsewhere.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6366
File: hoprd/rest-api/src/network.rs:32-49
Timestamp: 2024-10-09T06:16:18.170Z
Learning: Error messages in the `price` function within `hoprd/rest-api/src/network.rs` must remain unchanged to maintain backwards-compatibility.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#7088
File: transport/session/src/types.rs:358-362
Timestamp: 2025-05-11T14:30:00.917Z
Learning: In the HOPR transport session implementation, implementing backpressure or application notifications when SURBs are exhausted (TransportSessionError::OutOfSurbs) is not possible. The current approach of discarding messages and logging errors is the intended handling mechanism.
Learnt from: NumberFour8
PR: hoprnet/hoprnet#7088
File: transport/session/src/manager.rs:217-226
Timestamp: 2025-05-08T11:12:14.009Z
Learning: When reviewing SURB flow control logic in hoprnet, each keep-alive message can carry MAX_SURBS_IN_PACKET SURBs. The flow rate is correctly controlled by passing the desired surbs_per_sec while scaling the time unit by MAX_SURBS_IN_PACKET.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6542
File: hoprd/hoprd/Cargo.toml:74-74
Timestamp: 2024-10-11T09:28:07.406Z
Learning: In `hoprd/hoprd/src/main.rs`, within the `init_logger` function, the Rust code checks the `HOPRD_LOG_FORMAT` environment variable and configures the `tracing_subscriber` to output logs in JSON format when it is set to `"json"`.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6393
File: hoprd/rest-api/src/session.rs:91-91
Timestamp: 2024-07-31T10:24:08.332Z
Learning: The current implementation in `hoprd/rest-api/src/session.rs` assumes all sessions are TCP-like due to the missing implementation of UDP behavior. The commented-out code suggests an intention to support different session types based on `capabilities`.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: hoprd / docker
  • GitHub Check: hopli / docker
  • GitHub Check: Docs / Rust
  • GitHub Check: Pre-commit / Pre-commit
  • GitHub Check: Zizmor / Zizmor
  • GitHub Check: Lint / Lint
  • GitHub Check: tests-unit-nightly
  • GitHub Check: Build Candidate Binaries (hoprd)
  • GitHub Check: Build Candidate Binaries (hopli)
  • GitHub Check: tests-unit
🔇 Additional comments (5)
transport/protocol/Cargo.toml (1)

3-3: LGTM! Version increment is appropriate.

The minor version bump from 0.8.0 to 0.8.1 correctly reflects the addition of environment variable configurability without breaking existing functionality.

README.md (1)

231-232: Documentation looks good! Verify default values match implementation.

The environment variable documentation follows the established pattern and provides clear descriptions. Please ensure the documented default values (10 for max concurrent packets, 2000ms for timeout) match the implementation in transport/protocol/src/stream.rs.

transport/protocol/src/stream.rs (3)

155-159: Consistent implementation with good defaults.

The timeout parsing correctly converts milliseconds to Duration and matches the documented default of 2000ms.


165-165: Good use of configurable concurrency limit.

The dynamic max_concurrent_packets value is correctly applied to for_each_concurrent for processing outgoing messages to peers.


186-186: Configurable timeout properly implemented.

The dynamic global_stream_open_timeout correctly replaces the hardcoded constant in the stream open operation.

@NumberFour8 NumberFour8 changed the title feat: add configurable limits for transport packet handling and strea… feat: add configurable limits for transport packet handling and stream open timeout Jul 16, 2025
@NumberFour8 NumberFour8 merged commit ea5a248 into master Jul 16, 2025
42 of 43 checks passed
@NumberFour8 NumberFour8 deleted the lukas/make-values-configurable branch July 16, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:hopr-transport-protocol dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make stream.rs constants configurable
2 participants