-
Notifications
You must be signed in to change notification settings - Fork 159
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
Bitswap Integration #518
Merged
Merged
Bitswap Integration #518
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ec2
requested review from
ansermino,
austinabell and
dutterbutter
as code owners
June 24, 2020 06:08
ec2
requested review from
timvermeulen,
StaticallyTypedAnxiety,
flodesi and
RajarupanSampanthan
June 24, 2020 06:09
Closed
austinabell
suggested changes
Jun 26, 2020
austinabell
reviewed
Jul 10, 2020
dutterbutter
suggested changes
Jul 10, 2020
austinabell
reviewed
Jul 13, 2020
austinabell
reviewed
Jul 13, 2020
austinabell
suggested changes
Jul 14, 2020
austinabell
reviewed
Jul 15, 2020
austinabell
approved these changes
Jul 15, 2020
dutterbutter
approved these changes
Jul 15, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
Changes introduced in this pull request:
Added the Bitswap libp2p behaviour
Bitswap is the protocol used to do IPLD data exchange. In this case (will be handled in next PR) Bitswap is needed for when we recieve a BlockHeader over Gossipsub. Bitswap is used to fetch messages (by Cid) in the event we don't have the message already (which is likely).
The general flow is: Call the swarm to broadcast a WantList of Cids we want. Every relevant task will have a flo_stream::Subscriber that is awaited on. We keep awaiting and matching until we get a NetworkEvent::BitswapBlock(cid) that we are looking for. Not all this is implemented yet. Only the setup of the architecture is built here.
Added support for concurrent Libp2p RPC message handling
Libp2p RPC was originally written in such a way that we assume only one thread/task will send/recieve a request/response. This will not be the case in the next PR where we sync multiple blocks at the same time.
The way this is "solved" is by keeping a mapping between request_id and channel senders. When a request is made, a request_id -> Sender is stored in a hashmap, and the Receiver is returned immediately, which the sending method can await on. When the network receives the response corresponding to the request via a request_id, the result will be sent to the channel.
Reference issue to close (if applicable)
Closes
Other information and links