Skip to content

Commit

Permalink
Update ouroboros-network dependency
Browse files Browse the repository at this point in the history
After IntersectMBO/ouroboros-network#1657

Co-authored-by: Karl Knutsson <karl.knutsson@iohk.io>
  • Loading branch information
2 people authored and intricate committed Feb 26, 2020
1 parent 65bef97 commit 4fe75fd
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 188 deletions.
63 changes: 45 additions & 18 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ package cardano-config
package cardano-node
ghc-options: -Wall -fwarn-redundant-constraints

package ouroboros-consensus-byron
tests: False

package ouroboros-consensus-mock
tests: False

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
Expand Down Expand Up @@ -184,64 +190,85 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-network

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: io-sim

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-network-testing

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-consensus

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-consensus/ouroboros-consensus-mock

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-consensus-byron

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-consensus-cardano

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: typed-protocols

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: typed-protocols-examples

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: ouroboros-network-framework

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: network-mux

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 5f77e24c2263560ad58b9ba092c8cfed174675ae
--sha256: 00bm1fa83lc6jgh36mwr4zymzg9hvmq68y2hm4klk8c8gn7vwqqb
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
subdir: io-sim-classes

source-repository-package
Expand Down
2 changes: 2 additions & 0 deletions cardano-config/cardano-config.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ library
, network
, optparse-applicative
, ouroboros-consensus
, ouroboros-consensus-byron
, ouroboros-consensus-cardano
, ouroboros-network
, process
, iproute
Expand Down
59 changes: 27 additions & 32 deletions cardano-config/src/Cardano/Config/Protocol.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wno-all-missed-specialisations #-}
Expand All @@ -16,15 +16,13 @@ module Cardano.Config.Protocol
, TraceConstraints
) where



import Cardano.Prelude
import Test.Cardano.Prelude (canonicalDecodePretty)

import Codec.CBOR.Read (deserialiseFromBytes, DeserialiseFailure)
import Codec.CBOR.Read (DeserialiseFailure, deserialiseFromBytes)
import Control.Monad.Trans.Except (ExceptT)
import Control.Monad.Trans.Except.Extra ( bimapExceptT, firstExceptT
, hoistEither, left)
import Control.Monad.Trans.Except.Extra (bimapExceptT, firstExceptT,
hoistEither, left)
import qualified Data.ByteString.Lazy as LB

import qualified Cardano.Chain.Genesis as Genesis
Expand All @@ -33,31 +31,28 @@ import Cardano.Crypto (RequiresNetworkMagic, decodeHash)
import qualified Cardano.Crypto.Signing as Signing

import Ouroboros.Consensus.Block (Header)
import Ouroboros.Consensus.BlockchainTime
(SlotLength, slotLengthFromSec,
SlotLengths, singletonSlotLengths)
import Ouroboros.Consensus.BlockchainTime (SlotLength, SlotLengths,
singletonSlotLengths,
slotLengthFromSec)
import Ouroboros.Consensus.Cardano hiding (Protocol)
import qualified Ouroboros.Consensus.Cardano as Consensus
import Ouroboros.Consensus.Mempool.API (ApplyTxErr, GenTx, GenTxId,
HasTxId, TxId)
import Ouroboros.Consensus.Node.ProtocolInfo (NumCoreNodes (..),
PBftLeaderCredentials,
PBftLeaderCredentialsError,
PBftSignatureThreshold(..),
mkPBftLeaderCredentials)
import Ouroboros.Consensus.NodeId (CoreNodeId (..), NodeId (..))
import Ouroboros.Consensus.Node.ProtocolInfo (NumCoreNodes (..))

import Ouroboros.Consensus.Byron.Ledger (ByronBlock)
import Ouroboros.Consensus.Node.Run (RunNode)
import Ouroboros.Consensus.Protocol (SecurityParam (..),
PraosParams (..),
PBftParams (..))
import qualified Ouroboros.Consensus.Protocol as Consensus
import qualified Ouroboros.Consensus.Ledger.Byron as Consensus
import Ouroboros.Consensus.Util (Dict(..))
import Ouroboros.Consensus.NodeId (CoreNodeId (..), NodeId (..))
import Ouroboros.Consensus.Protocol.Abstract (SecurityParam (..))
import Ouroboros.Consensus.Util (Dict (..))
import Ouroboros.Consensus.Util.Condense
import Ouroboros.Network.Block
import Ouroboros.Network.Block (HeaderHash)

import Cardano.Config.Types
(DelegationCertFile (..), GenesisFile (..),
LastKnownBlockVersion (..), Update (..),
Protocol (..), SigningKeyFile (..))
import Cardano.Config.Types (DelegationCertFile (..),
GenesisFile (..),
LastKnownBlockVersion (..),
Protocol (..), SigningKeyFile (..),
Update (..))

-- TODO: consider not throwing this, or wrap it in a local error type here
-- that has proper error messages.
Expand Down Expand Up @@ -194,7 +189,7 @@ protocolConfigRealPbft :: Update
-> Maybe Double
-> Genesis.Config
-> Maybe PBftLeaderCredentials
-> Consensus.Protocol Consensus.ByronBlock
-> Consensus.Protocol ByronBlock
protocolConfigRealPbft (Update appName appVer lastKnownBlockVersion)
pbftSignatureThresh
genesis leaderCredentials =
Expand Down Expand Up @@ -247,6 +242,6 @@ extractNodeInfo mNodeId ncNumCoreNodes = do

coreNodeId <- case mNodeId of
Just (CoreId coreNodeId) -> pure coreNodeId
_ -> Left MissingCoreNodeId
_ -> Left MissingCoreNodeId
numCoreNodes <- maybe (Left MissingNumCoreNodes) Right ncNumCoreNodes
return (coreNodeId , NumCoreNodes numCoreNodes)
2 changes: 2 additions & 0 deletions cardano-config/src/Cardano/Config/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ instance FromJSON NodeConfiguration where
<*> v .:? "TraceDNSResolver" .!= False
<*> v .:? "TraceDNSSubscription" .!= True
<*> v .:? "TraceErrorPolicy" .!= True
<*> v .:? "TraceLocalErrorPolicy" .!= True
<*> v .:? "TraceForge" .!= True
<*> v .:? "TraceIpSubscription" .!= True
<*> v .:? "TraceLocalChainSyncProtocol" .!= False
Expand Down Expand Up @@ -277,6 +278,7 @@ data TraceOptions = TraceOptions
, traceDnsResolver :: !Bool
, traceDnsSubscription :: !Bool
, traceErrorPolicy :: !Bool
, traceLocalErrorPolicy :: !Bool
, traceForge :: !Bool
, traceIpSubscription :: !Bool
, traceLocalChainSyncProtocol :: !Bool
Expand Down
3 changes: 2 additions & 1 deletion cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ library
Cardano.CLI.Tx
Cardano.Common.Help
Cardano.Common.LocalSocket
Cardano.Common.Orphans
Cardano.Common.Parsers
Cardano.Common.TopHandler
Cardano.Node.Features.Node
Expand Down Expand Up @@ -90,6 +89,8 @@ library
, network-mux
, optparse-applicative
, ouroboros-consensus
, ouroboros-consensus-byron
, ouroboros-consensus-cardano
, ouroboros-network
, safe-exceptions
, serialise
Expand Down
16 changes: 7 additions & 9 deletions cardano-node/src/Cardano/CLI/Benchmarking/Tx/Generation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,14 @@ import Control.Tracer (Tracer, traceWith)

import Ouroboros.Consensus.Node.Run (RunNode)
import Ouroboros.Consensus.Block(BlockProtocol)
import Ouroboros.Consensus.Ledger.Byron.Config (pbftProtocolMagic)
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo (..),
protocolInfo)
import qualified Ouroboros.Consensus.Protocol as Consensus
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo (..))
import qualified Ouroboros.Consensus.Cardano as Consensus
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Ledger.Byron (ByronBlock (..),
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..),
GenTx (..),
ByronConsensusProtocol)
ByronConsensusProtocol,
getGenesisConfig)
import Ouroboros.Consensus.Protocol.Abstract (NodeConfig)
import Ouroboros.Consensus.Protocol.ExtConfig (extNodeConfig)

newtype NumberOfTxs =
NumberOfTxs Word64
Expand Down Expand Up @@ -190,7 +188,7 @@ genesisBenchmarkRunner loggingLayer
liftIO . traceWith benchTracer . TraceBenchTxSubDebug
$ "******* Tx generator, genesis UTxO is ready *******"

let ProtocolInfo{pInfoConfig} = protocolInfo protocol
let ProtocolInfo{pInfoConfig} = Consensus.protocolInfo protocol
genesisAddress = mkAddressForKey pInfoConfig genesisKey
sourceAddress = mkAddressForKey pInfoConfig sourceKey
recipientAddress = mkAddressForKey pInfoConfig recepientKey
Expand Down Expand Up @@ -599,7 +597,7 @@ createTxAux config tx signingKey = CC.UTxO.annotateTxAux $ CC.UTxO.mkTxAux tx wi
CC.UTxO.VKWitness
(Crypto.toVerification signingKey)
(Crypto.sign
(Crypto.getProtocolMagicId . pbftProtocolMagic . extNodeConfig $ config)
(CC.Genesis.configProtocolMagicId (getGenesisConfig config))
-- provide ProtocolMagicId so as not to calculate it every time
Crypto.SignTx
signingKey
Expand Down
17 changes: 10 additions & 7 deletions cardano-node/src/Cardano/CLI/Benchmarking/Tx/NodeToNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import Data.Proxy (Proxy (..))
import qualified Data.Text as T
import Data.Time.Clock (getCurrentTime)
import Network.Mux (AppType(InitiatorApp), WithMuxBearer (..))
import Network.Socket (AddrInfo)
import Network.Socket (AddrInfo (..))
import Network.TypedProtocol.Codec (AnyMessage (..))
import Network.TypedProtocol.Driver (TraceSendRecv (..), runPeer)

Expand All @@ -42,7 +42,7 @@ import Cardano.BM.Data.Tracer (DefinePrivacyAnnotation (..),
TracingVerbosity (..), Transformable (..),
emptyObject, mkObject, trStructured)
import Ouroboros.Consensus.Block (BlockProtocol)
import Ouroboros.Consensus.Ledger.Byron (ByronBlock (..))
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..))
import Ouroboros.Consensus.Mempool.API (GenTxId, GenTx)
import Ouroboros.Consensus.Node.NetworkProtocolVersion
import Ouroboros.Consensus.Node.Run (RunNode, nodeNetworkMagic)
Expand All @@ -57,9 +57,11 @@ import Ouroboros.Network.Protocol.Handshake.Type (Handshake)
import Ouroboros.Network.Protocol.Handshake.Version (Versions, simpleSingletonVersions)
import Ouroboros.Network.Protocol.TxSubmission.Client (TxSubmissionClient, txSubmissionClientPeer)
import qualified Ouroboros.Network.Protocol.TxSubmission.Type as TS
import Ouroboros.Network.Snocket (socketSnocket)
import Ouroboros.Network.IOManager (withIOManager)

type SendRecvConnect = WithMuxBearer
NtN.ConnectionId
NtN.RemoteConnectionId
(TraceSendRecv (Handshake
NtN.NodeToNodeVersion
CBOR.Term))
Expand Down Expand Up @@ -201,15 +203,16 @@ benchmarkConnectTxSubmit
-> TxSubmissionClient (GenTxId blk) (GenTx blk) m ()
-- ^ the particular txSubmission peer
-> m ()
benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = do
benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = withIOManager $ \iocp -> do
NtN.connectTo
(socketSnocket iocp)
NetworkConnectTracers {
nctMuxTracer = nullTracer,
nctHandshakeTracer = trSendRecvConnect trs
}
peerMultiplex
localAddr
remoteAddr
(addrAddress <$> localAddr)
(addrAddress remoteAddr)
where
myCodecs :: ProtocolCodecs blk DeserialiseFailure m
ByteString ByteString ByteString ByteString ByteString
Expand All @@ -219,7 +222,7 @@ benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = do
peerMultiplex :: Versions NtN.NodeToNodeVersion NtN.DictVersion
(OuroborosApplication
'InitiatorApp
NtN.ConnectionId
NtN.RemoteConnectionId
NtN.NodeToNodeProtocols
m
ByteString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import Cardano.BM.Data.Tracer (DefinePrivacyAnnotation (..),
emptyObject, mkObject, nullTracer, trStructured)

import Control.Tracer (Tracer, traceWith)
import Ouroboros.Consensus.Ledger.Byron (ByronBlock (..))
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..))
import qualified Ouroboros.Consensus.Mempool as Mempool
import qualified Ouroboros.Network.Protocol.TxSubmission.Type as TxSubmit

Expand Down
4 changes: 2 additions & 2 deletions cardano-node/src/Cardano/CLI/Ops.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ import Control.Tracer (nullTracer, stdoutTracer, traceWith)
import Network.Mux (MuxError)
import Network.TypedProtocol.Driver (runPeer)
import Ouroboros.Consensus.Block (BlockProtocol)
import Ouroboros.Consensus.Ledger.Byron (ByronBlock, GenTx)
import Ouroboros.Consensus.Byron.Ledger (ByronBlock, GenTx)
import qualified Ouroboros.Consensus.Cardano as Consensus
import Ouroboros.Consensus.Mempool.API (ApplyTxErr)
import Ouroboros.Consensus.NodeNetwork (ProtocolCodecs(..), protocolCodecs)
import Ouroboros.Consensus.Node.NetworkProtocolVersion
(NodeToClientVersion, mostRecentNetworkProtocolVersion)
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo(..), protocolInfo)
import Ouroboros.Consensus.Node.Run
(RunNode(..))
import qualified Ouroboros.Consensus.Protocol as Consensus
import Ouroboros.Consensus.Util.Condense (Condense(..))
import Ouroboros.Consensus.Util.IOLike (IOLike)
import Ouroboros.Network.Block
Expand Down
Loading

0 comments on commit 4fe75fd

Please sign in to comment.