Skip to content

Latest commit

 

History

History
176 lines (146 loc) · 6.06 KB

README.md

File metadata and controls

176 lines (146 loc) · 6.06 KB

Build Status

Ouroboros-Network

  • io-sim - IOSim simulator monad which supports asynchronous exceptions, STM transactions and async interface, timers.
  • io-sim-classes - type classes, all of them have instance for both IOSim and IO.
  • typed-protocols - session type framework with support of protocol pipelining
    • See 45min Haskell eXchange 2019 talk by @dcoutts.
    • See three 50min Monadic Party 2019 workshop talks by @coot: Part 1, Part 2, Part 3.
  • ouroboros-network- ouroboros network package which implements protocols which to run ouroboros family of protocols, multiplexing layer.
  • The byron-proxy is a network protocol proxy between Byron and Shelley. It now lives in a seaprate repository.

Ouroboros-Network Documentation

We have two documents which describe various levels of the networking layer of the Cardano Shelley implementation:

  • Introduction to the design of Data Diffusion and Networking of Cardano Shelley

    This document explains the technical requirements and key constraints for the networking layer of the Cardano Shelley implementation of Ouroboros Praos. This is a design document.

  • The Shelley Networking Protocol

    This document is a technical specification of the networking protocol. It includes serialisation formats, necessary details of multiplexer and technical specifications of mini-protocols used by either node-to-node and node-to-client flavors of the protocol.

The latest versions of the two documents can be found here.

Ouroboros-Network API

The API consisists of three layers:

• mini-protocol api's, which are GADTs for each mini-protocol under Ouroboros.Network.Protocol; this hides heavy type machinery of session types. One only needs the typed Peer type when one is using runPeer or runPeerPipelined function and each protocol exposes a function to create it (e.g. Ouroboros.Network.Protocol.ChainSync.Client.chainSyncClientPeer)

• callback ptcl -> channel -> m () where ptcl is enumeration for each mini-protoicol, this is either NodeToNodeProtocols or NodeToClientProtocols. The callback is wrapped in OuroborosApplication GADT which allows to differentiate the initiator / responder (or client / server) callbacks.

• versioning which is a map from version numbers to the above callbacks and version data (the tricky part here is that version data type can be different between different versions; there is a simple way of building this map using a semigroup). You can use simpleSingletonVersion if your application does not depend on negotated version data. However, Ouroboros.Network.NodeToNode and Ouroboros.Network.NodeToClient expose V1 api which hides versioning from the caller.

Demo application

You can run a demo application, check chain-sync-demo wiki page.

Tests

Typed Protocols test suite

cabal new-run pkg:typed-protocols:tests

or with nix

nix-build -A haskellPackages.typed-protocols.checks

IOSim test suite

cabal new-run pkg:io-sim:tests

or with nix

nix-build -A haskellPackages.io-sim.checks

Ouroboros-Network test suite

cabal new-run pkg:ouroboros-network:tests

or with nix

nix-build -A haskellPackages.ouroboros-network.checks

Ouroboros-Consensus test suite

cabal new-run pkg:ouroboros-consensus:tests

or with nix

nix-build -A haskellPackages.ouroboros-consensus.checks

Ouroboros-Consensus

Consensus layer of the family Ouroboros blockchain protocols.

Tests

Consensus test suite

cabal new-run ouroboros-consensus-test:test-consensus

or with nix

nix-build -A haskellPackages.ouroboros-consensus-test.checks.test-consensus

Storage test suite

cabal new-run ouroboros-consensus-test:test-storage

or with nix

nix-build -A haskellPackages.ouroboros-consensus-test.checks.test-storage

Test infrastructure test suite

cabal new-run ouroboros-consensus-test:test-infra

or with nix

nix-build -A haskellPackages.ouroboros-consensus-test.checks.test-infra

Mock test suite

cabal new-run ouroboros-consensus-mock-test:test

or with nix

nix-build -A haskellPackages.ouroboros-consensus-mock-test.checks.test

Byron test suite

cabal new-run ouroboros-consensus-byron-test:test

or with nix

nix-build -A haskellPackages.ouroboros-consensus-byron-test.checks.test

Shelley test suite

cabal new-run ouroboros-consensus-shelley-test:test

or with nix

nix-build -A haskellPackages.ouroboros-consensus-shelley-test.checks.test

Cardano test suite

cabal new-run ouroboros-consensus-cardano-test:test

or with nix

nix-build -A haskellPackages.ouroboros-consensus-cardano-test.checks.test

Formatting

The consensus team uses stylish-haskell >= 0.11.0.0 to format its code. This is enforced by CI.

Either enable editor integration or run the following command to manually format all of the consensus code (but not the network code):

stylish-haskell -i `git ls-files -- 'ouroboros-consensus*/*.hs' | grep -v Setup.hs`

Alternatively, call the script used by CI itself: https://github.com/input-output-hk/ouroboros-network/blob/master/scripts/buildkite/check-stylish.sh

./scripts/buildkite/check-stylish.sh

When using Nix, you can use the following command, which will build and use the right version of stylish-haskell.

nix-shell --run ./scripts/buildkite/check-stylish.sh