hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Configurable peers

Open ch1bo opened this issue 3 years ago • 0 comments
trafficstars

What & Why

Right now, the hydra-node is configured on startup to which other nodes it is connecting to using command line arguments like --peer. This is very inflexible, as it means the hostnames/IP addresses need to be known up-front and this becomes quickly unmanagable, especially in bigger, coordinated setups like benchmarks from #203 or #186.

For that matter, this feature will add ways to modify peers during runtime of hydra-node via the API.

For now, it shall not be possible to change the list of peers while the head is initialized or open. So only in IdleState.

Also, we want to be using the existing API layer to keep this small and focused! (see below for more rationale)

How

  • New client inputs and outputs are added for providing a new peer list, e.g. ModifyPeers
  • Extend the Network handle to modifyPeers :: ([Peer] -> (a, [Peer])) -> m a
  • The head logic will allow modification only when the head is in IdleState
  • Modifying the peer list will have the network layer do a full reinitialization
  • (optional) Factor a Hydra.NodeLogic module with a similar update function, moving the event/effect types into a shared module, and handle these "node-level" concerns there. For other concerns it would delegate to Hydra.HeadLogic.update

FAQ

  • Do we want to keep the command line way of configuring peers? Yes, these would be "starting" peers
  • Is it allowed to change peers in all Head states? No, only while in IdleState
  • Didn't we want to create an Admin/Operator API (ADR-15)? Yes, but we want to focus on the actual problem at hand. We would need to move other existing things like PeerConnected anyways.

ch1bo avatar Mar 08 '22 09:03 ch1bo