-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
bcf99c6
to
487b4f2
Compare
Not sure why |
Try rebasing / merging newer |
487b4f2
to
fc32410
Compare
@magik6k same error |
Working on review of this. |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 6551219
There was a problem hiding this 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). |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
Still a lot of tests failing from unrelated reasons.. |
While trying not to modify too much of the external callers code. The only major change outside of
chain/blocksync/
is extracing theFetchMessagesByCids
/FetchSignedMessagesByCids
functions to the consumer. They did not actually used this protocol, just theBlockService
embedded in one of its structures (that was also extracted since the server only needs theChainStore
).