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

Support exposing bitswap publicly #967

Closed
wants to merge 6 commits into from

Conversation

hannahhoward
Copy link
Collaborator

Goals

Implements #951

Uses index provider families to switch to advertising bitswap as an extended provider in the indexer-- this allows a provider to expose booster-bitswap directly as a public node.

Implementation

  • unfortunately, this has two dependent PRs for the time being, cause the indexprovider package needed a major update which triggered other deps updates -- chore(deps): update index provider 0.9.1 lotus#9688 & Upgrade to index provider v0.9.1 go-fil-markets#766
  • per Support exposing booster bitswap peer directly to indexer via extended providers #951 description, adds two config vars for public addresses and the location of a private key for booster bitswap
  • if public addresses are not present, proxy approach still works:
    • adds BItswap peer id to config of protocol proxy
    • advertises Bitswap records for the main peer id
    • NOTE: rather than announcing bitswap per deal any more, we announce bitswap as a supported protocol on an extended provider with the same peer ID as boost
  • if public address are present, annouces them as extended provider
    • extended provider for bitswap is announced in indexer with peerKey + addrs of the bitswap node
    • booster-bitswap should be started w/o forwarding
    • also makes sure these addresses are advertised instead of the main peer in the support transport endpoint

For discussion

  • This PR could probably lose the Lotus update if we moved the index provider code we are depending on over to boost. Why are we relying on this code from Lotus? It seems like it should live in Boost.
  • Do we need to bother with trying to unannounce individual bitswap records?

@hannahhoward hannahhoward force-pushed the feat/update-indexer-announce branch 2 times, most recently from efdd08b to 0ccfa8c Compare November 20, 2022 01:29
Copy link
Collaborator

@willscott willscott left a comment

Choose a reason for hiding this comment

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

This seems generally reasonable.

@ischasny should also review

var eps []xproviders.Info

// add bitswap extended provider as needed
if cfg.Dealmaking.BitswapPeerID != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

wonder if we can jump directly to this being an array / support multiple bitswap peers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

would rather not jump anything? we'd need to handle multiple private ids too.

if err != nil {
return nil, err
}
if len(cfg.Dealmaking.BitswapPublicAddresses) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

so not setting addresses on your bitswap config means that it'll use the main markets host for advertisements? that seems like the wrong thing to condition on - wouldn't it instead be if the bitswap peer ID matches the host ID?

Copy link
Collaborator Author

@hannahhoward hannahhoward Dec 8, 2022

Choose a reason for hiding this comment

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

no. In this case, you still use the bitswap peer id but it now uses the protocol proxy to forward bitswap to that separate peer id while publishing the main boost peer id with the indexer.

}
// announce all deals on startup in case of a config change
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
go func() {
_ = w.IndexerAnnounceAllDeals(ctx)
_ = w.AnnounceExtendedProviders(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this change (from calling IndexerAnnounceAllDeals to calling AnnounceExtendedProviders) will now just update the multiaddrs / if bitswap is running.
Before, that method on startup would try to reconcile what was announced with the known deals.
where will we do that now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That method just got added to the start with booster-bitswap previous release, so I don't think it's all that important. We could run it though for other reasons?

github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/index-provider v0.8.1
github.com/filecoin-project/lotus v1.18.0-rc3
github.com/filecoin-project/index-provider v0.9.2-0.20221119192528-622ddb90df0e
Copy link
Collaborator

Choose a reason for hiding this comment

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

v0.9.2 has been cut, please use it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep

return nil
}
adBuilder := xproviders.NewAdBuilder(w.h.ID(), w.h.Peerstore().PrivKey(w.h.ID()), w.h.Addrs())
adBuilder.WithExtendedProviders(w.extendedProviders...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want a bitswap endpoint to also be added for the main provider, don't forget to call .WithMetadata(...) on the builder.

@hannahhoward hannahhoward requested a review from masih November 21, 2022 16:41
@hannahhoward
Copy link
Collaborator Author

moved the indexer code cause it was the right thing to do, but still not able to avoid a Lotus deps update

uses index provider families to switch to advertising bitswap as an extended provider -- this allows
us to expose booster-bitswap directly
node/config/types.go Outdated Show resolved Hide resolved
node/config/types.go Outdated Show resolved Hide resolved
@@ -51,9 +51,20 @@ func NewTransportsListener(cfg *config.Boost) func(h host.Host) (*lp2pimpl.Trans
})
}
if cfg.Dealmaking.BitswapPeerID != "" {
addrs := h.Addrs()
if len(cfg.Dealmaking.BitswapPublicAddresses) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a comment explaining what this code is doing (and why we need it)

if err != nil {
return nil, err
}
if len(cfg.Dealmaking.BitswapPublicAddresses) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a comment explaining what this code is doing (and why we need it)

hannahhoward and others added 3 commits December 7, 2022 18:51
Co-authored-by: dirkmc <dirkmdev@gmail.com>
Co-authored-by: dirkmc <dirkmdev@gmail.com>
@hannahhoward
Copy link
Collaborator Author

closing in favor of #1030

legacyProv lotus_storagemarket.StorageProvider
prov provider.Interface
dagStore *dagstore.Wrapper
meshCreator idxprov.MeshCreator
Copy link
Collaborator

Choose a reason for hiding this comment

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

@hannahhoward Can we copy over idxprov from Lotus to Boost?

@nonsense nonsense deleted the feat/update-indexer-announce branch January 17, 2023 15:29
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.

5 participants