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

blocksync: introduce interfaces; rename to ChainExchange (abbrev. chainxchg) #3624

Merged
merged 5 commits into from
Sep 9, 2020

Conversation

raulk
Copy link
Member

@raulk raulk commented Sep 7, 2020

Fixes #2612.

@raulk
Copy link
Member Author

raulk commented Sep 7, 2020

cc @yiannisbot

@raulk raulk changed the title blocksync: introduce interfaces; rename to chainexchange. blocksync: introduce interfaces; rename to ChainExchange (abbrev. chainxchg) Sep 7, 2020
Comment on lines +18 to +26
const (
// BlockSyncProtocolID is the protocol ID of the former blocksync protocol.
// Deprecated.
BlockSyncProtocolID = "/fil/sync/blk/0.0.1"

// ChainExchangeProtocolID is the protocol ID of the chain exchange
// protocol.
ChainExchangeProtocolID = "/fil/chain/xchg/0.0.1"
)
Copy link
Member Author

Choose a reason for hiding this comment

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

For consistency, I had to rename the p2p protocol. It's totally fine since we register the stream handler under both protocol IDs. And when opening an outbound stream, we try ChainExchange first, falling back to BlockSync. Before releasing v1, we can probably get rid of the deprecated one entirely.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you open an issue so we can track this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done: #3737.

@raulk raulk marked this pull request as ready for review September 7, 2020 19:11
Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

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

😍

// used by the Syncer.
type Client interface {
// GetBlocks fetches block headers from the network, from the provided
// tipset *backwards*, returning as many tipsets as the count parameter,
Copy link
Member

Choose a reason for hiding this comment

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

What does "backwards" mean here? Decending in height?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

GetBlocks(ctx context.Context, tsk types.TipSetKey, count int) ([]*types.TipSet, error)

// GetChainMessages fetches messages from the network, from the provided
// tipset *backwards*, returning the messages from as many tipsets as the
Copy link
Member

Choose a reason for hiding this comment

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

Same here - descending?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

// FIXME: Should be reviewed and confirmed.
SuccessPeerTagValue = 25
WriteReqDeadline = 5 * time.Second
ReadResDeadline = WriteReqDeadline
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, interested to know if we actually want these to be linked or if we just did not want to see repetition 😅...

If no then we should unlink and set to 5 * time.Second and if yes then there should be a comment to explain the linking is intentional!

Copy link
Member Author

Choose a reason for hiding this comment

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

I left all this logically unchanged, but yeah, this is a bit odd. Theoretically the response read timeout should be a bit larger than the write timeout, to account for the fact that this is an RPC and the remote party has work to do before they can actually return a response.

Copy link
Contributor

Choose a reason for hiding this comment

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

I probably linked them when extracting the constants, fine to decouple if you want.

Copy link
Contributor

@schomatis schomatis left a comment

Choose a reason for hiding this comment

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

With the exception of the innocuous ChainExchangeProtocolID addition this does modify the protocol logic and should present no problems to incorporate. Thanks for taking care of it @raulk.

// FIXME: Should be reviewed and confirmed.
SuccessPeerTagValue = 25
WriteReqDeadline = 5 * time.Second
ReadResDeadline = WriteReqDeadline
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably linked them when extracting the constants, fine to decouple if you want.

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.

Rename the block sync service
4 participants