Skip to content

Commit

Permalink
WIP: Use protocolMagic from Genesis cfg
Browse files Browse the repository at this point in the history
Breaks backwards compatibility with previous versions where the magic
number was hardcoded to 0.

XXX Uses non-master ourboros-network. Don't merge.
  • Loading branch information
karknu committed Oct 17, 2019
1 parent 12070bf commit 54f7f5f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
12 changes: 6 additions & 6 deletions cabal.project
Expand Up @@ -122,37 +122,37 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: ouroboros-network

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: ouroboros-consensus

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: typed-protocols

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: typed-protocols-cbor

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: network-mux

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 815278131bd5ab070199712e167659c472b466ce
tag: 2c52171fd88c4ca4a63de052f902714e0cac513b
subdir: io-sim-classes

source-repository-package
Expand Down
4 changes: 2 additions & 2 deletions cardano-node/src/Cardano/CLI/Tx/BenchmarkingNodeToNode.hs
Expand Up @@ -29,7 +29,7 @@ import Ouroboros.Consensus.Block (BlockProtocol)
import Ouroboros.Consensus.Mempool.API (GenTxId, GenTx)
import Ouroboros.Consensus.Node.Run (RunNode)
import Ouroboros.Consensus.NodeNetwork (ProtocolCodecs(..), protocolCodecs)
import Ouroboros.Consensus.Protocol.Abstract (NodeConfig)
import Ouroboros.Consensus.Protocol.Abstract (NodeConfig, protocolNetworkMagic)
import Ouroboros.Network.Mux (OuroborosApplication(..))
import qualified Ouroboros.Network.NodeToNode as NtN
import Ouroboros.Network.Protocol.BlockFetch.Client (BlockFetchClient(..), blockFetchClientPeer)
Expand Down Expand Up @@ -84,7 +84,7 @@ benchmarkConnectTxSubmit trs nc localAddr remoteAddr myTxSubClient = do
peerMultiplex =
simpleSingletonVersions
NtN.NodeToNodeV_1
(NtN.NodeToNodeVersionData { NtN.networkMagic = 0})
(NtN.NodeToNodeVersionData { NtN.networkMagic = protocolNetworkMagic nc})
(NtN.DictVersion NtN.nodeToNodeCodecCBORTerm)
$ OuroborosInitiatorApplication $ \peer ptcl ->
case ptcl of
Expand Down
3 changes: 2 additions & 1 deletion cardano-node/src/Cardano/CLI/Tx/Submission.hs
Expand Up @@ -124,7 +124,8 @@ localInitiatorNetworkApplication
localInitiatorNetworkApplication tracer protoInfoConfig tx =
simpleSingletonVersions
NodeToClient.NodeToClientV_1
(NodeToClient.NodeToClientVersionData { NodeToClient.networkMagic = 0 })
(NodeToClient.NodeToClientVersionData
{ NodeToClient.networkMagic = protocolNetworkMagic protoInfoConfig })
(NodeToClient.DictVersion NodeToClient.nodeToClientCodecCBORTerm)

$ OuroborosInitiatorApplication $ \peer ptcl -> case ptcl of
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Chairman.hs
Expand Up @@ -379,7 +379,7 @@ localInitiatorNetworkApplication
localInitiatorNetworkApplication coreNodeId chainsVar securityParam maxBlockNo chairmanTracer chainSyncTracer localTxSubmissionTracer pInfoConfig =
simpleSingletonVersions
NodeToClientV_1
(NodeToClientVersionData { networkMagic = 0 })
(NodeToClientVersionData (protocolNetworkMagic pInfoConfig))
(DictVersion nodeToClientCodecCBORTerm)

$ OuroborosInitiatorApplication $ \peer ptcl -> case ptcl of
Expand Down
5 changes: 1 addition & 4 deletions cardano-node/src/Cardano/Node/Run.hs
Expand Up @@ -49,8 +49,6 @@ import Cardano.Config.Types (CardanoConfiguration (..))
import Cardano.Config.Logging (LoggingLayer (..))

import Ouroboros.Network.Block
import Ouroboros.Network.NodeToClient (NodeToClientVersionData (..))
import Ouroboros.Network.NodeToNode (NodeToNodeVersionData (..))
import Ouroboros.Network.Subscription.Dns

import Ouroboros.Consensus.Node (NodeKernel (getChainDB),
Expand Down Expand Up @@ -209,8 +207,7 @@ handleSimpleNode
, rnaDnsProducers = dnsProducers
, rnaHandshakeTracer = nullTracer
, rnaHandshakeLocalTracer = nullTracer
, rnaNodeToNodeVersionData = NodeToNodeVersionData 1
, rnaNodeToClientVersionData = NodeToClientVersionData 1
, rnaNetworkMagic = Consensus.protocolNetworkMagic cfg
}

producerSubscription :: RemoteAddress -> DnsSubscriptionTarget
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/src/Cardano/Wallet/Client.hs
Expand Up @@ -112,7 +112,7 @@ localInitiatorNetworkApplication
localInitiatorNetworkApplication Proxy chainSyncTracer localTxSubmissionTracer pInfoConfig =
simpleSingletonVersions
NodeToClientV_1
(NodeToClientVersionData { networkMagic = 0 })
(NodeToClientVersionData { networkMagic = protocolNetworkMagic pInfoConfig })
(DictVersion nodeToClientCodecCBORTerm)

$ OuroborosInitiatorApplication $ \peer ptcl -> case ptcl of
Expand Down

0 comments on commit 54f7f5f

Please sign in to comment.