Skip to content
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

feat: add check using only a CID #47

Merged
merged 14 commits into from
Aug 30, 2024
Merged

feat: add check using only a CID #47

merged 14 commits into from
Aug 30, 2024

Conversation

2color
Copy link
Member

@2color 2color commented Aug 21, 2024

What's in this PR

This PR fixes #6

  • It allows running a check by only passing a CID
  • running the check using only a CID will differ in its output, returning an array of objects instead of a single object
  • Each object in the CID only check eschew the PeerFoundInDHT in favour of a simpler array of Maddrs containing the maddrs for each provider (without the observed address count) and removing CidInDHT which is redundant for this check (see Rename CIDinDHT to ProviderRecordFromPeerInDHT #52)
  • The checks for each individual provider happen concurrently for faster response
  • The test caps the number of providers at 10. This is an arbitrary number but the logic is that beyond 10 providers (assuming at least one working one), you are probably not having any difficulty with retrieval anyways.

Other approaches explored but decided against

Exposing a delegated routing endpoint and reusing the existing CID & Maddr endpoint

In this approach, given a CID by the user, the frontend would make a delegated routing providers request and then issue multiple check requests for each provider returned. This would make the frontend a bit more logic heavy. However, after some initial exploration, I decided against it for a number of reasons:

  • Reusing the dht instance to create a delegated routing endpoint wasn’t so trivial and required a fair amount of code. It didn’t seem like it’s worth the complexity.
  • The peer specific endpoint also returns CidInDHT which adds overhead to
  • The approach already taken by this PR proved to be quick enough to return results.

* origin/main:
  chore: bump go.mod to Go 1.22 and run go fix (#51)
  chore: port version.go from rainbow
  chore: bump libp2p and kad-dht
  fix: make overflown text scroll
  chore: go-libp2p-kad-dht v0.26.1
  chore: first release
@2color 2color marked this pull request as ready for review August 27, 2024 16:04
@2color
Copy link
Member Author

2color commented Aug 28, 2024

Example test result
Screenshot 2024-08-28 at 3 57 47 PM

@2color 2color requested a review from lidel August 29, 2024 10:19
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you @2color! Small suggestions inline, but feel free to ship and deploy to prod 🙏

I think this is a good incremental improvement that delivers important feature (testing CID's availability without knowing specific provider).

We can enhance it in future but just shipping this as-is is already a big win for anyone trying to debug things.

ps. I did a small cleanup in #55 but it is not related to this PR.

web/index.html Outdated Show resolved Hide resolved
Comment on lines +93 to +96
if maStr == "" {
data, err = d.runCidCheck(r.Context(), cidStr)
} else {
data, err = d.runPeerCheck(r.Context(), maStr, cidStr)
Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker, but I think we may want to time-bound these with some sane timeout.

I've filled #54 to tackle that in future PR.

@2color 2color merged commit 6c45882 into main Aug 30, 2024
11 checks passed
@2color 2color deleted the just-cid branch August 30, 2024 10:56
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.

Allow for testing using only a CID
2 participants