Skip to content

Commit

Permalink
Update the dependency on ouroboros-network again
Browse files Browse the repository at this point in the history
  • Loading branch information
mrBliss committed Feb 27, 2020
1 parent 91cd6ac commit 94b440b
Show file tree
Hide file tree
Showing 14 changed files with 134 additions and 128 deletions.
52 changes: 26 additions & 26 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -190,92 +190,92 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: ouroboros-network

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: io-sim

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: ouroboros-network-testing

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

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

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

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

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

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

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: ouroboros-network-framework

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: network-mux

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: io-sim-classes

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 68ebc7b8c53078629dd57fd579eece12c66576c8
--sha256: 11hsa5b218cbkq0wb7hc9x7m5mp56dlfw4zx4q9i4ymyq82ra69c
tag: 36861a97272de1e4de448925dd9bb9c0fddd80f6
--sha256: 08jb0qj60i5dfsq17dyix3pdv05kg505n9kd7ps9j7dzl1p9pb2y
subdir: Win32-network

source-repository-package
Expand Down
28 changes: 16 additions & 12 deletions cardano-config/src/Cardano/Config/Protocol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import qualified Cardano.Chain.Update as Update
import Cardano.Crypto (RequiresNetworkMagic, decodeHash)
import qualified Cardano.Crypto.Signing as Signing

import Ouroboros.Consensus.Block (Header)
import Ouroboros.Consensus.Block (Header, BlockProtocol)
import Ouroboros.Consensus.BlockchainTime (SlotLength, SlotLengths,
singletonSlotLengths,
slotLengthFromSec)
Expand Down Expand Up @@ -100,7 +100,7 @@ mockSomeProtocol
=> Maybe NodeId
-> Maybe Word64
-- ^ Number of core nodes
-> (CoreNodeId -> NumCoreNodes -> Consensus.Protocol blk)
-> (CoreNodeId -> NumCoreNodes -> Consensus.Protocol blk (BlockProtocol blk))
-> Either ProtocolInstantiationError SomeProtocol
mockSomeProtocol nId mNumCoreNodes mkConsensusProtocol = do
(cid, numCoreNodes) <- extractNodeInfo nId mNumCoreNodes
Expand All @@ -110,7 +110,7 @@ mockSomeProtocol nId mNumCoreNodes mkConsensusProtocol = do

data SomeProtocol where
SomeProtocol :: (RunNode blk, TraceConstraints blk)
=> Consensus.Protocol blk -> SomeProtocol
=> Consensus.Protocol blk (BlockProtocol blk) -> SomeProtocol

data ProtocolInstantiationError =
ByronLegacyProtocolNotImplemented
Expand Down Expand Up @@ -144,21 +144,25 @@ fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ BFT =
Consensus.ProtocolMockBFT numCoreNodes cid mockSecurityParam mockSlotLengths
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ Praos =
hoistEither $ mockSomeProtocol nId mNumCoreNodes $ \cid numCoreNodes ->
Consensus.ProtocolMockPraos numCoreNodes cid PraosParams {
praosSecurityParam = mockSecurityParam
, praosSlotsPerEpoch = 3
, praosLeaderF = 0.5
, praosLifetimeKES = 1000000
, praosSlotLength = slotLengthFromSec 2
}
Consensus.ProtocolMockPraos
numCoreNodes
cid
PraosParams {
praosSecurityParam = mockSecurityParam
, praosSlotsPerEpoch = 3
, praosLeaderF = 0.5
, praosLifetimeKES = 1000000
}
(singletonSlotLengths (slotLengthFromSec 2))
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ MockPBFT =
hoistEither $ mockSomeProtocol nId mNumCoreNodes $ \cid numCoreNodes@(NumCoreNodes numNodes) ->
Consensus.ProtocolMockPBFT
PBftParams { pbftSecurityParam = mockSecurityParam
, pbftNumNodes = numCoreNodes
, pbftSignatureThreshold = (1.0 / fromIntegral numNodes) + 0.1
, pbftSlotLength = mockSlotLength

}
(singletonSlotLengths mockSlotLength)
cid
fromProtocol gHash _ _ mGenFile nMagic sigThresh delCertFp sKeyFp update RealPBFT = do
let genHash = either panic identity $ decodeHash gHash
Expand Down Expand Up @@ -189,7 +193,7 @@ protocolConfigRealPbft :: Update
-> Maybe Double
-> Genesis.Config
-> Maybe PBftLeaderCredentials
-> Consensus.Protocol ByronBlock
-> Consensus.Protocol ByronBlock ProtocolRealPBFT
protocolConfigRealPbft (Update appName appVer lastKnownBlockVersion)
pbftSignatureThresh
genesis leaderCredentials =
Expand Down
28 changes: 13 additions & 15 deletions cardano-node/src/Cardano/CLI/Benchmarking/Tx/Generation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ import Control.Tracer (Tracer, traceWith)
import Ouroboros.Network.NodeToClient (AssociateWithIOCP)

import Ouroboros.Consensus.Node.Run (RunNode)
import Ouroboros.Consensus.Block(BlockProtocol)
import Ouroboros.Consensus.Node.ProtocolInfo (ProtocolInfo (..))
import qualified Ouroboros.Consensus.Cardano as Consensus
import Ouroboros.Consensus.Config (TopLevelConfig (configBlock))
import qualified Ouroboros.Consensus.Mempool as Mempool
import Ouroboros.Consensus.Byron.Ledger (ByronBlock (..),
GenTx (..),
ByronConsensusProtocol,
getGenesisConfig)
import Ouroboros.Consensus.Protocol.Abstract (NodeConfig)
byronProtocolMagicId)

newtype NumberOfTxs =
NumberOfTxs Word64
Expand Down Expand Up @@ -147,7 +145,7 @@ genesisBenchmarkRunner
:: LoggingLayer
-> AssociateWithIOCP
-> SocketPath
-> Consensus.Protocol ByronBlock
-> Consensus.Protocol ByronBlock Consensus.ProtocolRealPBFT
-> NonEmpty NodeAddress
-> NumberOfTxs
-> NumberOfInputsPerTx
Expand Down Expand Up @@ -326,7 +324,7 @@ prepareSigningKeys skeys = do
pure . map (Crypto.SigningKey . snd) $ rights desKeys

mkAddressForKey
:: NodeConfig ByronConsensusProtocol
:: TopLevelConfig ByronBlock
-> Crypto.SigningKey
-> CC.Common.Address
mkAddressForKey _pInfoConfig =
Expand Down Expand Up @@ -398,7 +396,7 @@ prepareInitialFunds
-> AssociateWithIOCP
-> SocketPath
-> CC.Genesis.Config
-> NodeConfig ByronConsensusProtocol
-> TopLevelConfig ByronBlock
-> Map Int ((CC.UTxO.TxIn, CC.UTxO.TxOut), Crypto.SigningKey)
-> CC.Common.Address
-> CC.Common.Address
Expand Down Expand Up @@ -466,7 +464,7 @@ getTxIdFromGenTx _ = panic "Impossible happened: generated transaction is not a
-- | One or more inputs -> one or more outputs.
mkTransaction
:: (FiscalRecipient r)
=> NodeConfig ByronConsensusProtocol
=> TopLevelConfig ByronBlock
-> NonEmpty (TxDetails, Crypto.SigningKey)
-- ^ Non-empty list of (TxIn, TxOut) that will be used as
-- inputs and the key to spend the associated value
Expand Down Expand Up @@ -595,7 +593,7 @@ appendr l nel = foldr NE.cons nel l

-- | ...
createTxAux
:: NodeConfig ByronConsensusProtocol
:: TopLevelConfig ByronBlock
-> CC.UTxO.Tx
-> Crypto.SigningKey
-> CC.UTxO.ATxAux ByteString
Expand All @@ -605,7 +603,7 @@ createTxAux config tx signingKey = CC.UTxO.annotateTxAux $ CC.UTxO.mkTxAux tx wi
CC.UTxO.VKWitness
(Crypto.toVerification signingKey)
(Crypto.sign
(CC.Genesis.configProtocolMagicId (getGenesisConfig config))
(byronProtocolMagicId (configBlock config))
-- provide ProtocolMagicId so as not to calculate it every time
Crypto.SignTx
signingKey
Expand Down Expand Up @@ -643,7 +641,7 @@ runBenchmark
-> Tracer IO TraceLowLevelSubmit
-> AssociateWithIOCP
-> SocketPath
-> NodeConfig ByronConsensusProtocol
-> TopLevelConfig ByronBlock
-> Crypto.SigningKey
-> CC.Common.Address
-> NonEmpty NodeAddress
Expand Down Expand Up @@ -838,7 +836,7 @@ createMoreFundCoins
-> Tracer IO TraceLowLevelSubmit
-> AssociateWithIOCP
-> SocketPath
-> NodeConfig ByronConsensusProtocol
-> TopLevelConfig ByronBlock
-> Crypto.SigningKey
-> FeePerTx
-> NumberOfTxs
Expand Down Expand Up @@ -912,7 +910,7 @@ createMoreFundCoins benchTracer
where
-- create txs which split the funds to numTxOuts equal parts
createSplittingTxs
:: NodeConfig ByronConsensusProtocol
:: TopLevelConfig ByronBlock
-> (TxDetails, Crypto.SigningKey)
-> Word64
-> Word64
Expand Down Expand Up @@ -985,7 +983,7 @@ minimalTPSRate (TPSRate tps) = picosecondsToDiffTime timeInPicoSecs

txGenerator
:: Tracer IO (TraceBenchTxSubmit (Mempool.GenTxId ByronBlock))
-> NodeConfig ByronConsensusProtocol
-> TopLevelConfig ByronBlock
-> CC.Common.Address
-> Crypto.SigningKey
-> FeePerTx
Expand Down Expand Up @@ -1179,7 +1177,7 @@ launchTxPeer
-- ^ associate a file descriptor with IO completion port
-> MSTM.TVar m Bool
-- a "global" stop variable, set to True to force shutdown
-> NodeConfig (Ouroboros.Consensus.Block.BlockProtocol block)
-> TopLevelConfig block
-- the configuration
-> Maybe Network.Socket.AddrInfo
-- local address binding (if wanted)
Expand Down
11 changes: 5 additions & 6 deletions cardano-node/src/Cardano/CLI/Benchmarking/Tx/NodeToNode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ import Cardano.BM.Data.Tracer (DefinePrivacyAnnotation (..),
DefineSeverity (..), ToObject (..), TracingFormatting (..),
TracingVerbosity (..), Transformable (..),
emptyObject, mkObject, trStructured)
import Ouroboros.Consensus.Block (BlockProtocol)
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)
import Ouroboros.Consensus.NodeNetwork (ProtocolCodecs(..), protocolCodecs)
import Ouroboros.Consensus.Protocol.Abstract (NodeConfig)
import Ouroboros.Consensus.Config (TopLevelConfig)
import Ouroboros.Network.Mux (OuroborosApplication(..))
import Ouroboros.Network.NodeToNode (NetworkConnectTracers (..))
import qualified Ouroboros.Network.NodeToNode as NtN
Expand Down Expand Up @@ -197,7 +196,7 @@ benchmarkConnectTxSubmit
=> AssociateWithIOCP
-> BenchmarkTxSubmitTracers m blk
-- ^ For tracing the send/receive actions
-> NodeConfig (BlockProtocol blk)
-> TopLevelConfig blk
-- ^ The particular block protocol
-> Maybe AddrInfo
-- ^ local address information (typically local interface/port to use)
Expand All @@ -206,7 +205,7 @@ benchmarkConnectTxSubmit
-> TxSubmissionClient (GenTxId blk) (GenTx blk) m ()
-- ^ the particular txSubmission peer
-> m ()
benchmarkConnectTxSubmit iocp trs nc localAddr remoteAddr myTxSubClient = do
benchmarkConnectTxSubmit iocp trs cfg localAddr remoteAddr myTxSubClient = do
NtN.connectTo
(socketSnocket iocp)
NetworkConnectTracers {
Expand All @@ -220,7 +219,7 @@ benchmarkConnectTxSubmit iocp trs nc localAddr remoteAddr myTxSubClient = do
myCodecs :: ProtocolCodecs blk DeserialiseFailure m
ByteString ByteString ByteString ByteString ByteString
ByteString ByteString ByteString
myCodecs = protocolCodecs nc (mostRecentNetworkProtocolVersion (Proxy @blk))
myCodecs = protocolCodecs cfg (mostRecentNetworkProtocolVersion (Proxy @blk))

peerMultiplex :: Versions NtN.NodeToNodeVersion NtN.DictVersion
(OuroborosApplication
Expand All @@ -234,7 +233,7 @@ benchmarkConnectTxSubmit iocp trs nc localAddr remoteAddr myTxSubClient = do
peerMultiplex =
simpleSingletonVersions
NtN.NodeToNodeV_1
(NtN.NodeToNodeVersionData { NtN.networkMagic = nodeNetworkMagic (Proxy @blk) nc})
(NtN.NodeToNodeVersionData { NtN.networkMagic = nodeNetworkMagic (Proxy @blk) cfg})
(NtN.DictVersion NtN.nodeToNodeCodecCBORTerm)
$ OuroborosInitiatorApplication $ \_peer ptcl ->
case ptcl of
Expand Down
Loading

0 comments on commit 94b440b

Please sign in to comment.