Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Propagate changes from cardano-cli
  • Loading branch information
Jimbo4350 authored and carbolymer committed Sep 24, 2025
commit c38a12e7ec86c4300f07d1a96ce8eb278614da38
5 changes: 3 additions & 2 deletions bench/tx-generator/src/Cardano/TxGenerator/Setup/Plutus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Data.ByteString.Short (ShortByteString)
import Data.Int (Int64)
import Data.Map.Strict as Map (lookup)

import Control.Exception (displayException)
import Control.Monad.Trans.Except
import Control.Monad.Trans.Except.Extra
import Control.Monad.Writer (runWriter)
Expand Down Expand Up @@ -71,8 +72,8 @@ readPlutusScript (Left s)
doLoad fp = second (second (const $ ResolvedToFallback asFileName)) <$> readPlutusScript (Right fp)
readPlutusScript (Right fp)
= runExceptT $ do
script <- firstExceptT ApiError $
readFileScriptInAnyLang fp
script <-
handleExceptT (\(e :: SomeException) -> ApiError $ displayException e) (readFileScriptInAnyLang fp)
case script of
ScriptInAnyLang (PlutusScriptLanguage _) _ -> pure (script, ResolvedToFileName fp)
ScriptInAnyLang lang _ -> throwE $ TxGenError $ "readPlutusScript: only PlutusScript supported, found: " ++ show lang
Expand Down
2 changes: 1 addition & 1 deletion cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ library
, async
, base16-bytestring
, bytestring
, cardano-api ^>= 10.17.1
, cardano-api ^>= 10.17
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-git-rev ^>=0.2.2
Expand Down
1 change: 1 addition & 0 deletions cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ test-suite cardano-testnet-test
, mtl
, process
, regex-compat
, rio
, tasty ^>= 1.5
, text
, time
Expand Down
35 changes: 33 additions & 2 deletions cardano-testnet/src/Parsers/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module Parsers.Cardano
, cmdCreateEnv
) where

import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..))
import Cardano.Api ( AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..), Eon(..)
, forEraInEonMaybe, convert, ShelleyBasedEra(..), AnyCardanoEra(..))

import Cardano.CLI.Environment
import Cardano.CLI.EraBased.Common.Option hiding (pNetworkId)
Expand All @@ -16,7 +17,8 @@ import Control.Applicative
import Data.Default.Class
import Data.Functor
import qualified Data.List as L
import Data.Maybe (fromMaybe)
import Data.Maybe
import Data.Typeable
import Data.Word (Word64)
import Options.Applicative (CommandFields, Mod, Parser)
import qualified Options.Applicative as OA
Expand Down Expand Up @@ -80,6 +82,35 @@ pCardanoTestnetCliOptions envCli = CardanoTestnetOptions
pAnyShelleyBasedEra' =
pAnyShelleyBasedEra envCli <&> (\(EraInEon x) -> AnyShelleyBasedEra x)

pAnyShelleyBasedEra :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pAnyShelleyBasedEra envCli =
asum $
mconcat
[
[ OA.flag' (EraInEon ShelleyBasedEraShelley) $
mconcat [OA.long "shelley-era", OA.help $ "Specify the Shelley era" <> deprecationText]
, OA.flag' (EraInEon ShelleyBasedEraAllegra) $
mconcat [OA.long "allegra-era", OA.help $ "Specify the Allegra era" <> deprecationText]
, OA.flag' (EraInEon ShelleyBasedEraMary) $
mconcat [OA.long "mary-era", OA.help $ "Specify the Mary era" <> deprecationText]
, OA.flag' (EraInEon ShelleyBasedEraAlonzo) $
mconcat [OA.long "alonzo-era", OA.help $ "Specify the Alonzo era" <> deprecationText]
, OA.flag' (EraInEon ShelleyBasedEraBabbage) $
mconcat [OA.long "babbage-era", OA.help $ "Specify the Babbage era (default)" <> deprecationText]
, fmap (EraInEon . convert) $ pConwayEra envCli
]
, maybeToList $ pure <$> envCliAnyEon envCli
, pure $ pure $ EraInEon ShelleyBasedEraConway
]
where
deprecationText :: String
deprecationText = " - DEPRECATED - will be removed in the future"

envCliAnyEon :: Typeable eon => Eon eon => EnvCli -> Maybe (EraInEon eon)
envCliAnyEon envCli' = do
AnyCardanoEra era <- envCliAnyCardanoEra envCli'
forEraInEonMaybe era EraInEon

pTestnetNodeOptions :: Parser [NodeOption]
pTestnetNodeOptions =
-- If `--num-pool-nodes N` is present, return N nodes with option `SpoNodeOptions []`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import qualified Data.Vector as Vector
import GHC.Exts (IsList (..))
import GHC.Stack (HasCallStack, withFrozenCallStack)
import qualified GHC.Stack as GHC
import RIO (runRIO)
import System.Directory (makeAbsolute)
import System.FilePath ((</>))

Expand Down Expand Up @@ -481,7 +482,6 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
readVerificationKeyFromFile
:: ( HasCallStack
, MonadIO m
, MonadCatch m
, MonadTest m
, HasTextEnvelope (VerificationKey keyrole)
, SerialiseAsBech32 (VerificationKey keyrole)
Expand All @@ -490,7 +490,7 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
-> File content direction
-> m (VerificationKey keyrole)
readVerificationKeyFromFile work =
H.evalEitherM . liftIO . runExceptT . readVerificationKeyOrFile . VerificationKeyFilePath . File . (work </>) . unFile
H.evalIO . runRIO () . readVerificationKeyOrFile . VerificationKeyFilePath . File . (work </>) . unFile

_verificationStakeKeyToStakeAddress :: Int -> VerificationKey StakeKey -> StakeAddress
_verificationStakeKeyToStakeAddress testnetMagic delegatorVKey =
Expand Down