Skip to content

Commit

Permalink
Merge pull request #15 from input-output-hk/rvl/update-stack-snapshot
Browse files Browse the repository at this point in the history
Update to cardano-node 1.14.2 stack snapshot
  • Loading branch information
KtorZ committed Jul 1, 2020
2 parents 76b58ce + 8a0438c commit a68107c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: 💽 Install OS Packages
uses: mstksg/get-package@v1
with:
apt-get: libgmp-dev
apt-get: libgmp-dev libsodium-dev

- name: 📥 Checkout repository
uses: actions/checkout@v1
Expand Down
8 changes: 5 additions & 3 deletions src/Data/UTxO/Transaction/Cardano/Byron.hs
Expand Up @@ -6,6 +6,7 @@
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_HADDOCK prune #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} -- needed for {#- HLINT ... #-}

module Data.UTxO.Transaction.Cardano.Byron
(
Expand Down Expand Up @@ -39,7 +40,7 @@ import Cardano.Chain.Common
import Cardano.Chain.UTxO
( TxIn (..), TxInWitness (..), TxOut (..), TxSigData (..), mkTxAux )
import Cardano.Crypto.Hashing
( AbstractHash (..), hash )
( abstractHashFromDigest, serializeCborHash )
import Cardano.Crypto.ProtocolMagic
( ProtocolMagicId (..) )
import Cardano.Crypto.Signing
Expand Down Expand Up @@ -131,7 +132,7 @@ mkInput
-> Maybe (Input Byron)
mkInput ix bytes =
case digestFromByteString @Blake2b_256 bytes of
Just txId -> Just $ TxInUtxo (AbstractHash txId) ix
Just txId -> Just $ TxInUtxo (abstractHashFromDigest txId) ix
Nothing -> Nothing

-- | Construct a payment 'Output' for /Byron/ from primitive types.
Expand Down Expand Up @@ -247,7 +248,7 @@ instance MkPayment Byron where
lock (pm, inps, outs) =
Right (pm, neInps, neOuts, sigData, mempty)
where
sigData = TxSigData $ hash $ CC.UnsafeTx neInps neOuts (mkAttributes ())
sigData = TxSigData $ serializeCborHash $ CC.UnsafeTx neInps neOuts (mkAttributes ())
neInps = NE.fromList $ reverse inps
neOuts = NE.fromList $ reverse outs

Expand Down Expand Up @@ -322,6 +323,7 @@ encodeTx (Right (pm, inps, outs, sigData, wits)) = mconcat
, CBOR.encodeBreak
]

{-# HLINT ignore decodeTx "Redundant fmap" #-}
-- __Internal__: Decode a 'Tx Byron' from CBOR.
decodeTx :: CBOR.Decoder s (Tx Byron)
decodeTx = do
Expand Down
8 changes: 7 additions & 1 deletion stack.yaml
@@ -1,4 +1,4 @@
resolver: https://raw.githubusercontent.com/input-output-hk/cardano-haskell/master/snapshots/cardano-1.9.3.yaml
resolver: https://raw.githubusercontent.com/input-output-hk/cardano-haskell/633f6141c3e7211dbb0c6ae6ad50d4976313e190/snapshots/cardano-1.14.2.yaml

# Generate files required by Weeder.
# See https://github.com/ndmitchell/weeder/issues/53
Expand All @@ -9,3 +9,9 @@ packages:

extra-deps:
- hedgehog-quickcheck-0.1.1

flags:
# Bundle VRF crypto in libsodium and do not rely on an external fork to have it.
# This still requires the host system to have the 'standard' libsodium installed.
cardano-crypto-praos:
external-libsodium-vrf: false
6 changes: 3 additions & 3 deletions test/Data/UTxO/Transaction/Cardano/ByronSpec.hs
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

{-# OPTIONS_GHC -fno-warn-orphans #-}

Expand Down Expand Up @@ -328,9 +329,8 @@ instance {-# OVERLAPS #-}
arbitrary = do
pm <- arbitrary
wits <- listOf (hedgehog $ genTxInWitness pm)
(,,,,)
<$> pure pm
<*> fmap (NE.fromList . getNonEmpty) arbitrary
(pm,,,,)
<$> fmap (NE.fromList . getNonEmpty) arbitrary
<*> fmap (NE.fromList . getNonEmpty) arbitrary
<*> arbitrary
<*> pure wits
Expand Down

0 comments on commit a68107c

Please sign in to comment.