Skip to content

Commit

Permalink
Remove more trace/output/demo related constraints from RunNode (#776)
Browse files Browse the repository at this point in the history
* Remove more trace/output/demo related constraints from RunNode

Whenever a new constraint was needed in `cardano-node` to trace something, it
was added as a super-class constraint of `RunDemo`, which required updating
the `ouroboros-network` package.

A better approach:

In `cardano-node/Cardano/Node/CLI.hs` in `cardano-node`:

```
type DemoTracing blk =
    ( Condense blk
    , Condense [blk]
    , Condense (ChainHash blk)
    , Condense (Header blk)
    , Condense (HeaderHash blk)
    , Condense (GenTx blk)
    )

data SomeProtocol where
  SomeProtocol :: ( RunDemo blk
                  , DemoTracing blk
                  )
               => Consensus.Protocol blk -> SomeProtocol
```

Add `DemoTracing blk` to `app/Run.hs`:

```
handleSimpleNode :: forall blk. (RunDemo blk, DemoTracing blk)
..
```

Now, whenever you need an additional constraint for tracing/demo purposes,
just add it to `DemoTracing`. No changes to the consensus package will be
needed, unless the constraint is not satisfied for a block type.

* Remove left-over Ouroboros.Consensus.Demo.Ledger.Mock

This should have been removed in #727.
  • Loading branch information
mrBliss authored and nc6 committed Jul 16, 2019
1 parent 71f4a22 commit b836fea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 67 deletions.
61 changes: 0 additions & 61 deletions ouroboros-consensus/src/Ouroboros/Consensus/Demo/Ledger/Mock.hs

This file was deleted.

Expand Up @@ -26,12 +26,7 @@ import Ouroboros.Consensus.Protocol.Abstract

import Ouroboros.Storage.Common (EpochNo, EpochSize)

class ( ProtocolLedgerView blk
, ApplyTx blk
, Show blk
, Show (ApplyTxErr blk)
, Show (GenTx blk)
) => RunNode blk where
class (ProtocolLedgerView blk, ApplyTx blk) => RunNode blk where

nodeForgeBlock :: (HasNodeState (BlockProtocol blk) m, MonadRandom m)
=> NodeConfig (BlockProtocol blk)
Expand Down

0 comments on commit b836fea

Please sign in to comment.