-
Notifications
You must be signed in to change notification settings - Fork 235
deps!: update pkarr to v3 #3186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4bdd95e
to
65eefe1
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3186/docs/iroh/ Last updated: 2025-04-30T10:14:29Z |
65eefe1
to
7fac5d9
Compare
@Frando The wasm error is what I get for updating to Long story short you need to add Edit: if you know a better way to do this, let me know, would love to learn. |
560bb0d
to
fdc5561
Compare
I am not sure how would iroh-relay run in wasm, but anyway, I think the .cargo/config.toml should go in that crate. |
Note: While all tests pass this is not yet good to go. the PkarrClient in
So let's wait for a new release that fixes these issues. |
@Frando published However, Github CI has been failing for me for no reason, even when I rerun older commits that already passed, I seen no issues on mac or linux, so it should be fine, but I am not feeling too much confidence in CIs at the moment, so keep that in mind. |
|
Alright, I updated this PR:
Let's see what CI says, but I think this should be good to go now. Requested a review from @rklaehn as the biggest changes are in the pkarr dht discovery impl. It became quite a bit simpler, as more of the logic to use both relays and the DHT is now handled by pkarr itself. There's also some changes in the DNS server. To make sure that we don't break anything: @Arqu, can we testdrive this on staging or in a test environment somehow easily? |
@@ -101,13 +101,13 @@ mod tests { | |||
30, | |||
dns::rdata::RData::AAAA(Ipv6Addr::LOCALHOST.into()), | |||
)); | |||
SignedPacket::from_packet(&keypair, &packet)? | |||
SignedPacket::new(&keypair, &packet.answers, Timestamp::now())? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not important here, but if there are other places where you have similar verbosity, reminder that the new SignedPacket::builder()
api is much nicer.
Yes, we can set this up on the staging dns instance and do some tests. |
iroh/src/discovery/pkarr/dht.rs
Outdated
tracing::info!("discovered node info from DHT {:?}", &node_info); | ||
Some(Ok(DiscoveryItem::new(node_info, "mainline", None))) | ||
tracing::info!("discovered node info {:?}", node_info); | ||
Some(Ok(DiscoveryItem::new(node_info, "dht", None))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this always dht
or should we rename this to pkarr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, it supports both relay and DHT, so changed to pkarr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem like a straightforward API update.
I tried the dht_discovery example. It still seems to work.
Not sure if pkarr has gotten heavier with this update, but since it is an optional feature I guess we will have to live with it.
Did a quick cargo tree, and didn't see anything unusual. Just the usual rust madness.
… iroh-dns-server v0.34 or lower (#3295) ## Description #3186 introduced a backwards-incompatible change to the iroh-dns-server database that went uncaught so far. The serialization format for SignedPackets changed between pkarr v2 and pkarr v3: pkarr v3 prepends a `last_seen` timestamp (8 bytes) to the serialized representation of a SignedPacket. Therefore, parsing packets stored in the the database with pkarr v2 (iroh-dns-server v0.34 and lower) fails with an error. The error also stops the store actor, and thus all subsequent requests will fail as well. This PR changes this by attempting to parse the packet in the pkarr v2 format if parsing as pkarr v3 packet fails. Parsing as pkarr v2 is achieved by prepending 8 zero bytes to the payload (an empty last_seen timestamp). The PR also improves the tracing logging at various places. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions There's no test yet. I tested manually by launching iroh-dns-server v0.34, inserting some packets with the `publish` example. When restarting the server from `main`, retrieving packets leads to errors. When applying this PR, retrieving the old packets work. If we want / need a test, how should we do it? We can either add a dev dependency to `[email protected]` (which would recursively pull in all of `[email protected]`), or somehow insert a packet as it would be created by `[email protected]` manually into the database. Not sure if it's worth it, but maybe it is? ## Change checklist <!-- Remove any that are not relevant. --> - [x] Self-review. - [x] 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.
Description
Updates pkarr from v2 to v3. The pkarr client now supports both relays and DHT, so the DHT discovery code becomes a bit simpler.
Breaking Changes
pkarr::SignedPacket
, as used as a parameter iniroh::dns::node_info::NodeInfo::to_pkarr_signed_packet
andiroh::dns::node_info::NodeInfo::from_pkarr_signed_packet
is now expectingpkarr
at major version3
instead of2
Notes & open questions
Change checklist