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

Bitswap Integration #518

Merged
merged 53 commits into from
Jul 15, 2020
Merged

Bitswap Integration #518

merged 53 commits into from
Jul 15, 2020

Conversation

ec2
Copy link
Member

@ec2 ec2 commented Jun 24, 2020

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

@ec2 ec2 linked an issue Jun 24, 2020 that may be closed by this pull request
@austinabell austinabell changed the base branch from master to main June 24, 2020 15:20
blockchain/chain_sync/src/network_handler.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/network_handler.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/network_context.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/network_context.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/network_context.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/Cargo.toml Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Show resolved Hide resolved
blockchain/chain_sync/src/sync.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/service.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
node/forest_libp2p/src/behaviour.rs Outdated Show resolved Hide resolved
@ec2 ec2 merged commit d83dac3 into main Jul 15, 2020
@ec2 ec2 deleted the ec2/libp2p/bitswap branch July 15, 2020 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitswap Integration
4 participants