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

Network Abstraction For Retrieval Market #17

Merged
merged 37 commits into from
Jan 8, 2020

Conversation

hannahhoward
Copy link
Collaborator

To Simplify RetrievalCode and improve testability, this creates a retrieval market network abstraction to handle the protocols

Interfaces are here, implementation to come

@codecov-io
Copy link

codecov-io commented Dec 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@10eb435). Click here to learn what that means.
The diff coverage is 72.36%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #17   +/-   ##
=========================================
  Coverage          ?   14.97%           
=========================================
  Files             ?       26           
  Lines             ?     1756           
  Branches          ?        0           
=========================================
  Hits              ?      263           
  Misses            ?     1445           
  Partials          ?       48
Impacted Files Coverage Δ
retrievalmarket/network/libp2p_impl.go 61.76% <61.76%> (ø)
retrievalmarket/network/deal_stream.go 79.16% <79.16%> (ø)
retrievalmarket/network/query_stream.go 83.33% <83.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10eb435...aee364d. Read the comment docs.

@shannonwells shannonwells changed the base branch from spec-compliance to master January 2, 2020 18:23
retrievalmarket/network/query_stream.go Outdated Show resolved Hide resolved
retrievalmarket/impl/client.go Outdated Show resolved Hide resolved
retrievalmarket/impl/client_test.go Outdated Show resolved Hide resolved
shared/statestore/store.go Outdated Show resolved Hide resolved
shared/statestore/store_test.go Outdated Show resolved Hide resolved
retrievalmarket/impl/impl_types/types_cbor_gen.go Outdated Show resolved Hide resolved
@@ -3,6 +3,7 @@ package filestore
import (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is another rebase that's in a weird place

Copy link
Contributor

Choose a reason for hiding this comment

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

This file is still in master. The changes are because the linter complained about not error checking

@shannonwells shannonwells marked this pull request as ready for review January 8, 2020 19:43
Copy link
Collaborator Author

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

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

Wow
So this PR turned out really awesome!

I can't mark it approved cause I opened the PR I guess :)

I have a couple non-blocking comments you can address if you like. Overall though, nice work and thanks for all the detailed testing and additional fixtures and what not.

@@ -0,0 +1,109 @@
package shared_testutil
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Neat!

}

func TestQueryStreamSendReceiveOutOfOrderFails(t *testing.T) {
// send query, read response in handler - fails
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had in mind just doing:
from: write query
to: read query response <- errors

Not the second step as well. It's fine that the test is actually testing more, but if it means you can get rid of the go routine I'd probably just do that.

assert.Equal(t, dpy, receivedPayment)
}

func TestQueryStreamSendReceiveMultipleOutOfOrderFails(t *testing.T) {
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 is my own fault, but, honestly, this test doesn't make sense in retrospect.

I think the reason you're deadlocking without a go routine is the second WriteDealProposal never finishes in side the go routine. But cause there's no channel write at the end of the go routine, you just never see that.

It would be interesting to put a channel write at the end of the go routine and then try to read from it at the very end. I think you might find it never gets written to.

Assuming that's the case, I think this test gives a false impression of testing something it doesn't. Namely that all the writes after the first do not in fact pass.

I'm not sure if there's a good way to resolve this, and I wonder if it's just unrealstic to trying to have this test -- in practice,
the handlers we write are likely to return as soon as they encounter an error, and there will not be multiple error reads in a row.

So my honest, though non-blocking, recommendation is to delete this test and simplify the out-of-order query read test above to just test a single write/read, so that we don't have to deal with this. Sorry for having unneccesary work.

"github.com/filecoin-project/go-fil-components/retrievalmarket"
)

type DealStream struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NB: I wonder if this type should be private to the module. is there any downside there?

Copy link
Contributor

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

I approve of this PR.

@shannonwells shannonwells merged commit 6aa664e into master Jan 8, 2020
@shannonwells shannonwells deleted the feat/retrieval-network branch January 9, 2020 19:19
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