Skip to content

Commit 7533f6e

Browse files
committed
Propagate changes from cardano-cli
1 parent f11e0f3 commit 7533f6e

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Data.ByteString.Short (ShortByteString)
1919
import Data.Int (Int64)
2020
import Data.Map.Strict as Map (lookup)
2121

22+
import Control.Exception (displayException)
2223
import Control.Monad.Trans.Except
2324
import Control.Monad.Trans.Except.Extra
2425
import Control.Monad.Writer (runWriter)
@@ -71,8 +72,8 @@ readPlutusScript (Left s)
7172
doLoad fp = second (second (const $ ResolvedToFallback asFileName)) <$> readPlutusScript (Right fp)
7273
readPlutusScript (Right fp)
7374
= runExceptT $ do
74-
script <- firstExceptT ApiError $
75-
readFileScriptInAnyLang fp
75+
script <-
76+
handleExceptT (\(e :: SomeException) -> ApiError $ displayException e) (readFileScriptInAnyLang fp)
7677
case script of
7778
ScriptInAnyLang (PlutusScriptLanguage _) _ -> pure (script, ResolvedToFileName fp)
7879
ScriptInAnyLang lang _ -> throwE $ TxGenError $ "readPlutusScript: only PlutusScript supported, found: " ++ show lang

bench/tx-generator/src/Cardano/TxGenerator/Types.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ data PlutusAutoBudget
140140

141141
data TxGenError where
142142
ApiError :: Cardano.Api.Error e => !e -> TxGenError
143+
-- Cli
143144
ProtocolError :: Cardano.Api.Error e => !e -> TxGenError
144145
PlutusError :: Show e => !e -> TxGenError
145146
TxGenError :: !String -> TxGenError

cardano-node/cardano-node.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ library
142142
, async
143143
, base16-bytestring
144144
, bytestring
145-
, cardano-api ^>= 10.17.1
145+
, cardano-api ^>= 10.17
146146
, cardano-crypto-class
147147
, cardano-crypto-wrapper
148148
, cardano-git-rev ^>=0.2.2

cardano-testnet/cardano-testnet.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ test-suite cardano-testnet-test
262262
, mtl
263263
, process
264264
, regex-compat
265+
, rio
265266
, tasty ^>= 1.5
266267
, text
267268
, time

cardano-testnet/src/Parsers/Cardano.hs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module Parsers.Cardano
55
, cmdCreateEnv
66
) where
77

8-
import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..))
8+
import Cardano.Api ( AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..), Eon(..)
9+
, forEraInEonMaybe, convert, ShelleyBasedEra(..), AnyCardanoEra(..))
910

1011
import Cardano.CLI.Environment
1112
import Cardano.CLI.EraBased.Common.Option hiding (pNetworkId)
@@ -16,6 +17,8 @@ import Control.Applicative
1617
import Data.Default.Class
1718
import Data.Functor
1819
import qualified Data.List as L
20+
import Data.Maybe
21+
import Data.Typeable
1922
import Data.Word (Word64)
2023
import Options.Applicative (CommandFields, Mod, Parser)
2124
import qualified Options.Applicative as OA
@@ -74,6 +77,35 @@ pCardanoTestnetCliOptions envCli = CardanoTestnetOptions
7477
pAnyShelleyBasedEra' =
7578
pAnyShelleyBasedEra envCli <&> (\(EraInEon x) -> AnyShelleyBasedEra x)
7679

80+
pAnyShelleyBasedEra :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
81+
pAnyShelleyBasedEra envCli =
82+
asum $
83+
mconcat
84+
[
85+
[ OA.flag' (EraInEon ShelleyBasedEraShelley) $
86+
mconcat [OA.long "shelley-era", OA.help $ "Specify the Shelley era" <> deprecationText]
87+
, OA.flag' (EraInEon ShelleyBasedEraAllegra) $
88+
mconcat [OA.long "allegra-era", OA.help $ "Specify the Allegra era" <> deprecationText]
89+
, OA.flag' (EraInEon ShelleyBasedEraMary) $
90+
mconcat [OA.long "mary-era", OA.help $ "Specify the Mary era" <> deprecationText]
91+
, OA.flag' (EraInEon ShelleyBasedEraAlonzo) $
92+
mconcat [OA.long "alonzo-era", OA.help $ "Specify the Alonzo era" <> deprecationText]
93+
, OA.flag' (EraInEon ShelleyBasedEraBabbage) $
94+
mconcat [OA.long "babbage-era", OA.help $ "Specify the Babbage era (default)" <> deprecationText]
95+
, fmap (EraInEon . convert) $ pConwayEra envCli
96+
]
97+
, maybeToList $ pure <$> envCliAnyEon envCli
98+
, pure $ pure $ EraInEon ShelleyBasedEraConway
99+
]
100+
where
101+
deprecationText :: String
102+
deprecationText = " - DEPRECATED - will be removed in the future"
103+
104+
envCliAnyEon :: Typeable eon => Eon eon => EnvCli -> Maybe (EraInEon eon)
105+
envCliAnyEon envCli' = do
106+
AnyCardanoEra era <- envCliAnyCardanoEra envCli'
107+
forEraInEonMaybe era EraInEon
108+
77109
pTestnetNodeOptions :: Parser [NodeOption]
78110
pTestnetNodeOptions =
79111
-- If `--num-pool-nodes N` is present, return N nodes with option `SpoNodeOptions []`.

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import qualified Data.Vector as Vector
4848
import GHC.Exts (IsList (..))
4949
import GHC.Stack (HasCallStack, withFrozenCallStack)
5050
import qualified GHC.Stack as GHC
51+
import RIO (runRIO)
5152
import System.Directory (makeAbsolute)
5253
import System.FilePath ((</>))
5354

@@ -481,7 +482,6 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
481482
readVerificationKeyFromFile
482483
:: ( HasCallStack
483484
, MonadIO m
484-
, MonadCatch m
485485
, MonadTest m
486486
, HasTextEnvelope (VerificationKey keyrole)
487487
, SerialiseAsBech32 (VerificationKey keyrole)
@@ -490,7 +490,7 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
490490
-> File content direction
491491
-> m (VerificationKey keyrole)
492492
readVerificationKeyFromFile work =
493-
H.evalEitherM . liftIO . runExceptT . readVerificationKeyOrFile . VerificationKeyFilePath . File . (work </>) . unFile
493+
H.evalIO . runRIO () . readVerificationKeyOrFile . VerificationKeyFilePath . File . (work </>) . unFile
494494

495495
_verificationStakeKeyToStakeAddress :: Int -> VerificationKey StakeKey -> StakeAddress
496496
_verificationStakeKeyToStakeAddress testnetMagic delegatorVKey =

0 commit comments

Comments
 (0)