Skip to content

fix dead multiaddresses blocking working multiaddresses#1151

Open
pokefan77 wants to merge 4 commits into
eigenwallet:masterfrom
pokefan77:fix/tor-dial-clearnet-not-blocked-by-dead-onion
Open

fix dead multiaddresses blocking working multiaddresses#1151
pokefan77 wants to merge 4 commits into
eigenwallet:masterfrom
pokefan77:fix/tor-dial-clearnet-not-blocked-by-dead-onion

Conversation

@pokefan77

Copy link
Copy Markdown

currently: low priority peers get a single global slot. a dead onion (e.g. expired wormhole, other onion connectivity issues) holds that slot for 15 sec. the dial to other multiaddresses never happens.

this also partly addresses the issue of dead wormholes that we store in db that wont work. currently we cant dial those peers for above reason.

with the fix we will give EACH multiaddress its own 15sec timeout and prefer clearnet dial because this should fail fast if unavailable and then go to onion multiaddresses. clearnet addresses are still called over TOR not directly. libp2p will cancel further dials to other multiaddresses on success.

changes are localized to libp2p-tor and the CLI transport wiring. the Tor dial limiter moves from inside TorTransport to a thin outer transport wrapper. no user-visible behaviour change (the ASB and the shared upgrade path are untouched). internally the dial permit is now held through the bounded handshake as well as the connect.

i finally debugged this very annoying discovery issue after lots of testing, please take a look ASAP

pokefan77 added 3 commits July 3, 2026 21:39
Add is_onion to wait() and DialRequest, and make release_ready serve the first clearnet waiter before any onion at the same priority, so a reachable clearnet address is not starved by an onion dial that hangs on a dead service. Update the existing test call-sites to the new signature and add tests for clearnet-first and onion-only serving.
…t-permit

Add an outer DialLimiterTransport wrapper that acquires the Tor dial permit before polling the inner dial, then bounds it with tokio::time::timeout, so the time spent queued for a slot is excluded from the timeout. Remove the dial limiter from TorTransport (it now just connects) and drop the now-dead DialLimiter error variant.
…port

Extract authenticate_and_multiplex_no_timeout and keep authenticate_and_multiplex as that plus the timeout so the ASB is unchanged. Rewire the CLI transport to wrap the no-timeout upgrade with DialLimiterTransport when Tor is enabled (timeout measured after the permit) and a plain timeout when Tor is disabled. Add a CHANGELOG entry.
@pokefan77

Copy link
Copy Markdown
Author

Ran into some compile errors while testing. Will update and confirm once manually tested end-to-end.

libp2p-core 0.41's Transport trait has no 	imeout method, so calling .timeout() on a Boxed transport resolved to tokio_stream::StreamExt::timeout and failed to compile. Wrap the boxed transport with TransportTimeout::new(..) instead, in both the CLI transport (non-Tor branch) and authenticate_and_multiplex.
@pokefan77

Copy link
Copy Markdown
Author

compiles and LGTM, connecting fine and quick. ready for review.

@pokefan77 pokefan77 force-pushed the fix/tor-dial-clearnet-not-blocked-by-dead-onion branch 2 times, most recently from 78d5219 to 7149353 Compare July 4, 2026 14:46
@pokefan77

pokefan77 commented Jul 4, 2026

Copy link
Copy Markdown
Author

ignore force push, mixup with 1050.

tested fine locally, discovery is fine, discovery is quicker overall and bugfix as described. good to go.

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.

1 participant