-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
A-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-hardExperience needed to fix/implement: Hard / a lotExperience needed to fix/implement: Hard / a lotS-needs-designStatus: Needs architectural design or RFCStatus: Needs architectural design or RFCT-enhancementType: Improvement to existing functionalityType: Improvement to existing functionality
Description
Background
PR #2105 introduced transient connection tracking for gateways using runtime validation. This works but could be made safer and less error-prone using Rust's type system.
Proposal
As suggested by @iduartgomez in #2105 (comment):
I think we can handle transient connections at the type level and that would make all this stuff safer and less error prone, but that will require some further changes/refactoring so will do that in a separate PR in the future
Current Implementation
Transient connections are tracked via:
- Runtime checks in
ConnectionManager::register_transient() - Manual budget tracking with
RwLock<DashMap<PeerId, TransientEntry>> - TTL expiration checked at registration time
Type-Level Approach
Use Rust's type system to enforce transient connection constraints at compile time:
- Separate connection types (e.g.,
Connection<Permanent>vsConnection<Transient>) - Type-safe budget management
- Compile-time guarantees about connection lifecycle
References
- PR fix: propagate connection errors for blocked peer fallback (#2021) #2105: Introduced transient connection tracking
- Related:
crates/core/src/ring/connection_manager.rs
[AI-assisted - Claude]
Metadata
Metadata
Assignees
Labels
A-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-hardExperience needed to fix/implement: Hard / a lotExperience needed to fix/implement: Hard / a lotS-needs-designStatus: Needs architectural design or RFCStatus: Needs architectural design or RFCT-enhancementType: Improvement to existing functionalityType: Improvement to existing functionality
Type
Projects
Status
Triage