Skip to content

deps: Inline pkarr#4026

Open
rklaehn wants to merge 39 commits intomainfrom
inline-pkarr
Open

deps: Inline pkarr#4026
rklaehn wants to merge 39 commits intomainfrom
inline-pkarr

Conversation

@rklaehn
Copy link
Copy Markdown
Contributor

@rklaehn rklaehn commented Mar 18, 2026

Description

On main we use the pkarr dependency, which comes with an entire tree of dependencies and is not under our control. But we do not use the reqwest based client at all in the dns discovery, instead we have our own. So what we use is just the encoding and decoding of DNS records.

It seems less than optimal to have a big dependency for just that. So this PR removes the pkarr dependency, inlines the DNS record encoding with the help of simple-dns, and implements the dht part manually, directly using the mainline crate.

Note for reviewers: just do cargo doc -p iroh_dns --open to see the API of the new crate. Almost everything is just copied, with the exception of using mainline directly to publish to the DHT.

(In a subsequent PR I might also try to get rid of the mainline dep)

Breaking Changes

A lot of stuff moves into iroh-dns

Notes & open questions

Note: I am using simple-dns for en/decoding. We could even inline this, but it is very lightweight compared to hickory or even hickory-proto. I was originally planning to use hickory-proto, but it has a lot of deps even with default features disabled. Simple-dns is not a new dependency - we used to have it via pkarr.

Note: this adds a dep to iroh-relay to iroh-dns-server, just for the pkarr SignedPacket impl. We could alternatively let iroh-relay-server depend on pkarr (it's not so critical regarding deps), or have a tiny iroh-pkarr crate.

Note: we are no longer using pkarr client (which has relay and dht built in) for the dht lookup. So there is a functionality change: the dht lookup can now only look up via the DHT. Before you could configure it with relays.

But I think that is fine, we already have a way to look up via relays.

Note: I also added a few comments and tests regarding storage on iroh-dns-server. These are unrelated but should do no harm.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

rklaehn added 5 commits March 18, 2026 12:57
we use mainline directly for the optional address-lookup-pkarr-dht feature.
And some more simplifications
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

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

Last updated: 2026-04-14T11:55:04Z

@rklaehn rklaehn force-pushed the inline-pkarr branch 2 times, most recently from d4fbe07 to 6929e64 Compare March 18, 2026 12:06
@n0bot n0bot bot added this to iroh Mar 18, 2026
@github-project-automation github-project-automation bot moved this to 🚑 Needs Triage in iroh Mar 18, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

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: 05d13d2

rklaehn added 2 commits March 20, 2026 11:37
This allows us to not depend on iroh-relay in iroh-dns-server
@dignifiedquire dignifiedquire moved this from 🚑 Needs Triage to 👍 Ready in iroh Apr 7, 2026
rklaehn added 2 commits April 8, 2026 12:28
## Description

This allows us to not depend on iroh-relay in iroh-dns-server

## Breaking Changes

<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] List all breaking changes in the above "Breaking Changes" section.
- [ ] Open an issue or PR on any number0 repos that are affected by this
breaking change. Give guidance on how the updates should be handled or
do the actual updates themselves. The major ones are:
    - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc)
    - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip)
    - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs)
    - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe)
    - [ ] [`sendme`](https://github.com/n0-computer/sendme)
@rklaehn rklaehn marked this pull request as ready for review April 9, 2026 09:08
@rklaehn rklaehn requested a review from dignifiedquire April 9, 2026 09:09
@Frando
Copy link
Copy Markdown
Member

Frando commented Apr 9, 2026

I would suggest to move the entire iroh_relay::dns module into the new iroh_dns crate. The whole module only lives in iroh-relay because that is the lowest in our dependency graph. It would be cleaner for that to move to iroh-dns IMO.

@rklaehn
Copy link
Copy Markdown
Contributor Author

rklaehn commented Apr 9, 2026

I would suggest to move the entire iroh_relay::dns module into the new iroh_dns crate. The whole module only lives in iroh-relay because that is the lowest in our dependency graph. It would be cleaner for that to move to iroh-dns IMO.

Good idea. That would make the crate a little less lightweight.

This is a major change though.

Edit: I think it would be best to do this in a separate PR. See #4094

let res = this
.0
.pkarr
.resolve_most_recent(&public_key)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so this is not needed anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be completely honest I don't understand the reason for this. It basically looks up the record and then republishes it with the previous timestamp before then immediately after overwriting it with the new timestamp.

Doing a lookup first might be useful to warm up the DHT cache, but why publish with the previous timestamp if we do all this effort to keep the timestamps monotonic?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't understand it before either, which is where my confusion came from 😅

Copy link
Copy Markdown
Contributor Author

@rklaehn rklaehn Apr 13, 2026

Choose a reason for hiding this comment

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

I tried this out manually without, and it works. Let's just keep it like this and then re-add it if it turns out necessary?

Note that I can see the lookup being useful - if your addr is quickly changing you basically warm up the DHT while adding a little delay before you spam the DHT with soon to be obsolete data. Sort of like debounce but more useful.

But not the publish with the previous timestamp.

- Use derive_more and n0_error
- remove useless rename
- add README.md (not much in there yet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👍 Ready

Development

Successfully merging this pull request may close these issues.

4 participants