Skip to content

Conversation

dignifiedquire
Copy link
Contributor

@dignifiedquire dignifiedquire commented Sep 30, 2025

Description

Simplifies the public API. If you need to provide static information about node addresses, please use StaticProvider from now on.

Closes #3329

Breaking Changes

  • removed
    • iroh::Endpoint::add_node_addr
    • iroh::Endpoint::remote_info
    • iroh::Endpoint::remote_info_iter
    • iroh::RemoteInfo
    • iroh::discovery::DiscoveryItem
  • added
    • iroh::discovery::mdns::DiscoveryItem
    • iroh::Endpoint::latency

Notes & open questions

Is it okay to have these all removed now, given the replacements for connection details have not yet landed (will only with multipath)?

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

seems reasonable to me.

Wrt removal of remote_info, the conn_type API still exists so might be usable? We're also unlikely to release in this state? Though it could happen I guess.

Copy link

github-actions bot commented Sep 30, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 3dd9383

@dignifiedquire
Copy link
Contributor Author

the conn_type API still exists so might be usable?

It is, but it doesn't provide latency information, which is something I know some users do care about

@rklaehn
Copy link
Contributor

rklaehn commented Sep 30, 2025

I thought this might break big-block-syc, but it seems like in the latest version of big-block-sync I only use Connection::rtt(). So I guess it's fine. I will have to refactor a lot of code to get rid of add_node_addr, e.g. in the dht experiment, but it should be fine.

Not a fan of having any kind of mutable default StaticDiscovery in the endpoint. Just accept the inconvenience instead of creating chaos later when multiple places try to modify it.

https://github.com/n0-computer/big-block-sync/blob/main/src/lib.rs

@n0bot n0bot bot added this to iroh Sep 30, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Sep 30, 2025
@dignifiedquire
Copy link
Contributor Author

This currently breaks the advertised way to see (passively) discovered MDNS nodes, need to figure this part out.

@dignifiedquire
Copy link
Contributor Author

Latency should be fine, .rtt() on the connection is preferrable anway

@Frando
Copy link
Member

Frando commented Sep 30, 2025

Nous started using Endpoint::remote_info in psyche just now to sort provider candidates for iroh blobs downloads by latency:
https://github.com/PsycheFoundation/psyche/blob/4a54db82929a86612423ea537c3b65106ab76a99/shared/network/src/latency_sorted.rs#L42

This is a valid use case IMO, and it only works easily this way if this info is available for any node directly from the endpoint, not from Connection only, so this might need some more thought? Or what would our alternative suggestion be?

@ramfox
Copy link
Member

ramfox commented Sep 30, 2025

This currently breaks the advertised way to see (passively) discovered MDNS nodes, need to figure this part out.

Yea, I think the only option is to change the example to show you need to build the mdns discovery service, subscribe to the stream, and THEN add the discovery service to the endpoint, now that we can add discovery services after the endpoint has been built.

Then the example can show a loop through the stream, which will all be locally discovered nodes, rather than relying on a provenance string.

Copy link

github-actions bot commented Oct 1, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3485/docs/iroh/

Last updated: 2025-10-03T01:56:08Z

@ramfox
Copy link
Member

ramfox commented Oct 1, 2025

Hmmm, to @Frando 's point, I think as long as the docs specify that the remote_info and remote_info_iter returns information for remote endpoints that we have called called connect on or have accepted connections from, then it's valid to add those methods back in.

@ramfox
Copy link
Member

ramfox commented Oct 1, 2025

Cleaned things up so tests are passing:

  • adjusted doc comments and examples
  • removed discovery_subscriber method and DiscoverySubscriber struct

API thoughts:

  1. The current way to add a discovery service after the endpoint has been created is:
    ep.discovery().clone().add(new_discovery_service)
    The clone is a bit of a footgun, because without it the error that the complier gives you is about the ConcurrentDiscovery being behind a &, so it can't be mutable and it's not obvious from the docs that you won't get penalized by cloning because there is an internal Arc in ConcurrentDiscovery.
    Now that ConcurrentDiscovery has an Arc, should we just return a ConcurrentDiscovery rather than a &ConcurrentDiscovery, from ep.discovery()?

  2. Now that subscribe is only an MdnsDiscovery method, we should likely change the return types from DiscoveryEvent to MdnsEvent. We also no longer need to return DiscoveryItems, and can likely just simplify to returning NodeAddrs for MdnsEvent::Discovery and NodeIds for MdnsEvent::Expiry events.

Also, we now have to including tokio::pin-ing the stream, why did we not have to do that before?

  1. I do think we might be foot-gunning ourselves by removing remote_info/remote_info_iter too early until we have a valid replacement.

@dignifiedquire
Copy link
Contributor Author

Also, we now have to including tokio::pin-ing the stream, why did we not have to do that before?

yeah, a bit annoying, I want to try and fix it

@ramfox
Copy link
Member

ramfox commented Oct 1, 2025

Added no_run to the mdns doc example, since there is no logical end to the example anymore, and it can theoretically run forever (which was causing problems in CI)

@dignifiedquire dignifiedquire force-pushed the feat-remove-add-node-addr branch from b32e0c8 to c04bc64 Compare October 2, 2025 08:49
@dignifiedquire
Copy link
Contributor Author

The current way to add a discovery service after the endpoint has been created is:
ep.discovery().clone().add(new_discovery_service)

fixed

Now that subscribe is only an MdnsDiscovery method, we should likely change the return types from DiscoveryEvent to MdnsEvent

fixed

Also, we now have to including tokio::pin-ing the stream, why did we not have to do that before?

fixed

@ramfox ramfox added this to the v0.93.0 milestone Oct 2, 2025
@ramfox ramfox added this pull request to the merge queue Oct 3, 2025
Merged via the queue into main with commit 0ffadef Oct 3, 2025
28 of 29 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Oct 3, 2025
@ramfox ramfox deleted the feat-remove-add-node-addr branch October 3, 2025 03:03
@flub
Copy link
Contributor

flub commented Oct 3, 2025

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

remove endpoint::Builder::known_nodes
5 participants