Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Rewrite peers module - phase two #446

Closed
karmacoma opened this issue Feb 22, 2017 · 3 comments
Closed

Rewrite peers module - phase two #446

karmacoma opened this issue Feb 22, 2017 · 3 comments
Assignees
Milestone

Comments

@karmacoma
Copy link
Contributor

Decoupling @4miners ideas from #406:

Phase 2 of 2: Change peers communication protocol from http to websockets.

@karmacoma
Copy link
Contributor Author

See phase one: #409

@karmacoma
Copy link
Contributor Author

We are looking to utilize http://socketcluster.io/ which is base on: https://github.com/uWebSockets/uWebSockets.

By changing from the stateless http protocol to persistent socket connections, we aim to improve block / transaction propagations times, and the general efficiency of peer to peer communications.

@MaciejBaj
Copy link
Contributor

MaciejBaj commented Mar 22, 2017

For communication with peers, different process (worker) can be launched- it is easy to do with SocketCluster. SocketCluster very seems to be a very good choice in terms of scalability. However, it is not compatible with the WAMP protocol (such as AutobahnJS), and from the point of how peers communicating, RPC could be very useful. It addresses the problem of the response order in case of subscription to an event after peer sends many requests one by one. Merging ideas of WAMP protocol to introduce RPC with good performance of SocketCluster seems to be the best solution.

  • library to extend WebSocket Socket object with RPC methods
  • setup SocketCluster server and client in Lisk
  • handshake between peers as WS middleware
  • transactions broadcast and receiving as WS stream
  • signatures broadcast and receiving as WS stream
  • new block broadcast and receiving as WS stream
  • ping peer as WS RPC method
  • get height from peer as WS RPC method
  • get peers list from peer as WS RPC method
  • get common block from peer as WS RPC method
  • load blocks from peer as WS RPC method
  • load signatures from peer as WS RPC method
  • load transactions from peer as WS RPC method
  • introduce another layer of tests, which will test the peer's integration

Also, some changes should be introduced in current Lisk protocol:

  • get rid of passing the peer headers with every request and updating the peer after every request as it will be done by preceding handshake
  • remove getFromRandomPeer and getFromPeer functions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants