Skip to content

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Aug 4, 2025

We'll deprecate this event, but we still have to keep sending this for a few more releases. More importantly, we need to update the peerstore with the host's addresses and it's better to do this before sending update events so that consumers of the event can rely on the host addrs being updated in the peerstore.

@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch from 1b4f6c6 to 7ceafe9 Compare August 7, 2025 16:29
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from 91d3854 to 611df04 Compare August 7, 2025 16:29
@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch from 7ceafe9 to b7f0784 Compare August 7, 2025 17:19
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from 611df04 to 8be2504 Compare August 7, 2025 17:19
@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch 5 times, most recently from c0a8a78 to cc0711a Compare August 17, 2025 12:14
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch 2 times, most recently from b8d1eab to d388884 Compare August 18, 2025 11:16
@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch from cc0711a to 7a01719 Compare August 18, 2025 11:22
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from d388884 to 4d77c2b Compare August 18, 2025 11:22
@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch from 7a01719 to 771b390 Compare August 18, 2025 13:25
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from 4d77c2b to 51add1c Compare August 18, 2025 13:25
@sukunrt sukunrt force-pushed the sukun/obs-addr-manager-move branch from 771b390 to 6a09306 Compare August 18, 2025 13:34
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from 51add1c to 2346193 Compare August 18, 2025 13:34
@sukunrt sukunrt marked this pull request as ready for review August 18, 2025 13:39
Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

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

I think it would be better if we did the following:

  • Add a method to the Peerstore interface for HandleLocalAddrUpdate(currentAddrs []multiaddr.Multiaddr, lastAddrs []multiaddr.Multiaddr) error.
  • Have this method handle all the peerstore related code including the signed peer records.
  • Move emitting here instead of basic host.

We'll deprecate this event, but we still have to keep sending this for a
few more releases. More importantly, we need to update the peerstore
with the host's addresses and it's better to do this *before* sending
update events so that consumers of the event can rely on the host addrs
being updated in the peerstore.
@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch 2 times, most recently from 3846f17 to f9389e0 Compare September 16, 2025 15:50
@sukunrt sukunrt changed the base branch from sukun/obs-addr-manager-move to master September 16, 2025 15:50
@sukunrt sukunrt requested a review from MarcoPolo September 16, 2025 15:50
@sukunrt
Copy link
Member Author

sukunrt commented Sep 16, 2025

I've made this change to adding a method on the peerstore. I'm not convinced about it though.

  1. This adds host context to the peerstore, which at the moment can be used by any object, like Gossipsub and kaddht, to store data against peerids.
  2. This method must be on peerstore and not on any of the component interfaces like AddrBook because we need the Private Key from the KeyBook.
  3. Not sure if creating a PeerRecord should be with peerstore. At the moment AddrManager seems like the best owner for this logic since the only thing in the PeerRecord are the addresses.

Comment on lines +76 to +77
// This method should only be used to update the addresses of the Host that owns the peerstore.
UpdateHostAddrs(hostID peer.ID, currentAddrs, removedAddrs, peerRecordAddrs []ma.Multiaddr) error
Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping the signature this way to avoid attaching a peerstore to a host. That would complicate the host creation even more.

@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from f9389e0 to e675e47 Compare September 16, 2025 15:58
@@ -98,6 +100,33 @@ func (ps *pstoremem) PeerInfo(p peer.ID) peer.AddrInfo {
}
}

func (ps *pstoremem) UpdateHostAddrs(hostID peer.ID, currentAddrs, removedAddrs, peerRecordAddrs []ma.Multiaddr) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

There's a small change here. All host's now will store the signed peer record in th e peerstore. This I think is okay because identify is configured to disable sending signed peer records.

@sukunrt sukunrt force-pushed the sukun/basichost-evtlocaladdrs branch from e675e47 to ecab374 Compare September 16, 2025 16:07
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.

2 participants