Skip to content

Commit

Permalink
Merge pull request #841 from input-output-hk/abailly-iohk/ghc-9.2.7
Browse files Browse the repository at this point in the history
Update to GHC 9.2.7
  • Loading branch information
ch1bo authored Jul 20, 2023
2 parents 201b1e0 + 4a41222 commit 9a2c386
Show file tree
Hide file tree
Showing 27 changed files with 85 additions and 83 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci-cabal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
uses: ./.github/workflows/actions/setup_dev_ubuntu
with:
clean_caches: true
version_ghc: 9.2.7

- name: cabal build
run: |
Expand All @@ -53,6 +54,8 @@ jobs:

- name: setup dev environment
uses: ./.github/workflows/actions/setup_dev_ubuntu
with:
version_ghc: 9.2.7

- name: ❓ Test
if: ${{ matrix.package != 'hydra-tui' }}
Expand Down Expand Up @@ -115,6 +118,8 @@ jobs:

- name: setup dev environment
uses: ./.github/workflows/actions/setup_dev_ubuntu
with:
version_ghc: 9.2.7

- name: 📚 Documentation (Haddock)
run: |
Expand Down Expand Up @@ -150,6 +155,8 @@ jobs:

- name: setup dev environment
uses: ./.github/workflows/actions/setup_dev_ubuntu
with:
version_ghc: 9.2.7

- name: 📈 Benchmark
run: |
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ changes.
a snapshot to be seen before acknowledging it, and only send
transaction ids in snapshot requests

- **BREAKING** Change to the Hydra scripts due to upgrading our plutus compiler
and toolchain.

## [0.11.0] - 2023-06-30

This release contains breaking changes of the persistence and on-chain scripts
Expand Down
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ package plutus-cbor
package plutus-merkle-tree
haddock-options: "--optghc=-fplugin-opt PlutusTx.Plugin:defer-errors"

-- Fix compilation of strict-containers (see also nix/hydra/project.nix)
package strict-containers
ghc-options: "-Wno-noncanonical-monad-instances"

-- Always show detailed output for tests
test-show-details: direct

Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
inherit hydraProject;

packages =
{ default = hydraPackages.hydra-node; } //
hydraPackages //
prefixAttrs "docker-" hydraImages // {
spec = import ./spec { inherit pkgs; };
Expand Down
4 changes: 2 additions & 2 deletions hydra-cardano-api/src/Hydra/Cardano/Api/UsingRawBytesHex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ instance SerialiseAsRawBytes a => IsString (UsingRawBytesHex a) where
instance SerialiseAsRawBytes a => ToJSON (UsingRawBytesHex a) where
toJSON (UsingRawBytesHex x) = toJSON (serialiseToRawBytesHexText x)

instance (SerialiseAsRawBytes a, Typeable a) => FromJSON (UsingRawBytesHex a) where
instance (SerialiseAsRawBytes a) => FromJSON (UsingRawBytesHex a) where
parseJSON =
Aeson.withText tname $
either fail pure . deserialiseFromRawBytesBase16 . encodeUtf8
Expand All @@ -44,7 +44,7 @@ instance SerialiseAsRawBytes a => ToJSONKey (UsingRawBytesHex a) where
toJSONKey =
Aeson.toJSONKeyText $ \(UsingRawBytesHex x) -> serialiseToRawBytesHexText x

instance (SerialiseAsRawBytes a, Typeable a) => FromJSONKey (UsingRawBytesHex a) where
instance (SerialiseAsRawBytes a) => FromJSONKey (UsingRawBytesHex a) where
fromJSONKey =
Aeson.FromJSONKeyTextParser $
either fail pure . deserialiseFromRawBytesBase16 . encodeUtf8
Expand Down
1 change: 0 additions & 1 deletion hydra-cluster/exe/log-filter/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Main where

import Data.Aeson (decode, encode)
import qualified Data.ByteString.Char8 as LBS
import qualified Data.ByteString.Lazy as LBS
import Hydra.Ledger.Cardano (Tx)
import Hydra.LogFilter (tracePerformance)
import Hydra.Prelude
Expand Down
1 change: 1 addition & 0 deletions hydra-cluster/src/Hydra/Cluster/Scenarios.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-ambiguous-fields #-}

module Hydra.Cluster.Scenarios where

Expand Down
5 changes: 0 additions & 5 deletions hydra-node/hydra-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ library
, optparse-applicative
, ouroboros-consensus
, ouroboros-consensus-cardano
, ouroboros-network
, ouroboros-network-api >=0.1.0.0
, ouroboros-network-framework >=0.3.0.0
, ouroboros-network-protocols >=0.3.0.0
Expand Down Expand Up @@ -191,7 +190,6 @@ executable hydra-node
hs-source-dirs: exe/hydra-node
main-is: Main.hs
build-depends:
, base
, hydra-cardano-api
, hydra-node
, hydra-prelude
Expand All @@ -203,7 +201,6 @@ executable hydra-tools
hs-source-dirs: exe/hydra-tools
main-is: Main.hs
build-depends:
, base
, cryptonite
, filepath
, hydra-cardano-api
Expand Down Expand Up @@ -233,7 +230,6 @@ benchmark tx-cost
, plutus-ledger-api
, plutus-tx
, QuickCheck
, text

ghc-options: -threaded -rtsopts

Expand Down Expand Up @@ -345,7 +341,6 @@ test-suite tests
, io-sim
, lens
, lens-aeson
, network
, ouroboros-consensus-cardano-test
, plutus-ledger-api:{plutus-ledger-api, plutus-ledger-api-testlib} >=1.1.1.0
, plutus-tx
Expand Down
12 changes: 6 additions & 6 deletions hydra-node/src/Hydra/API/ServerOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ genTimedServerOutput :: ServerOutput tx -> Gen (TimedServerOutput tx)
genTimedServerOutput o =
TimedServerOutput o <$> arbitrary <*> arbitrary

instance (ToJSON tx, IsChainState tx) => ToJSON (TimedServerOutput tx) where
instance (IsChainState tx) => ToJSON (TimedServerOutput tx) where
toJSON TimedServerOutput{output, seq, time} =
case toJSON output of
Object o ->
Object $ o <> KeyMap.fromList [("seq", toJSON seq), ("timestamp", toJSON time)]
_NotAnObject -> error "expected ServerOutput to serialize to an Object"

instance (FromJSON tx, IsChainState tx) => FromJSON (TimedServerOutput tx) where
instance (IsChainState tx) => FromJSON (TimedServerOutput tx) where
parseJSON v = flip (withObject "TimedServerOutput") v $ \o ->
TimedServerOutput <$> parseJSON v <*> o .: "seq" <*> o .: "timestamp"

Expand Down Expand Up @@ -91,17 +91,17 @@ data ServerOutput tx
| PostTxOnChainFailed {postChainTx :: PostChainTx tx, postTxError :: PostTxError tx}
deriving (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (ServerOutput tx)
deriving instance (IsTx tx, IsChainState tx) => Show (ServerOutput tx)
deriving instance (IsChainState tx) => Eq (ServerOutput tx)
deriving instance (IsChainState tx) => Show (ServerOutput tx)

instance (IsTx tx, IsChainState tx) => ToJSON (ServerOutput tx) where
instance (IsChainState tx) => ToJSON (ServerOutput tx) where
toJSON =
genericToJSON
defaultOptions
{ omitNothingFields = True
}

instance (IsTx tx, IsChainState tx) => FromJSON (ServerOutput tx) where
instance (IsChainState tx) => FromJSON (ServerOutput tx) where
parseJSON =
genericParseJSON
defaultOptions
Expand Down
10 changes: 5 additions & 5 deletions hydra-node/src/Hydra/Chain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ data PostTxError tx
SpendingNodeUtxoForbidden
deriving (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (PostTxError tx)
deriving instance (IsTx tx, IsChainState tx) => Show (PostTxError tx)
deriving instance (IsTx tx, IsChainState tx) => ToJSON (PostTxError tx)
deriving instance (IsTx tx, IsChainState tx) => FromJSON (PostTxError tx)
deriving instance (IsChainState tx) => Eq (PostTxError tx)
deriving instance (IsChainState tx) => Show (PostTxError tx)
deriving instance (IsChainState tx) => ToJSON (PostTxError tx)
deriving instance (IsChainState tx) => FromJSON (PostTxError tx)

instance (IsTx tx, IsChainState tx) => Exception (PostTxError tx)
instance (IsChainState tx) => Exception (PostTxError tx)

instance Arbitrary Lovelace where
arbitrary = Lovelace <$> scale (* 8) arbitrary `suchThat` (> 0)
Expand Down
2 changes: 1 addition & 1 deletion hydra-node/src/Hydra/Chain/Direct/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ type GetTimeHandle m = m TimeHandle
-- and does not require any actual `IO` to happen which makes it highly suitable
-- for simulations and testing.
mkChain ::
(MonadSTM m, MonadTimer m, MonadThrow (STM m)) =>
(MonadSTM m, MonadThrow (STM m)) =>
Tracer m DirectChainLog ->
-- | Means to acquire a new 'TimeHandle'.
GetTimeHandle m ->
Expand Down
27 changes: 14 additions & 13 deletions hydra-node/src/Hydra/HeadLogic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-ambiguous-fields #-}

-- | Implements the Head Protocol's /state machine/ as a /pure function/.
--
Expand Down Expand Up @@ -79,10 +80,10 @@ data Event tx
PostTxError {postChainTx :: PostChainTx tx, postTxError :: PostTxError tx}
deriving stock (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (Event tx)
deriving instance (IsTx tx, IsChainState tx) => Show (Event tx)
deriving instance (IsTx tx, IsChainState tx) => ToJSON (Event tx)
deriving instance (IsTx tx, IsChainState tx) => FromJSON (Event tx)
deriving instance (IsChainState tx) => Eq (Event tx)
deriving instance (IsChainState tx) => Show (Event tx)
deriving instance (IsChainState tx) => ToJSON (Event tx)
deriving instance (IsChainState tx) => FromJSON (Event tx)

instance
( IsTx tx
Expand All @@ -104,10 +105,10 @@ data Effect tx
OnChainEffect {postChainTx :: PostChainTx tx}
deriving stock (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (Effect tx)
deriving instance (IsTx tx, IsChainState tx) => Show (Effect tx)
deriving instance (IsTx tx, IsChainState tx) => ToJSON (Effect tx)
deriving instance (IsTx tx, IsChainState tx) => FromJSON (Effect tx)
deriving instance (IsChainState tx) => Eq (Effect tx)
deriving instance (IsChainState tx) => Show (Effect tx)
deriving instance (IsChainState tx) => ToJSON (Effect tx)
deriving instance (IsChainState tx) => FromJSON (Effect tx)

instance
( IsTx tx
Expand Down Expand Up @@ -374,10 +375,10 @@ data Outcome tx
| Combined {left :: Outcome tx, right :: Outcome tx}
deriving stock (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (Outcome tx)
deriving instance (IsTx tx, IsChainState tx) => Show (Outcome tx)
deriving instance (IsTx tx, IsChainState tx) => ToJSON (Outcome tx)
deriving instance (IsTx tx, IsChainState tx) => FromJSON (Outcome tx)
deriving instance (IsChainState tx) => Eq (Outcome tx)
deriving instance (IsChainState tx) => Show (Outcome tx)
deriving instance (IsChainState tx) => ToJSON (Outcome tx)
deriving instance (IsChainState tx) => FromJSON (Outcome tx)

instance (IsTx tx, Arbitrary (ChainStateType tx)) => Arbitrary (Outcome tx) where
arbitrary = genericArbitrary
Expand Down Expand Up @@ -1026,7 +1027,7 @@ onClosedChainFanoutTx closedState newChainState =
-- current 'HeadState'. Resulting new 'HeadState's are retained and 'Effect'
-- outcomes handled by the "Hydra.Node".
update ::
(IsTx tx, IsChainState tx) =>
(IsChainState tx) =>
Environment ->
Ledger tx ->
HeadState tx ->
Expand Down
18 changes: 3 additions & 15 deletions hydra-node/src/Hydra/Ledger/Cardano/Json.hs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ safeHashFromText t =

instance
( Crypto (Ledger.Crypto era)
, Typeable era
, Ledger.Era era
) =>
FromJSON (Ledger.Alonzo.AlonzoScript era)
Expand Down Expand Up @@ -313,7 +312,6 @@ instance (ToCBOR a, FromJSON a) => FromJSON (Sized a) where

instance
( Ledger.Babbage.BabbageEraTxBody era
, Show (Core.Value era)
, FromJSON (Core.Value era)
, FromJSON (Ledger.Mary.MaryValue (Ledger.Crypto era))
, FromJSON (Core.AuxiliaryData era)
Expand Down Expand Up @@ -354,27 +352,17 @@ instance
toJSON (Ledger.Alonzo.TxDats datums) = toJSON datums

instance
( Typeable era
, Crypto (Ledger.Crypto era)
( Crypto (Ledger.Crypto era)
, Ledger.Era era
) =>
FromJSON (Ledger.Alonzo.TxDats era)
where
parseJSON = fmap Ledger.Alonzo.TxDats . parseJSON

instance
( Typeable era
) =>
ToJSON (Ledger.Alonzo.Data era)
where
instance Typeable era => ToJSON (Ledger.Alonzo.Data era) where
toJSON = String . decodeUtf8 . Base16.encode . serialize'

instance
( Typeable era
, Ledger.Era era
) =>
FromJSON (Ledger.Alonzo.Data era)
where
instance Ledger.Era era => FromJSON (Ledger.Alonzo.Data era) where
parseJSON = withText "Data" $ \t ->
case Base16.decode $ encodeUtf8 t of
Left e -> fail $ "failed to decode from base16: " <> show e
Expand Down
16 changes: 7 additions & 9 deletions hydra-node/src/Hydra/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,16 @@ data HydraNodeLog tx
| LogicOutcome {by :: Party, outcome :: Outcome tx}
deriving stock (Generic)

deriving instance (IsTx tx, IsChainState tx) => Eq (HydraNodeLog tx)
deriving instance (IsTx tx, IsChainState tx) => Show (HydraNodeLog tx)
deriving instance (IsTx tx, IsChainState tx) => ToJSON (HydraNodeLog tx)
deriving instance (IsTx tx, IsChainState tx) => FromJSON (HydraNodeLog tx)
deriving instance (IsChainState tx) => Eq (HydraNodeLog tx)
deriving instance (IsChainState tx) => Show (HydraNodeLog tx)
deriving instance (IsChainState tx) => ToJSON (HydraNodeLog tx)
deriving instance (IsChainState tx) => FromJSON (HydraNodeLog tx)

instance (IsTx tx, Arbitrary (ChainStateType tx)) => Arbitrary (HydraNodeLog tx) where
arbitrary = genericArbitrary

runHydraNode ::
( MonadThrow m
, MonadCatch m
( MonadCatch m
, MonadAsync m
, IsChainState tx
) =>
Expand All @@ -94,8 +93,7 @@ runHydraNode tracer node =
forever $ stepHydraNode tracer node

stepHydraNode ::
( MonadThrow m
, MonadCatch m
( MonadCatch m
, MonadAsync m
, IsChainState tx
) =>
Expand Down Expand Up @@ -192,7 +190,7 @@ data NodeState tx m = NodeState
}

-- | Initialize a new 'NodeState'.
createNodeState :: (MonadSTM m, MonadLabelledSTM m) => HeadState tx -> m (NodeState tx m)
createNodeState :: (MonadLabelledSTM m) => HeadState tx -> m (NodeState tx m)
createNodeState initialState = do
tv <- newTVarIO initialState
labelTVarIO tv "node-state"
Expand Down
3 changes: 1 addition & 2 deletions hydra-node/src/Hydra/Node/EventQueue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ data EventQueue m e = EventQueue
data Queued e = Queued {eventId :: Word64, queuedEvent :: e}

createEventQueue ::
( MonadSTM m
, MonadDelay m
( MonadDelay m
, MonadAsync m
, MonadLabelledSTM m
) =>
Expand Down
4 changes: 2 additions & 2 deletions hydra-node/test/Hydra/BehaviorSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ data SimulatedChainNetwork tx m = SimulatedChainNetwork
-- the 'tickThread'. Also, this will fix tx to 'SimpleTx' so that it can pick an
-- initial chain state to play back to our test nodes.
withSimulatedChainAndNetwork ::
(MonadSTM m, MonadTime m, MonadDelay m, MonadAsync m) =>
(MonadTime m, MonadDelay m, MonadAsync m) =>
(SimulatedChainNetwork SimpleTx m -> m ()) ->
m ()
withSimulatedChainAndNetwork action = do
Expand Down Expand Up @@ -579,7 +579,7 @@ instance IsChainStateTest Tx where
-- 'cancel'ed after use. Use 'withSimulatedChainAndNetwork' instead where
-- possible.
simulatedChainAndNetwork ::
(MonadSTM m, MonadTime m, MonadDelay m, MonadAsync m, IsChainStateTest tx) =>
(MonadTime m, MonadDelay m, MonadAsync m, IsChainStateTest tx) =>
ChainStateType tx ->
m (SimulatedChainNetwork tx m)
simulatedChainAndNetwork initialChainState = do
Expand Down
Loading

0 comments on commit 9a2c386

Please sign in to comment.