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

bitswap client #856

Merged
merged 25 commits into from
Oct 4, 2022
Merged

bitswap client #856

merged 25 commits into from
Oct 4, 2022

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Oct 3, 2022

Fixes Allow direct connection to booster-bitswap

TODO:

  • create temporary on-disk blockstore
  • write output to file

hannahhoward and others added 12 commits September 13, 2022 17:30
* feat(booster-bitswap): booster bitswap MVP untested

* refactor(booster-bitswap): use API for fetching blocks

* fix(deps): update deps to compile

* feat(booster-bitswap): makefile & fixes

add commands to build booster-bitswap, and very a round tripped successful fetch from
booster-bitswap

* refactor: clean up unused vars etc

* fix: booster-bitsawp - check error when creating libp2p key

* refactor(node): avoid FreeAndUnsealed method

Co-authored-by: Dirk McCormick <[email protected]>
Co-authored-by: Anton Evangelatov <[email protected]>
* fix: return ipld ErrNotFound from remote blockstore interface

* test: add more tests for ipld ErrNotFound
* feat(loadbalancer): add message types

* feat(messages): add utility functions

* feat(loadbalancer): initial load balancer impl

implementation of the load balancer node itself

* feat(loadbalancer): add service node

implements code for running a service node

* feat(loadbalancer): integrate into boost and booster-bitswap

* Update loadbalancer/loadbalancer.go

Co-authored-by: Rod Vagg <[email protected]>

* Update loadbalancer/servicenode.go

Co-authored-by: Rod Vagg <[email protected]>

* Update loadbalancer/servicenode.go

Co-authored-by: Rod Vagg <[email protected]>

* Update loadbalancer/messages/messages.ipldsch

Co-authored-by: Rod Vagg <[email protected]>

* Update loadbalancer/messages/messages.ipldsch

Co-authored-by: Rod Vagg <[email protected]>

* refactor(loadbalancer): remove routing protocol

remove the routing protocol, instead relying on a set config. also remove forwarding response for
inbound requests

* fix(loadbalancer): update tests

* refactor(loadbalancer): integrate simplified load balancer

removed pub keys to minimize network traffic, added api's to configure and update bitswap peer id,
added auto config of bitswap peer id in booster-bitswap

* docs(gen): regenerate api docs

* chore(lint): fix lint errors

* fix(loadbalancer): minor bridgestream fix

* Update loadbalancer/servicenode.go

Co-authored-by: dirkmc <[email protected]>

* refactor(protocolproxy): address PR comments

renames, reconfigured architecture, etc

* refactor(make init print out peer id): remove apis and transparent peer id setting. have init print

Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: dirkmc <[email protected]>
* feat(booster-bitswap): add block filter via BadBits

* refactor(booster-bitswap): use bitswap blockfilter for filtering

* feat(blockfilter): only update when list is modified

* feat(blockFilter): add on disk caching

* Update cmd/booster-bitswap/blockfilter/blockfilter.go

Co-authored-by: dirkmc <[email protected]>

* fix(blockfilter): minor PR fixups

Co-authored-by: dirkmc <[email protected]>
* chore(deps): upgrade to Lotus RC & libp2p v0.22

* chore(deps): update go to 1.18

* ci(circle): update circle to go 1.18

* style(imports): fix imports

* fix(build): update ffi

* fix(lint): fix deprecated strings.Title method

* fix(mod): mod tidy
* refactor(booster-bitswap): minor UI fixes for booster-bitswap UI

* Update cmd/booster-bitswap/init.go

Co-authored-by: dirkmc <[email protected]>

Co-authored-by: dirkmc <[email protected]>
@dirkmc dirkmc force-pushed the feat/bitswap-client branch from b022f1b to efcfb9e Compare October 3, 2022 09:40
@dirkmc dirkmc requested a review from nonsense October 3, 2022 09:42
@dirkmc dirkmc force-pushed the feat/bitswap-client branch 2 times, most recently from 6ccb1fa to 7ef9e1d Compare October 3, 2022 09:48
@dirkmc dirkmc marked this pull request as draft October 3, 2022 10:03
@dirkmc dirkmc removed the request for review from nonsense October 3, 2022 10:03
@dirkmc dirkmc force-pushed the feat/bitswap-client branch 2 times, most recently from 43a79f6 to 65646ef Compare October 3, 2022 12:14
@dirkmc dirkmc force-pushed the feat/bitswap-client branch from 65646ef to 0bd7736 Compare October 3, 2022 12:41
@dirkmc dirkmc marked this pull request as ready for review October 4, 2022 11:59
Copy link
Member

@nonsense nonsense left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from release/lotus1.17.2 to main October 4, 2022 12:40
@dirkmc dirkmc merged commit f0726d2 into main Oct 4, 2022
@dirkmc dirkmc deleted the feat/bitswap-client branch October 4, 2022 12:55
Copy link
Collaborator

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

@dirkmc just a few pass-by comments on the fetch command in case you're interested.

Also worth noting that this code has been duplicated in a few places. Might be worth taking the pieces and putting them into a library so not everyone runs into the same issues/concerns although maybe this is different enough that the few hundred lines is no big deal.

Ones I know of:

For example, all three implementations (and this one) have the same problem with host disconnects and requiring some code like the one in the linked issue that kubo has, to make larger data transfers more reliable even when the server is busy (maybe some peering/retry code should end up as a utility in go-libp2p 🤷).


// setup libp2p host
log.Infow("generating libp2p key")
privKey, _, err := crypto.GenerateECDSAKeyPair(rand.Reader)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason you went with ECDSA over ED25519, I tend to see the latter as the default in more places.

Comment on lines +88 to +89
libp2p.Transport(tcp.NewTCPTransport),
libp2p.Transport(quic.NewTransport),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these the only transports you're supporting because they're the only ones Boost supports?

Comment on lines +120 to +122
err = host.Connect(ctx, *serverAddrInfo)
if err != nil {
return fmt.Errorf("connecting to %s: %w", serverAddrInfo, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will likely cause you problems with large files since if the connection gets pruned on the server side it'll never get re-established and your download will stall (e.g. like ipfs/ipget#103).

It's resolvable by trying to keep the connection alive.

@dirkmc
Copy link
Contributor Author

dirkmc commented Oct 18, 2022

@aschmahmann thanks a lot for the comments 🙏

This client is just intended as a convenience for testing, not to be used in production. So we kept it simple on purpose, but I agree that using kubo or of the other clients would make more sense in production.

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 direct connection to booster-bitswap
4 participants