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

Rewrite internal logic of block sync client #2715

Merged
merged 17 commits into from
Aug 6, 2020
Merged

Conversation

schomatis
Copy link
Contributor

@schomatis schomatis commented Jul 30, 2020

While trying not to modify too much of the external callers code. The only major change outside of chain/blocksync/ is extracing the FetchMessagesByCids/FetchSignedMessagesByCids functions to the consumer. They did not actually used this protocol, just the BlockService embedded in one of its structures (that was also extracted since the server only needs the ChainStore).

@schomatis schomatis mentioned this pull request Jul 30, 2020
@schomatis
Copy link
Contributor Author

Not sure why TestAPIRPC/testMining is failing.

@schomatis schomatis marked this pull request as ready for review July 31, 2020 13:19
@magik6k
Copy link
Contributor

magik6k commented Aug 3, 2020

TestAPIRPC/testMining

Try rebasing / merging newer next - #2740

@schomatis
Copy link
Contributor Author

@magik6k same error

@Kubuxu
Copy link
Contributor

Kubuxu commented Aug 3, 2020

Working on review of this.

Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

Looks like this introduces some protocol-breaknig changes, but i still managed to sync the calibration chain between 2 local nodes.

In general this looks good to me, but probably want @Kubuxu / @whyrusleeping to have a look too before merging

if options.IncludeMessages {
validRes.messages = make([]*CompactedMessages, resLength)
for i := 0; i < resLength; i++ {
if res.Chain[i].Messages == nil {
Copy link
Member

Choose a reason for hiding this comment

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

what if there actually arent any messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you'd have an empty structure but not a nil pointer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but that's a good question, i now realize i had the implicit (unfounded) assumption that blocks couldn't be empty

// FIXME: What's the point of setting a blank deadline that won't time out?
// Is this our way of clearing the old one?
client.peerTracker.logFailure(peer, build.Clock.Since(connectionStart))
// FIXME: Should we also remove peer here?
Copy link
Member

Choose a reason for hiding this comment

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

i currently assume the peer tracker won't try the peer again unless they are our only other option

// * BI: block index in the tipset.
// * MI: message index in `Bls` list
//
// FIXME: The logic to decompress this structure should belong
Copy link
Member

Choose a reason for hiding this comment

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

👍

return
}

_ = stream.SetDeadline(time.Now().Add(WRITE_RES_DEADLINE))
Copy link
Member

Choose a reason for hiding this comment

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

need to clear the deadline too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 6551219

Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

This LGTM, I have a couple comments, one should be addressed (set timeout thing)

// FIXME: Same, why are we doing this again here?
_ = stream.SetWriteDeadline(time.Time{})
_ = stream.SetWriteDeadline(time.Time{}) // clear deadline // FIXME: Needs
// its own API (https://github.com/libp2p/go-libp2p-core/issues/162).
Copy link
Contributor

Choose a reason for hiding this comment

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

Clearing Deadline by empty time is the Go's standard, I agree specific API might be nice.

chain/blocksync/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

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

One or two nits but otherwise SGWM

@schomatis
Copy link
Contributor Author

Still a lot of tests failing from unrelated reasons..

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.

4 participants