Repository navigation
Description
Goal
Replace the bittorrent-primitives crate dependency with the new torrust-info-hash crate (v0.1.0) across the entire workspace. The InfoHash type originally came from bittorrent-primitives and has now been published as a standalone crate torrust-info-hash from the torrust/torrust-bittorrent monorepo (see torrust/torrust-bittorrent#87 / torrust/torrust-bittorrent#88).
Background
The bittorrent-primitives crate (v0.2.0) is a single-package repository whose sole public type is InfoHash. As part of the broader workspace overhaul (EPIC #1669), the InfoHash type has been migrated to the torrust/torrust-bittorrent workspace as torrust-info-hash v0.1.0 and published to crates.io.
This workspace (torrust/torrust-tracker) currently depends on bittorrent-primitives in 14 Cargo.toml files (13 packages + the root crate for dev-dependencies) — exclusively for the InfoHash type. Replacing it with torrust-info-hash reduces the dependency footprint and moves toward deprecating/archiving the torrust/bittorrent-primitives repository.
Note: the udp-protocol package (torrust-tracker-udp-tracker-protocol) defines its own local InfoHash struct (a newtype over [u8; 20]) and does NOT use bittorrent-primitives. It is not in scope for this migration.
Scope
In Scope
- Replace
bittorrent-primitives = "0.2.0"withtorrust-info-hash = "=0.1.0"in all workspaceCargo.tomlfiles that use it forInfoHash - Update all Rust source files:
use bittorrent_primitives::info_hash::InfoHash->use torrust_info_hash::InfoHash - Update doc comments that reference the old import path (
bittorrent_primitives::info_hash::InfoHash) - Remove
bittorrent-primitivesfrom rootCargo.tomldev-dependencies if no longer needed - Run
cargo macheteto verify no unused dependencies remain - Run
linter alland full test suite to validate - Update
AGENTS.mdif the package table requires changes - Update
project-words.txtwith any new technical terms
Out of Scope
- The
udp-protocolpackage's localInfoHashstruct — it is unrelated tobittorrent-primitives(see background) - Migrating any other types —
torrust-info-hashonly containsInfoHash - Publishing new crates to crates.io
- Archiving the
torrust/bittorrent-primitivesrepository
Implementation Plan
| ID | Status | Task | Notes / Expected Output |
|---|---|---|---|
| T1 | TODO | Add torrust-info-hash to root workspace Cargo.toml dependencies section |
Add torrust-info-hash version pin for workspace-wide use |
| T2 | TODO | Replace dependency + imports in packages/http-tracker-core |
Cargo.toml + all .rs imports and doc comments |
| T3 | TODO | Replace dependency + imports in packages/http-protocol |
Cargo.toml + all .rs imports and doc comments |
| T4 | TODO | Replace dependency + imports in packages/primitives |
Cargo.toml + all .rs imports and doc comments |
| T5 | TODO | Replace dependency + imports in packages/tracker-core |
Cargo.toml + all .rs imports and doc comments |
| T6 | TODO | Replace dependency + imports in packages/tracker-client |
Cargo.toml + all .rs imports and doc comments |
| T7 | TODO | Replace dependency + imports in packages/udp-tracker-core |
Cargo.toml + all .rs imports and doc comments |
| T8 | TODO | Replace dependency + imports in packages/udp-server |
Cargo.toml + all .rs imports and doc comments |
| T9 | TODO | Replace dependency + imports in packages/axum-rest-api-server |
Cargo.toml + all .rs imports and doc comments |
| T10 | TODO | Replace dependency + imports in packages/axum-http-server |
Cargo.toml + all .rs imports and doc comments |
| T11 | TODO | Replace dependency + imports in packages/swarm-coordination-registry |
Cargo.toml + all .rs imports and doc comments |
| T12 | TODO | Replace dependency + imports in packages/torrent-repository-benchmarking |
Cargo.toml + all .rs imports and doc comments |
| T13 | TODO | Replace dependency + imports in packages/persistence-benchmark |
Cargo.toml + all .rs imports and doc comments |
| T14 | TODO | Replace dependency + imports in console/tracker-client |
Cargo.toml + all .rs imports and doc comments |
| T15 | TODO | Replace root dev-dependency + update tests/ imports |
Root Cargo.toml + tests/servers/ files |
| T16 | TODO | Remove bittorrent-primitives from all Cargo.toml files |
After confirming no remaining references |
| T17 | TODO | Run cargo check --workspace |
Verify compilation |
| T18 | TODO | Run cargo machete |
Verify no unused dependencies |
| T19 | TODO | Run linter all |
Verify linting passes |
| T20 | TODO | Run cargo test --workspace |
Verify tests pass |
| T21 | TODO | Update project-words.txt |
Add any needed terms |
| T22 | TODO | Update AGENTS.md if needed |
If workspace package table changes |
Acceptance Criteria
- AC1: All
Cargo.tomlfiles usetorrust-info-hash = "=0.1.0"instead ofbittorrent-primitives = "0.2.0"for InfoHash - AC2: All Rust source imports use
use torrust_info_hash::InfoHashinstead ofuse bittorrent_primitives::info_hash::InfoHash - AC3: No remaining references to
bittorrent-primitivesorbittorrent_primitivesexcept the comment inudp-protocol/src/common.rs(which is out of scope) - AC4:
cargo check --workspaceexits with code0 - AC5:
cargo macheteexits with code0 - AC6:
linter allexits with code0 - AC7:
cargo test --workspacepasses - AC8:
project-words.txtis up to date - AC9: Documentation is updated when behavior/workflow changes
- AC10: Manual verification scenarios are executed and documented (status + evidence)
- AC11: Acceptance criteria are re-reviewed after implementation and reflect actual behavior
Activity
[-]Migrate from `bittorrent-primitives` to `torrust-info-hash`[/-][+]SI-21: Migrate from `bittorrent-primitives` to `torrust-info-hash`[/+]feat(info-hash): migrate from bittorrent-primitives to torrust-info-h…
chore(docs): archive 7 closed issue specs from open/ to closed/
Merge #1901: chore(docs): archive closed issue specs and add branch-n…
Merge torrust#1891: Migrate from bittorrent-primitives to torrust-inf…