-
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
blocksync: introduce interfaces; rename to ChainExchange (abbrev. chainxchg) #3624
Conversation
cc @yiannisbot |
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" | ||
) |
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.
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.
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.
Can you open an issue so we can track 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.
Done: #3737.
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.
😍
// 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, |
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 does "backwards" mean here? Decending in height?
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.
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 |
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.
Same here - descending?
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.
Yep!
// FIXME: Should be reviewed and confirmed. | ||
SuccessPeerTagValue = 25 | ||
WriteReqDeadline = 5 * time.Second | ||
ReadResDeadline = WriteReqDeadline |
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.
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!
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 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.
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 probably linked them when extracting the constants, fine to decouple if you want.
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.
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 |
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 probably linked them when extracting the constants, fine to decouple if you want.
Fixes #2612.