Skip to content
Open
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
2 changes: 1 addition & 1 deletion bench/locli/locli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ test-suite test-locli
build-depends: cardano-prelude
, containers
, hedgehog
, hedgehog-extras ^>= 0.8
, hedgehog-extras ^>= 0.9
, locli
, text

Expand Down
3 changes: 2 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository cardano-haskell-packages
-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
index-state:
, hackage.haskell.org 2025-06-24T21:06:59Z
, hackage.haskell.org 2025-06-27T07:48:39Z
, cardano-haskell-packages 2025-09-18T12:21:32Z

packages:
Expand Down Expand Up @@ -60,6 +60,7 @@ package plutus-scripts-bench

allow-newer:
, katip:Win32
, hedgehog-extras

if impl (ghc >= 9.12)
allow-newer:
Expand Down
2 changes: 1 addition & 1 deletion cardano-node-chairman/cardano-node-chairman.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test-suite chairman-tests
, data-default-class
, filepath
, hedgehog
, hedgehog-extras ^>= 0.8
, hedgehog-extras ^>= 0.9
, network
, process
, random
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 @@ -265,7 +265,7 @@ test-suite cardano-node-test
, filepath
, hedgehog
, hedgehog-corpus
, hedgehog-extras ^>= 0.8
, hedgehog-extras ^>= 0.9
, iproute
, mtl
, ouroboros-consensus
Expand Down
4 changes: 4 additions & 0 deletions cardano-node/src/Cardano/Node/Protocol/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Cardano.Tracing.OrphanInstances.Shelley ()
import Ouroboros.Consensus.Cardano
import qualified Ouroboros.Consensus.Cardano as Consensus

import Control.Exception
import qualified Data.ByteString.Lazy as LB
import Data.Maybe (fromMaybe)
import Data.Text (Text)
Expand Down Expand Up @@ -167,6 +168,9 @@ data ByronProtocolInstantiationError =
| SigningKeyFilepathNotSpecified
deriving Show

instance Exception ByronProtocolInstantiationError where
displayException = docToString . prettyError

instance Error ByronProtocolInstantiationError where
prettyError (CanonicalDecodeFailure fp failure) =
"Canonical decode failure in " <> pshow fp
Expand Down
11 changes: 9 additions & 2 deletions cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ library

build-depends: aeson
, aeson-pretty
, annotated-exception
, ansi-terminal
, bytestring
, cardano-api ^>= 10.18
Expand Down Expand Up @@ -70,7 +71,7 @@ library
, extra
, filepath
, hedgehog
, hedgehog-extras ^>= 0.8
, hedgehog-extras ^>= 0.9
, http-conduit
, lens-aeson
, microlens
Expand All @@ -86,6 +87,8 @@ library
, process
, resourcet
, retry
, rio
, rio-orphans
, safe-exceptions
, scientific
, si-timers
Expand All @@ -98,6 +101,7 @@ library
, time
, transformers
, transformers-except
, unliftio
, vector
, yaml

Expand All @@ -111,17 +115,20 @@ library
Testnet.EpochStateProcessing
Testnet.Filepath
Testnet.Handlers
Testnet.Orphans
Testnet.Ping
Testnet.Process.Cli.DRep
Testnet.Process.Cli.Keys
Testnet.Process.Cli.SPO
Testnet.Process.Cli.Transaction
Testnet.Process.RunIO
Testnet.Process.Run
Testnet.Property.Assert
Testnet.Property.Run
Testnet.Property.Util
Testnet.Runtime
Testnet.Start.Byron
Testnet.Start.Cardano
Testnet.Start.Types
Testnet.SubmitApi
Testnet.TestQueryCmds
Expand All @@ -130,7 +137,6 @@ library
other-modules: Parsers.Cardano
Parsers.Help
Parsers.Version
Testnet.Start.Cardano
Testnet.TestEnumGenerator
Paths_cardano_testnet

Expand Down Expand Up @@ -265,6 +271,7 @@ test-suite cardano-testnet-test
, monad-control
, mtl
, process
, resourcet
, regex-compat
, rio
, tasty ^>= 1.5
Expand Down
36 changes: 18 additions & 18 deletions cardano-testnet/src/Parsers/Run.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Parsers.Run
Expand All @@ -11,13 +10,14 @@ module Parsers.Run
) where

import Cardano.CLI.Environment
import Control.Monad

import Data.Default.Class (def)
import Data.Foldable
import Options.Applicative
import qualified Options.Applicative as Opt

import Testnet.Property.Run
import RIO (runRIO)
import RIO.Orphans
import Testnet.Start.Cardano
import Testnet.Start.Types

Expand Down Expand Up @@ -60,8 +60,8 @@ createEnvOptions CardanoTestnetCreateEnvOptions
, createEnvGenesisOptions=genesisOptions
, createEnvOutputDir=outputDir
, createEnvCreateEnvOptions=ceOptions
} =
testnetRoutine (UserProvidedEnv outputDir) $ \conf -> do
} = do
conf <- mkConfigAbs outputDir
createTestnetEnv
testnetOptions genesisOptions ceOptions
-- Do not add hashes to the main config file, so that genesis files
Expand All @@ -70,25 +70,25 @@ createEnvOptions CardanoTestnetCreateEnvOptions

runCardanoOptions :: CardanoTestnetCliOptions -> IO ()
runCardanoOptions CardanoTestnetCliOptions
{ cliTestnetOptions=testnetOptions@CardanoTestnetOptions{cardanoOutputDir}
{ cliTestnetOptions=testnetOptions
, cliGenesisOptions=genesisOptions
, cliNodeEnvironment=env
, cliUpdateTimestamps=updateTimestamps
} =
, cliUpdateTimestamps=updateTimestamps'
} = do
case env of
NoUserProvidedEnv ->
NoUserProvidedEnv -> do
-- Create the sandbox, then run cardano-testnet.
-- It is not necessary to honor `cliUpdateTimestamps` here, because
-- the genesis files will be created with up-to-date stamps already.
runTestnet cardanoOutputDir $ \conf -> do
createTestnetEnv
testnetOptions genesisOptions def
conf
cardanoTestnet testnetOptions conf
UserProvidedEnv nodeEnvPath ->
conf <- mkConfigAbs "testnet"
runRIO () $ createTestnetEnv
testnetOptions genesisOptions def
conf
withResourceMap (\rm -> void . runRIO rm $ cardanoTestnet testnetOptions conf)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the advantage over:

Suggested change
withResourceMap (\rm -> void . runRIO rm $ cardanoTestnet testnetOptions conf)
void . runResourceT $ cardanoTestnet testnetOptions conf

?

UserProvidedEnv nodeEnvPath -> do
-- Run cardano-testnet in the sandbox provided by the user
-- In that case, 'cardanoOutputDir' is not used
runTestnet (UserProvidedEnv nodeEnvPath) $ \conf ->
cardanoTestnet
conf <- mkConfigAbs nodeEnvPath
withResourceMap (\rm -> void . runRIO rm $ cardanoTestnet
testnetOptions
conf{updateTimestamps=updateTimestamps}
conf{updateTimestamps=updateTimestamps'})
Loading
Loading