Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Large changes in network, consensus and ledger-specs required
significant code changes throughout.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: Luke Nadur <19835357+intricate@users.noreply.github.com>
  • Loading branch information
3 people committed May 28, 2020
1 parent 3caac21 commit e6bb375
Show file tree
Hide file tree
Showing 30 changed files with 270 additions and 187 deletions.
126 changes: 70 additions & 56 deletions cabal.project
Expand Up @@ -110,29 +110,29 @@ package cardano-ledger
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 9b82346b78e212fcd3e795faf9dd7f3266ab7297
--sha256: 04iv32x233bck4xd34x2g0yaxj438f57d3z6m0pvvzj2yca1slxm
tag: 8061c5dd00f7aad134b18a4e6818879641f8589f
--sha256: 182a2x16mh7gqjfkyrc4vgindxwwlr0i8vhmqyfbmnnvg6m8bzaq
subdir: binary

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 9b82346b78e212fcd3e795faf9dd7f3266ab7297
--sha256: 04iv32x233bck4xd34x2g0yaxj438f57d3z6m0pvvzj2yca1slxm
tag: 8061c5dd00f7aad134b18a4e6818879641f8589f
--sha256: 182a2x16mh7gqjfkyrc4vgindxwwlr0i8vhmqyfbmnnvg6m8bzaq
subdir: binary/test

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 9b82346b78e212fcd3e795faf9dd7f3266ab7297
--sha256: 04iv32x233bck4xd34x2g0yaxj438f57d3z6m0pvvzj2yca1slxm
tag: 8061c5dd00f7aad134b18a4e6818879641f8589f
--sha256: 182a2x16mh7gqjfkyrc4vgindxwwlr0i8vhmqyfbmnnvg6m8bzaq
subdir: cardano-crypto-class

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-base
tag: 9b82346b78e212fcd3e795faf9dd7f3266ab7297
--sha256: 04iv32x233bck4xd34x2g0yaxj438f57d3z6m0pvvzj2yca1slxm
tag: 8061c5dd00f7aad134b18a4e6818879641f8589f
--sha256: 182a2x16mh7gqjfkyrc4vgindxwwlr0i8vhmqyfbmnnvg6m8bzaq
subdir: slotting

source-repository-package
Expand All @@ -144,71 +144,71 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/ledger/impl

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/crypto

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/ledger/impl/test

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/crypto/test

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/chain/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: byron/ledger/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: semantics/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: shelley/chain-and-ledger/dependencies/non-integer

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: shelley/chain-and-ledger/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: b687fa55369f480cb134c007e534662bef961cea
--sha256: 1bwbrj22a0nmsw990ac8k4ffz4xdazfb85dyl3lv3pa5yp3svw1j
tag: 37ea0bb59ff2cc7f6690240f8c4d55e15cd30f2c
--sha256: 1f9idm15yzdlpl9akzy9mkpalw7naz5p4yw16l9835jbdyqxw3sc
subdir: shelley/chain-and-ledger/executable-spec/test

source-repository-package
Expand Down Expand Up @@ -302,99 +302,113 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-network

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: io-sim

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-network-testing

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus/ouroboros-consensus-test-infra

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus/ouroboros-consensus-mock

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus-byron

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus-shelley

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus-shelley-test

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-consensus-cardano

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: typed-protocols

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: typed-protocols-examples

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: ouroboros-network-framework

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: network-mux

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: io-sim-classes

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 9d9754c9ddcfff82b27c371a545aa4680d86d996
--sha256: 18ws841jn6hhmm3pqd22lmy20cgnp430dk3s07jzw3d5bpf3i34v
tag: 0143c516f860a2c790911bc4cc177569d7d04710
--sha256: 0608rashhvybqd1h6fjq9bvnzbyywhxbjxxr9h55m5fjp7i2v3sz
subdir: Win32-network

source-repository-package
Expand Down
22 changes: 13 additions & 9 deletions cardano-api/src/Cardano/Api.hs
Expand Up @@ -27,6 +27,7 @@ module Cardano.Api
, NetworkMagic (..)
, toNetworkMagic
, toByronNetworkMagic
, toShelleyNetwork

-- * Transactions
, TxSigned (..)
Expand Down Expand Up @@ -298,12 +299,13 @@ byronVerificationKeyAddress vkey nw =
PaymentVerificationKeyShelley _ -> panic "Cardano.Api.byronVerificationKeyAddress: VerificationKeyInfoShelley"

shelleyVerificationKeyAddress
:: PaymentVerificationKey
:: Network
-> PaymentVerificationKey
-> Maybe StakingVerificationKey
-> Address
shelleyVerificationKeyAddress (PaymentVerificationKeyByron _) _ =
shelleyVerificationKeyAddress _ (PaymentVerificationKeyByron _) _ =
panic "Cardano.Api.shelleyVerificationKeyAddress: PaymentVerificationKeyByron"
shelleyVerificationKeyAddress (PaymentVerificationKeyShelley payVKey) mbStkVKey = do
shelleyVerificationKeyAddress nw (PaymentVerificationKeyShelley payVKey) mbStkVKey = do
case mbStkVKey of
-- Build a Shelley base address.
Just (StakingVerificationKeyShelley stkVKey) -> do
Expand All @@ -312,22 +314,23 @@ shelleyVerificationKeyAddress (PaymentVerificationKeyShelley payVKey) mbStkVKey
-- is all we have here
let paymentCredential = Shelley.KeyHashObj $ Shelley.hashKey payVKey
stakingCredential = Shelley.StakeRefBase . Shelley.KeyHashObj $ Shelley.hashKey stkVKey
AddressShelley $ Shelley.Addr paymentCredential stakingCredential
AddressShelley $ Shelley.Addr (toShelleyNetwork nw) paymentCredential stakingCredential

-- Build a Shelley enterprise address.
Nothing ->
AddressShelley $
-- TODO: we cannot use toAddr or toCred here because they unnecessarily
-- require a full key pair, when only the pub key is needed, and that
-- is all we have here
Shelley.Addr (Shelley.KeyHashObj (Shelley.hashKey payVKey))
Shelley.Addr (toShelleyNetwork nw)
(Shelley.KeyHashObj (Shelley.hashKey payVKey))
Shelley.StakeRefNull

-- | Shelley reward accounts are not UTxO addresses so they are handled differently.
shelleyVerificationKeyRewardAddress :: StakingVerificationKey -> ShelleyRewardAccount
shelleyVerificationKeyRewardAddress (StakingVerificationKeyShelley stkVKey) = do
shelleyVerificationKeyRewardAddress :: Network -> StakingVerificationKey -> ShelleyRewardAccount
shelleyVerificationKeyRewardAddress nw (StakingVerificationKeyShelley stkVKey) = do
let stakingCredential = Shelley.KeyHashObj $ Shelley.hashKey stkVKey
Shelley.mkRwdAcnt stakingCredential
Shelley.mkRwdAcnt (toShelleyNetwork nw) stakingCredential

getGenesisVerificationKey :: SigningKey -> GenesisVerificationKey
getGenesisVerificationKey kp =
Expand Down Expand Up @@ -455,7 +458,7 @@ buildDummyShelleyTxForFeeCalc txInCount txOutCount ttl network skeys certs =
(headMay skeys)

addr :: Address
addr = shelleyVerificationKeyAddress vkey Nothing
addr = shelleyVerificationKeyAddress network vkey Nothing

txIns :: [TxIn]
txIns = map (mkTxIn . mkTxId) [0..txInCount - 1]
Expand Down Expand Up @@ -624,3 +627,4 @@ getTxUnsignedBody txu =
-- or separate accessor functions
-- the txid should be cached, it might be already. There was a ticket about doing that in the ledger
-- so consensus doesn’t have to do it elsewhere

8 changes: 4 additions & 4 deletions cardano-api/src/Cardano/Api/LocalChainSync.hs
Expand Up @@ -23,7 +23,7 @@ import Control.Tracer (nullTracer)

import Network.Mux (MuxError)

import Ouroboros.Consensus.Block (CodecConfig)
import Ouroboros.Consensus.Cardano (CodecConfig)
import Ouroboros.Consensus.Network.NodeToClient
(Codecs'(..), defaultCodecs)
import Ouroboros.Consensus.Node.NetworkProtocolVersion
Expand All @@ -36,7 +36,7 @@ import Ouroboros.Network.Mux
(AppType(InitiatorApp), OuroborosApplication(..),
MuxPeer(..), RunMiniProtocol(..))
import Ouroboros.Network.NodeToClient
(IOManager, LocalConnectionId, NetworkConnectTracers(..),
(IOManager, LocalAddress, NetworkConnectTracers(..),
NodeToClientProtocols(..), NodeToClientVersionData(..),
NodeToClientVersion, connectTo, localSnocket,
localStateQueryPeerNull, localTxSubmissionPeerNull,
Expand Down Expand Up @@ -90,14 +90,14 @@ localInitiatorNetworkApplication
-> Network
-> StrictTMVar m (Tip blk)
-> Versions NodeToClientVersion DictVersion
(LocalConnectionId -> OuroborosApplication 'InitiatorApp LBS.ByteString m () Void)
(OuroborosApplication 'InitiatorApp LocalAddress LBS.ByteString m () Void)
localInitiatorNetworkApplication cfg nm tipVar =
foldMapVersions
(\v ->
versionedNodeToClientProtocols
(nodeToClientProtocolVersion proxy v)
versionData
(protocols v))
(const $ protocols v))
(supportedNodeToClientVersions proxy)
where
proxy :: Proxy blk
Expand Down

0 comments on commit e6bb375

Please sign in to comment.