Skip to content

Gateway Upgrades

David Vorick requested to merge gateway-proto into master

This is a merge of the gateway staging branch, which addresses the points of the "Gateway Upgrades" project. The goals of the project were:

  • Version exchange should provide a genesis block + self-identifying nonce

  • Gateway should use self-identifying nonce to avoid connecting to itself

  • Gateway needs to be using yamux smux instead of muxado

  • More research should be done on what we can do to prevent eclispe attacks, DoS attacks, and other network-based attacks.

As of this PR, the gateway uses smux, with muxado still employed for communicating with older gateways. Muxado will eventually be phased out, but this cannot happen until we drop support for LTS v1.0.4. Unlike muxado, smux has been vendored into the repo.

Gateways v1.3.0 and above will use a new handshake that includes their genesis block ID and a unique ID. This handshake requires fewer roundtrips than the previous protocol, and allows each gateway to send an error message to the other instead of hacks like silently closing the connection. For example, when a gateway wants to ping another gateway, it will send a modules.StopResponse error, which is handled as a special case by the recipient. (This mimics the use of StopResponse in the renter-host protocol to initiate graceful termination.)

Lastly, the gateway now stores more information persistently about each node, including whether the node has ever been connected to as an outbound peer. This information can be used to improve the gateway's resilience to certain attacks.

Merge request reports