Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
Update dependencies and Hackage index-state
Browse files Browse the repository at this point in the history
The dependency update was needed in db-sync.
Biggest changes were due to updates to protolude (via cardano-prelude).
  • Loading branch information
erikd committed Jul 2, 2020
1 parent 601bb43 commit 2b1efea
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 18 deletions.
42 changes: 38 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
index-state: 2020-05-15T00:00:00Z

packages:
./cardano-shell
./cardano-launcher

-- ---------------------------------------------------------
-- Disable all tests by default

tests: False

test-show-details: direct

-- Then enable specific tests in this repo

package cardano-shell
tests: True

package cardano-launcher
tests: True

-- ---------------------------------------------------------

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-sl-x509
Expand All @@ -10,12 +29,12 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-prelude
tag: 3c40edcf5bdba8721d3430d0aaaeea8770ce9bec
tag: 316c854d1d3089f480708ad5cd5ecf8a74423ddd

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-prelude
tag: 3c40edcf5bdba8721d3430d0aaaeea8770ce9bec
tag: 316c854d1d3089f480708ad5cd5ecf8a74423ddd
subdir: test

source-repository-package
Expand All @@ -26,12 +45,27 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/iohk-monitoring-framework
tag: efa4b5ecd7f0a13124616b12679cd42517cd905a
--sha256: 0h1h5ifl5d7dl3y6fym9pjd6rfrbh5rbyxs0xw5las503pibv2bf
subdir: iohk-monitoring
tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044

source-repository-package
type: git
location: https://github.com/input-output-hk/iohk-monitoring-framework
tag: efa4b5ecd7f0a13124616b12679cd42517cd905a
--sha256: 0h1h5ifl5d7dl3y6fym9pjd6rfrbh5rbyxs0xw5las503pibv2bf
subdir: contra-tracer
tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044

source-repository-package
type: git
location: https://github.com/input-output-hk/iohk-monitoring-framework
tag: efa4b5ecd7f0a13124616b12679cd42517cd905a
--sha256: 0h1h5ifl5d7dl3y6fym9pjd6rfrbh5rbyxs0xw5las503pibv2bf
subdir: tracer-transformers

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: bcd7a88beb6d5d30558aed00081855d256eea0c1
--sha256: 158pb9q6vd8bi1f0falvhp0gzmfld2f7cprcxsh1pms2840xhisa
subdir: Win32-network
3 changes: 2 additions & 1 deletion cardano-launcher/src/Cardano/Shell/Update/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Cardano.Shell.Update.Types where

import Cardano.Prelude

import qualified Data.Text as Text
import qualified Data.Map as M
import Test.QuickCheck (Gen, choose, frequency, listOf1)

Expand Down Expand Up @@ -55,7 +56,7 @@ genInstallerHash = InstallerHash <$> genSafeText

-- | Generate random ascii string, it's very simplifed.
genSafeText :: Gen Text
genSafeText = strConv Lenient <$> (listOf1 $ choose ('a', 'z'))
genSafeText = Text.pack <$> (listOf1 $ choose ('a', 'z'))

genBlock :: Gen Block
genBlock = Block <$> genBlockHash <*> genMaybeInstallerVersion
Expand Down
2 changes: 2 additions & 0 deletions cardano-shell/cardano-shell.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ test-suite cardano-shell-test
build-depends:
aeson
, base >=4.7 && <5
, bytestring
, cardano-shell
, cardano-prelude
-- quickcheck
, QuickCheck
-- SM
, quickcheck-state-machine >= 0.6
-- required because of QSM
, text
, tree-diff
-- tests
, hspec
Expand Down
6 changes: 4 additions & 2 deletions cardano-shell/src/Cardano/Shell/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ module Cardano.Shell.Lib
, runCardanoApplicationWithFeatures
) where

import Cardano.Prelude hiding (async, cancel, (%))
import Cardano.Prelude hiding (Handler, async, cancel, (%))
import Prelude (Show (..))

import Control.Concurrent.Classy.Async (async, cancel)
import qualified Control.Concurrent.Classy.Async as CA

import qualified Data.Text as Text

import Formatting (bprint, build, formatToString, stext, (%))
import Formatting.Buildable (Buildable (..))

Expand All @@ -33,7 +35,7 @@ instance Exception GeneralException

instance Buildable GeneralException where
build UnknownFailureException = bprint ("Something went wrong and we don't know what.")
build (FileNotFoundException filePath) = bprint ("File not found on path '"%stext%"'.") (strConv Lenient filePath)
build (FileNotFoundException filePath) = bprint ("File not found on path '"%stext%"'.") (Text.pack filePath)
build (ConfigurationError etext) = bprint ("Configuration error: "%stext%".") etext

-- | Instance so we can see helpful error messages when something goes wrong.
Expand Down
10 changes: 6 additions & 4 deletions cardano-shell/src/Cardano/Shell/NodeIPC/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ module Cardano.Shell.NodeIPC.Lib
, isNodeChannelCannotBeFound
) where

import Cardano.Prelude hiding (catches, finally, handle)
import Cardano.Prelude hiding (Handler, catches, finally, handle)

import Control.Exception.Safe (Handler (..), catches, finally)
import Data.Aeson (FromJSON (parseJSON), ToJSON (toEncoding),
defaultOptions, genericParseJSON,
genericToEncoding)
import Data.Aeson.Types (Options, SumEncoding (ObjectWithSingleField),
sumEncoding)
import qualified Data.Text as Text

import GHC.IO.Handle (hIsEOF, hIsOpen, hIsReadable, hIsWritable)
import GHC.IO.Handle.FD (fdToHandle)

Expand Down Expand Up @@ -155,7 +157,7 @@ instance Arbitrary MsgOut where
]

genSafeText :: Gen Text
genSafeText = strConv Lenient <$> listOf1 arbitraryASCIIChar
genSafeText = Text.pack <$> listOf1 arbitraryASCIIChar

opts :: Options
opts = defaultOptions { sumEncoding = ObjectWithSingleField }
Expand Down Expand Up @@ -215,9 +217,9 @@ data NodeIPCError
instance Show NodeIPCError where
show = \case
NodeChannelNotFound envName ->
"Environment variable cannot be found: " <> strConv Lenient envName
"Environment variable cannot be found: " <> Text.unpack envName
UnableToParseNodeChannel err ->
"Unable to parse file descriptor: " <> strConv Lenient err
"Unable to parse file descriptor: " <> Text.unpack err
IPCError ->
"IOError has occured"
HandleClosed h ->
Expand Down
2 changes: 1 addition & 1 deletion cardano-shell/src/Cardano/Shell/NodeIPC/Message.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data MessageException
= DecodeFail BSL.ByteString

instance Show MessageException where
show (DecodeFail blob) = "Failed to decode given blob: " <> toS blob
show (DecodeFail blob) = "Failed to decode given blob: " <> BSLC.unpack blob

instance Exception MessageException

Expand Down
8 changes: 5 additions & 3 deletions cardano-shell/test/NodeIPCSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module NodeIPCSpec
import Cardano.Prelude

import Data.Aeson (FromJSON, ToJSON, encode)
import qualified Data.ByteString.Lazy.Char8 as LBS
import qualified Data.Text.Encoding as Text
import GHC.IO.Handle (hIsOpen)
import System.IO (hClose)
import System.IO.Error (eofErrorType, mkIOError, IOError)
Expand Down Expand Up @@ -49,7 +51,7 @@ nodeIPCSpec = do
assert $ isLeft (eResult :: Either MessageException MsgIn)

describe "startIPC" $ do
modifyMaxSuccess (const 1000) $ prop "model based testing" $
modifyMaxSuccess (const 1000) $ prop "model based testing" $
-- Have both MsgIn and MsgOut in order to test failing cases
\(eMsg :: Either MsgOut MsgIn) (randomPort :: Port) -> monadicIO $ do
response <- run $ either
Expand Down Expand Up @@ -169,9 +171,9 @@ whenLeft _ _ = pure ()
modelResponse :: Port -> Either MsgOut MsgIn -> MsgOut
modelResponse (Port portNumber) = \case
Left msgOut ->
let errorMessage = "Failed to decode given blob: " <> toS (encode msgOut)
let errorMessage = "Failed to decode given blob: " <> Text.decodeUtf8 (LBS.toStrict $ encode msgOut)
in MessageOutFailure $ ParseError errorMessage
Right QueryPort ->
Right QueryPort ->
ReplyPort portNumber
Right Ping ->
Pong
Expand Down
13 changes: 10 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: https://raw.githubusercontent.com/input-output-hk/cardano-prelude/3c40edcf5bdba8721d3430d0aaaeea8770ce9bec/snapshot.yaml
resolver: https://raw.githubusercontent.com/input-output-hk/cardano-prelude/316c854d1d3089f480708ad5cd5ecf8a74423ddd/snapshot.yaml

packages:
- ./cardano-shell
Expand All @@ -10,20 +10,27 @@ extra-deps:
- pretty-show-1.9.5 # Used for quickcheck-state-machine.
- time-units-1.0.0
- silently-1.2.5.1
- network-3.1.1.1

- Win32-2.5.4.1@sha256:e623a1058bd8134ec14d62759f76cac52eee3576711cb2c4981f398f1ec44b85

- git: https://github.com/input-output-hk/cardano-prelude
commit: 3c40edcf5bdba8721d3430d0aaaeea8770ce9bec
commit: 316c854d1d3089f480708ad5cd5ecf8a74423ddd
subdirs:
- .
- test

- git: https://github.com/input-output-hk/iohk-monitoring-framework
commit: 4956b32f039579a0e7e4fd10793f65b4c77d9044
commit: efa4b5ecd7f0a13124616b12679cd42517cd905a
subdirs:
- contra-tracer
- iohk-monitoring
- tracer-transformers

- git: https://github.com/input-output-hk/ouroboros-network
commit: bcd7a88beb6d5d30558aed00081855d256eea0c1
subdirs:
- Win32-network

# Extracted from cardano-sl since it's quite useful
- git: https://github.com/input-output-hk/cardano-sl-x509
Expand Down

0 comments on commit 2b1efea

Please sign in to comment.