-
Notifications
You must be signed in to change notification settings - Fork 75
Conversation
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.
I like it.
1a01f08
to
3e4984c
Compare
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 work, mostly nits; the important one is that we use gogo protobuf instead of the golang stuff.
I've been playing around with interfaces a bit, and there is a way to add this functionality without making a breaking API change. Instead of adding the new methods to the To avoid the breaking change, we can't embed the new interface into the main p := myHost.Peerstore()
if cab, ok := p.(CertifiedAddrBook); ok {
cab.AddCertifiedAddrs(signedRoutingState, ttl)
} This is more awkward to use though, and I'm probably overthinking this... |
Definitely overthinking this! I think it's ok to just extend the interface in this case. |
4fec275
to
1f29b58
Compare
2e0614d
to
b57c502
Compare
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.
Some feedback. I'm gonna rejig a few things, and open a PR against your branch so we can discuss alternative options for some things.
Yeah, I wouldn't hardcode an enumeration in the protobuf. |
Note that the using component would only do that once, and it would safe a reference to the |
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.
Thanks for the feedback @raulk
I spent some time today pulling in your branch and am refactoring a few things that I can push tomorrow.
I also think I've found a way around the implementation problem I was having with a separate CertifiedAddrBook
interface, so I can make that change here once I verify that it works in the peerstore implementation.
Hey @raulk, I pulled in your review branch and added a few commits based on your feedback. The main changes are:
What do you think? I've updated my -peerstore and go-libp2p branches locally to reflect the changes & will push after some cleanup if you think we're on the right track here. |
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.
Initial feedback. Still going through the rest, but posting this quickly so we can discuss the proposed API changes and build up the rest of the review on top of that discussion ;-)
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.
@yusefnapora really, really great work here! I am especially enjoying the thoughtful structure and godocs ❤️
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.
This is looking close to the finish line. Just a few comments from my first review that went unaddressed, and a proposal to further refine the Record
interface and simplify the overall solution.
also: - add Domain and Codec fields to Record interface
also, adds bool `accepted` return value
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.
LGTM
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.
// Seq value of zero may be ignored or rejected by other peers. | ||
// | ||
// PeerRecords are intended to be shared with other peers inside a signed | ||
// routing.Envelope, and PeerRecord implements the routing.Record interface |
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.
record.Envelope*
PayloadType []byte | ||
|
||
// The envelope payload. | ||
RawPayload []byte |
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.
@yusefnapora Why do we use the RawPayload
here instead of using a field of Record
type since any payload that goes into the Envelope will always be a Record.
Removed []UpdatedAddress | ||
} | ||
|
||
// EvtLocalPeerRoutingStateUpdated should be emitted when a new signed PeerRecord |
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.
EvtLocalPeerRecordUpdated*
This implements the signed envelopes and routing records described in libp2p/specs#217.
I've also updated the peerstore implementation to fit the new API & will open a PR there in a sec.
Travis correctly marks this as a breaking API change, since the new methods on the peerstore make existing implementations no longer fit the interface. I think this means I need to bump the minor version?
I still feel like a Go newbie, so don't be shy about review feedback :)
Some TODO items: