Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ["9.6", "9.12"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You weren't able to get it to build with 9.12?

Copy link
Contributor Author

@carbolymer carbolymer Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, unfortunately no. I suspect the situation will improve once there will be stackage snapshot with 9.12, which means more of haskell packages will work with 9.12. Do we need 9.12 at this moment?

Copy link
Contributor

@Jimbo4350 Jimbo4350 Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop we don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @erikd

ghc: ["9.6", "9.10"]
cabal: ["3.14"]
sys:
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
Expand Down Expand Up @@ -80,6 +80,25 @@ jobs:
with:
use-sodium-vrf: true # default is true

- name: "[Linux] Install grpc dependencies"
if: runner.os == 'Linux'
run: sudo apt install libsnappy-dev protobuf-compiler

- name: "[Windows] Install grpc dependencies"
if: runner.os == 'Windows'
run: /usr/bin/pacman --noconfirm -S mingw-w64-x86_64-snappy mingw-w64-x86_64-protobuf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


- name: "[macOS] Install grpc dependencies"
if: runner.os == 'macOS'
run: |
brew install snappy protobuf
SNAPPY_PREFIX=$(brew --prefix snappy)
# TODO generalise and move these paths fixups to https://github.com/input-output-hk/actions/blob/latest/base/action.yml
cat <<EOF >> $GITHUB_ENV
LIBRARY_PATH=$SNAPPY_PREFIX/lib
CPATH=$SNAPPY_PREFIX/include
EOF

- uses: actions/checkout@v4

- name: Cabal update
Expand Down Expand Up @@ -159,10 +178,10 @@ jobs:
# and will silently fail if msys2 is not in path. See the "Run tests" step.
#
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true

build-complete:
needs: [build]
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/hls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,10 @@ jobs:

- name: Test HLS works
if: steps.check_trivial_changes.outputs.CHECK_HLS_WORKS > 0
run: haskell-language-server
run: |
# workaround for https://github.com/haskell/haskell-language-server/issues/3735
cat <<EOF > hie.yaml
cradle:
cabal:
EOF
haskell-language-server
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ The changelogs of constituent packages:

### `cardano-api-gen`
[./cardano-api-gen/CHANGELOG.md](./cardano-api-gen/CHANGELOG.md)

### `cardano-rpc`
[./cardano-rpc/CHANGELOG.md](./cardano-rpc/CHANGELOG.md)
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021-2023 Input Output Global Inc (IOG).
Copyright 2021-2025 Input Output Global Inc (IOG).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
9 changes: 5 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ packages:
cardano-api
cardano-api-gen
cardano-wasm
cardano-rpc

extra-packages: Cabal, process

Expand Down Expand Up @@ -51,10 +52,6 @@ write-ghc-environment-files: always
jobs: $ncpus
semaphore: True

-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

if impl (ghc >= 9.12)
allow-newer:
-- https://github.com/kapralVV/Unique/issues/11
Expand Down Expand Up @@ -151,3 +148,7 @@ if arch(wasm32)
package crypton
ghc-options: -optc-DARGON2_NO_THREADS

-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

2 changes: 1 addition & 1 deletion cardano-api-gen/NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020-2023 Input Output Global Inc (IOG).
Copyright 2020-2025 Input Output Global Inc (IOG).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020-2023 Input Output Global Inc (IOG).
Copyright 2020-2025 Input Output Global Inc (IOG).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
5 changes: 5 additions & 0 deletions cardano-api/src/Cardano/Api/Experimental/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Cardano.Api.Era.Internal.Eon.Convert
import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
import Cardano.Api.Era.Internal.Eon.MaryEraOnwards
import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra (ShelleyBasedEra (..), ShelleyLedgerEra)
import Cardano.Api.Error
import Cardano.Api.Ledger.Internal.Reexport qualified as L
import Cardano.Api.Pretty.Internal.ShowOf

Expand Down Expand Up @@ -232,6 +233,10 @@ newtype DeprecatedEra era

deriving via (ShowOf (DeprecatedEra era)) instance Pretty (DeprecatedEra era)

instance Error (DeprecatedEra era) where
prettyError (DeprecatedEra era) =
"The era " <> pretty (show era) <> " is deprecated and no longer supported."

sbeToEra
:: MonadError (DeprecatedEra era) m
=> ShelleyBasedEra era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ module Cardano.Api.Governance.Internal.Action.VotingProcedure where
import Cardano.Api.Address
import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards
import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra
import Cardano.Api.Error
import Cardano.Api.Governance.Internal.Action.ProposalProcedure
import Cardano.Api.HasTypeProxy
import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger
import Cardano.Api.Pretty (pshow)
import Cardano.Api.Serialise.Cbor
import Cardano.Api.Serialise.TextEnvelope.Internal

Expand Down Expand Up @@ -144,6 +146,9 @@ newtype VotesMergingConflict era
)
deriving Show

instance Error (VotesMergingConflict era) where
prettyError = pshow

-- | @mergeVotingProcedures vote1 vote2@ merges @vote1@ and @vote2@ into a single vote,
-- or fails if the votes are incompatible.
mergeVotingProcedures
Expand Down
4 changes: 4 additions & 0 deletions cardano-api/src/Cardano/Api/Governance/Internal/Poll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Cardano.Api.Governance.Internal.Poll
where

import Cardano.Api.Era
import Cardano.Api.Error
import Cardano.Api.HasTypeProxy
import Cardano.Api.Hash
import Cardano.Api.Key.Internal
Expand Down Expand Up @@ -278,6 +279,9 @@ data GovernancePollError
| ErrGovernancePollInvalidAnswer GovernancePollInvalidAnswerError
deriving Show

instance Error GovernancePollError where
prettyError = pretty . renderGovernancePollError

data GovernancePollInvalidAnswerError = GovernancePollInvalidAnswerError
{ invalidAnswerAcceptableAnswers :: [(Word, Text)]
, invalidAnswerReceivedAnswer :: Word
Expand Down
22 changes: 22 additions & 0 deletions cardano-api/src/Cardano/Api/Internal/Orphans/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ where
import Cardano.Api.Error
import Cardano.Api.Pretty

import Cardano.Chain.Genesis qualified as Byron
import Cardano.Ledger.Alonzo.PParams qualified as Ledger
import Cardano.Ledger.Babbage.PParams qualified as Ledger
import Cardano.Ledger.BaseTypes (strictMaybeToMaybe)
Expand All @@ -28,6 +29,7 @@ import Cardano.Ledger.Coin qualified as L
import Cardano.Ledger.Conway.PParams qualified as Ledger
import Cardano.Ledger.HKD (NoUpdate (..))
import Cardano.Ledger.Shelley.PParams qualified as Ledger
import Ouroboros.Consensus.Cardano.Block (EraMismatch (..))
import PlutusLedgerApi.Common qualified as P

import Codec.Binary.Bech32 qualified as Bech32
Expand All @@ -36,8 +38,10 @@ import Data.ListMap (ListMap)
import Data.ListMap qualified as ListMap
import Data.Maybe.Strict (StrictMaybe (..))
import Data.Monoid
import Data.Text.Encoding.Error qualified as T
import GHC.Exts (IsList (..))
import Network.Mux qualified as Mux
import Text.Parsec.Error qualified as P

deriving instance Data DecoderError

Expand Down Expand Up @@ -270,3 +274,21 @@ instance Error CBOR.DecoderError where

instance Error P.ScriptDecodeError where
prettyError = pshow

instance Error T.UnicodeException where
prettyError = pshow

instance Error EraMismatch where
prettyError (EraMismatch ledgerEraName' otherEraName') =
"The era of the node and the tx do not match. "
<> "The node is running in the "
<> pshow ledgerEraName'
<> " era, but the transaction is for the "
<> pshow otherEraName'
<> " era."

instance Error Byron.GenesisDataGenerationError where
prettyError = pretty . show

instance Error P.ParseError where
prettyError = pretty . show
5 changes: 5 additions & 0 deletions cardano-api/src/Cardano/Api/Network/IPC/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ import Cardano.Api.Block
import Cardano.Api.Consensus.Internal.InMode
import Cardano.Api.Consensus.Internal.Mode
import Cardano.Api.Consensus.Internal.Protocol
import Cardano.Api.Error
import Cardano.Api.HasTypeProxy
import Cardano.Api.IO
import Cardano.Api.Monad.Error (ExceptT (..))
import Cardano.Api.Network.IPC.Internal.Version
import Cardano.Api.Network.Internal.NetworkId
import Cardano.Api.Pretty
import Cardano.Api.Query.Internal.Type.QueryInMode
import Cardano.Api.Tx.Internal.Body
import Cardano.Api.Tx.Internal.Sign
Expand Down Expand Up @@ -566,6 +568,9 @@ data AcquiringFailure
| AFPointNotOnChain
deriving (Eq, Show)

instance Error AcquiringFailure where
prettyError = pshow

toAcquiringFailure :: Net.Query.AcquireFailure -> AcquiringFailure
toAcquiringFailure AcquireFailurePointTooOld = AFPointTooOld
toAcquiringFailure AcquireFailurePointNotOnChain = AFPointNotOnChain
Expand Down
13 changes: 13 additions & 0 deletions cardano-api/src/Cardano/Api/Network/IPC/Internal/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module Cardano.Api.Network.IPC.Internal.Version
)
where

import Cardano.Api.Error
import Cardano.Api.Pretty

import Cardano.Protocol.Crypto
import Ouroboros.Consensus.Cardano.Block qualified as Consensus
import Ouroboros.Consensus.Cardano.Node ()
Expand Down Expand Up @@ -52,3 +55,13 @@ data UnsupportedNtcVersionError
![NodeToClientVersion]
-- ^ The versions in which this query is supported
deriving (Eq, Show)

instance Error UnsupportedNtcVersionError where
prettyError (UnsupportedNtcVersionError minNtcVersion ntcVersion) =
"Unsupported feature for the node-to-client protocol version.\n"
<> "This query requires at least "
<> pshow minNtcVersion
<> " but the node negotiated "
<> pshow ntcVersion
<> ".\n"
<> "Later node versions support later protocol versions (but development protocol versions are not enabled in the node by default)."
4 changes: 4 additions & 0 deletions cardano-api/src/Cardano/Api/Query/Internal/Convenience.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Cardano.Api.Address
import Cardano.Api.Certificate.Internal
import Cardano.Api.Consensus.Internal.Mode
import Cardano.Api.Era
import Cardano.Api.Error
import Cardano.Api.IO
import Cardano.Api.Monad.Error
import Cardano.Api.Network.IPC
Expand Down Expand Up @@ -62,6 +63,9 @@ data QueryConvenienceError
| QceUnexpectedException !SomeException
deriving Show

instance Error QueryConvenienceError where
prettyError = pshow . renderQueryConvenienceError

renderQueryConvenienceError :: QueryConvenienceError -> Text
renderQueryConvenienceError (AcqFailure e) =
"Acquiring failure: " <> textShow e
Expand Down
15 changes: 9 additions & 6 deletions cardano-api/src/Cardano/Api/Serialise/Raw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ data RawBytesHexError
-- ^ error message
deriving Show

newtype SerialiseAsRawBytesError = SerialiseAsRawBytesError
-- TODO We can do better than use String to carry the error message
{ unSerialiseAsRawBytesError :: String
}
deriving (Eq, Show)

instance Error RawBytesHexError where
prettyError = \case
RawBytesHexErrorBase16DecodeFail input typeRep' message ->
Expand All @@ -95,3 +89,12 @@ instance Error RawBytesHexError where
toText bs = case Text.decodeUtf8' bs of
Right t -> Text.unpack t
Left _ -> show bs

newtype SerialiseAsRawBytesError = SerialiseAsRawBytesError
-- TODO We can do better than use String to carry the error message
{ unSerialiseAsRawBytesError :: String
}
deriving (Eq, Show)

instance Error SerialiseAsRawBytesError where
prettyError = pshow . unSerialiseAsRawBytesError
5 changes: 5 additions & 0 deletions cardano-rpc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog for cardano-rpc

## Unreleased

- Initial version
Loading
Loading