Skip to content

feat(deps): replace aquatic_udp_protocol with in-house implementation (#1732)#1733

Merged
josecelano merged 42 commits into
torrust:developfrom
josecelano:1732-replace-aquatic-udp-protocol
May 6, 2026
Merged

feat(deps): replace aquatic_udp_protocol with in-house implementation (#1732)#1733
josecelano merged 42 commits into
torrust:developfrom
josecelano:1732-replace-aquatic-udp-protocol

Conversation

@josecelano

@josecelano josecelano commented May 5, 2026

Copy link
Copy Markdown
Member

Replaces the external aquatic_udp_protocol and aquatic_peer_id dependencies with in-house maintained packages and completes the post-migration refactor/cleanup for issue #1732.

This removes the upstream maintenance bottleneck, keeps dependency/security updates under Torrust control, and preserves behavior across protocol and domain consumers.

Why this change

Upstream Aquatic crates appear unmaintained for our needs, while this tracker must continue evolving and receiving dependency/security updates.

Relevant upstream context:

What was delivered

  1. Replaced upstream aquatic dependencies with in-house maintained packages.
  2. Completed udp-protocol refactor into action-oriented modules.
  3. Completed primitives module refactor (announce / scrape split, cleanup).
  4. Removed temporary compatibility wrappers after consumer migration.
  5. Extracted duplicated PeerId / PeerClient logic into shared in-house package:
    • packages/peer-id (bittorrent-peer-id)
  6. Integrated bittorrent-peer-id into:
    • packages/udp-protocol
    • packages/primitives (compatibility re-export preserved)
  7. Split packages/peer-id internals into focused modules while keeping public API stable.
  8. Updated package documentation and provenance notes for:
    • packages/udp-protocol/README.md
    • packages/peer-id/README.md
  9. Added package-level license file for packages/peer-id and clarified notices/acknowledgment.

Architecture outcome

  • udp-protocol no longer owns duplicated peer-id logic.
  • primitives no longer owns duplicated peer-id logic.
  • peer-id is the canonical owner of PeerId/PeerClient logic.
  • Dependency direction remains correct (udp-protocol does not depend on primitives).

Validation

All required checks were run and passed during the final slices:

  • cargo check --workspace
  • cargo test --workspace
  • cargo test --doc --workspace
  • linter all

Attribution and licensing

Code originates from Aquatic crates (Apache-2.0), with in-house maintenance and required notices retained.

Special acknowledgment to greatest-ape (Joakim Frostegård) for significant contributions to the BitTorrent ecosystem.

Closes #1732

josecelano added 5 commits May 5, 2026 18:18
…p-protocol (step 1a of torrust#1732)

These are verbatim copies of aquatic_peer_id 0.9.0 and aquatic_udp_protocol 0.9.0
(Apache 2.0), registered in the workspace Cargo.toml as path packages. No dependent
package has been switched to use them yet — that is Step 1b. Each source file carries
an inline attribution header crediting Joakim Frostegård (greatest-ape) and linking
to the original crates.io release.
…ps (step 1b of torrust#1732)

All 13 packages that previously depended on `aquatic_udp_protocol = "0"` (crates.io) now use `path = "../aquatic-udp-protocol"` (or `../../packages/aquatic-udp-protocol` for `console/tracker-client`). Build is clean and all tests pass.
…ent homes (torrust#1732)

Split Step 4 into 4a (UDP protocol types → udp-protocol) and 4b (peer ID types → primitives). This reflects the fact that PeerId is a domain concept used by HTTP tracker, REST API, and core logic—not UDP-protocol-specific. Peer ID types belong in primitives with other peer-related domain types.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces in-workspace forks of the unmaintained aquatic_udp_protocol / aquatic_peer_id crates and switches Torrust Tracker packages to consume those forks via path dependencies, as the first step toward unblocking the zerocopy 0.8 upgrade and reducing external maintenance risk.

Changes:

  • Added new internal fork crates under packages/aquatic-udp-protocol and packages/aquatic-peer-id (source + LICENSE + README).
  • Updated multiple workspace crates to use the internal fork via path dependency instead of crates.io.
  • Added workspace wiring/docs updates (Cargo.toml workspace members + patch, analysis docs, word list updates).

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
Cargo.toml Adds fork crates to workspace members and adds a crates.io patch override for aquatic_*.
Cargo.lock Removes registry sourcing for aquatic_* and records additional resolved deps for fork test/dev usage.
project-words.txt Updates spellchecker allowlist for new terms used in the migration/docs/tests.
console/tracker-client/Cargo.toml Switches console client to use forked aquatic_udp_protocol via path.
packages/udp-tracker-server/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/udp-tracker-core/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/udp-protocol/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/tracker-core/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/tracker-client/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/torrent-repository-benchmarking/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/swarm-coordination-registry/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/primitives/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/http-tracker-core/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/http-protocol/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/axum-rest-tracker-api-server/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/axum-http-tracker-server/Cargo.toml Switches dependency to forked aquatic_udp_protocol via path.
packages/aquatic-udp-protocol/Cargo.toml New fork crate manifest for aquatic_udp_protocol.
packages/aquatic-udp-protocol/src/lib.rs New fork crate module exports and lint allowances to preserve upstream code verbatim.
packages/aquatic-udp-protocol/src/common.rs Forked shared protocol types/helpers.
packages/aquatic-udp-protocol/src/request.rs Forked request parsing/serialization implementation + tests.
packages/aquatic-udp-protocol/src/response.rs Forked response parsing/serialization implementation + tests.
packages/aquatic-udp-protocol/README.md Documents purpose and provenance of the fork.
packages/aquatic-udp-protocol/LICENSE Adds Apache-2.0 license text for the fork.
packages/aquatic-peer-id/Cargo.toml New fork crate manifest for aquatic_peer_id.
packages/aquatic-peer-id/src/lib.rs Forked peer-id parsing/client identification implementation.
packages/aquatic-peer-id/README.md Documents purpose and provenance of the fork.
packages/aquatic-peer-id/LICENSE Adds Apache-2.0 license text for the fork.
docs/issues/1732-replace-aquatic-udp-protocol/ISSUE.md Adds in-repo migration plan/issue documentation.
docs/issues/1732-replace-aquatic-udp-protocol/step-2-analysis.md Records Step 2 “unused code” analysis for the forks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Cargo.toml Outdated
Comment thread packages/udp-tracker-server/Cargo.toml Outdated
Comment thread packages/udp-tracker-core/Cargo.toml Outdated
Comment thread packages/udp-protocol/Cargo.toml Outdated
Comment thread packages/tracker-core/Cargo.toml Outdated
Comment thread packages/axum-http-tracker-server/Cargo.toml Outdated
Comment thread console/tracker-client/Cargo.toml Outdated
Comment thread docs/issues/1732-replace-aquatic-udp-protocol/step-2-analysis.md Outdated
Comment thread packages/aquatic-peer-id/Cargo.toml Outdated
Comment thread packages/aquatic-udp-protocol/Cargo.toml Outdated
@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.87719% with 165 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.52%. Comparing base (0e71e40) to head (7a587dd).

Files with missing lines Patch % Lines
packages/peer-id/src/peer_client.rs 71.12% 40 Missing and 1 partial ⚠️
packages/udp-protocol/src/common.rs 57.97% 28 Missing and 1 partial ⚠️
packages/udp-protocol/src/response.rs 82.23% 13 Missing and 14 partials ⚠️
packages/udp-protocol/src/announce.rs 54.28% 13 Missing and 3 partials ⚠️
packages/peer-id/src/peer_id.rs 16.66% 15 Missing ⚠️
packages/udp-protocol/src/request.rs 94.53% 6 Missing and 4 partials ⚠️
packages/http-protocol/src/v1/requests/announce.rs 12.50% 7 Missing ⚠️
packages/udp-protocol/src/scrape.rs 46.15% 0 Missing and 7 partials ⚠️
packages/udp-protocol/src/connect.rs 54.54% 0 Missing and 5 partials ⚠️
...r-client/src/console/clients/checker/checks/udp.rs 0.00% 3 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1733      +/-   ##
===========================================
- Coverage    79.69%   79.52%   -0.17%     
===========================================
  Files          359      368       +9     
  Lines        26411    27049     +638     
  Branches     26411    27049     +638     
===========================================
+ Hits         21048    21511     +463     
- Misses        5117     5258     +141     
- Partials       246      280      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

josecelano added 2 commits May 5, 2026 21:36
- In ISSUE.md: replace the 'Related future work' callout in Step 4 with a
  leaner 'See also' note linking to the step-3 analysis doc; add new Step 4c
  checklist 'Consolidate InfoHash into bittorrent-primitives' with concrete
  action items (swap inner field to [u8;20], drop aquatic_udp_protocol dep,
  update impls/tests, publish, remove fork/patch entry).
- In step-3-bittorrent-primitives-problem.md: rename 'Consolidate InfoHash'
  subsection to reference Step 4c explicitly; rename 'Update
  bittorrent-primitives after Step 4a' to 'Update bittorrent-primitives
  dependency after Step 4c' with matching explanation.
@josecelano josecelano marked this pull request as ready for review May 6, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 105 out of 106 changed files in this pull request and generated 9 comments.

Comment thread packages/udp-protocol/src/announce.rs
Comment thread packages/udp-protocol/Cargo.toml
Comment thread packages/udp-protocol/src/common.rs
Comment thread packages/udp-tracker-core/src/services/scrape.rs Outdated
Comment thread console/tracker-client/src/console/clients/udp/responses/dto.rs Outdated
Comment thread packages/udp-tracker-server/src/error.rs Outdated
Comment thread project-words.txt
Comment thread Cargo.toml
Comment thread packages/udp-protocol/README.md
- New skill: process-copilot-suggestions for end-to-end workflow
- Updated existing skills to reference comprehensive workflow
- Added helper scripts in contrib/dev-tools/github-api-scripts/
  * get-pr-review-threads.sh: fetch PR review threads
  * list-unresolved-threads.sh: filter unresolved threads
  * resolve-all-unresolved-threads.sh: batch resolve threads
- Created template and workflow documentation in docs/pr-reviews/
- Example: completed PR torrust#1733 copilot suggestions audit
- Includes reusable process for future PR reviews
@josecelano josecelano requested a review from a team as a code owner May 6, 2026 14:21
@josecelano

Copy link
Copy Markdown
Member Author

ACK 7a587dd

@josecelano josecelano merged commit 2007330 into torrust:develop May 6, 2026
25 of 26 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.

Replace external aquatic_udp_protocol crate with an in-house UDP protocol implementation

2 participants