-
Notifications
You must be signed in to change notification settings - Fork 9
Implementation of delegated routing based on the Edelweiss compiler #11
Conversation
@petar : probably my naivety not to know or see it, but can you provide:
|
It’s all in the repo in package gen.
…On Tue, Mar 8, 2022 at 12:57 PM Steve Loeppky ***@***.***> wrote:
@petar <https://github.com/petar> : probably my naivety not to know or
see it, but can you provide:
1. command/process you ran to generate this code?
2. the schema that was used for the generation?
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFTS4XYUXX33IO6PYYHDLU665KLANCNFSM5QG33JQQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
A couple of thoughts here: I'm sure there's legit and genuine curiosity here given that this is some of the first generated code we're seeing come out of Edelweiss (great). I know @petar needs something to target towards and is using the existing proposed schema. We ultimately though need to get the schema fully decided as part of #8. Thanks @petar for doing some explanation. I know it's on the Edelweiss project roadmap to be working more on docs and communication this month. It looks like those will be welcome and appreciated! Good stuff! |
Moving back to in progress because this can't be in review until the spec ipfs/specs#272 is completed. |
@petar : thanks for owning this and make the updates for ipfs/specs#272. I'm assuming once the spec changes fully land, you'll keep updating this. Also, given we don't want to spend people's time reviewing the generated code itself, it would be great if the unit test coverage on go-delegated-server was pretty high for client/server communication so that we can have confidence in the generated code as a result. (I'm saying that as a general statement. I don't know how high unit test coverage is right now, but if it should have more, let's please include it.) |
@aschmahmann First draft of delegated routing using the new Reframe API is ready. You can do a pass on this PR and then let's regroup to discuss next steps. At the moment, this PR implements the content routing interface which we already use to connect delegated routing into Hydra. As such, this PR is a drop-in replacement for the current delegated routing in master. In particular, Get/PutIPNS are not implemented. Also, FindProviders extracts the AddrInfo of all returned provider nodes, regardless of which transport protocols they offer. Perhaps we need to filter out only the bitswap providers, or otherwise we need to extend the Go content routing interface to capture supported transfer protocols. If I recall correctly, you also want to go a step further and implement a more general content routing interface so that it can be used both in Hydra and IPFS? Let's discuss what that would be. |
@aschmahmann I finished all remaining items we mentioned at standup today:
|
@petar can you hook this up to unified CI? I'm seeing the tests fail and/or hang locally (Windows). |
Yep, I’ve already filed a PR with unified CI :)
…On Wed, Apr 13, 2022 at 8:25 AM Adin Schmahmann ***@***.***> wrote:
@petar <https://github.com/petar> can you hook this up to unified CI? I'm
seeing the tests fail and/or hang locally.
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACFTS44MNPADBYOAXU3MXLVE3RNRANCNFSM5QG33JQQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
… than take them as arguments)
server/findproviders.go
Outdated
func buildPeerFromAddrInfo(addrInfo peer.AddrInfo) *proto.Peer { | ||
pm := make([]values.Bytes, len(addrInfo.Addrs)) | ||
for i, addr := range addrInfo.Addrs { | ||
// XXX: Adin, please, verify this is as intended. |
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.
@aschmahmann Please, verify this is as intended. PeerAddrs are created from whatever the server-implementing user passes. The code rewrites the multiaddresses to make sure they conform to the spec.
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.
A peer.AddrInfo
should not have the last component be a /p2p/peerID
in any event. For example some functions that would stop working include https://github.com/libp2p/go-libp2p-core/blob/02cbdcc4191b0f512c6cf4f2b1a8eeaaf32f1061/peer/addrinfo.go#L88
We could clean the data here, but really if this is happening then something else is likely wrong with your application. To me this means either we should just pass it through without validation, or when we validate and there's a problem we should return an error to the application to let them know they passed in invalid input.
client/findproviders.go
Outdated
} | ||
infos = append(infos, *ai) | ||
// ParseNodeAddresses parses peer node addresses from the protocol structure Peer. | ||
// XXX: Adin, please, verify this is as intended. |
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.
@aschmahmann Please, verify this is as intended.
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.
Looks good 👍
@aschmahmann I've addressed all the comments. Please take another look. |
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.
Looks good! The main comments are around lack of validation of the responses we get as a client and missing chunks of the IPNS records.
For the IPNS records I'm fine if you'd prefer to split it into a different PR, but I don't think it'll be too much if you want to do it here (i.e. do validation and some basic testing).
client/findproviders.go
Outdated
} | ||
infos = append(infos, *ai) | ||
// ParseNodeAddresses parses peer node addresses from the protocol structure Peer. | ||
// XXX: Adin, please, verify this is as intended. |
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.
Looks good 👍
server/findproviders.go
Outdated
func buildPeerFromAddrInfo(addrInfo peer.AddrInfo) *proto.Peer { | ||
pm := make([]values.Bytes, len(addrInfo.Addrs)) | ||
for i, addr := range addrInfo.Addrs { | ||
// XXX: Adin, please, verify this is as intended. |
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.
A peer.AddrInfo
should not have the last component be a /p2p/peerID
in any event. For example some functions that would stop working include https://github.com/libp2p/go-libp2p-core/blob/02cbdcc4191b0f512c6cf4f2b1a8eeaaf32f1061/peer/addrinfo.go#L88
We could clean the data here, but really if this is happening then something else is likely wrong with your application. To me this means either we should just pass it through without validation, or when we validate and there's a problem we should return an error to the application to let them know they passed in invalid input.
close(addrInfoCh) | ||
return addrInfoCh | ||
} | ||
go func() { |
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.
Thoughts (not blockers for merge):
Not sure if this is avoidable but wanted your thoughts on this. It looks like every abstraction layer involving a channel turns into another goroutine to pull x
from the channel and return f(x)
into a new channel.
Maybe once generics become more widely supported in our codebase (once Go 1.19 is released) this will become easier by letting us return generic channels and pass in functions to convert between types so a goroutine isn't required.
To be fair short lived goroutines aren't necessarily a big issue unless we're doing them on mass so we can cross this bridge when it becomes a problem.
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.
Yes. Without generics, we would need to resort to empty interfaces, which I think makes the code very unmanageable. I lean towards code readability unless there is a clear performance problem. And indeed it seems like Go generics can fix this issue.
@aschmahmann It's worth another look. I think I've addressed all comments in this round. |
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.
Looks good! There may be some more things we learn about here and need to improve the wrapper APIs down the road, but this is enough for us to make some good progress trying to integrate.
Thanks for all the hard work here 🙏
@aschmahmann Here's what I am thinking should be next steps:
|
@petar sounds like a plan to me 😄. In order for the hydras to properly utilize it there needs to be some server responding to Reframe requests. However, you might save yourself some pain by working on getting the indexers to serve the data using Reframe earlier. Otherwise you'll have to get the Hydras to support both the Indexer and Reframe endpoints. Your call though, if you think it'll be easier to start off working in the Hydras then start there. |
Sounds good! Thanks for reviewing this monster PR :) |
Ref.
Resolves ipld/edelweiss#12