ouroboros-consensus:unstable-consensus-testlib
Safe HaskellNone
LanguageHaskell2010

Test.Util.SupportedNetworkProtocolVersion

Synopsis

Documentation

contiguousSupportedNetworkProtocolVersions ∷ (Typeable blk, SupportedNetworkProtocolVersion blk) ⇒ Proxy blk → Assertion Source #

Make sure that supportedNodeToNodeVersions and supportedNodeToClientVersions each map a contiguous range of versions ending at maxBound.

We deliberately do not require every version of the network layer's enum to be mapped. Dropping the oldest versions once no client still negotiates them is a recurring, intentional operation, and the network layer keeps the constructors around for longer than we keep supporting them.

What must hold is that the supported versions are a suffix without holes:

  • ending at maxBound, so that adding a version to the network layer's enum and forgetting to map it here is a build-time-visible failure, which is the mistake this test was originally written to catch;
  • without holes, since the handshake picks the highest version both sides know, and a gap in the middle only makes the negotiated version harder to reason about for no benefit;
  • containing latestReleasedNodeVersion, which caps how far the oldest supported version can rise. The diffusion layer truncates the advertised map at the released version, so a released version below the run leaves nothing to advertise.