Jun 26, 2-3 PM (33)
Jun 26, 3-4 PM (14)
Jun 26, 4-5 PM (20)
Jun 26, 5-6 PM (8)
Jun 26, 6-7 PM (8)
Jun 26, 7-8 PM (7)
Jun 26, 8-9 PM (17)
Jun 26, 9-10 PM (16)
Jun 26, 10-11 PM (11)
Jun 26, 11-12 AM (2)
Jun 27, 12-1 AM (6)
Jun 27, 1-2 AM (22)
Jun 27, 2-3 AM (0)
Jun 27, 3-4 AM (1)
Jun 27, 4-5 AM (1)
Jun 27, 5-6 AM (3)
Jun 27, 6-7 AM (4)
Jun 27, 7-8 AM (6)
Jun 27, 8-9 AM (3)
Jun 27, 9-10 AM (6)
Jun 27, 10-11 AM (2)
Jun 27, 11-12 PM (4)
Jun 27, 12-1 PM (4)
Jun 27, 1-2 PM (4)
Jun 27, 2-3 PM (5)
Jun 27, 3-4 PM (16)
Jun 27, 4-5 PM (2)
Jun 27, 5-6 PM (3)
Jun 27, 6-7 PM (4)
Jun 27, 7-8 PM (2)
Jun 27, 8-9 PM (2)
Jun 27, 9-10 PM (2)
Jun 27, 10-11 PM (3)
Jun 27, 11-12 AM (1)
Jun 28, 12-1 AM (9)
Jun 28, 1-2 AM (0)
Jun 28, 2-3 AM (2)
Jun 28, 3-4 AM (2)
Jun 28, 4-5 AM (0)
Jun 28, 5-6 AM (0)
Jun 28, 6-7 AM (2)
Jun 28, 7-8 AM (1)
Jun 28, 8-9 AM (0)
Jun 28, 9-10 AM (0)
Jun 28, 10-11 AM (9)
Jun 28, 11-12 PM (0)
Jun 28, 12-1 PM (0)
Jun 28, 1-2 PM (0)
Jun 28, 2-3 PM (1)
Jun 28, 3-4 PM (0)
Jun 28, 4-5 PM (0)
Jun 28, 5-6 PM (0)
Jun 28, 6-7 PM (2)
Jun 28, 7-8 PM (8)
Jun 28, 8-9 PM (5)
Jun 28, 9-10 PM (11)
Jun 28, 10-11 PM (1)
Jun 28, 11-12 AM (2)
Jun 29, 12-1 AM (4)
Jun 29, 1-2 AM (1)
Jun 29, 2-3 AM (0)
Jun 29, 3-4 AM (16)
Jun 29, 4-5 AM (1)
Jun 29, 5-6 AM (10)
Jun 29, 6-7 AM (12)
Jun 29, 7-8 AM (183)
Jun 29, 8-9 AM (13)
Jun 29, 9-10 AM (12)
Jun 29, 10-11 AM (11)
Jun 29, 11-12 PM (21)
Jun 29, 12-1 PM (19)
Jun 29, 1-2 PM (34)
Jun 29, 2-3 PM (17)
Jun 29, 3-4 PM (19)
Jun 29, 4-5 PM (24)
Jun 29, 5-6 PM (15)
Jun 29, 6-7 PM (12)
Jun 29, 7-8 PM (3)
Jun 29, 8-9 PM (11)
Jun 29, 9-10 PM (18)
Jun 29, 10-11 PM (1)
Jun 29, 11-12 AM (6)
Jun 30, 12-1 AM (9)
Jun 30, 1-2 AM (7)
Jun 30, 2-3 AM (13)
Jun 30, 3-4 AM (6)
Jun 30, 4-5 AM (1)
Jun 30, 5-6 AM (11)
Jun 30, 6-7 AM (14)
Jun 30, 7-8 AM (30)
Jun 30, 8-9 AM (25)
Jun 30, 9-10 AM (22)
Jun 30, 10-11 AM (25)
Jun 30, 11-12 PM (27)
Jun 30, 12-1 PM (39)
Jun 30, 1-2 PM (33)
Jun 30, 2-3 PM (31)
Jun 30, 3-4 PM (41)
Jun 30, 4-5 PM (59)
Jun 30, 5-6 PM (65)
Jun 30, 6-7 PM (85)
Jun 30, 7-8 PM (16)
Jun 30, 8-9 PM (29)
Jun 30, 9-10 PM (39)
Jun 30, 10-11 PM (5)
Jun 30, 11-12 AM (3)
Jul 01, 12-1 AM (10)
Jul 01, 1-2 AM (1)
Jul 01, 2-3 AM (10)
Jul 01, 3-4 AM (1)
Jul 01, 4-5 AM (9)
Jul 01, 5-6 AM (24)
Jul 01, 6-7 AM (23)
Jul 01, 7-8 AM (38)
Jul 01, 8-9 AM (25)
Jul 01, 9-10 AM (15)
Jul 01, 10-11 AM (52)
Jul 01, 11-12 PM (11)
Jul 01, 12-1 PM (11)
Jul 01, 1-2 PM (51)
Jul 01, 2-3 PM (41)
Jul 01, 3-4 PM (18)
Jul 01, 4-5 PM (13)
Jul 01, 5-6 PM (50)
Jul 01, 6-7 PM (23)
Jul 01, 7-8 PM (23)
Jul 01, 8-9 PM (5)
Jul 01, 9-10 PM (3)
Jul 01, 10-11 PM (1)
Jul 01, 11-12 AM (39)
Jul 02, 12-1 AM (3)
Jul 02, 1-2 AM (2)
Jul 02, 2-3 AM (6)
Jul 02, 3-4 AM (11)
Jul 02, 4-5 AM (8)
Jul 02, 5-6 AM (20)
Jul 02, 6-7 AM (25)
Jul 02, 7-8 AM (33)
Jul 02, 8-9 AM (14)
Jul 02, 9-10 AM (20)
Jul 02, 10-11 AM (18)
Jul 02, 11-12 PM (23)
Jul 02, 12-1 PM (16)
Jul 02, 1-2 PM (30)
Jul 02, 2-3 PM (33)
Jul 02, 3-4 PM (19)
Jul 02, 4-5 PM (16)
Jul 02, 5-6 PM (21)
Jul 02, 6-7 PM (1)
Jul 02, 7-8 PM (7)
Jul 02, 8-9 PM (4)
Jul 02, 9-10 PM (5)
Jul 02, 10-11 PM (2)
Jul 02, 11-12 AM (4)
Jul 03, 12-1 AM (7)
Jul 03, 1-2 AM (10)
Jul 03, 2-3 AM (8)
Jul 03, 3-4 AM (20)
Jul 03, 4-5 AM (7)
Jul 03, 5-6 AM (4)
Jul 03, 6-7 AM (11)
Jul 03, 7-8 AM (27)
Jul 03, 8-9 AM (20)
Jul 03, 9-10 AM (8)
Jul 03, 10-11 AM (22)
Jul 03, 11-12 PM (11)
Jul 03, 12-1 PM (14)
Jul 03, 1-2 PM (22)
Jul 03, 2-3 PM (12)
2,413 commits this week Jun 26, 2020 - Jul 03, 2020
Merge #2358
2358: Refactor network/consensus versioning r=mrBliss a=mrBliss

Fixes #2309.

Previously, we had a list of supported `BlockNodeToNodeVersion`s and a method
to translate them to a `NodeToNodeVersion`. This meant that there were two
layers of "support": (1) include the version in `BlockNodeToNodeVersion`
and (2) return a non-`error` for it in the translation function.

Replace these methods by a map from `NodeToNodeVersion` to
`BlockNodeToNodeVersion`. Similarly for `NodeToClient`. An important insight
is that not each network version requires a consensus-side block version. For
example, enabling the `LocalStateQuery` `NodeToClient` protocol requires a new
network version, but no block version, as the serialisation format doesn't
change. A new block version is only needed when the serialisation changes, so
not when protocols get added/removed or the protocol messages are
added/removed.

This means we don't need separate Byron (nor Cardano) versions for
`NodeToClientV_2`, as the serialisation format didn't change, so remove these
redundant versions and map `NodeToClientV_2` to `ByronNodeToClientVersion1`.

The `mostRecentSupportedNodeToNode` method was only used for the ThreadNet
tests to make sure we were testing the most recent version. Remove this method
in favour of randomly picking a supported version in the tests. The
`Test.ThreadNet.Util.NodeToNodeVersion` was added to aid in picking a version.

* Rewrite `foldMapVersions` and `combineVersions` to work for any `Foldable`
  instead of a `NonEmpty`, as we now use a `Map` instead of a `NonEmpty` for
  the supported versions.

* Rewrite `Cardano.Client.Subscription` to take a `CodecConfig` +
  `NetworkMagic` instead of an entire `TopLevelConfig`. Producing a
  `TopLevelConfig` is a lot of work for clients. The whole point of
  introducing the `CodecConfig` was to make it easier for clients.

Co-authored-by: Thomas Winant <[email protected]>
Refactor network/consensus versioning
Fixes #2309.

Previously, we had a list of supported `BlockNodeToNodeVersion`s and a method
to translate them to a `NodeToNodeVersion`. This meant that there were two
layers of "support": (1) include the version in `BlockNodeToNodeVersion`
and (2) return a non-`error` for it in the translation function.

Replace these methods by a map from `NodeToNodeVersion` to
`BlockNodeToNodeVersion`. Similarly for `NodeToClient`. An important insight
is that not each network version requires a consensus-side block version. For
example, enabling the `LocalStateQuery` `NodeToClient` protocol requires a new
network version, but no block version, as the serialisation format doesn't
change. A new block version is only needed when the serialisation changes, so
not when protocols get added/removed or the protocol messages are
added/removed.

This means we don't need separate Byron (nor Cardano) versions for
`NodeToClientV_2`, as the serialisation format didn't change, so remove these
redundant versions and map `NodeToClientV_2` to `ByronNodeToClientVersion1`.

The `mostRecentSupportedNodeToNode` method was only used for the ThreadNet
tests to make sure we were testing the most recent version. Remove this method
in favour of randomly picking a supported version in the tests. The
`Test.ThreadNet.Util.NodeToNodeVersion` was added to aid in picking a version.

* Rewrite `foldMapVersions` and `combineVersions` to work for any `Foldable`
  instead of a `NonEmpty`, as we now use a `Map` instead of a `NonEmpty` for
  the supported versions.

* Rewrite `Cardano.Client.Subscription` to take a `CodecConfig` +
  `NetworkMagic` instead of an entire `TopLevelConfig`. Producing a
  `TopLevelConfig` is a lot of work for clients. The whole point of
  introducing the `CodecConfig` was to make it easier for clients.