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

Announce Bitswap records to indexer #839

Merged
merged 3 commits into from
Oct 13, 2022
Merged

Conversation

hannahhoward
Copy link
Collaborator

Goals

When booster-bitswap is configured, announce Bitswap as a supported protocol to the indexer

Implementation

  • First, see Support using custom metadata in index announcements go-fil-markets#752 - this updates go-fil-markets to support a custom metadata generation function for a given deal. It also removes treating provider.ErrAlreadyAdvertised as an error when announcing all deals
  • In this PR, the indexprovider.Wrapper struct is augmented in the following ways:
      1. It's configured to run IndexerAnnounceAllDeals once on startup (to catch config updates)
      1. We no longer treat provider.ErrAlreadyAdvertised as an error when announcing all deals.
      1. The announcement is augmented on Bitswap if config.DealMaking.BitswapPeerID is set.
  • A new constructor function for the legacy storage market provider also configures a custom metadata generator that announces legacy deals on bitswap if config.Dealmaking.BitswapPeerID is set

@hannahhoward hannahhoward force-pushed the feat/announce-to-indexer branch 2 times, most recently from 3afabbb to a211e4e Compare September 27, 2022 22:32
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
go func() {
_ = w.IndexerAnnounceAllDeals(ctx)
Copy link
Contributor

@dirkmc dirkmc Sep 28, 2022

Choose a reason for hiding this comment

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

Looking at how IndexerAnnounceAllDeals is implemented it looks like it will announce

  • all legacy deals that are in a sealing state (but not in an error or completed state)
  • all new deals that have not already been announced (and are not in an error or completed state)

Is that what we want to happen here?

Also keep in mind that some providers have up to 100k deals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If there is no change to the protocols supported, this is essentially a no-op -- the call to announce will error with ErrAlreadyPublished.

per @willscott at the moment there is no more efficient way to do this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok but I don't think this is going to re-announce deals that are not in one of the two categories I mentioned. For example non-legacy deals that have already been announced.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah I now see what you mean.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok I now have more questions having read the code. I'm writing it up in a new issue. Basically, based on the behavior of the code as it exists, I really can't figure out what IndexerAnnounceAllDeals was intended to do.

The intent of the go-fil-markets code looks like a re-announce, while the code in boost looks like a first time announce, which will include several deals that really shouldn't be announced yet (i.e. haven't even had a data transfer)

Will document in more detail in a seperate issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok @dirkmc I think I've put this in a reasonable state. There are two new commits --
filecoin-project/go-fil-markets@5dd7bc1

  • this removes StorageDealStaged from the list of states that announce, because StorageDealStaged is the stage where they get announces (vaguely equivalent to dealcheckpoints.AddedPiece in Boost)
  • otherwise, I think the go-fil-markets logic is correct --
    • StorageDealActive describes the entire time the deal is on chain, which seems like a reasonable bound keep the announcement alive, and it is already among the states that get reannounced. The actual "completion states" are either errors or after the deal has actually expired (i.e. we're past SectorEndEpoch).

63ba701

  • this changes the condition for announce to essentially be only those deals that are at the IndexedAndAnnounced. Technically, it filters out all that are < IndexedAndAnnouced and >= Complete, which is currently the same as != IndexedAndAnnounced but I thought it'd be useful to treat this as a range in case we add something between IndexedAndAnnounced and Complete in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this addresses most of the issues in #882 though not all of them. It certainly shouldn't make things worse. :)

@hannahhoward hannahhoward marked this pull request as ready for review October 3, 2022 23:08
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 is okay from the indexer side

Base automatically changed from release/lotus1.17.2 to main October 4, 2022 12:40
support announcing on bitswap when configured to do so
@hannahhoward
Copy link
Collaborator Author

I'm not sure why test-all is failing -- I don't seem to get this failure locally and it seems unrelated.

@dirkmc
Copy link
Contributor

dirkmc commented Oct 10, 2022

LGTM 👍

@hannahhoward thanks for digging through all this code and figuring out how to fix it the right way 🙏

@hannahhoward hannahhoward merged commit d5d367f into main Oct 13, 2022
@nonsense nonsense deleted the feat/announce-to-indexer branch November 3, 2022 14:37
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.

3 participants