Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
34 changed files
with
394 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.