From cf36980b163d8ec11ab14aad22201dbe0ee22363 Mon Sep 17 00:00:00 2001 From: Felix Lipski Date: Mon, 8 Jan 2024 12:10:10 +0100 Subject: [PATCH 1/3] Remove direct imports from Cardano.Ledger --- cardano-cli/cardano-cli.cabal | 5 -- .../src/Cardano/CLI/Byron/Delegation.hs | 14 ++-- cardano-cli/src/Cardano/CLI/Byron/Parsers.hs | 4 +- cardano-cli/src/Cardano/CLI/Byron/Tx.hs | 5 +- .../EraBased/Commands/Governance/Actions.hs | 20 ++--- .../CLI/EraBased/Commands/Governance/Vote.hs | 6 +- .../Cardano/CLI/EraBased/Options/Common.hs | 19 ++--- .../EraBased/Options/Governance/Actions.hs | 3 +- .../EraBased/Options/Governance/Committee.hs | 8 +- .../CLI/EraBased/Options/Governance/DRep.hs | 8 +- .../CLI/EraBased/Run/CreateTestnetData.hs | 80 ++++++++---------- .../src/Cardano/CLI/EraBased/Run/Genesis.hs | 84 ++++++++----------- .../Cardano/CLI/EraBased/Run/Governance.hs | 3 +- .../CLI/EraBased/Run/Governance/Actions.hs | 3 +- .../CLI/EraBased/Run/Governance/Hash.hs | 9 +- .../src/Cardano/CLI/EraBased/Run/Key.hs | 4 +- .../src/Cardano/CLI/EraBased/Run/Query.hs | 52 +++++------- .../Cardano/CLI/EraBased/Run/Transaction.hs | 1 - cardano-cli/src/Cardano/CLI/Helpers.hs | 15 ++-- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 47 +++++------ .../src/Cardano/CLI/Legacy/Run/StakePool.hs | 4 +- cardano-cli/src/Cardano/CLI/Parser.hs | 8 +- cardano-cli/src/Cardano/CLI/Read.hs | 47 +++++------ cardano-cli/src/Cardano/CLI/Types/Common.hs | 14 ++-- cardano-cli/src/Cardano/CLI/Types/Output.hs | 1 - 25 files changed, 195 insertions(+), 269 deletions(-) diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index d7d62bf206..2146d7334b 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -203,12 +203,7 @@ library , cardano-crypto-wrapper ^>= 1.5.1 , cardano-data >= 1.1 , cardano-git-rev - , cardano-ledger-alonzo >= 1.6.0.0 - , cardano-ledger-binary >= 1.2 , cardano-ledger-byron >= 1.0.0.2 - , cardano-ledger-conway >= 1.10 - , cardano-ledger-core >= 1.8 - , cardano-ledger-shelley >=1.7.0.0 , cardano-ping ^>= 0.2.0.7 , cardano-prelude , cardano-slotting ^>= 0.1 diff --git a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs index 44577e42ae..f03f425465 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs @@ -14,6 +14,7 @@ module Cardano.CLI.Byron.Delegation where import Cardano.Api.Byron +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import qualified Cardano.Chain.Delegation as Dlg @@ -22,7 +23,6 @@ import Cardano.CLI.Byron.Key (ByronKeyFailure, renderByronKeyFailure) import Cardano.CLI.Types.Common (CertificateFile (..)) import Cardano.Crypto (ProtocolMagicId) import qualified Cardano.Crypto as Crypto -import Cardano.Ledger.Binary (Annotated (..), byronProtVer, serialize') import Cardano.Prelude (canonicalDecodePretty, canonicalEncodePretty) import Prelude hiding ((.)) @@ -103,18 +103,18 @@ checkDlgCert cert magic issuerVK' delegateVK' = ] ] where - magic' :: Annotated ProtocolMagicId ByteString - magic' = Annotated magic (serialize' byronProtVer magic) + magic' :: L.Annotated ProtocolMagicId ByteString + magic' = L.Annotated magic (L.serialize' L.byronProtVer magic) epoch :: EpochNumber - epoch = unAnnotated $ Dlg.aEpoch cert + epoch = L.unAnnotated $ Dlg.aEpoch cert cert' :: Dlg.ACertificate ByteString cert' = - let unannotated = cert { Dlg.aEpoch = Annotated epoch () + let unannotated = cert { Dlg.aEpoch = L.Annotated epoch () , Dlg.annotation = () } - in unannotated { Dlg.annotation = serialize' byronProtVer unannotated - , Dlg.aEpoch = Annotated epoch (serialize' byronProtVer epoch) } + in unannotated { Dlg.annotation = L.serialize' L.byronProtVer unannotated + , Dlg.aEpoch = L.Annotated epoch (L.serialize' L.byronProtVer epoch) } vkF :: forall r. Format r (Crypto.VerificationKey -> r) vkF = Crypto.fullVerificationKeyF diff --git a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs index cc38d1402c..b93a9a1465 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs @@ -27,6 +27,7 @@ module Cardano.CLI.Byron.Parsers import Cardano.Api hiding (GenesisParameters, UpdateProposal) import Cardano.Api.Byron (Address (..), ByronProtocolParametersUpdate (..), toByronLovelace) +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import Cardano.Api.Shelley (ReferenceScript (ReferenceScriptNone)) @@ -50,7 +51,6 @@ import Cardano.Crypto (RequiresNetworkMagic (..)) import Cardano.Crypto.Hashing (hashRaw) import Cardano.Crypto.ProtocolMagic (AProtocolMagic (..), ProtocolMagic, ProtocolMagicId (..)) -import Cardano.Ledger.Binary (Annotated (..)) import Control.Monad (when) import qualified Data.Attoparsec.ByteString.Char8 as Atto @@ -654,7 +654,7 @@ parseProtocolMagicId arg = parseProtocolMagic :: Parser ProtocolMagic parseProtocolMagic = - flip AProtocolMagic RequiresMagic . flip Annotated () + flip AProtocolMagic RequiresMagic . flip L.Annotated () <$> parseProtocolMagicId "protocol-magic" parseTxFile :: String -> Parser (TxFile In) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs index 8fa70d995a..a153a34b06 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs @@ -37,7 +37,6 @@ import qualified Cardano.Chain.UTxO as UTxO import Cardano.CLI.Byron.Key (byronWitnessToVerKey) import Cardano.CLI.Types.Common (TxFile) import qualified Cardano.Crypto.Signing as Crypto -import qualified Cardano.Ledger.Binary.Decoding as LedgerBinary import Ouroboros.Consensus.Byron.Ledger (ByronBlock, GenTx (..)) import qualified Ouroboros.Consensus.Byron.Ledger as Byron import Ouroboros.Consensus.Cardano.Block (EraMismatch (..)) @@ -215,8 +214,8 @@ fromCborTxAux lbs = <$> Binary.decodeFullDecoder "Cardano.Chain.UTxO.TxAux.fromCborTxAux" Binary.fromCBOR lbs where - annotationBytes :: Functor f => LB.ByteString -> f LedgerBinary.ByteSpan -> f B.ByteString - annotationBytes bytes = fmap (LB.toStrict . LedgerBinary.slice bytes) + annotationBytes :: Functor f => LB.ByteString -> f L.ByteSpan -> f B.ByteString + annotationBytes bytes = fmap (LB.toStrict . L.slice bytes) toCborTxAux :: UTxO.ATxAux ByteString -> LB.ByteString toCborTxAux = LB.fromStrict . UTxO.aTaAnnotation -- The ByteString anotation is the CBOR encoded version. diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index 3dfc58a2f3..6fcd72ef98 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -27,10 +27,6 @@ import Cardano.Api.Shelley import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key -import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo -import qualified Cardano.Ledger.BaseTypes as Ledger -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.SafeHash as Ledger import Data.Text (Text) import Data.Word @@ -52,7 +48,7 @@ data GoveranceActionUpdateCommitteeCmdArgs era , deposit :: !Lovelace , returnAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFile CommitteeColdKey] , newCommitteeVkeySource :: ![(VerificationKeyOrHashOrFile CommitteeColdKey, EpochNo)] , requiredQuorum :: !Rational @@ -68,9 +64,9 @@ data GovernanceActionCreateConstitutionCmdArgs era , stakeCredential :: !(VerificationKeyOrHashOrFile StakeKey) , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , constitutionUrl :: !ConstitutionUrl - , constitutionHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , constitutionHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , outFile :: !(File () Out) } deriving Show @@ -82,7 +78,7 @@ data GovernanceActionInfoCmdArgs era , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , outFile :: !(File () Out) } deriving Show @@ -93,7 +89,7 @@ data GovernanceActionCreateNoConfidenceCmdArgs era , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , governanceActionId :: !TxId , governanceActionIndex :: !Word32 , outFile :: !(File () Out) @@ -123,7 +119,7 @@ data GovernanceActionTreasuryWithdrawalCmdArgs era , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] , constitutionScriptHash :: !(Maybe ScriptHash) , outFile :: !(File () Out) @@ -144,7 +140,7 @@ data UpdateProtocolParametersConwayOnwards era , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , governanceActionId :: !(Maybe (TxId, Word32)) , constitutionScriptHash :: !(Maybe ScriptHash) } @@ -152,7 +148,7 @@ data UpdateProtocolParametersConwayOnwards era data CostModelsFile era = CostModelsFile { eon :: !(AlonzoEraOnwards era) - , costModelsFile :: !(File Alonzo.CostModels In) + , costModelsFile :: !(File Ledger.CostModels In) } deriving Show deriving instance Show (UpdateProtocolParametersConwayOnwards era) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs index a86fe9855f..8ca7ec2a09 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs @@ -9,13 +9,11 @@ module Cardano.CLI.EraBased.Commands.Governance.Vote , GovernanceVoteCreateCmdArgs(..) , renderGovernanceVoteCmds ) where +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import Cardano.CLI.Types.Common import Cardano.CLI.Types.Governance -import qualified Cardano.Ledger.BaseTypes as Ledger -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.SafeHash as Ledger import Data.Text (Text) import Data.Word @@ -32,7 +30,7 @@ data GovernanceVoteCreateCmdArgs era , voteChoice :: Vote , governanceAction :: (TxId, Word32) , votingStakeCredentialSource :: AnyVotingStakeVerificationKeyOrHashOrFile - , mAnchor :: Maybe (VoteUrl, Ledger.SafeHash Crypto.StandardCrypto Ledger.AnchorData) + , mAnchor :: Maybe (VoteUrl, Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) , outFile :: VoteFile Out } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 3ea68d284e..b35006fd20 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -12,6 +12,7 @@ module Cardano.CLI.EraBased.Options.Common where import Cardano.Api +import qualified Cardano.Api.Ledger as L import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Pretty import Cardano.Api.Shelley @@ -24,10 +25,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key import Cardano.CLI.Types.Key.VerificationKey -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.SafeHash as L -import qualified Cardano.Ledger.Shelley.API as Shelley import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import Control.Monad (mfilter) @@ -489,14 +486,14 @@ pOutputFile = , Opt.completer (Opt.bashCompleter "file") ] -pMIRPot :: Parser Shelley.MIRPot +pMIRPot :: Parser L.MIRPot pMIRPot = asum - [ Opt.flag' Shelley.ReservesMIR $ mconcat + [ Opt.flag' L.ReservesMIR $ mconcat [ Opt.long "reserves" , Opt.help "Use the reserves pot." ] - , Opt.flag' Shelley.TreasuryMIR $ mconcat + , Opt.flag' L.TreasuryMIR $ mconcat [ Opt.long "treasury" , Opt.help "Use the treasury pot." ] @@ -902,7 +899,7 @@ pConstitutionUrl = ConstitutionUrl <$> pUrl "constitution-url" "Constitution URL." -pConstitutionHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData) +pConstitutionHash :: Parser (L.SafeHash L.StandardCrypto L.AnchorData) pConstitutionHash = Opt.option readSafeHash $ mconcat [ Opt.long "constitution-hash" @@ -3123,12 +3120,12 @@ pAlwaysAbstain = , Opt.help "Abstain from voting on all proposals." ] -pVoteAnchor :: Parser (VoteUrl, L.SafeHash Crypto.StandardCrypto L.AnchorData) +pVoteAnchor :: Parser (VoteUrl, L.SafeHash L.StandardCrypto L.AnchorData) pVoteAnchor = (,) <$> (VoteUrl <$> pUrl "anchor-url" "Vote anchor URL") <*> pVoteAnchorDataHash -pVoteAnchorDataHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData) +pVoteAnchorDataHash :: Parser (L.SafeHash L.StandardCrypto L.AnchorData) pVoteAnchorDataHash = Opt.option readSafeHash $ mconcat [ Opt.long "anchor-data-hash" @@ -3220,7 +3217,7 @@ pAnchorUrl = ProposalUrl <$> pUrl "anchor-url" "Anchor URL" -pAnchorDataHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData) +pAnchorDataHash :: Parser (L.SafeHash L.StandardCrypto L.AnchorData) pAnchorDataHash = Opt.option readSafeHash $ mconcat [ Opt.long "anchor-data-hash" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index 53e056a97b..4d49dcc191 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -8,13 +8,12 @@ module Cardano.CLI.EraBased.Options.Governance.Actions import Cardano.Api import Cardano.Api.Ledger +import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Actions as Cmd import Cardano.CLI.EraBased.Options.Common import Cardano.CLI.Types.Common -import Cardano.Ledger.BaseTypes (NonNegativeInterval) -import qualified Cardano.Ledger.BaseTypes as Ledger import Data.Foldable import GHC.Natural (Natural) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Committee.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Committee.hs index cc56db0a11..7538c00159 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Committee.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Committee.hs @@ -6,13 +6,11 @@ module Cardano.CLI.EraBased.Options.Governance.Committee ) where import Cardano.Api +import qualified Cardano.Api.Ledger as L import Cardano.CLI.EraBased.Commands.Governance.Committee import Cardano.CLI.EraBased.Options.Common hiding (pAnchorUrl) import Cardano.CLI.Read -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.SafeHash as L import Options.Applicative (Parser) import qualified Options.Applicative as Opt @@ -135,7 +133,7 @@ pGovernanceCommitteeCreateColdKeyResignationCertificateCmd era = do pOutputFile ) -pAnchor :: Parser (Maybe (L.Anchor Crypto.StandardCrypto)) +pAnchor :: Parser (Maybe (L.Anchor L.StandardCrypto)) pAnchor = Opt.optional $ L.Anchor @@ -147,7 +145,7 @@ pAnchorUrl = AnchorUrl <$> pUrl "resignation-metadata-url" "Constitutional Committee cold key resignation certificate URL" -pSafeHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData) +pSafeHash :: Parser (L.SafeHash L.StandardCrypto L.AnchorData) pSafeHash = Opt.option readSafeHash $ mconcat [ Opt.long "resignation-metadata-hash" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs index e6b83928e4..81c8b98abf 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/DRep.hs @@ -9,6 +9,7 @@ module Cardano.CLI.EraBased.Options.Governance.DRep , pUpdateCertificateCmd) where import Cardano.Api +import qualified Cardano.Api.Ledger as L import Cardano.CLI.Environment import Cardano.CLI.EraBased.Commands.Governance.DRep @@ -17,9 +18,6 @@ import Cardano.CLI.Parser import Cardano.CLI.Read import Cardano.CLI.Types.Common import Cardano.CLI.Types.Key -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.SafeHash as L import Control.Applicative import Data.Foldable @@ -108,7 +106,7 @@ pRegistrationCertificateCmd era = do <*> pDRepMetadata <*> pOutputFile -pDRepMetadata :: Parser (Maybe (L.Anchor Crypto.StandardCrypto)) +pDRepMetadata :: Parser (Maybe (L.Anchor L.StandardCrypto)) pDRepMetadata = optional $ L.Anchor @@ -120,7 +118,7 @@ pDrepMetadataUrl = AnchorUrl <$> pUrl "drep-metadata-url" "DRep anchor URL" -pDrepMetadataHash :: Parser (L.SafeHash Crypto.StandardCrypto L.AnchorData) +pDrepMetadataHash :: Parser (L.SafeHash L.StandardCrypto L.AnchorData) pDrepMetadataHash = Opt.option readSafeHash $ mconcat [ Opt.long "drep-metadata-hash" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs index 11bf455a6a..9084638da0 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs @@ -26,6 +26,7 @@ module Cardano.CLI.EraBased.Run.CreateTestnetData ) where import Cardano.Api +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Genesis as Cmd @@ -47,14 +48,6 @@ import qualified Cardano.CLI.Types.Key as Keys import Cardano.Crypto.Hash (HashAlgorithm) import qualified Cardano.Crypto.Hash as Hash import qualified Cardano.Crypto.Random as Crypto -import qualified Cardano.Ledger.BaseTypes as Ledger -import Cardano.Ledger.Binary (ToCBOR (..)) -import Cardano.Ledger.Coin (Coin (..)) -import Cardano.Ledger.Core (ppMinUTxOValueL) -import Cardano.Ledger.Crypto (ADDRHASH, Crypto, StandardCrypto) -import Cardano.Ledger.Era () -import qualified Cardano.Ledger.Keys as Ledger -import qualified Cardano.Ledger.Shelley.API as Ledger import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..)) import Control.DeepSeq (NFData, force) @@ -301,8 +294,8 @@ runGenesisCreateTestNetDataCmd Cmd.GenesisCreateTestNetDataCmdArgs let network = toShelleyNetwork actualNetworkId stuffedUtxoAddrs <- liftIO $ Lazy.replicateM (fromIntegral numStuffedUtxo) $ genStuffedAddress network - let stake = second Ledger.ppId . mkDelegationMapEntry <$> delegations - stakePools = [ (Ledger.ppId poolParams', poolParams') | poolParams' <- snd . mkDelegationMapEntry <$> delegations ] + let stake = second L.ppId . mkDelegationMapEntry <$> delegations + stakePools = [ (L.ppId poolParams', poolParams') | poolParams' <- snd . mkDelegationMapEntry <$> delegations ] delegAddrs = dInitialUtxoAddr <$> delegations !shelleyGenesis' <- updateOutputTemplate @@ -319,7 +312,7 @@ runGenesisCreateTestNetDataCmd Cmd.GenesisCreateTestNetDataCmdArgs poolsDir = outputDir "pools-keys" stakeDelegatorsDir = outputDir "stake-delegators" numStakeDelegators = case stakeDelegators of OnDisk n -> n; Transient n -> n - mkDelegationMapEntry :: Delegation -> (Ledger.KeyHash Ledger.Staking StandardCrypto, Ledger.PoolParams StandardCrypto) + mkDelegationMapEntry :: Delegation -> (L.KeyHash L.Staking L.StandardCrypto, L.PoolParams L.StandardCrypto) mkDelegationMapEntry d = (dDelegStaking d, dPoolParams d) -- | The output format used all along this file @@ -367,24 +360,24 @@ mkPaths numKeys dir segment filename = fromList [(fromIntegral idx, dir (segment <> show idx) filename) | idx <- [1 .. numKeys]] -genStuffedAddress :: Ledger.Network -> IO (AddressInEra ShelleyEra) +genStuffedAddress :: L.Network -> IO (AddressInEra ShelleyEra) genStuffedAddress network = shelleyAddressInEra ShelleyBasedEraShelley <$> (ShelleyAddress <$> pure network - <*> (Ledger.KeyHashObj . mkKeyHash . read64BitInt + <*> (L.KeyHashObj . mkKeyHash . read64BitInt <$> Crypto.runSecureRandom (getRandomBytes 8)) - <*> pure Ledger.StakeRefNull) + <*> pure L.StakeRefNull) where read64BitInt :: ByteString -> Int read64BitInt = (fromIntegral :: Word64 -> Int) . Bin.runGet Bin.getWord64le . LBS.fromStrict mkDummyHash :: forall h a. HashAlgorithm h => Proxy h -> Int -> Hash.Hash h a - mkDummyHash _ = coerce . Ledger.hashWithSerialiser @h toCBOR + mkDummyHash _ = coerce . L.hashWithSerialiser @h L.toCBOR - mkKeyHash :: forall c discriminator. Crypto c => Int -> Ledger.KeyHash discriminator c - mkKeyHash = Ledger.KeyHash . mkDummyHash (Proxy @(ADDRHASH c)) + mkKeyHash :: forall c discriminator. L.Crypto c => Int -> L.KeyHash discriminator c + mkKeyHash = L.KeyHash . mkDummyHash (Proxy @(L.ADDRHASH c)) createDelegateKeys :: KeyOutputFormat -> FilePath -> ExceptT GenesisCmdError IO () createDelegateKeys fmt dir = do @@ -480,8 +473,8 @@ createPoolCredentials fmt dir = do data Delegation = Delegation { dInitialUtxoAddr :: !(AddressInEra ShelleyEra) - , dDelegStaking :: !(Ledger.KeyHash Ledger.Staking StandardCrypto) - , dPoolParams :: !(Ledger.PoolParams StandardCrypto) + , dDelegStaking :: !(L.KeyHash L.Staking L.StandardCrypto) + , dPoolParams :: !(L.PoolParams L.StandardCrypto) } deriving (Generic, NFData) @@ -489,8 +482,8 @@ buildPoolParams :: NetworkId -> FilePath -- ^ File directory where the necessary pool credentials were created -> Maybe Word - -> Map Word [Ledger.StakePoolRelay] -- ^ User submitted stake pool relay map - -> ExceptT GenesisCmdError IO (Ledger.PoolParams StandardCrypto) + -> Map Word [L.StakePoolRelay] -- ^ User submitted stake pool relay map + -> ExceptT GenesisCmdError IO (L.PoolParams L.StandardCrypto) buildPoolParams nw dir index specifiedRelays = do StakePoolVerificationKey poolColdVK <- firstExceptT (GenesisCmdStakePoolCmdError . StakePoolCmdReadFileError) @@ -503,21 +496,21 @@ buildPoolParams nw dir index specifiedRelays = do <- firstExceptT GenesisCmdTextEnvReadFileError . newExceptT $ readFileTextEnvelope (AsVerificationKey AsStakeKey) poolRewardVKF - pure Ledger.PoolParams - { Ledger.ppId = Ledger.hashKey poolColdVK - , Ledger.ppVrf = Ledger.hashVerKeyVRF poolVrfVK - , Ledger.ppPledge = Ledger.Coin 0 - , Ledger.ppCost = Ledger.Coin 0 - , Ledger.ppMargin = minBound - , Ledger.ppRewardAcnt = + pure L.PoolParams + { L.ppId = L.hashKey poolColdVK + , L.ppVrf = L.hashVerKeyVRF poolVrfVK + , L.ppPledge = L.Coin 0 + , L.ppCost = L.Coin 0 + , L.ppMargin = minBound + , L.ppRewardAcnt = toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK) - , Ledger.ppOwners = mempty - , Ledger.ppRelays = lookupPoolRelay specifiedRelays - , Ledger.ppMetadata = Ledger.SNothing + , L.ppOwners = mempty + , L.ppRelays = lookupPoolRelay specifiedRelays + , L.ppMetadata = L.SNothing } where lookupPoolRelay - :: Map Word [Ledger.StakePoolRelay] -> Seq.StrictSeq Ledger.StakePoolRelay + :: Map Word [L.StakePoolRelay] -> Seq.StrictSeq L.StakePoolRelay lookupPoolRelay m = case index of Nothing -> mempty @@ -531,7 +524,7 @@ buildPoolParams nw dir index specifiedRelays = do computeDelegation :: NetworkId -> FilePath - -> Ledger.PoolParams StandardCrypto + -> L.PoolParams L.StandardCrypto -> ExceptT GenesisCmdError IO Delegation computeDelegation nw delegDir dPoolParams = do payVK <- readVKeyFromDisk AsPaymentKey payVKF @@ -539,7 +532,7 @@ computeDelegation nw delegDir dPoolParams = do let paymentCredential = PaymentCredentialByKey $ verificationKeyHash payVK stakeAddrRef = StakeAddressByValue $ StakeCredentialByKey $ verificationKeyHash stakeVK dInitialUtxoAddr = makeShelleyAddressInEra ShelleyBasedEraShelley nw paymentCredential stakeAddrRef - dDelegStaking = Ledger.hashKey $ unStakeVerificationKey stakeVK + dDelegStaking = L.hashKey $ unStakeVerificationKey stakeVK pure $ Delegation { dInitialUtxoAddr, dDelegStaking, dPoolParams } where @@ -554,7 +547,7 @@ computeDelegation nw delegDir dPoolParams = do computeInsecureDelegation :: StdGen -> NetworkId - -> Ledger.PoolParams StandardCrypto + -> L.PoolParams L.StandardCrypto -> IO (StdGen, Delegation) computeInsecureDelegation g0 nw pool = do (paymentVK, g1) <- first getVerificationKey <$> generateInsecureSigningKey g0 AsPaymentKey @@ -565,7 +558,7 @@ computeInsecureDelegation g0 nw pool = do delegation <- pure $ force Delegation { dInitialUtxoAddr = shelleyAddressInEra ShelleyBasedEraShelley initialUtxoAddr - , dDelegStaking = Ledger.hashKey (unStakeVerificationKey stakeVK) + , dDelegStaking = L.hashKey (unStakeVerificationKey stakeVK) , dPoolParams = pool } @@ -578,14 +571,14 @@ updateOutputTemplate -> Map (Hash GenesisKey) (Hash GenesisDelegateKey, Hash VrfKey) -- ^ Genesis delegation (not stake-based) -> Maybe Lovelace -- ^ Total amount of lovelace -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> [(Ledger.KeyHash 'Ledger.StakePool StandardCrypto, Ledger.PoolParams StandardCrypto)] -- ^ Pool map - -> [(Ledger.KeyHash 'Ledger.Staking StandardCrypto, Ledger.KeyHash 'Ledger.StakePool StandardCrypto)] -- ^ Delegaton map + -> [(L.KeyHash 'L.StakePool L.StandardCrypto, L.PoolParams L.StandardCrypto)] -- ^ Pool map + -> [(L.KeyHash 'L.Staking L.StandardCrypto, L.KeyHash 'L.StakePool L.StandardCrypto)] -- ^ Delegaton map -> Maybe Lovelace -- ^ Amount of lovelace to delegate -> Int -- ^ Number of UTxO address for delegation -> [AddressInEra ShelleyEra] -- ^ UTxO address for delegation -> [AddressInEra ShelleyEra] -- ^ Stuffed UTxO addresses - -> ShelleyGenesis StandardCrypto -- ^ Template from which to build a genesis - -> m (ShelleyGenesis StandardCrypto) -- ^ Updated genesis + -> ShelleyGenesis L.StandardCrypto -- ^ Template from which to build a genesis + -> m (ShelleyGenesis L.StandardCrypto) -- ^ Updated genesis updateOutputTemplate (SystemStart sgSystemStart) genDelegMap mTotalSupply utxoAddrsNonDeleg pools stake @@ -643,10 +636,9 @@ updateOutputTemplate mkStuffedUtxo :: [AddressInEra ShelleyEra] -> [(AddressInEra ShelleyEra, Lovelace)] mkStuffedUtxo xs = (, Lovelace minUtxoVal) <$> xs - where Coin minUtxoVal = sgProtocolParams ^. ppMinUTxOValueL - + where L.Coin minUtxoVal = sgProtocolParams ^. L.ppMinUTxOValueL shelleyDelKeys = Map.fromList - [ (gh, Ledger.GenDelegPair gdh h) + [ (gh, L.GenDelegPair gdh h) | (GenesisKeyHash gh, (GenesisDelegateKeyHash gdh, VrfKeyHash h)) <- Map.toList genDelegMap ] @@ -656,7 +648,7 @@ updateOutputTemplate readAndDecodeShelleyGenesis :: FilePath - -> IO (Either GenesisCmdError (ShelleyGenesis StandardCrypto)) + -> IO (Either GenesisCmdError (ShelleyGenesis L.StandardCrypto)) readAndDecodeShelleyGenesis fpath = runExceptT $ do lbs <- handleIOExceptT (GenesisCmdGenesisFileReadError . FileIOError fpath) $ LBS.readFile fpath firstExceptT (GenesisCmdGenesisFileDecodeError fpath . Text.pack) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index f7aef6ffb4..7e6a026290 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -39,6 +39,7 @@ module Cardano.CLI.EraBased.Run.Genesis import Cardano.Api import Cardano.Api.Byron (toByronLovelace, toByronProtocolMagicId, toByronRequiresNetworkMagic) +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.Chain.Common (BlockCount (unBlockCount)) @@ -68,17 +69,6 @@ import Cardano.CLI.Types.Key import qualified Cardano.Crypto as CC import qualified Cardano.Crypto.Hash as Crypto import qualified Cardano.Crypto.Signing as Byron -import qualified Cardano.Ledger.Alonzo.Genesis as Alonzo -import qualified Cardano.Ledger.BaseTypes as Ledger -import Cardano.Ledger.Binary (Annotated (Annotated)) -import Cardano.Ledger.Coin (Coin (..)) -import qualified Cardano.Ledger.Conway.Genesis as Conway -import Cardano.Ledger.Core (ppMinUTxOValueL) -import Cardano.Ledger.Crypto (StandardCrypto) -import Cardano.Ledger.Era () -import qualified Cardano.Ledger.Keys as Ledger -import qualified Cardano.Ledger.Shelley.API as Ledger -import Cardano.Ledger.Shelley.Genesis (secondsToNominalDiffTimeMicro) import Cardano.Prelude (canonicalEncodePretty) import Cardano.Slotting.Slot (EpochSize (EpochSize)) import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..)) @@ -415,20 +405,20 @@ runGenesisCreateCardanoCmd overrideShelleyGenesis t = t { sgNetworkMagic = unNetworkMagic (toNetworkMagic network) , sgNetworkId = toShelleyNetwork network - , sgActiveSlotsCoeff = fromMaybe (error $ "Could not convert from Rational: " ++ show slotCoeff) $ Ledger.boundRational slotCoeff + , sgActiveSlotsCoeff = fromMaybe (error $ "Could not convert from Rational: " ++ show slotCoeff) $ L.boundRational slotCoeff , sgSecurityParam = unBlockCount security , sgUpdateQuorum = fromIntegral $ ((numGenesisKeys `div` 3) * 2) + 1 , sgEpochLength = EpochSize $ floor $ (fromIntegral (unBlockCount security) * 10) / slotCoeff , sgMaxLovelaceSupply = 45000000000000000 , sgSystemStart = getSystemStart start - , sgSlotLength = secondsToNominalDiffTimeMicro $ MkFixed (fromIntegral slotLength) * 1000 + , sgSlotLength = L.secondsToNominalDiffTimeMicro $ MkFixed (fromIntegral slotLength) * 1000 } shelleyGenesisTemplate' <- liftIO $ overrideShelleyGenesis . fromRight (error "shelley genesis template not found") <$> TN.readAndDecodeShelleyGenesis shelleyGenesisTemplate alonzoGenesis <- readAlonzoGenesis alonzoGenesisTemplate conwayGenesis <- readConwayGenesis conwayGenesisTemplate (delegateMap, vrfKeys, kesKeys, opCerts) <- liftIO $ generateShelleyNodeSecrets shelleyDelegateKeys shelleyGenesisvkeys let - shelleyGenesis :: ShelleyGenesis StandardCrypto + shelleyGenesis :: ShelleyGenesis L.StandardCrypto shelleyGenesis = updateTemplate start delegateMap Nothing [] mempty 0 [] [] shelleyGenesisTemplate' let GenesisDir rootdir = genesisDir @@ -500,7 +490,7 @@ runGenesisCreateCardanoCmd byronParams start = Byron.GenesisParameters (getSystemStart start) byronGenesisTemplate security byronNetwork byronBalance byronFakeAvvm byronAvvmFactor Nothing byronNetwork = CC.AProtocolMagic - (Annotated (toByronProtocolMagicId network) ()) + (L.Annotated (toByronProtocolMagicId network) ()) (toByronRequiresNetworkMagic network) byronBalance = TestnetBalanceOptions { tboRichmen = numGenesisKeys @@ -621,8 +611,8 @@ runGenesisCreateStakedCmd let network = toShelleyNetwork networkId stuffedUtxoAddrs <- liftIO $ Lazy.replicateM (fromIntegral numStuffedUtxo) $ TN.genStuffedAddress network - let stake = second Ledger.ppId . mkDelegationMapEntry <$> delegations - stakePools = [ (Ledger.ppId poolParams', poolParams') | poolParams' <- snd . mkDelegationMapEntry <$> delegations ] + let stake = second L.ppId . mkDelegationMapEntry <$> delegations + stakePools = [ (L.ppId poolParams', poolParams') | poolParams' <- snd . mkDelegationMapEntry <$> delegations ] delegAddrs = dInitialUtxoAddr <$> delegations !shelleyGenesis = updateOutputTemplate @@ -656,7 +646,7 @@ runGenesisCreateStakedCmd where adjustTemplate t = t { sgNetworkMagic = unNetworkMagic (toNetworkMagic networkId) } - mkDelegationMapEntry :: Delegation -> (Ledger.KeyHash Ledger.Staking StandardCrypto, Ledger.PoolParams StandardCrypto) + mkDelegationMapEntry :: Delegation -> (L.KeyHash L.Staking L.StandardCrypto, L.PoolParams L.StandardCrypto) mkDelegationMapEntry d = (dDelegStaking d, dPoolParams d) -- ------------------------------------------------------------------------------------------------- @@ -815,8 +805,8 @@ createPoolCredentials fmt dir index = do data Delegation = Delegation { dInitialUtxoAddr :: !(AddressInEra ShelleyEra) - , dDelegStaking :: !(Ledger.KeyHash Ledger.Staking StandardCrypto) - , dPoolParams :: !(Ledger.PoolParams StandardCrypto) + , dDelegStaking :: !(L.KeyHash L.Staking L.StandardCrypto) + , dPoolParams :: !(L.PoolParams L.StandardCrypto) } deriving (Generic, NFData) @@ -824,8 +814,8 @@ buildPoolParams :: NetworkId -> FilePath -- ^ File directory where the necessary pool credentials were created -> Maybe Word - -> Map Word [Ledger.StakePoolRelay] -- ^ User submitted stake pool relay map - -> ExceptT GenesisCmdError IO (Ledger.PoolParams StandardCrypto) + -> Map Word [L.StakePoolRelay] -- ^ User submitted stake pool relay map + -> ExceptT GenesisCmdError IO (L.PoolParams L.StandardCrypto) buildPoolParams nw dir index specifiedRelays = do StakePoolVerificationKey poolColdVK <- firstExceptT (GenesisCmdStakePoolCmdError . StakePoolCmdReadFileError) @@ -838,21 +828,21 @@ buildPoolParams nw dir index specifiedRelays = do <- firstExceptT GenesisCmdTextEnvReadFileError . newExceptT $ readFileTextEnvelope (AsVerificationKey AsStakeKey) poolRewardVKF - pure Ledger.PoolParams - { Ledger.ppId = Ledger.hashKey poolColdVK - , Ledger.ppVrf = Ledger.hashVerKeyVRF poolVrfVK - , Ledger.ppPledge = Ledger.Coin 0 - , Ledger.ppCost = Ledger.Coin 0 - , Ledger.ppMargin = minBound - , Ledger.ppRewardAcnt = + pure L.PoolParams + { L.ppId = L.hashKey poolColdVK + , L.ppVrf = L.hashVerKeyVRF poolVrfVK + , L.ppPledge = L.Coin 0 + , L.ppCost = L.Coin 0 + , L.ppMargin = minBound + , L.ppRewardAcnt = toShelleyStakeAddr $ makeStakeAddress nw $ StakeCredentialByKey (verificationKeyHash rewardsSVK) - , Ledger.ppOwners = mempty - , Ledger.ppRelays = lookupPoolRelay specifiedRelays - , Ledger.ppMetadata = Ledger.SNothing + , L.ppOwners = mempty + , L.ppRelays = lookupPoolRelay specifiedRelays + , L.ppMetadata = L.SNothing } where lookupPoolRelay - :: Map Word [Ledger.StakePoolRelay] -> Seq.StrictSeq Ledger.StakePoolRelay + :: Map Word [L.StakePoolRelay] -> Seq.StrictSeq L.StakePoolRelay lookupPoolRelay m = case index of Nothing -> mempty @@ -894,7 +884,7 @@ writeBulkPoolCredentials dir bulkIx poolIxs = do computeInsecureDelegation :: StdGen -> NetworkId - -> Ledger.PoolParams StandardCrypto + -> L.PoolParams L.StandardCrypto -> IO (StdGen, Delegation) computeInsecureDelegation g0 nw pool = do (paymentVK, g1) <- first getVerificationKey <$> generateInsecureSigningKey g0 AsPaymentKey @@ -905,7 +895,7 @@ computeInsecureDelegation g0 nw pool = do delegation <- pure $ force Delegation { dInitialUtxoAddr = shelleyAddressInEra ShelleyBasedEraShelley initialUtxoAddr - , dDelegStaking = Ledger.hashKey (unStakeVerificationKey stakeVK) + , dDelegStaking = L.hashKey (unStakeVerificationKey stakeVK) , dPoolParams = pool } @@ -915,8 +905,8 @@ computeInsecureDelegation g0 nw pool = do -- and if not found creates a default Shelley genesis. readShelleyGenesisWithDefault :: FilePath - -> (ShelleyGenesis StandardCrypto -> ShelleyGenesis StandardCrypto) - -> ExceptT GenesisCmdError IO (ShelleyGenesis StandardCrypto) + -> (ShelleyGenesis L.StandardCrypto -> ShelleyGenesis L.StandardCrypto) + -> ExceptT GenesisCmdError IO (ShelleyGenesis L.StandardCrypto) readShelleyGenesisWithDefault fpath adjustDefaults = do newExceptT (TN.readAndDecodeShelleyGenesis fpath) `catchError` \err -> @@ -925,7 +915,7 @@ readShelleyGenesisWithDefault fpath adjustDefaults = do | isDoesNotExistError ioe -> writeDefault _ -> left err where - defaults :: ShelleyGenesis StandardCrypto + defaults :: ShelleyGenesis L.StandardCrypto defaults = adjustDefaults shelleyGenesisDefaults writeDefault = do @@ -938,12 +928,12 @@ updateTemplate -> Map (Hash GenesisKey) (Hash GenesisDelegateKey, Hash VrfKey) -- ^ Genesis delegation (not stake-based) -> Maybe Lovelace -- ^ Amount of lovelace not delegated -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> Map (Ledger.KeyHash 'Ledger.Staking StandardCrypto) (Ledger.PoolParams StandardCrypto) -- ^ Genesis staking: pools/delegation map & delegated initial UTxO spec + -> Map (L.KeyHash 'L.Staking L.StandardCrypto) (L.PoolParams L.StandardCrypto) -- ^ Genesis staking: pools/delegation map & delegated initial UTxO spec -> Lovelace -- ^ Number of UTxO Addresses for delegation -> [AddressInEra ShelleyEra] -- ^ UTxO Addresses for delegation -> [AddressInEra ShelleyEra] -- ^ Stuffed UTxO addresses - -> ShelleyGenesis StandardCrypto -- ^ Template from which to build a genesis - -> ShelleyGenesis StandardCrypto -- ^ Updated genesis + -> ShelleyGenesis L.StandardCrypto -- ^ Template from which to build a genesis + -> ShelleyGenesis L.StandardCrypto -- ^ Updated genesis updateTemplate (SystemStart start) genDelegMap mAmountNonDeleg utxoAddrsNonDeleg poolSpecs (Lovelace amountDeleg) utxoAddrsDeleg stuffedUtxoAddrs @@ -963,9 +953,9 @@ updateTemplate (SystemStart start) , sgStaking = ShelleyGenesisStaking { sgsPools = ListMap.fromList - [ (Ledger.ppId poolParams, poolParams) + [ (L.ppId poolParams, poolParams) | poolParams <- Map.elems poolSpecs ] - , sgsStake = ListMap.fromMap $ Ledger.ppId <$> poolSpecs + , sgsStake = ListMap.fromMap $ L.ppId <$> poolSpecs } , sgProtocolParams = pparamsFromTemplate } @@ -999,11 +989,11 @@ updateTemplate (SystemStart start) mkStuffedUtxo :: [AddressInEra ShelleyEra] -> [(AddressInEra ShelleyEra, Lovelace)] mkStuffedUtxo xs = (, Lovelace minUtxoVal) <$> xs - where Coin minUtxoVal = sgProtocolParams template ^. ppMinUTxOValueL + where L.Coin minUtxoVal = sgProtocolParams template ^. L.ppMinUTxOValueL shelleyDelKeys = Map.fromList - [ (gh, Ledger.GenDelegPair gdh h) + [ (gh, L.GenDelegPair gdh h) | (GenesisKeyHash gh, (GenesisDelegateKeyHash gdh, VrfKeyHash h)) <- Map.toList genDelegMap ] @@ -1178,7 +1168,7 @@ runGenesisHashFileCmd (GenesisFile fpath) = do readAlonzoGenesis :: FilePath - -> ExceptT GenesisCmdError IO Alonzo.AlonzoGenesis + -> ExceptT GenesisCmdError IO L.AlonzoGenesis readAlonzoGenesis fpath = do lbs <- handleIOExceptT (GenesisCmdGenesisFileError . FileIOError fpath) $ LBS.readFile fpath firstExceptT (GenesisCmdAesonDecodeError fpath . Text.pack) @@ -1186,7 +1176,7 @@ readAlonzoGenesis fpath = do readConwayGenesis :: FilePath - -> ExceptT GenesisCmdError IO (Conway.ConwayGenesis StandardCrypto) + -> ExceptT GenesisCmdError IO (L.ConwayGenesis L.StandardCrypto) readConwayGenesis fpath = do lbs <- handleIOExceptT (GenesisCmdGenesisFileError . FileIOError fpath) $ LBS.readFile fpath firstExceptT (GenesisCmdAesonDecodeError fpath . Text.pack) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index 7951f863a7..7aba46f9a4 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -29,7 +29,6 @@ import Cardano.CLI.EraBased.Run.Governance.Poll import Cardano.CLI.EraBased.Run.Governance.Vote import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceCmdError -import qualified Cardano.Ledger.Shelley.API as Shelley import Control.Monad import Control.Monad.Trans.Except (ExceptT) @@ -80,7 +79,7 @@ runGovernanceCmds = \case runGovernanceMIRCertificatePayStakeAddrs :: ShelleyToBabbageEra era - -> Shelley.MIRPot + -> Ledger.MIRPot -> [StakeAddress] -- ^ Stake addresses -> [Lovelace] -- ^ Corresponding reward amounts (same length) -> File () Out diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 0670f9eedc..ae61bfd0e1 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -23,7 +23,6 @@ import Cardano.CLI.Read import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.GovernanceActionsError import Cardano.CLI.Types.Key -import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo import Control.Monad import Control.Monad.Except (ExceptT) @@ -312,7 +311,7 @@ readStakeKeyHash stake = addCostModelsToEraBasedProtocolParametersUpdate :: AlonzoEraOnwards era - -> Alonzo.CostModels + -> Ledger.CostModels -> EraBasedProtocolParametersUpdate era -> EraBasedProtocolParametersUpdate era addCostModelsToEraBasedProtocolParametersUpdate diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs index ca9fd7003a..ef9cf0a62d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs @@ -14,6 +14,7 @@ module Cardano.CLI.EraBased.Run.Governance.Hash ) where import Cardano.Api +import qualified Cardano.Api.Ledger as Ledger import qualified Cardano.CLI.EraBased.Commands.Governance.Hash as Cmd import Cardano.CLI.Read @@ -22,10 +23,6 @@ import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceCmdError import Cardano.CLI.Types.Errors.GovernanceHashError import Cardano.Crypto.Hash (hashToTextAsHex) -import qualified Cardano.Ledger.BaseTypes as Ledger -import Cardano.Ledger.Crypto -import Cardano.Ledger.SafeHash (extractHash) -import qualified Cardano.Ledger.SafeHash as Ledger import Control.Monad.Trans.Except import Control.Monad.Trans.Except.Extra @@ -66,12 +63,12 @@ runGovernanceHashAnchorDataCmd Cmd.GovernanceHashAnchorDataCmdArgs { toHash, mou let hash = Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 text printHash hash where - printHash :: Ledger.SafeHash StandardCrypto i -> ExceptT GovernanceHashError IO () + printHash :: Ledger.SafeHash Ledger.StandardCrypto i -> ExceptT GovernanceHashError IO () printHash hash = do firstExceptT GovernanceHashWriteFileError $ newExceptT $ writeTextOutput moutFile text where - text = hashToTextAsHex . extractHash $ hash + text = hashToTextAsHex . Ledger.extractHash $ hash runGovernanceHashScriptCmd :: () => Cmd.GovernanceHashScriptCmdArgs era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs index c8128e071a..0d369edf89 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs @@ -31,6 +31,7 @@ module Cardano.CLI.EraBased.Run.Key import Cardano.Api import qualified Cardano.Api.Byron as ByronApi import Cardano.Api.Crypto.Ed25519Bip32 (xPrvFromBytes) +import qualified Cardano.Api.Ledger as L import qualified Cardano.CLI.Byron.Key as Byron import qualified Cardano.CLI.EraBased.Commands.Key as Cmd @@ -44,7 +45,6 @@ import qualified Cardano.Crypto.Signing as Byron import qualified Cardano.Crypto.Signing as Byron.Crypto import qualified Cardano.Crypto.Signing as Crypto import qualified Cardano.Crypto.Wallet as Crypto -import qualified Cardano.Ledger.Keys as Shelley import qualified Codec.Binary.Bech32 as Bech32 import qualified Control.Exception as Exception @@ -392,7 +392,7 @@ convertITNVerificationKey :: Text -> Either ItnKeyConversionError (VerificationK convertITNVerificationKey pubKey = do (_, _, keyBS) <- first ItnKeyBech32DecodeError (decodeBech32 pubKey) case DSIGN.rawDeserialiseVerKeyDSIGN keyBS of - Just verKey -> Right . StakeVerificationKey $ Shelley.VKey verKey + Just verKey -> Right . StakeVerificationKey $ L.VKey verKey Nothing -> Left $ ItnVerificationKeyDeserialisationError keyBS -- | Convert private ed22519 key to a Shelley signing key. diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index 28e79f04d4..ae83f0642f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -41,7 +41,6 @@ import Cardano.Api hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api as Api import Cardano.Api.Byron hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api.Ledger as L -import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Pretty import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) @@ -57,15 +56,6 @@ import Cardano.CLI.Types.Key import qualified Cardano.CLI.Types.Output as O import Cardano.Crypto.Hash (hashToBytesAsHex) import qualified Cardano.Crypto.Hash.Blake2b as Blake2b -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.Core as Core -import qualified Cardano.Ledger.Credential as L -import qualified Cardano.Ledger.Crypto as Crypto -import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..)) -import Cardano.Ledger.SafeHash (SafeHash) -import Cardano.Ledger.Shelley.LedgerState - (PState (psFutureStakePoolParams, psRetiring, psStakePoolParams)) -import qualified Cardano.Ledger.Shelley.LedgerState as SL import Cardano.Slotting.EpochInfo (EpochInfo (..), epochInfoSlotToUTCTime, hoistEpochInfo) import Ouroboros.Consensus.BlockchainTime.WallClock.Types (RelativeTime (..), toRelativeTime) @@ -165,7 +155,7 @@ runQueryConstitutionHashCmd where writeConstitutionHash :: Maybe (File () Out) - -> Maybe (SafeHash StandardCrypto L.AnchorData) + -> Maybe (L.SafeHash L.StandardCrypto L.AnchorData) -> ExceptT QueryCmdError IO () writeConstitutionHash mOutFile' cHash = case mOutFile' of @@ -196,7 +186,7 @@ runQueryProtocolParametersCmd writeProtocolParameters :: ShelleyBasedEra era -> Maybe (File () Out) - -> Ledger.PParams (ShelleyLedgerEra era) + -> L.PParams (ShelleyLedgerEra era) -> ExceptT QueryCmdError IO () writeProtocolParameters sbe mOutFile' pparams = let apiPParamsJSON = (encodePretty $ fromLedgerPParams sbe pparams) @@ -557,7 +547,7 @@ runQueryKesPeriodInfoCmd opCertOnDiskAndStateCounters :: forall era . () => Consensus.PraosProtocolSupportsNode (ConsensusProtocol era) => FromCBOR (Consensus.ChainDepState (ConsensusProtocol era)) - => Crypto.ADDRHASH (Consensus.PraosProtocolSupportsNodeCrypto (ConsensusProtocol era)) ~ Blake2b.Blake2b_224 + => L.ADDRHASH (Consensus.PraosProtocolSupportsNodeCrypto (ConsensusProtocol era)) ~ Blake2b.Blake2b_224 => ProtocolState era -> OperationalCertificate -> ExceptT QueryCmdError IO (OpCertOnDiskCounter, Maybe OpCertNodeStateCounter) @@ -938,7 +928,7 @@ writeLedgerState mOutFile qState@(SerialisedDebugLedgerState serLedgerState) = writeStakeSnapshots :: forall era ledgerera. () => ShelleyLedgerEra era ~ ledgerera - => Core.EraCrypto ledgerera ~ StandardCrypto + => L.EraCrypto ledgerera ~ StandardCrypto => Maybe (File () Out) -> SerialisedStakeSnapshots era -> ExceptT QueryCmdError IO () @@ -953,25 +943,25 @@ writeStakeSnapshots mOutFile qState = do -- .nesEs.esLState.lsDPState.dpsPState.psStakePoolParams. writePoolState :: forall era ledgerera. () => ShelleyLedgerEra era ~ ledgerera - => Core.EraCrypto ledgerera ~ StandardCrypto - => Core.Era ledgerera + => L.EraCrypto ledgerera ~ StandardCrypto + => L.Era ledgerera => SerialisedPoolState era -> ExceptT QueryCmdError IO () writePoolState serialisedCurrentEpochState = do PoolState poolState <- pure (decodePoolState serialisedCurrentEpochState) & onLeft (left . QueryCmdPoolStateDecodeError) - let hks = Set.toList $ Set.fromList $ Map.keys (psStakePoolParams poolState) - <> Map.keys (psFutureStakePoolParams poolState) <> Map.keys (psRetiring poolState) + let hks = Set.toList $ Set.fromList $ Map.keys (L.psStakePoolParams poolState) + <> Map.keys (L.psFutureStakePoolParams poolState) <> Map.keys (L.psRetiring poolState) - let poolStates :: Map (KeyHash 'StakePool StandardCrypto) (Params StandardCrypto) + let poolStates :: Map (L.KeyHash 'L.StakePool StandardCrypto) (Params StandardCrypto) poolStates = Map.fromList $ hks <&> ( \hk -> ( hk , Params - { poolParameters = Map.lookup hk (SL.psStakePoolParams poolState) - , futurePoolParameters = Map.lookup hk (SL.psFutureStakePoolParams poolState) - , retiringEpoch = Map.lookup hk (SL.psRetiring poolState) + { poolParameters = Map.lookup hk (L.psStakePoolParams poolState) + , futurePoolParameters = Map.lookup hk (L.psFutureStakePoolParams poolState) + , retiringEpoch = Map.lookup hk (L.psRetiring poolState) } ) ) @@ -1449,7 +1439,7 @@ runQueryDRepState drepStakeDistribution <- case includeStake of Cmd.WithStake -> runQuery localNodeConnInfo target $ - queryDRepStakeDistribution eon (Set.fromList $ Ledger.DRepCredential <$> drepCreds) + queryDRepStakeDistribution eon (Set.fromList $ L.DRepCredential <$> drepCreds) Cmd.NoStake -> return mempty writeOutput mOutFile $ @@ -1458,15 +1448,15 @@ runQueryDRepState drepStateToJson stakeDistr (cred, ds) = (cred,) . A.object $ if Map.null stakeDistr then - [ "expiry" .= (ds ^. Ledger.drepExpiryL) - , "anchor" .= (ds ^. Ledger.drepAnchorL) - , "deposit" .= (ds ^. Ledger.drepDepositL) + [ "expiry" .= (ds ^. L.drepExpiryL) + , "anchor" .= (ds ^. L.drepAnchorL) + , "deposit" .= (ds ^. L.drepDepositL) ] else - [ "expiry" .= (ds ^. Ledger.drepExpiryL) - , "anchor" .= (ds ^. Ledger.drepAnchorL) - , "deposit" .= (ds ^. Ledger.drepDepositL) - , "stake" .= Map.lookup (Ledger.DRepCredential cred) stakeDistr + [ "expiry" .= (ds ^. L.drepExpiryL) + , "anchor" .= (ds ^. L.drepAnchorL) + , "deposit" .= (ds ^. L.drepDepositL) + , "stake" .= Map.lookup (L.DRepCredential cred) stakeDistr ] runQueryDRepStakeDistribution @@ -1484,7 +1474,7 @@ runQueryDRepStakeDistribution } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath - let drepFromVrfKey = fmap Ledger.DRepCredential + let drepFromVrfKey = fmap L.DRepCredential . firstExceptT QueryCmdDRepKeyError . getDRepCredentialFromVerKeyHashOrFile drepKeys = case drepKeys' of diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index e53a7b52f5..4be66c5bdc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -48,7 +48,6 @@ import Cardano.CLI.Types.Errors.TxCmdError import Cardano.CLI.Types.Errors.TxValidationError import Cardano.CLI.Types.Output (renderScriptCosts) import Cardano.CLI.Types.TxFeature -import qualified Cardano.Ledger.Alonzo.Core as Ledger import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx diff --git a/cardano-cli/src/Cardano/CLI/Helpers.hs b/cardano-cli/src/Cardano/CLI/Helpers.hs index 02473017d6..7249b97ed8 100644 --- a/cardano-cli/src/Cardano/CLI/Helpers.hs +++ b/cardano-cli/src/Cardano/CLI/Helpers.hs @@ -16,6 +16,7 @@ module Cardano.CLI.Helpers , validateCBOR ) where +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import Cardano.Chain.Block (decCBORABlockOrBoundary) @@ -23,8 +24,6 @@ import qualified Cardano.Chain.Delegation as Delegation import qualified Cardano.Chain.Update as Update import qualified Cardano.Chain.UTxO as UTxO import Cardano.CLI.Types.Common -import Cardano.Ledger.Binary (byronProtVer, toPlainDecoder) -import Cardano.Ledger.Binary.Plain (Decoder, fromCBOR) import Codec.CBOR.Pretty (prettyHexEnc) import Codec.CBOR.Read (DeserialiseFailure, deserialiseFromBytes) @@ -70,7 +69,7 @@ renderHelpersError = \case decodeCBOR :: LB.ByteString - -> (forall s. Decoder s a) + -> (forall s. L.Decoder s a) -> Either HelpersError (LB.ByteString, a) decodeCBOR bs decoder = first CBORDecodingError $ deserialiseFromBytes decoder bs @@ -118,21 +117,21 @@ validateCBOR :: CBORObject -> LB.ByteString -> Either HelpersError Text validateCBOR cborObject bs = case cborObject of CBORBlockByron epochSlots -> do - void $ decodeCBOR bs (toPlainDecoder byronProtVer (decCBORABlockOrBoundary epochSlots)) + void $ decodeCBOR bs (L.toPlainDecoder L.byronProtVer (decCBORABlockOrBoundary epochSlots)) Right "Valid Byron block." CBORDelegationCertificateByron -> do - void $ decodeCBOR bs (fromCBOR :: Decoder s Delegation.Certificate) + void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Delegation.Certificate) Right "Valid Byron delegation certificate." CBORTxByron -> do - void $ decodeCBOR bs (fromCBOR :: Decoder s UTxO.Tx) + void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s UTxO.Tx) Right "Valid Byron Tx." CBORUpdateProposalByron -> do - void $ decodeCBOR bs (fromCBOR :: Decoder s Update.Proposal) + void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Update.Proposal) Right "Valid Byron update proposal." CBORVoteByron -> do - void $ decodeCBOR bs (fromCBOR :: Decoder s Update.Vote) + void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Update.Vote) Right "Valid Byron vote." diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 02c92558ed..2607bc9a64 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -25,11 +25,6 @@ import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), ShelleyLedgerEra, StakeAddress (..), fromShelleyPaymentCredential, fromShelleyStakeReference, toShelleyLovelace, toShelleyStakeCredential) -import qualified Cardano.Ledger.Conway.Governance as Gov -import qualified Cardano.Ledger.Conway.TxCert as ConwayLedger -import qualified Cardano.Ledger.Credential as Shelley -import qualified Cardano.Ledger.Shelley.API as Shelley - import Control.Monad.Trans (MonadIO) import Data.Aeson (Value (..), object, toJSON, (.=)) import qualified Data.Aeson as Aeson @@ -104,11 +99,11 @@ friendlyProposalImpl :: ConwayEraOnwards era -> Proposal era -> [Aeson.Pair] friendlyProposalImpl era (Proposal - (Gov.ProposalProcedure - { Gov.pProcDeposit - , Gov.pProcReturnAddr - , Gov.pProcGovAction - , Gov.pProcAnchor + (Ledger.ProposalProcedure + { Ledger.pProcDeposit + , Ledger.pProcReturnAddr + , Ledger.pProcGovAction + , Ledger.pProcAnchor } ) ) = conwayEraOnwardsConstraints era @@ -132,7 +127,7 @@ friendlyKeyWitness = ByronKeyWitness txInWitness -> ["Byron witness" .= textShow txInWitness] ShelleyBootstrapWitness _era bootstrapWitness -> ["bootstrap witness" .= textShow bootstrapWitness] - ShelleyKeyWitness _era (Shelley.WitVKey key signature) -> + ShelleyKeyWitness _era (Ledger.WitVKey key signature) -> ["key" .= textShow key, "signature" .= textShow signature] friendlyTxBodyImpl :: () @@ -413,25 +408,25 @@ renderCertificate sbe = \case , "certificate" .= conwayToObject w credential ] Ledger.AuthCommitteeHotKeyTxCert coldCred hotCred - | Shelley.ScriptHashObj sh <- coldCred -> + | Ledger.ScriptHashObj sh <- coldCred -> "Cold committee authorization" .= object [ "script hash" .= sh ] - | Shelley.ScriptHashObj sh <- hotCred -> + | Ledger.ScriptHashObj sh <- hotCred -> "Hot committee authorization" .= object [ "script hash" .= sh] - | Shelley.KeyHashObj ck@Shelley.KeyHash{} <- coldCred - , Shelley.KeyHashObj hk@Shelley.KeyHash{} <- hotCred -> + | Ledger.KeyHashObj ck@Ledger.KeyHash{} <- coldCred + , Ledger.KeyHashObj hk@Ledger.KeyHash{} <- hotCred -> "Constitutional committee member hot key registration" .= object [ "cold key hash" .= ck , "hot key hash" .= hk ] Ledger.ResignCommitteeColdTxCert cred anchor -> case cred of - Shelley.ScriptHashObj sh -> + Ledger.ScriptHashObj sh -> "Cold committee resignation" .= object [ "script hash" .= sh , "anchor" .= anchor ] - Shelley.KeyHashObj ck@Shelley.KeyHash{} -> + Ledger.KeyHashObj ck@Ledger.KeyHash{} -> "Constitutional committee cold key resignation" .= object [ "cold key hash" .= ck ] @@ -468,12 +463,12 @@ renderCertificate sbe = \case "Pool registration" .= object [ "pool params" .= poolParams ] - Ledger.RetirePoolTxCert kh@Shelley.KeyHash{} epoch -> + Ledger.RetirePoolTxCert kh@Ledger.KeyHash{} epoch -> "Pool retirement" .= object [ "stake pool key hash" .= kh , "epoch" .= epoch ] - ConwayLedger.UpdateDRepTxCert drepCredential mbAnchor -> + Ledger.UpdateDRepTxCert drepCredential mbAnchor -> "Drep certificate update" .= object [ "Drep credential" .= drepCredential , "anchor " .= mbAnchor @@ -481,7 +476,7 @@ renderCertificate sbe = \case where conwayToObject :: () => ConwayEraOnwards era - -> Shelley.Credential 'Shelley.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> Ledger.Credential 'Ledger.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value conwayToObject w' = conwayEraOnwardsConstraints w' $ @@ -492,7 +487,7 @@ renderCertificate sbe = \case delegateeJson :: ( Ledger.EraCrypto (ShelleyLedgerEra era) ~ Ledger.StandardCrypto) => ShelleyBasedEra era -> Ledger.Delegatee (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value delegateeJson _ = object . \case - Ledger.DelegStake hk@Shelley.KeyHash{} -> + Ledger.DelegStake hk@Ledger.KeyHash{} -> [ "delegatee type" .= String "stake" , "key hash" .= hk ] @@ -519,7 +514,7 @@ friendlyMirTarget sbe = \case -- TODO: Conway era. Replace cardano-api's StakeCredential definition with -- the ledger's StakeCredential definition. friendlyStakeCredential - :: Shelley.Credential Shelley.Staking Ledger.StandardCrypto -> Aeson.Pair + :: Ledger.Credential Ledger.Staking Ledger.StandardCrypto -> Aeson.Pair friendlyStakeCredential = \case Ledger.KeyHashObj keyHash -> "stake credential key hash" .= keyHash @@ -533,10 +528,10 @@ friendlyPaymentCredential = \case PaymentCredentialByScript scriptHash -> "payment credential script hash" .= scriptHash -friendlyMirPot :: Shelley.MIRPot -> Aeson.Value +friendlyMirPot :: Ledger.MIRPot -> Aeson.Value friendlyMirPot = \case - Shelley.ReservesMIR -> "reserves" - Shelley.TreasuryMIR -> "treasury" + Ledger.ReservesMIR -> "reserves" + Ledger.TreasuryMIR -> "treasury" friendlyRational :: Rational -> Aeson.Value @@ -554,7 +549,7 @@ friendlyFee = \case TxFeeExplicit _ fee -> friendlyLovelace $ toShelleyLovelace fee friendlyLovelace :: Ledger.Coin -> Aeson.Value -friendlyLovelace (Shelley.Coin value) = String $ textShow value <> " Lovelace" +friendlyLovelace (Ledger.Coin value) = String $ textShow value <> " Lovelace" friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs index 2d0d1b7a1f..d82e51519e 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs @@ -7,6 +7,7 @@ module Cardano.CLI.Legacy.Run.StakePool ) where import Cardano.Api +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.StakePool as Cmd @@ -15,7 +16,6 @@ import Cardano.CLI.Legacy.Commands.StakePool import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.StakePoolCmdError import Cardano.CLI.Types.Key (VerificationKeyOrFile) -import qualified Cardano.Ledger.Slot as Shelley import Control.Monad.Trans.Except (ExceptT) @@ -91,7 +91,7 @@ runLegacyStakePoolRegistrationCertificateCmd runLegacyStakePoolDeregistrationCertificateCmd :: () => EraInEon ShelleyBasedEra -> VerificationKeyOrFile StakePoolKey - -> Shelley.EpochNo + -> L.EpochNo -> File () Out -> ExceptT StakePoolCmdError IO () runLegacyStakePoolDeregistrationCertificateCmd inSbe poolVerificationKeyOrFile retireEpoch outFile = diff --git a/cardano-cli/src/Cardano/CLI/Parser.hs b/cardano-cli/src/Cardano/CLI/Parser.hs index 6270fe4c01..f0d7c21812 100644 --- a/cardano-cli/src/Cardano/CLI/Parser.hs +++ b/cardano-cli/src/Cardano/CLI/Parser.hs @@ -15,8 +15,9 @@ module Cardano.CLI.Parser , eDNSName ) where +import qualified Cardano.Api.Ledger as L + import Cardano.CLI.Types.Common -import qualified Cardano.Ledger.BaseTypes as Shelley import qualified Data.Attoparsec.ByteString.Char8 as Atto import Data.ByteString (ByteString) @@ -114,7 +115,6 @@ readerFromAttoParser p = eDNSName :: String -> Either String ByteString eDNSName str = -- We're using 'Shelley.textToDns' to validate the string. - -- The limit in the Conway CDDL spec is 128. - case Shelley.textToDns 128 (Text.pack str) of + case L.textToDns 128 (Text.pack str) of Nothing -> Left $ "DNS name is more than 64 bytes: " <> str - Just dnsName -> Right . Text.encodeUtf8 . Shelley.dnsToText $ dnsName + Just dnsName -> Right . Text.encodeUtf8 . L.dnsToText $ dnsName diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 14a2b57579..05c35494af 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -111,15 +111,6 @@ import Cardano.CLI.Types.Errors.StakeCredentialError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key import qualified Cardano.Crypto.Hash.Class as Crypto -import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.BaseTypes as Ledger -import qualified Cardano.Ledger.Credential as Ledger -import qualified Cardano.Ledger.Crypto as Crypto -import qualified Cardano.Ledger.Crypto as Ledger -import qualified Cardano.Ledger.Keys as Ledger -import qualified Cardano.Ledger.SafeHash as L -import qualified Cardano.Ledger.SafeHash as Ledger import Prelude @@ -878,16 +869,16 @@ readProposal w (fp, mScriptWit) = do constitutionHashSourceToHash :: () => ConstitutionHashSource - -> ExceptT ConstitutionError IO (Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + -> ExceptT ConstitutionError IO (L.SafeHash L.StandardCrypto L.AnchorData) constitutionHashSourceToHash constitutionHashSource = do case constitutionHashSource of ConstitutionHashSourceFile fp -> do cBs <- liftIO $ BS.readFile $ unFile fp _utf8EncodedText <- firstExceptT ConstitutionNotUnicodeError . hoistEither $ Text.decodeUtf8' cBs - pure $ Ledger.hashAnchorData $ Ledger.AnchorData cBs + pure $ L.hashAnchorData $ L.AnchorData cBs ConstitutionHashSourceText c -> do - pure $ Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 c + pure $ L.hashAnchorData $ L.AnchorData $ Text.encodeUtf8 c ConstitutionHashSourceHash h -> pure h @@ -925,8 +916,8 @@ instance Error CostModelsError where readCostModels - :: File Alonzo.CostModels In - -> ExceptT CostModelsError IO Alonzo.CostModels + :: File L.CostModels In + -> ExceptT CostModelsError IO L.CostModels readCostModels (File fp) = do bytes <- handleIOExceptT (CostModelsErrorReadFile . FileIOError fp) $ LBS.readFile fp costModels <- firstExceptT (CostModelsErrorJSONDecode fp) . except $ Aeson.eitherDecode bytes @@ -1075,35 +1066,35 @@ getStakeAddressFromVerifier networkId stakeVerifier = getDRepCredentialFromVerKeyHashOrFile :: () => VerificationKeyOrHashOrFile DRepKey - -> ExceptT (FileError InputDecodeError) IO (Ledger.Credential Ledger.DRepRole Ledger.StandardCrypto) + -> ExceptT (FileError InputDecodeError) IO (L.Credential L.DRepRole L.StandardCrypto) getDRepCredentialFromVerKeyHashOrFile = \case VerificationKeyOrFile verKeyOrFile -> do drepVerKey <- ExceptT (readVerificationKeyOrFile AsDRepKey verKeyOrFile) - pure . Ledger.KeyHashObj . unDRepKeyHash $ verificationKeyHash drepVerKey - VerificationKeyHash kh -> pure . Ledger.KeyHashObj $ unDRepKeyHash kh + pure . L.KeyHashObj . unDRepKeyHash $ verificationKeyHash drepVerKey + VerificationKeyHash kh -> pure . L.KeyHashObj $ unDRepKeyHash kh getCommitteeColdCredentialFromVerKeyHashOrFile :: () => VerificationKeyOrHashOrFile CommitteeColdKey - -> ExceptT (FileError InputDecodeError) IO (Ledger.Credential Ledger.ColdCommitteeRole Ledger.StandardCrypto) + -> ExceptT (FileError InputDecodeError) IO (L.Credential L.ColdCommitteeRole L.StandardCrypto) getCommitteeColdCredentialFromVerKeyHashOrFile = \case VerificationKeyOrFile verKeyOrFile -> do commmitteeColdVerKey <- ExceptT (readVerificationKeyOrFile AsCommitteeColdKey verKeyOrFile) let CommitteeColdKeyHash kh = verificationKeyHash commmitteeColdVerKey - pure $ Ledger.KeyHashObj kh - VerificationKeyHash (CommitteeColdKeyHash kh) -> pure $ Ledger.KeyHashObj kh + pure $ L.KeyHashObj kh + VerificationKeyHash (CommitteeColdKeyHash kh) -> pure $ L.KeyHashObj kh getCommitteeHotCredentialFromVerKeyHashOrFile :: () => VerificationKeyOrHashOrFile CommitteeHotKey - -> ExceptT (FileError InputDecodeError) IO (Ledger.Credential Ledger.HotCommitteeRole Ledger.StandardCrypto) + -> ExceptT (FileError InputDecodeError) IO (L.Credential L.HotCommitteeRole L.StandardCrypto) getCommitteeHotCredentialFromVerKeyHashOrFile = \case VerificationKeyOrFile verKeyOrFile -> do commmitteeHotVerKey <- ExceptT (readVerificationKeyOrFile AsCommitteeHotKey verKeyOrFile) let CommitteeHotKeyHash kh = verificationKeyHash commmitteeHotVerKey - pure $ Ledger.KeyHashObj kh - VerificationKeyHash (CommitteeHotKeyHash kh) -> pure $ Ledger.KeyHashObj kh + pure $ L.KeyHashObj kh + VerificationKeyHash (CommitteeHotKeyHash kh) -> pure $ L.KeyHashObj kh data ReadSafeHashError = ReadSafeHashErrorNotHex ByteString String @@ -1118,7 +1109,7 @@ renderReadSafeHashError = \case readHexAsSafeHash :: () => Text - -> Either ReadSafeHashError (L.SafeHash Crypto.StandardCrypto L.AnchorData) + -> Either ReadSafeHashError (L.SafeHash L.StandardCrypto L.AnchorData) readHexAsSafeHash hex = do let bs = Text.encodeUtf8 hex @@ -1128,7 +1119,7 @@ readHexAsSafeHash hex = do Just a -> Right (L.unsafeMakeSafeHash a) Nothing -> Left $ ReadSafeHashErrorInvalidHash "Unable to read hash" -readSafeHash :: Opt.ReadM (L.SafeHash Crypto.StandardCrypto L.AnchorData) +readSafeHash :: Opt.ReadM (L.SafeHash L.StandardCrypto L.AnchorData) readSafeHash = Opt.eitherReader $ \s -> readHexAsSafeHash (Text.pack s) @@ -1139,18 +1130,18 @@ scriptHashReader = Opt.eitherReader $ Right . fromString readVoteDelegationTarget :: () => VoteDelegationTarget - -> ExceptT DelegationError IO (L.DRep Ledger.StandardCrypto) + -> ExceptT DelegationError IO (L.DRep L.StandardCrypto) readVoteDelegationTarget voteDelegationTarget = case voteDelegationTarget of VoteDelegationTargetOfDRep drepHashSource -> do drepHash <- case drepHashSource of DRepHashSourceScript (ScriptHash scriptHash) -> - pure $ Ledger.ScriptHashObj scriptHash + pure $ L.ScriptHashObj scriptHash DRepHashSourceVerificationKey drepVKeyOrHashOrFile -> do DRepKeyHash drepKeyHash <- lift (readVerificationKeyOrHashOrTextEnvFile AsDRepKey drepVKeyOrHashOrFile) & onLeft (left . DelegationDRepReadError) - pure $ Ledger.KeyHashObj drepKeyHash + pure $ L.KeyHashObj drepKeyHash pure $ L.DRepCredential drepHash VoteDelegationTargetOfAbstain -> pure L.DRepAlwaysAbstain diff --git a/cardano-cli/src/Cardano/CLI/Types/Common.hs b/cardano-cli/src/Cardano/CLI/Types/Common.hs index 7e3b1dfd0c..2bf4ce9484 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Common.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Common.hs @@ -86,10 +86,6 @@ import Cardano.Api import qualified Cardano.Api.Ledger as L import qualified Cardano.Chain.Slotting as Byron -import qualified Cardano.Ledger.BaseTypes as L -import qualified Cardano.Ledger.Crypto as Crypto -import Cardano.Ledger.PoolParams (PoolParams (..)) -import qualified Cardano.Ledger.SafeHash as L import Data.Aeson (FromJSON (..), ToJSON (..), object, pairs, (.=)) import qualified Data.Aeson as Aeson @@ -117,7 +113,7 @@ newtype ConstitutionText = ConstitutionText data ConstitutionHashSource = ConstitutionHashSourceFile (File ConstitutionText In) | ConstitutionHashSourceText Text - | ConstitutionHashSourceHash (L.SafeHash Crypto.StandardCrypto L.AnchorData) + | ConstitutionHashSourceHash (L.SafeHash L.StandardCrypto L.AnchorData) deriving Show newtype ProposalUrl = ProposalUrl @@ -139,7 +135,7 @@ newtype VoteText = VoteText data VoteHashSource = VoteHashSourceFile (File VoteText In) | VoteHashSourceText Text - | VoteHashSourceHash (L.SafeHash Crypto.StandardCrypto L.AnchorData) + | VoteHashSourceHash (L.SafeHash L.StandardCrypto L.AnchorData) deriving Show data StakeDelegators @@ -298,13 +294,13 @@ data AllOrOnly a = All | Only [a] deriving (Eq, Show) -- params are the current pool parameter settings, futureparams are new parameters, retiringEpoch is the -- epoch that has been set for pool retirement. Any of these may be Nothing. data Params crypto = Params - { poolParameters :: Maybe (PoolParams crypto) - , futurePoolParameters :: Maybe (PoolParams crypto) + { poolParameters :: Maybe (L.PoolParams crypto) + , futurePoolParameters :: Maybe (L.PoolParams crypto) , retiringEpoch :: Maybe EpochNo } deriving Show -- | Pretty printing for pool parameters -instance Crypto.Crypto crypto => ToJSON (Params crypto) where +instance L.Crypto crypto => ToJSON (Params crypto) where toJSON (Params p fp r) = object [ "poolParams" .= p , "futurePoolParams" .= fp diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index 5f8033c749..18f4507bc4 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -18,7 +18,6 @@ import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common -import Cardano.Ledger.Shelley.Scripts () import Prelude From 8acffb1e835fe8cbc12d75709577d75d50d84df2 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Tue, 13 Feb 2024 01:59:19 +0100 Subject: [PATCH 2/3] Update and qualify Cardano.Api.Ledger as L --- .github/workflows/haskell.yml | 2 +- cabal.project | 4 +- cardano-cli/cardano-cli.cabal | 2 +- .../EraBased/Commands/Governance/Actions.hs | 30 ++--- .../EraBased/Commands/Governance/Committee.hs | 4 +- .../CLI/EraBased/Commands/Governance/DRep.hs | 6 +- .../CLI/EraBased/Commands/Governance/Vote.hs | 4 +- .../Cardano/CLI/EraBased/Options/Common.hs | 15 ++- .../EraBased/Options/Governance/Actions.hs | 25 ++-- .../src/Cardano/CLI/EraBased/Run/Genesis.hs | 12 +- .../Cardano/CLI/EraBased/Run/Governance.hs | 16 +-- .../CLI/EraBased/Run/Governance/Actions.hs | 58 +++++----- .../CLI/EraBased/Run/Governance/DRep.hs | 6 +- .../CLI/EraBased/Run/Governance/Hash.hs | 12 +- .../CLI/EraBased/Run/Governance/Vote.hs | 12 +- .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 14 +-- .../src/Cardano/CLI/EraBased/Run/StakePool.hs | 6 +- .../Cardano/CLI/EraBased/Run/Transaction.hs | 12 +- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 108 +++++++++--------- .../src/Cardano/CLI/Legacy/Run/Governance.hs | 4 +- .../CLI/Types/Errors/TxValidationError.hs | 12 +- cardano-cli/src/Cardano/CLI/Types/Output.hs | 6 +- flake.lock | 12 +- 23 files changed, 189 insertions(+), 193 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index ebecb0d5d0..b174810d79 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -24,7 +24,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2024-02-12-2" + CABAL_CACHE_VERSION: "2024-02-23" concurrency: group: > diff --git a/cabal.project b/cabal.project index 7d5650d1ee..358475004e 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ 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 2024-02-14T11:32:54Z - , cardano-haskell-packages 2024-02-14T10:17:08Z + , hackage.haskell.org 2024-02-23T02:09:28Z + , cardano-haskell-packages 2024-02-22T17:04:08Z packages: cardano-cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 2146d7334b..c39cd8c49a 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -196,7 +196,7 @@ library , binary , bytestring , canonical-json - , cardano-api ^>= 8.38.0.2 + , cardano-api ^>= 8.39.0.0 , cardano-binary , cardano-crypto , cardano-crypto-class ^>= 2.1.2 diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index 6fcd72ef98..b1409de9e7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -22,7 +22,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -44,11 +44,11 @@ data GovernanceActionCmds era data GoveranceActionUpdateCommitteeCmdArgs era = GoveranceActionUpdateCommitteeCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFile CommitteeColdKey] , newCommitteeVkeySource :: ![(VerificationKeyOrHashOrFile CommitteeColdKey, EpochNo)] , requiredQuorum :: !Rational @@ -59,14 +59,14 @@ data GoveranceActionUpdateCommitteeCmdArgs era data GovernanceActionCreateConstitutionCmdArgs era = GovernanceActionCreateConstitutionCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , stakeCredential :: !(VerificationKeyOrHashOrFile StakeKey) , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , constitutionUrl :: !ConstitutionUrl - , constitutionHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , constitutionHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: !(File () Out) } deriving Show @@ -74,22 +74,22 @@ data GovernanceActionCreateConstitutionCmdArgs era data GovernanceActionInfoCmdArgs era = GovernanceActionInfoCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: !(File () Out) } deriving Show data GovernanceActionCreateNoConfidenceCmdArgs era = GovernanceActionCreateNoConfidenceCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , governanceActionId :: !TxId , governanceActionIndex :: !Word32 , outFile :: !(File () Out) @@ -115,11 +115,11 @@ data GovernanceActionProtocolParametersUpdateCmdArgs era data GovernanceActionTreasuryWithdrawalCmdArgs era = GovernanceActionTreasuryWithdrawalCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] , constitutionScriptHash :: !(Maybe ScriptHash) , outFile :: !(File () Out) @@ -136,11 +136,11 @@ data GovernanceActionViewCmdArgs era data UpdateProtocolParametersConwayOnwards era = UpdateProtocolParametersConwayOnwards { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , governanceActionId :: !(Maybe (TxId, Word32)) , constitutionScriptHash :: !(Maybe ScriptHash) } @@ -148,7 +148,7 @@ data UpdateProtocolParametersConwayOnwards era data CostModelsFile era = CostModelsFile { eon :: !(AlonzoEraOnwards era) - , costModelsFile :: !(File Ledger.CostModels In) + , costModelsFile :: !(File L.CostModels In) } deriving Show deriving instance Show (UpdateProtocolParametersConwayOnwards era) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs index 9746c3f9ef..4a800cee9e 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs @@ -13,7 +13,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Committee ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Key @@ -61,7 +61,7 @@ data GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs era = GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs { eon :: !(ConwayEraOnwards era) , vkeyColdKeySource :: !(VerificationKeyOrHashOrFile CommitteeColdKey) - , anchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era)))) + , anchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era)))) , outFile :: !(File () Out) } deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs index 76284b3624..f7ce480fd4 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs @@ -16,7 +16,7 @@ module Cardano.CLI.EraBased.Commands.Governance.DRep where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -52,7 +52,7 @@ data GovernanceDRepRegistrationCertificateCmdArgs era = { eon :: !(ConwayEraOnwards era) , drepHashSource :: !DRepHashSource , deposit :: !Lovelace - , mAnchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era)))) + , mAnchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era)))) , outFile :: !(File () Out) } @@ -68,7 +68,7 @@ data GovernanceDRepUpdateCertificateCmdArgs era = GovernanceDRepUpdateCertificateCmdArgs { eon :: !(ConwayEraOnwards era) , drepVkeyHashSource :: !(VerificationKeyOrHashOrFile DRepKey) - , mAnchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era)))) + , mAnchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era)))) , outFile :: !(File () Out) } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs index 8ca7ec2a09..b7ee797aeb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs @@ -9,7 +9,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Vote , GovernanceVoteCreateCmdArgs(..) , renderGovernanceVoteCmds ) where -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -30,7 +30,7 @@ data GovernanceVoteCreateCmdArgs era , voteChoice :: Vote , governanceAction :: (TxId, Word32) , votingStakeCredentialSource :: AnyVotingStakeVerificationKeyOrHashOrFile - , mAnchor :: Maybe (VoteUrl, Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , mAnchor :: Maybe (VoteUrl, L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: VoteFile Out } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index b35006fd20..3977812388 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -13,7 +13,6 @@ module Cardano.CLI.EraBased.Options.Common where import Cardano.Api import qualified Cardano.Api.Ledger as L -import qualified Cardano.Api.Ledger as Ledger import Cardano.Api.Pretty import Cardano.Api.Shelley @@ -124,7 +123,7 @@ pTarget = inEonForEra (pure Consensus.VolatileTip) pTargetFromConway ] toUnitIntervalOrErr :: Rational -> L.UnitInterval -toUnitIntervalOrErr r = case Ledger.boundRational r of +toUnitIntervalOrErr r = case L.boundRational r of Nothing -> error $ mconcat [ "toUnitIntervalOrErr: " , "rational out of bounds " <> show r @@ -907,10 +906,10 @@ pConstitutionHash = , Opt.help "Hash of the constitution data (obtain it with \"cardano-cli conway governance hash anchor-data ...\")." ] -pUrl :: String -> String -> Parser Ledger.Url +pUrl :: String -> String -> Parser L.Url pUrl l h = let toUrl urlText = fromMaybe (error "Url longer than 64 bytes") - $ Ledger.textToUrl (Text.length urlText) urlText + $ L.textToUrl (Text.length urlText) urlText in fmap toUrl . Opt.strOption $ mconcat [ Opt.long l , Opt.metavar "TEXT" @@ -2898,9 +2897,9 @@ pProtocolVersion = ] ] -pPoolVotingThresholds :: Parser Ledger.PoolVotingThresholds +pPoolVotingThresholds :: Parser L.PoolVotingThresholds pPoolVotingThresholds = - Ledger.PoolVotingThresholds + L.PoolVotingThresholds <$> pMotionNoConfidence <*> pCommitteeNormal <*> pCommitteeNoConfidence @@ -2938,9 +2937,9 @@ pPoolVotingThresholds = , Opt.help "Acceptance threshold for stake pool votes on protocol parameters for parameters in the 'security' group." ] -pDRepVotingThresholds :: Parser Ledger.DRepVotingThresholds +pDRepVotingThresholds :: Parser L.DRepVotingThresholds pDRepVotingThresholds = - Ledger.DRepVotingThresholds + L.DRepVotingThresholds <$> pMotionNoConfidence <*> pCommitteeNormal <*> pCommitteeNoConfidence diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index 4d49dcc191..bab118c5b8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -7,8 +7,7 @@ module Cardano.CLI.EraBased.Options.Governance.Actions ) where import Cardano.Api -import Cardano.Api.Ledger -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Actions as Cmd @@ -219,20 +218,20 @@ pGovernanceActionProtocolParametersUpdateCmd era = do <$> pUpdateProtocolParametersCmd w -convertToLedger :: (a -> b) -> Parser (Maybe a) -> Parser (StrictMaybe b) -convertToLedger conv = fmap (maybeToStrictMaybe . fmap conv) +convertToLedger :: (a -> b) -> Parser (Maybe a) -> Parser (L.StrictMaybe b) +convertToLedger conv = fmap (L.maybeToStrictMaybe . fmap conv) -toNonNegativeIntervalOrErr :: Rational -> NonNegativeInterval -toNonNegativeIntervalOrErr r = case Ledger.boundRational r of +toNonNegativeIntervalOrErr :: Rational -> L.NonNegativeInterval +toNonNegativeIntervalOrErr r = case L.boundRational r of Nothing -> error $ mconcat [ "toNonNegativeIntervalOrErr: " , "rational out of bounds " <> show r ] Just n -> n -mkProtocolVersionOrErr :: (Natural, Natural) -> Ledger.ProtVer +mkProtocolVersionOrErr :: (Natural, Natural) -> L.ProtVer mkProtocolVersionOrErr (majorProtVer, minorProtVer) = - case (`Ledger.ProtVer` minorProtVer) <$> Ledger.mkVersion majorProtVer of + case (`L.ProtVer` minorProtVer) <$> L.mkVersion majorProtVer of Just v -> v Nothing -> error $ "mkProtocolVersionOrErr: invalid protocol version " <> show (majorProtVer, minorProtVer) @@ -273,7 +272,7 @@ pShelleyToAlonzoPParams = pAlonzoOnwardsPParams :: Parser (AlonzoOnwardsPParams ledgerera) pAlonzoOnwardsPParams = - AlonzoOnwardsPParams SNothing -- The cost models are read separately from a file, so we use 'SNothing' as the place holder here + AlonzoOnwardsPParams L.SNothing -- The cost models are read separately from a file, so we use 'SNothing' as the place holder here <$> convertToLedger (either (\e -> error $ "pAlonzoOnwardsPParams: " <> show e) id . toAlonzoPrices) (optional pExecutionUnitPrices) <*> convertToLedger toAlonzoExUnits (optional pMaxTxExecutionUnits) @@ -286,7 +285,7 @@ pAlonzoOnwardsPParams = pIntroducedInBabbagePParams :: Parser (IntroducedInBabbagePParams ledgerera) pIntroducedInBabbagePParams = IntroducedInBabbagePParams - <$> convertToLedger (CoinPerByte . toShelleyLovelace) (optional pUTxOCostPerByte) + <$> convertToLedger (L.CoinPerByte . toShelleyLovelace) (optional pUTxOCostPerByte) pIntroducedInConwayPParams :: Parser (IntroducedInConwayPParams ledgerera) pIntroducedInConwayPParams = @@ -363,13 +362,13 @@ pGovernanceActionTreasuryWithdrawalCmd era = do ) $ Opt.progDesc "Create a treasury withdrawal." -pNetwork :: Parser Ledger.Network +pNetwork :: Parser L.Network pNetwork = asum $ mconcat - [ [ Opt.flag' Ledger.Mainnet $ mconcat + [ [ Opt.flag' L.Mainnet $ mconcat [ Opt.long "mainnet" , Opt.help "Use the mainnet magic id." ] - , Opt.flag' Ledger.Testnet $ mconcat + , Opt.flag' L.Testnet $ mconcat [ Opt.long "testnet" , Opt.help "Use the testnet magic id." ] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index 7e6a026290..68223aca8c 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -657,14 +657,14 @@ updateOutputTemplate -> Maybe Lovelace -- ^ Amount of lovelace not delegated -> Int -- ^ Number of UTxO addresses that are delegating -> [AddressInEra ShelleyEra] -- ^ UTxO addresses that are not delegating - -> [(Ledger.KeyHash 'Ledger.StakePool StandardCrypto, Ledger.PoolParams StandardCrypto)] -- ^ Pool map - -> [(Ledger.KeyHash 'Ledger.Staking StandardCrypto, Ledger.KeyHash 'Ledger.StakePool StandardCrypto)] -- ^ Delegaton map + -> [(L.KeyHash 'L.StakePool L.StandardCrypto, L.PoolParams L.StandardCrypto)] -- ^ Pool map + -> [(L.KeyHash 'L.Staking L.StandardCrypto, L.KeyHash 'L.StakePool L.StandardCrypto)] -- ^ Delegaton map -> Maybe Lovelace -- ^ Amount of lovelace to delegate -> Int -- ^ Number of UTxO address for delegation -> [AddressInEra ShelleyEra] -- ^ UTxO address for delegation -> [AddressInEra ShelleyEra] -- ^ Stuffed UTxO addresses - -> ShelleyGenesis StandardCrypto -- ^ Template from which to build a genesis - -> ShelleyGenesis StandardCrypto -- ^ Updated genesis + -> ShelleyGenesis L.StandardCrypto -- ^ Template from which to build a genesis + -> ShelleyGenesis L.StandardCrypto -- ^ Updated genesis updateOutputTemplate (SystemStart sgSystemStart) genDelegMap mAmountNonDeleg nUtxoAddrsNonDeleg utxoAddrsNonDeleg pools stake @@ -709,10 +709,10 @@ updateOutputTemplate mkStuffedUtxo :: [AddressInEra ShelleyEra] -> [(AddressInEra ShelleyEra, Lovelace)] mkStuffedUtxo xs = (, Lovelace minUtxoVal) <$> xs - where Coin minUtxoVal = sgProtocolParams ^. ppMinUTxOValueL + where L.Coin minUtxoVal = sgProtocolParams ^. L.ppMinUTxOValueL shelleyDelKeys = Map.fromList - [ (gh, Ledger.GenDelegPair gdh h) + [ (gh, L.GenDelegPair gdh h) | (GenesisKeyHash gh, (GenesisDelegateKeyHash gdh, VrfKeyHash h)) <- Map.toList genDelegMap ] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index 7aba46f9a4..6989a4db25 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -16,7 +16,7 @@ module Cardano.CLI.EraBased.Run.Governance ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance as Cmd @@ -79,7 +79,7 @@ runGovernanceCmds = \case runGovernanceMIRCertificatePayStakeAddrs :: ShelleyToBabbageEra era - -> Ledger.MIRPot + -> L.MIRPot -> [StakeAddress] -- ^ Stake addresses -> [Lovelace] -- ^ Corresponding reward amounts (same length) -> File () Out @@ -90,8 +90,8 @@ runGovernanceMIRCertificatePayStakeAddrs w mirPot sAddrs rwdAmts oFp = do (unFile oFp) (length sAddrs) (length rwdAmts) let sCreds = map stakeAddressCredential sAddrs - mirTarget = Ledger.StakeAddressesMIR - $ Map.fromList [ (toShelleyStakeCredential scred, Ledger.toDeltaCoin (toShelleyLovelace rwdAmt)) + mirTarget = L.StakeAddressesMIR + $ Map.fromList [ (toShelleyStakeCredential scred, L.toDeltaCoin (toShelleyLovelace rwdAmt)) | (scred, rwdAmt) <- zip sCreds rwdAmts ] let mirCert = makeMIRCertificate @@ -113,9 +113,9 @@ runGovernanceCreateMirCertificateTransferToTreasuryCmd :: () -> File () Out -> ExceptT GovernanceCmdError IO () runGovernanceCreateMirCertificateTransferToTreasuryCmd w ll oFp = do - let mirTarget = Ledger.SendToOppositePotMIR (toShelleyLovelace ll) + let mirTarget = L.SendToOppositePotMIR (toShelleyLovelace ll) - let mirCert = makeMIRCertificate $ MirCertificateRequirements w Ledger.ReservesMIR mirTarget + let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.ReservesMIR mirTarget firstExceptT GovernanceCmdTextEnvWriteError . newExceptT @@ -132,9 +132,9 @@ runGovernanceCreateMirCertificateTransferToReservesCmd :: () -> File () Out -> ExceptT GovernanceCmdError IO () runGovernanceCreateMirCertificateTransferToReservesCmd w ll oFp = do - let mirTarget = Ledger.SendToOppositePotMIR (toShelleyLovelace ll) + let mirTarget = L.SendToOppositePotMIR (toShelleyLovelace ll) - let mirCert = makeMIRCertificate $ MirCertificateRequirements w Ledger.TreasuryMIR mirTarget + let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.TreasuryMIR mirTarget firstExceptT GovernanceCmdTextEnvWriteError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index ae61bfd0e1..9f786ee67d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -13,7 +13,7 @@ module Cardano.CLI.EraBased.Run.Governance.Actions import Cardano.Api import Cardano.Api.Ledger (StrictMaybe (..)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.Actions @@ -92,9 +92,9 @@ runGovernanceActionInfoCmd } = do returnKeyHash <- readStakeKeyHash returnStakeAddress - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } let sbe = conwayEraOnwardsToShelleyBasedEra eon @@ -123,14 +123,14 @@ runGovernanceActionCreateNoConfidenceCmd } = do returnKeyHash <- readStakeKeyHash returnStakeAddress - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } let sbe = conwayEraOnwardsToShelleyBasedEra eon previousGovernanceAction = MotionOfNoConfidence - $ Ledger.SJust + $ L.SJust $ shelleyBasedEraConstraints sbe $ createPreviousGovernanceActionId governanceActionId @@ -161,17 +161,17 @@ runGovernanceActionCreateConstitutionCmd stakeKeyHash <- readStakeKeyHash stakeCredential - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } - let prevGovActId = Ledger.maybeToStrictMaybe + let prevGovActId = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId - constitutionAnchor = Ledger.Anchor - { Ledger.anchorUrl = unConstitutionUrl constitutionUrl - , Ledger.anchorDataHash = constitutionHash + constitutionAnchor = L.Anchor + { L.anchorUrl = unConstitutionUrl constitutionUrl + , L.anchorDataHash = constitutionHash } govAct = ProposeNewConstitution prevGovActId constitutionAnchor sbe = conwayEraOnwardsToShelleyBasedEra eon @@ -201,14 +201,14 @@ runGovernanceActionCreateNewCommitteeCmd , Cmd.outFile } = do let sbe = conwayEraOnwardsToShelleyBasedEra eon - govActIdentifier = Ledger.maybeToStrictMaybe + govActIdentifier = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId quorumRational = toRational requiredQuorum - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } oldCommitteeKeyHashes <- forM oldCommitteeVkeySource $ \vkeyOrHashOrTextFile -> @@ -278,13 +278,13 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do let updateProtocolParams = createEraBasedProtocolParamUpdate sbe eraBasedPParams - prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId - proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + prevGovActId = L.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId + proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } govAct = UpdatePParams prevGovActId updateProtocolParams - (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe mConstitutionalScriptHash) + (toShelleyScriptHash <$> L.maybeToStrictMaybe mConstitutionalScriptHash) let proposalProcedure = createProposalProcedure sbe network deposit returnKeyHash govAct proposalAnchor @@ -311,7 +311,7 @@ readStakeKeyHash stake = addCostModelsToEraBasedProtocolParametersUpdate :: AlonzoEraOnwards era - -> Ledger.CostModels + -> L.CostModels -> EraBasedProtocolParametersUpdate era -> EraBasedProtocolParametersUpdate era addCostModelsToEraBasedProtocolParametersUpdate @@ -346,9 +346,9 @@ runGovernanceActionTreasuryWithdrawalCmd , Cmd.outFile } = do - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } returnKeyHash <- readStakeKeyHash returnAddr @@ -359,7 +359,7 @@ runGovernanceActionTreasuryWithdrawalCmd let sbe = conwayEraOnwardsToShelleyBasedEra eon treasuryWithdrawals = TreasuryWithdrawal withdrawals - (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe constitutionScriptHash) + (toShelleyScriptHash <$> L.maybeToStrictMaybe constitutionScriptHash) proposal = createProposalProcedure sbe networkId deposit returnKeyHash treasuryWithdrawals proposalAnchor firstExceptT GovernanceActionsCmdWriteFileError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index fb52f8e95e..3872a3aa07 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -16,7 +16,7 @@ module Cardano.CLI.EraBased.Run.Governance.DRep import Cardano.Api import Cardano.Api.Ledger (Credential (KeyHashObj)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.DRep as Cmd @@ -118,13 +118,13 @@ runGovernanceDRepRegistrationCertificateCmd drepCred <- case drepHashSource of DRepHashSourceScript (ScriptHash scriptHash) -> - return $ Ledger.ScriptHashObj scriptHash + return $ L.ScriptHashObj scriptHash DRepHashSourceVerificationKey drepVkeyHashSource -> do DRepKeyHash drepKeyHash <- firstExceptT RegistrationReadError . newExceptT $ readVerificationKeyOrHashOrFile AsDRepKey drepVkeyHashSource - return $ Ledger.KeyHashObj $ conwayEraOnwardsConstraints w drepKeyHash + return $ L.KeyHashObj $ conwayEraOnwardsConstraints w drepKeyHash let req = DRepRegistrationRequirements w drepCred deposit registrationCert = makeDrepRegistrationCertificate req mAnchor description = Just @TextEnvelopeDescr "DRep Key Registration Certificate" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs index ef9cf0a62d..d5fd8d4e81 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs @@ -14,7 +14,7 @@ module Cardano.CLI.EraBased.Run.Governance.Hash ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import qualified Cardano.CLI.EraBased.Commands.Governance.Hash as Cmd import Cardano.CLI.Read @@ -52,23 +52,23 @@ runGovernanceHashAnchorDataCmd Cmd.GovernanceHashAnchorDataCmdArgs { toHash, mou Cmd.GovernanceAnchorDataHashSourceBinaryFile fp -> do let path = unFile fp bytes <- handleIOExceptT (GovernanceHashReadFileError path) $ BS.readFile path - let hash = Ledger.hashAnchorData $ Ledger.AnchorData bytes + let hash = L.hashAnchorData $ L.AnchorData bytes printHash hash Cmd.GovernanceAnchorDataHashSourceTextFile fp -> do let path = unFile fp text <- handleIOExceptT (GovernanceHashReadFileError path) $ Text.readFile path - let hash = Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 text + let hash = L.hashAnchorData $ L.AnchorData $ Text.encodeUtf8 text printHash hash Cmd.GovernanceAnchorDataHashSourceText text -> do - let hash = Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 text + let hash = L.hashAnchorData $ L.AnchorData $ Text.encodeUtf8 text printHash hash where - printHash :: Ledger.SafeHash Ledger.StandardCrypto i -> ExceptT GovernanceHashError IO () + printHash :: L.SafeHash L.StandardCrypto i -> ExceptT GovernanceHashError IO () printHash hash = do firstExceptT GovernanceHashWriteFileError $ newExceptT $ writeTextOutput moutFile text where - text = hashToTextAsHex . Ledger.extractHash $ hash + text = hashToTextAsHex . L.extractHash $ hash runGovernanceHashScriptCmd :: () => Cmd.GovernanceHashScriptCmdArgs era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index c787472e4a..7e34eff091 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -11,7 +11,7 @@ module Cardano.CLI.EraBased.Run.Governance.Vote ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Vote as Cmd @@ -56,24 +56,24 @@ runGovernanceVoteCreateCmd voteProcedure <- case mAnchor of Nothing -> pure $ createVotingProcedure eon voteChoice Nothing Just (VoteUrl url, voteHash) -> shelleyBasedEraConstraints sbe $ do - let voteAnchor = Ledger.Anchor { Ledger.anchorUrl = url, Ledger.anchorDataHash = voteHash } + let voteAnchor = L.Anchor { L.anchorUrl = url, L.anchorDataHash = voteHash } VotingProcedure votingProcedureWithoutAnchor = createVotingProcedure eon voteChoice Nothing - votingProcedureWithAnchor = VotingProcedure $ votingProcedureWithoutAnchor { Ledger.vProcAnchor = Ledger.SJust voteAnchor } + votingProcedureWithAnchor = VotingProcedure $ votingProcedureWithoutAnchor { L.vProcAnchor = L.SJust voteAnchor } pure votingProcedureWithAnchor shelleyBasedEraConstraints sbe $ do voter <- firstExceptT GovernanceVoteCmdReadVerificationKeyError $ case votingStakeCredentialSource of AnyDRepVerificationKeyOrHashOrFile stake -> do DRepKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake - pure $ Ledger.DRepVoter $ Ledger.KeyHashObj h + pure $ L.DRepVoter $ L.KeyHashObj h AnyStakePoolVerificationKeyOrHashOrFile stake -> do StakePoolKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake - pure $ Ledger.StakePoolVoter h + pure $ L.StakePoolVoter h AnyCommitteeHotVerificationKeyOrHashOrFile stake -> do CommitteeHotKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake - pure $ Ledger.CommitteeVoter $ Ledger.KeyHashObj h + pure $ L.CommitteeVoter $ L.KeyHashObj h let govActIdentifier = createGovernanceActionId govActionTxId govActionIndex votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index ab1d45586a..f5a70f23ef 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -19,7 +19,7 @@ module Cardano.CLI.EraBased.Run.StakeAddress ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.StakeAddress @@ -219,11 +219,11 @@ runStakeAddressStakeAndVoteDelegationCertificateCmd w stakeVerifier poolVKeyOrHa readVoteDelegationTarget voteDelegationTarget & firstExceptT StakeAddressCmdDelegationError - let delegatee = Ledger.DelegStakeVote poolStakeVKeyHash drep + let delegatee = L.DelegStakeVote poolStakeVKeyHash drep let certificate = ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee firstExceptT StakeAddressCmdWriteFileError . newExceptT @@ -248,11 +248,11 @@ runStakeAddressVoteDelegationCertificateCmd w stakeVerifier voteDelegationTarget readVoteDelegationTarget voteDelegationTarget & firstExceptT StakeAddressCmdDelegationError - let delegatee = Ledger.DelegVote drep + let delegatee = L.DelegVote drep let certificate = ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee firstExceptT StakeAddressCmdWriteFileError . newExceptT @@ -269,11 +269,11 @@ createStakeDelegationCertificate stakeCredential (StakePoolKeyHash poolStakeVKey (\w -> shelleyToBabbageEraConstraints w $ ShelleyRelatedCertificate w - $ Ledger.mkDelegStakeTxCert (toShelleyStakeCredential stakeCredential) poolStakeVKeyHash) + $ L.mkDelegStakeTxCert (toShelleyStakeCredential stakeCredential) poolStakeVKeyHash) (\w -> conwayEraOnwardsConstraints w $ ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) (Ledger.DelegStake poolStakeVKeyHash) + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) (L.DelegStake poolStakeVKeyHash) ) runStakeAddressDeregistrationCertificateCmd :: () diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs index 212a71606e..f591512cfd 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs @@ -15,7 +15,7 @@ module Cardano.CLI.EraBased.Run.StakePool ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.StakePool @@ -124,7 +124,7 @@ runStakePoolRegistrationCertificateCmd createStakePoolRegistrationRequirements :: () => ShelleyBasedEra era - -> Ledger.PoolParams (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> L.PoolParams (L.EraCrypto (ShelleyLedgerEra era)) -> StakePoolRegistrationRequirements era createStakePoolRegistrationRequirements sbe pparams = case sbe of @@ -173,7 +173,7 @@ runStakePoolDeregistrationCertificateCmd createStakePoolRetirementRequirements :: () => ShelleyBasedEra era -> PoolId - -> Ledger.EpochNo + -> L.EpochNo -> StakePoolRetirementRequirements era createStakePoolRetirementRequirements sbe pid epoch = case sbe of diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 4be66c5bdc..071e93d675 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -34,7 +34,7 @@ module Cardano.CLI.EraBased.Run.Transaction import Cardano.Api import Cardano.Api.Byron hiding (SomeByronSigningKey (..)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Transaction as Cmd @@ -247,11 +247,11 @@ runTransactionBuildCmd in lift (cardanoEraConstraints era $ writeTxFileTextEnvelopeCddl eon fpath noWitTx) & onLeft (left . TxCmdWriteFileError) -getExecutionUnitPrices :: CardanoEra era -> LedgerProtocolParameters era -> Maybe Ledger.Prices +getExecutionUnitPrices :: CardanoEra era -> LedgerProtocolParameters era -> Maybe L.Prices getExecutionUnitPrices cEra (LedgerProtocolParameters pp) = forEraInEonMaybe cEra $ \aeo -> alonzoEraOnwardsConstraints aeo $ - pp ^. Ledger.ppPricesL + pp ^. L.ppPricesL runTransactionBuildRawCmd :: () => Cmd.TransactionBuildRawCmdArgs era @@ -296,7 +296,7 @@ runTransactionBuildRawCmd mapM (readFileScriptInAnyLang . unScriptFile) scriptFiles txAuxScripts <- hoistEither $ first TxCmdAuxScriptsValidationError $ validateTxAuxScripts eon scripts - -- TODO: Conway era - update readProtocolParameters to rely on Ledger.PParams JSON instances + -- TODO: Conway era - update readProtocolParameters to rely on L.PParams JSON instances pparams <- forM mProtocolParamsFile $ \ppf -> firstExceptT TxCmdProtocolParamsError (readProtocolParameters ppf) @@ -714,8 +714,8 @@ toAddressInShelleyBasedEra sbe sAddr = runExcept $ pure (AddressInEra (ShelleyAddressInEra sbe) sAddr) -lovelaceToCoin :: Lovelace -> Ledger.Coin -lovelaceToCoin (Lovelace ll) = Ledger.Coin ll +lovelaceToCoin :: Lovelace -> L.Coin +lovelaceToCoin (Lovelace ll) = L.Coin ll toTxOutValueInAnyEra :: ShelleyBasedEra era diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 2607bc9a64..c36df87daf 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -19,7 +19,7 @@ module Cardano.CLI.Json.Friendly import Cardano.Api as Api import Cardano.Api.Byron (KeyWitness (ByronKeyWitness)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), KeyWitness (ShelleyBootstrapWitness, ShelleyKeyWitness), Proposal (Proposal), ShelleyLedgerEra, StakeAddress (..), fromShelleyPaymentCredential, @@ -99,11 +99,11 @@ friendlyProposalImpl :: ConwayEraOnwards era -> Proposal era -> [Aeson.Pair] friendlyProposalImpl era (Proposal - (Ledger.ProposalProcedure - { Ledger.pProcDeposit - , Ledger.pProcReturnAddr - , Ledger.pProcGovAction - , Ledger.pProcAnchor + (L.ProposalProcedure + { L.pProcDeposit + , L.pProcReturnAddr + , L.pProcGovAction + , L.pProcAnchor } ) ) = conwayEraOnwardsConstraints era @@ -127,7 +127,7 @@ friendlyKeyWitness = ByronKeyWitness txInWitness -> ["Byron witness" .= textShow txInWitness] ShelleyBootstrapWitness _era bootstrapWitness -> ["bootstrap witness" .= textShow bootstrapWitness] - ShelleyKeyWitness _era (Ledger.WitVKey key signature) -> + ShelleyKeyWitness _era (L.WitVKey key signature) -> ["key" .= textShow key, "signature" .= textShow signature] friendlyTxBodyImpl :: () @@ -365,29 +365,29 @@ renderCertificate sbe = \case ShelleyRelatedCertificate _ c -> shelleyBasedEraConstraints sbe $ case c of - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyRegCert cred) -> + L.ShelleyTxCertDelegCert (L.ShelleyRegCert cred) -> "stake address registration" .= cred - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyUnRegCert cred) -> + L.ShelleyTxCertDelegCert (L.ShelleyUnRegCert cred) -> "stake address deregistration" .= cred - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyDelegCert cred poolId) -> + L.ShelleyTxCertDelegCert (L.ShelleyDelegCert cred poolId) -> "stake address delegation" .= object [ "credential" .= cred , "pool" .= poolId ] - Ledger.ShelleyTxCertPool (Ledger.RetirePool poolId retirementEpoch) -> + L.ShelleyTxCertPool (L.RetirePool poolId retirementEpoch) -> "stake pool retirement" .= object [ "pool" .= StakePoolKeyHash poolId , "epoch" .= retirementEpoch ] - Ledger.ShelleyTxCertPool (Ledger.RegPool poolParams) -> + L.ShelleyTxCertPool (L.RegPool poolParams) -> "stake pool registration" .= poolParams - Ledger.ShelleyTxCertGenesisDeleg (Ledger.GenesisDelegCert genesisKeyHash delegateKeyHash vrfKeyHash) -> + L.ShelleyTxCertGenesisDeleg (L.GenesisDelegCert genesisKeyHash delegateKeyHash vrfKeyHash) -> "genesis key delegation" .= object [ "genesis key hash" .= genesisKeyHash , "delegate key hash" .= delegateKeyHash , "VRF key hash" .= vrfKeyHash ] - Ledger.ShelleyTxCertMir (Ledger.MIRCert pot target) -> + L.ShelleyTxCertMir (L.MIRCert pot target) -> "MIR" .= object [ "pot" .= friendlyMirPot pot , friendlyMirTarget sbe target @@ -396,79 +396,79 @@ renderCertificate sbe = \case ConwayCertificate w cert -> conwayEraOnwardsConstraints w $ case cert of - Ledger.RegDRepTxCert credential coin mAnchor -> + L.RegDRepTxCert credential coin mAnchor -> "Drep registration certificate" .= object [ "deposit" .= coin , "certificate" .= conwayToObject w credential , "anchor" .= mAnchor ] - Ledger.UnRegDRepTxCert credential coin -> + L.UnRegDRepTxCert credential coin -> "Drep unregistration certificate" .= object [ "refund" .= coin , "certificate" .= conwayToObject w credential ] - Ledger.AuthCommitteeHotKeyTxCert coldCred hotCred - | Ledger.ScriptHashObj sh <- coldCred -> + L.AuthCommitteeHotKeyTxCert coldCred hotCred + | L.ScriptHashObj sh <- coldCred -> "Cold committee authorization" .= object [ "script hash" .= sh ] - | Ledger.ScriptHashObj sh <- hotCred -> + | L.ScriptHashObj sh <- hotCred -> "Hot committee authorization" .= object [ "script hash" .= sh] - | Ledger.KeyHashObj ck@Ledger.KeyHash{} <- coldCred - , Ledger.KeyHashObj hk@Ledger.KeyHash{} <- hotCred -> + | L.KeyHashObj ck@L.KeyHash{} <- coldCred + , L.KeyHashObj hk@L.KeyHash{} <- hotCred -> "Constitutional committee member hot key registration" .= object [ "cold key hash" .= ck , "hot key hash" .= hk ] - Ledger.ResignCommitteeColdTxCert cred anchor -> case cred of - Ledger.ScriptHashObj sh -> + L.ResignCommitteeColdTxCert cred anchor -> case cred of + L.ScriptHashObj sh -> "Cold committee resignation" .= object [ "script hash" .= sh , "anchor" .= anchor ] - Ledger.KeyHashObj ck@Ledger.KeyHash{} -> + L.KeyHashObj ck@L.KeyHash{} -> "Constitutional committee cold key resignation" .= object [ "cold key hash" .= ck ] - Ledger.RegTxCert stakeCredential -> + L.RegTxCert stakeCredential -> "Stake address registration" .= object [ "stake credential" .= stakeCredential ] - Ledger.UnRegTxCert stakeCredential -> + L.UnRegTxCert stakeCredential -> "Stake address deregistration" .= object [ "stake credential" .= stakeCredential ] - Ledger.RegDepositTxCert stakeCredential deposit -> + L.RegDepositTxCert stakeCredential deposit -> "Stake address registration" .= object [ "stake credential" .= stakeCredential , "deposit" .= deposit ] - Ledger.UnRegDepositTxCert stakeCredential refund -> + L.UnRegDepositTxCert stakeCredential refund -> "Stake address deregistration" .= object [ "stake credential" .= stakeCredential , "refund" .= refund ] - Ledger.DelegTxCert stakeCredential delegatee -> + L.DelegTxCert stakeCredential delegatee -> "Stake address delegation" .= object [ "stake credential" .= stakeCredential , "delegatee" .= delegateeJson sbe delegatee ] - Ledger.RegDepositDelegTxCert stakeCredential delegatee deposit -> + L.RegDepositDelegTxCert stakeCredential delegatee deposit -> "Stake address registration and delegation" .= object [ "stake credential" .= stakeCredential , "delegatee" .= delegateeJson sbe delegatee , "deposit" .= deposit ] - Ledger.RegPoolTxCert poolParams -> + L.RegPoolTxCert poolParams -> "Pool registration" .= object [ "pool params" .= poolParams ] - Ledger.RetirePoolTxCert kh@Ledger.KeyHash{} epoch -> + L.RetirePoolTxCert kh@L.KeyHash{} epoch -> "Pool retirement" .= object [ "stake pool key hash" .= kh , "epoch" .= epoch ] - Ledger.UpdateDRepTxCert drepCredential mbAnchor -> + L.UpdateDRepTxCert drepCredential mbAnchor -> "Drep certificate update" .= object [ "Drep credential" .= drepCredential , "anchor " .= mbAnchor @@ -476,49 +476,49 @@ renderCertificate sbe = \case where conwayToObject :: () => ConwayEraOnwards era - -> Ledger.Credential 'Ledger.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> L.Credential 'L.DRepRole (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value conwayToObject w' = conwayEraOnwardsConstraints w' $ object . \case - Ledger.ScriptHashObj sHash -> ["scriptHash" .= sHash] - Ledger.KeyHashObj keyHash -> ["keyHash" .= keyHash] + L.ScriptHashObj sHash -> ["scriptHash" .= sHash] + L.KeyHashObj keyHash -> ["keyHash" .= keyHash] - delegateeJson :: ( Ledger.EraCrypto (ShelleyLedgerEra era) ~ Ledger.StandardCrypto) - => ShelleyBasedEra era -> Ledger.Delegatee (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value + delegateeJson :: ( L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto) + => ShelleyBasedEra era -> L.Delegatee (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value delegateeJson _ = object . \case - Ledger.DelegStake hk@Ledger.KeyHash{} -> + L.DelegStake hk@L.KeyHash{} -> [ "delegatee type" .= String "stake" , "key hash" .= hk ] - Ledger.DelegVote drep -> do + L.DelegVote drep -> do ["delegatee type" .= String "vote", "DRep" .= drep] - Ledger.DelegStakeVote kh drep -> + L.DelegStakeVote kh drep -> ["delegatee type" .= String "stake vote" , "key hash" .= kh , "DRep" .= drep ] -friendlyMirTarget :: ShelleyBasedEra era -> Ledger.MIRTarget (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Pair +friendlyMirTarget :: ShelleyBasedEra era -> L.MIRTarget (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Pair friendlyMirTarget sbe = \case - Ledger.StakeAddressesMIR addresses -> + L.StakeAddressesMIR addresses -> "target stake addresses" .= [ object [ friendlyStakeCredential credential - , "amount" .= friendlyLovelace (toShelleyLovelace (Lovelace 0) `Ledger.addDeltaCoin` lovelace) + , "amount" .= friendlyLovelace (toShelleyLovelace (Lovelace 0) `L.addDeltaCoin` lovelace) ] | (credential, lovelace) <- Map.toList (shelleyBasedEraConstraints sbe addresses) ] - Ledger.SendToOppositePotMIR amount -> "MIR amount" .= friendlyLovelace amount + L.SendToOppositePotMIR amount -> "MIR amount" .= friendlyLovelace amount -- TODO: Conway era. Replace cardano-api's StakeCredential definition with -- the ledger's StakeCredential definition. friendlyStakeCredential - :: Ledger.Credential Ledger.Staking Ledger.StandardCrypto -> Aeson.Pair + :: L.Credential L.Staking L.StandardCrypto -> Aeson.Pair friendlyStakeCredential = \case - Ledger.KeyHashObj keyHash -> + L.KeyHashObj keyHash -> "stake credential key hash" .= keyHash - Ledger.ScriptHashObj scriptHash -> + L.ScriptHashObj scriptHash -> "stake credential script hash" .= scriptHash friendlyPaymentCredential :: PaymentCredential -> Aeson.Pair @@ -528,10 +528,10 @@ friendlyPaymentCredential = \case PaymentCredentialByScript scriptHash -> "payment credential script hash" .= scriptHash -friendlyMirPot :: Ledger.MIRPot -> Aeson.Value +friendlyMirPot :: L.MIRPot -> Aeson.Value friendlyMirPot = \case - Ledger.ReservesMIR -> "reserves" - Ledger.TreasuryMIR -> "treasury" + L.ReservesMIR -> "reserves" + L.TreasuryMIR -> "treasury" friendlyRational :: Rational -> Aeson.Value @@ -548,8 +548,8 @@ friendlyFee :: TxFee era -> Aeson.Value friendlyFee = \case TxFeeExplicit _ fee -> friendlyLovelace $ toShelleyLovelace fee -friendlyLovelace :: Ledger.Coin -> Aeson.Value -friendlyLovelace (Ledger.Coin value) = String $ textShow value <> " Lovelace" +friendlyLovelace :: L.Coin -> Aeson.Value +friendlyLovelace (L.Coin value) = String $ textShow value <> " Lovelace" friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case @@ -563,7 +563,7 @@ friendlyTxOutValue = \case friendlyLedgerValue :: () => ShelleyBasedEra era - -> Ledger.Value (ShelleyLedgerEra era) + -> L.Value (ShelleyLedgerEra era) -> Aeson.Value friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs index 9a1c5ea27d..59b1d4fa28 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs @@ -10,7 +10,7 @@ module Cardano.CLI.Legacy.Run.Governance ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Poll as Cmd @@ -96,7 +96,7 @@ runLegacyGovernanceVerifyPoll pollFile txFile mOutFile = runLegacyGovernanceMIRCertificatePayStakeAddrs :: EraInEon ShelleyToBabbageEra - -> Ledger.MIRPot + -> L.MIRPot -> [StakeAddress] -- ^ Stake addresses -> [Lovelace] -- ^ Corresponding reward amounts (same length) -> File () Out diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs index d414f9c22e..5a96a0aae9 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs @@ -41,8 +41,6 @@ import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common -import qualified Cardano.Ledger.Conway.Governance as Conway -import qualified Cardano.Ledger.Core as Ledger import Prelude @@ -311,14 +309,14 @@ conjureWitness era errF = getVotingScriptCredentials :: VotingProcedures era - -> Maybe (Conway.Voter (L.EraCrypto (ShelleyLedgerEra era))) -getVotingScriptCredentials (VotingProcedures (Conway.VotingProcedures m)) = + -> Maybe (L.Voter (L.EraCrypto (ShelleyLedgerEra era))) +getVotingScriptCredentials (VotingProcedures (L.VotingProcedures m)) = listToMaybe $ Map.keys m votingScriptWitnessSingleton :: VotingProcedures era -> Maybe (ScriptWitness WitCtxStake era) - -> Map (Conway.Voter (L.EraCrypto (ShelleyLedgerEra era))) (ScriptWitness WitCtxStake era) + -> Map (L.Voter (L.EraCrypto (ShelleyLedgerEra era))) (ScriptWitness WitCtxStake era) votingScriptWitnessSingleton _ Nothing = Map.empty votingScriptWitnessSingleton votingProcedures (Just scriptWitness) = let voter = fromJust $ getVotingScriptCredentials votingProcedures @@ -344,13 +342,13 @@ convertToTxVotingProcedures votingProcedures = proposingScriptWitnessSingleton :: Proposal era -> Maybe (ScriptWitness WitCtxStake era) - -> Map (Conway.ProposalProcedure (ShelleyLedgerEra era)) (ScriptWitness WitCtxStake era) + -> Map (L.ProposalProcedure (ShelleyLedgerEra era)) (ScriptWitness WitCtxStake era) proposingScriptWitnessSingleton _ Nothing = Map.empty proposingScriptWitnessSingleton (Proposal proposalProcedure) (Just scriptWitness) = Map.singleton proposalProcedure scriptWitness convToTxProposalProcedures - :: Ledger.EraPParams (ShelleyLedgerEra era) + :: L.EraPParams (ShelleyLedgerEra era) => [(Proposal era, Maybe (ScriptWitness WitCtxStake era))] -> TxProposalProcedures BuildTx era convToTxProposalProcedures proposalProcedures = diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index 18f4507bc4..da9387b675 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -13,7 +13,7 @@ module Cardano.CLI.Types.Output ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import Cardano.Api.Shelley @@ -260,7 +260,7 @@ instance ToJSON ScriptCostOutput where data PlutusScriptCostError = PlutusScriptCostErrPlutusScriptNotFound ScriptWitnessIndex | PlutusScriptCostErrExecError ScriptWitnessIndex (Maybe ScriptHash) ScriptExecutionError - | PlutusScriptCostErrRationalExceedsBound Ledger.Prices ExecutionUnits + | PlutusScriptCostErrRationalExceedsBound L.Prices ExecutionUnits | PlutusScriptCostErrRefInputNoScript TxIn | PlutusScriptCostErrRefInputNotInUTxO TxIn deriving Show @@ -283,7 +283,7 @@ instance Error PlutusScriptCostError where renderScriptCosts :: UTxO era - -> Ledger.Prices + -> L.Prices -> [(ScriptWitnessIndex, AnyScriptWitness era)] -- ^ Initial mapping of script witness index to actual script. -- We need this in order to know which script corresponds to the diff --git a/flake.lock b/flake.lock index c605f76475..5ba63aee5a 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1708424080, - "narHash": "sha256-qeMLKu0E99UycbvXNEjtaVFRaB8NLIEQROwgQcEthFQ=", + "lastModified": 1708623073, + "narHash": "sha256-4V4gwvyqBQ9LD/H7W5C9SNw8XYX7DauLpo0upR7bD1Y=", "owner": "input-output-hk", "repo": "cardano-haskell-packages", - "rev": "75c63f31a47341bfc64fb4985da2b93cc70dd1bc", + "rev": "5a82d3179f692326bc560becc4fe14625a361840", "type": "github" }, "original": { @@ -210,11 +210,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1708388523, - "narHash": "sha256-dlYgCaIk7TWzgCfKobW5pWQdWuQyvRo9n0geXJxGdPM=", + "lastModified": 1708647761, + "narHash": "sha256-1WiRX2IqiopPq3sQTBPF7BswDacfGB9UUNnN9PYgrXA=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "f089ddea2b4a66bb1b64469ae9f9a2dcfc373cdb", + "rev": "6a164db037c9cb2fd7ea946e7a0d62d7d8f53766", "type": "github" }, "original": { From ac64002d619eff49a220d7485347d28a652ef674 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Fri, 23 Feb 2024 05:12:59 +0100 Subject: [PATCH 3/3] Update imports --- .github/workflows/haskell.yml | 2 +- cardano-cli/cardano-cli.cabal | 2 -- .../src/Cardano/CLI/Byron/Delegation.hs | 4 --- cardano-cli/src/Cardano/CLI/Byron/Genesis.hs | 3 +- cardano-cli/src/Cardano/CLI/Byron/Key.hs | 4 --- cardano-cli/src/Cardano/CLI/Byron/Parsers.hs | 1 - cardano-cli/src/Cardano/CLI/Byron/Run.hs | 4 --- cardano-cli/src/Cardano/CLI/Byron/Tx.hs | 4 --- .../src/Cardano/CLI/Byron/UpdateProposal.hs | 2 +- cardano-cli/src/Cardano/CLI/Byron/Vote.hs | 4 --- .../Cardano/CLI/EraBased/Options/Common.hs | 1 - .../CLI/EraBased/Options/Transaction.hs | 2 +- cardano-cli/src/Cardano/CLI/EraBased/Run.hs | 2 -- .../src/Cardano/CLI/EraBased/Run/Address.hs | 3 -- .../Cardano/CLI/EraBased/Run/Address/Info.hs | 3 -- .../CLI/EraBased/Run/CreateTestnetData.hs | 5 --- .../src/Cardano/CLI/EraBased/Run/Genesis.hs | 5 --- .../Cardano/CLI/EraBased/Run/Governance.hs | 2 -- .../CLI/EraBased/Run/Governance/Actions.hs | 3 -- .../CLI/EraBased/Run/Governance/Committee.hs | 4 --- .../CLI/EraBased/Run/Governance/DRep.hs | 4 --- .../GenesisKeyDelegationCertificate.hs | 3 -- .../CLI/EraBased/Run/Governance/Hash.hs | 2 -- .../CLI/EraBased/Run/Governance/Poll.hs | 4 --- .../CLI/EraBased/Run/Governance/Vote.hs | 2 -- .../src/Cardano/CLI/EraBased/Run/Key.hs | 3 -- .../src/Cardano/CLI/EraBased/Run/Node.hs | 3 -- .../src/Cardano/CLI/EraBased/Run/Query.hs | 6 ---- .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 5 --- .../src/Cardano/CLI/EraBased/Run/StakePool.hs | 5 --- .../src/Cardano/CLI/EraBased/Run/TextView.hs | 3 -- .../Cardano/CLI/EraBased/Run/Transaction.hs | 5 --- cardano-cli/src/Cardano/CLI/Helpers.hs | 2 +- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 1 - cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 2 +- .../src/Cardano/CLI/Legacy/Run/Address.hs | 2 -- .../src/Cardano/CLI/Legacy/Run/Genesis.hs | 2 -- .../src/Cardano/CLI/Legacy/Run/Governance.hs | 2 -- cardano-cli/src/Cardano/CLI/Legacy/Run/Key.hs | 1 - .../Cardano/CLI/Legacy/Run/StakeAddress.hs | 2 -- .../src/Cardano/CLI/Legacy/Run/StakePool.hs | 2 -- .../src/Cardano/CLI/Legacy/Run/TextView.hs | 2 -- .../src/Cardano/CLI/Legacy/Run/Transaction.hs | 3 -- cardano-cli/src/Cardano/CLI/Pretty.hs | 35 +++++++++++++++---- cardano-cli/src/Cardano/CLI/Read.hs | 5 --- cardano-cli/src/Cardano/CLI/Run/Ping.hs | 3 +- .../CLI/Types/Errors/AddressCmdError.hs | 2 -- .../CLI/Types/Errors/AddressInfoError.hs | 1 - .../src/Cardano/CLI/Types/Errors/CmdError.hs | 1 - .../CLI/Types/Errors/GenesisCmdError.hs | 1 - .../Types/Errors/GovernanceActionsError.hs | 1 - .../CLI/Types/Errors/GovernanceCmdError.hs | 1 - .../CLI/Types/Errors/GovernanceHashError.hs | 1 - .../CLI/Types/Errors/GovernanceQueryError.hs | 1 - .../Types/Errors/GovernanceVoteCmdError.hs | 1 - .../CLI/Types/Errors/ItnKeyConversionError.hs | 1 - .../Cardano/CLI/Types/Errors/KeyCmdError.hs | 1 - .../Cardano/CLI/Types/Errors/NodeCmdError.hs | 1 - .../CLI/Types/Errors/ProtocolParamsError.hs | 1 - .../Cardano/CLI/Types/Errors/QueryCmdError.hs | 1 - .../Errors/QueryCmdLocalStateQueryError.hs | 2 +- .../Errors/StakeAddressDelegationError.hs | 1 - .../CLI/Types/Errors/StakePoolCmdError.hs | 2 -- .../CLI/Types/Errors/TextViewFileError.hs | 2 -- .../Cardano/CLI/Types/Errors/TxCmdError.hs | 1 - .../CLI/Types/Errors/TxValidationError.hs | 1 - cardano-cli/src/Cardano/CLI/Types/Key.hs | 4 --- cardano-cli/src/Cardano/CLI/Types/Output.hs | 1 - .../Test/Golden/Byron/SigningKeys.hs | 1 - .../Test/Golden/Byron/Tx.hs | 3 -- .../Test/Golden/Byron/UpdateProposal.hs | 3 +- .../Test/Golden/Byron/Vote.hs | 3 +- .../Golden/EraBased/Governance/VerifyPoll.hs | 2 -- .../golden/governance/hash/foo.script.hash | 2 +- .../Test/Cardano/CLI/Util.hs | 4 --- .../Test/Cli/FilePermissions.hs | 2 -- 76 files changed, 40 insertions(+), 178 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index b174810d79..65e26672de 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -24,7 +24,7 @@ jobs: env: # Modify this value to "invalidate" the cabal cache. - CABAL_CACHE_VERSION: "2024-02-23" + CABAL_CACHE_VERSION: "2024-02-23-3" concurrency: group: > diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index c39cd8c49a..bff4c5c591 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -270,7 +270,6 @@ library cardano-cli-test-lib , hedgehog-extras ^>= 0.6.1.0 , process , text - , transformers test-suite cardano-cli-test import: project-config @@ -296,7 +295,6 @@ test-suite cardano-cli-test , tasty-hedgehog , text , time - , transformers build-tool-depends: tasty-discover:tasty-discover diff --git a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs index f03f425465..8e49a865ae 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Delegation.hs @@ -15,7 +15,6 @@ where import Cardano.Api.Byron import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import qualified Cardano.Chain.Delegation as Dlg import Cardano.Chain.Slotting (EpochNumber) @@ -29,9 +28,6 @@ import Prelude hiding ((.)) import Control.Category import Control.Monad (unless) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (left) import Data.ByteString (ByteString) import qualified Data.ByteString.Lazy as LB import Data.Text (Text) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs index 8ef60131b6..1e255a13ea 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Genesis.hs @@ -15,7 +15,7 @@ where import Cardano.Api (Key (..), NetworkId, writeSecrets) import Cardano.Api.Byron (ByronKey, SerialiseAsRawBytes (..), SigningKey (..), toByronRequiresNetworkMagic) -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import qualified Cardano.Chain.Common as Common import Cardano.Chain.Delegation hiding (Map, epoch) @@ -28,7 +28,6 @@ import Cardano.CLI.Types.Common (GenesisFile (..)) import qualified Cardano.Crypto as Crypto import Cardano.Prelude (canonicalDecodePretty, canonicalEncodePretty) -import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Trans (MonadTrans (..)) import Control.Monad.Trans.Except (ExceptT (..), withExceptT) import Control.Monad.Trans.Except.Extra (firstExceptT, left, right) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Key.hs b/cardano-cli/src/Cardano/CLI/Byron/Key.hs index 6bf0df5b7b..c743579831 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Key.hs @@ -17,16 +17,12 @@ module Cardano.CLI.Byron.Key where import Cardano.Api.Byron -import Cardano.Api.Pretty import qualified Cardano.Chain.Common as Common import Cardano.CLI.Types.Common import qualified Cardano.Crypto.Signing as Crypto import Control.Exception (Exception (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, left, - right) import qualified Data.ByteString as SB import qualified Data.ByteString.UTF8 as UTF8 import Data.String (IsString, fromString) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs index b93a9a1465..5b7cdc1601 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Parsers.hs @@ -28,7 +28,6 @@ import Cardano.Api hiding (GenesisParameters, UpdateProposal) import Cardano.Api.Byron (Address (..), ByronProtocolParametersUpdate (..), toByronLovelace) import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley (ReferenceScript (ReferenceScriptNone)) import Cardano.Chain.Common (BlockCount (..), TxFeePolicy (..), TxSizeLinear (..), diff --git a/cardano-cli/src/Cardano/CLI/Byron/Run.hs b/cardano-cli/src/Cardano/CLI/Byron/Run.hs index 5c17012eee..f36ad6e99f 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Run.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Run.hs @@ -24,9 +24,6 @@ import Cardano.CLI.Types.Common import qualified Cardano.Crypto.Hashing as Crypto import qualified Cardano.Crypto.Signing as Crypto -import Control.Monad.IO.Class (MonadIO (liftIO)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, left) import Data.Bifunctor (Bifunctor (..)) import qualified Data.ByteString.Char8 as BS import Data.Text (Text) @@ -34,7 +31,6 @@ import qualified Data.Text.IO as Text import qualified Data.Text.Lazy.Builder as Builder import qualified Data.Text.Lazy.IO as TL import qualified Formatting as F -import Prettyprinter -- | Data type that encompasses all the possible errors of the -- Byron client. diff --git a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs index a153a34b06..17369e8efe 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Tx.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Tx.hs @@ -28,7 +28,6 @@ where import Cardano.Api import Cardano.Api.Byron import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import qualified Cardano.Binary as Binary import qualified Cardano.Chain.Common as Common @@ -42,9 +41,6 @@ import qualified Ouroboros.Consensus.Byron.Ledger as Byron import Ouroboros.Consensus.Cardano.Block (EraMismatch (..)) import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (left) import Data.Bifunctor (Bifunctor (..)) import Data.ByteString (ByteString) import qualified Data.ByteString as B diff --git a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs index c96450721e..4a2ac1eb6f 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs @@ -13,7 +13,7 @@ module Cardano.CLI.Byron.UpdateProposal import Cardano.Api (NetworkId, SerialiseAsRawBytes (..), SocketPath) import Cardano.Api.Byron (AsType (AsByronUpdateProposal), ByronProtocolParametersUpdate, ByronUpdateProposal, makeByronUpdateProposal, toByronLedgerUpdateProposal) -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import Cardano.Chain.Update (InstallerHash (..), ProtocolVersion (..), SoftwareVersion (..), SystemTag (..)) diff --git a/cardano-cli/src/Cardano/CLI/Byron/Vote.hs b/cardano-cli/src/Cardano/CLI/Byron/Vote.hs index 17d56e1683..29c8502426 100644 --- a/cardano-cli/src/Cardano/CLI/Byron/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/Byron/Vote.hs @@ -11,7 +11,6 @@ module Cardano.CLI.Byron.Vote ) where import Cardano.Api.Byron -import Cardano.Api.Pretty import qualified Cardano.Binary as Binary import Cardano.CLI.Byron.Genesis (ByronGenesisError) @@ -24,9 +23,6 @@ import Cardano.CLI.Types.Common import Ouroboros.Consensus.Ledger.SupportsMempool (txId) import Ouroboros.Consensus.Util.Condense (condense) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither) import Control.Tracer (stdoutTracer, traceWith) import Data.Bifunctor (first) import qualified Data.ByteString as BS diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index 3977812388..141365e526 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -13,7 +13,6 @@ module Cardano.CLI.EraBased.Options.Common where import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Environment (EnvCli (..), envCliAnyShelleyBasedEra, diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index 8283c64035..687a834816 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -19,7 +19,7 @@ import Data.Foldable import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt import qualified Options.Applicative.Help as H -import Prettyprinter (line, pretty) +import Prettyprinter (line) {- HLINT ignore "Use <$>" -} {- HLINT ignore "Move brackets to avoid $" -} diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run.hs index 1907e0c9a6..b3157cdfce 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run.hs @@ -22,8 +22,6 @@ import Cardano.CLI.EraBased.Run.TextView import Cardano.CLI.EraBased.Run.Transaction import Cardano.CLI.Types.Errors.CmdError -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra (firstExceptT) import Data.Function ((&)) runAnyEraCommand :: () diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs index d3ba338a5f..717fb287b5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs @@ -26,9 +26,6 @@ import Cardano.CLI.Types.Key (PaymentVerifier (..), StakeIdentifier (. StakeVerifier (..), VerificationKeyTextOrFile, generateKeyPair, readVerificationKeyOrFile, readVerificationKeyTextOrFileAnyOf) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, left, newExceptT) import qualified Data.ByteString.Char8 as BS import Data.Function import qualified Data.Text.IO as Text diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Address/Info.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Address/Info.hs index 7ce5e5d1c6..fe71b29d72 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Address/Info.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Address/Info.hs @@ -9,9 +9,6 @@ import Cardano.Api import Cardano.CLI.Types.Errors.AddressInfoError -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (left) import Data.Aeson (ToJSON (..), object, (.=)) import Data.Aeson.Encode.Pretty (encodePretty) import qualified Data.ByteString.Lazy.Char8 as LBS diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs index 9084638da0..40d79ddf52 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs @@ -52,11 +52,6 @@ import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..)) import Control.DeepSeq (NFData, force) import Control.Monad (forM, forM_, unless, void, when, zipWithM) -import Control.Monad.Except (MonadError (..), runExceptT) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, - newExceptT) import qualified Data.Aeson as Aeson import Data.Bifunctor (Bifunctor (..)) import qualified Data.Binary.Get as Bin diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index 68223aca8c..b40460826e 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -75,11 +75,6 @@ import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..)) import Control.DeepSeq (NFData, force) import Control.Monad (forM, forM_, unless, when) -import Control.Monad.Except (MonadError (..)) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT, throwE, withExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, left, - newExceptT) import Data.Aeson hiding (Key) import qualified Data.Aeson as Aeson import Data.Aeson.Encode.Pretty (encodePretty) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index 6989a4db25..f09f355d3b 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -31,8 +31,6 @@ import Cardano.CLI.Types.Errors.CmdError import Cardano.CLI.Types.Errors.GovernanceCmdError import Control.Monad -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra import Data.Function import qualified Data.Map.Strict as Map diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 9f786ee67d..66065379b3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -25,9 +25,6 @@ import Cardano.CLI.Types.Errors.GovernanceActionsError import Cardano.CLI.Types.Key import Control.Monad -import Control.Monad.Except (ExceptT) -import Control.Monad.Trans (MonadTrans (..)) -import Control.Monad.Trans.Except.Extra import Data.Function import qualified Data.Map.Strict as Map diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Committee.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Committee.hs index 91f0616c1e..9295fa78ee 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Committee.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Committee.hs @@ -17,10 +17,6 @@ import Cardano.CLI.Types.Errors.GovernanceCommitteeError import Cardano.CLI.Types.Key import Cardano.CLI.Types.Key.VerificationKey -import Control.Monad.Except (ExceptT) -import Control.Monad.IO.Class (liftIO) -import Control.Monad.Trans (lift) -import Control.Monad.Trans.Except.Extra import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BS import Data.Function diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index 3872a3aa07..8265dde3e6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -27,10 +27,6 @@ import Cardano.CLI.Types.Errors.GovernanceCmdError import Cardano.CLI.Types.Errors.RegistrationError import Cardano.CLI.Types.Key -import Control.Monad.IO.Class -import Control.Monad.Trans.Class -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import Data.Function import qualified Data.Text.Encoding as Text diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs index 995c1c74d4..de0032d6d7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs @@ -12,9 +12,6 @@ import Cardano.Api.Shelley import Cardano.CLI.Types.Errors.GovernanceCmdError import Cardano.CLI.Types.Key -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra - runGovernanceGenesisKeyDelegationCertificate :: ShelleyToBabbageEra era -> VerificationKeyOrHashOrFile GenesisKey diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs index d5fd8d4e81..f7c46a573d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs @@ -24,8 +24,6 @@ import Cardano.CLI.Types.Errors.GovernanceCmdError import Cardano.CLI.Types.Errors.GovernanceHashError import Cardano.Crypto.Hash (hashToTextAsHex) -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import qualified Data.ByteString as BS import Data.Function import qualified Data.Text.Encoding as Text diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs index 3ac4e6b683..6e8d57a18d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Poll.hs @@ -19,10 +19,6 @@ import Cardano.CLI.Read import Cardano.CLI.Types.Errors.GovernanceCmdError import Control.Monad -import Control.Monad.IO.Class -import Control.Monad.Trans.Class (lift) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra import qualified Data.ByteString.Char8 as BSC import Data.Function ((&)) import Data.String (fromString) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index 7e34eff091..201df0c1c2 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -22,8 +22,6 @@ import Cardano.CLI.Types.Errors.GovernanceVoteCmdError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import Data.Aeson.Encode.Pretty import Data.Function import qualified Data.Yaml.Pretty as Yaml diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs index 0d369edf89..ae180f7bdd 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Key.hs @@ -48,9 +48,6 @@ import qualified Cardano.Crypto.Wallet as Crypto import qualified Codec.Binary.Bech32 as Bech32 import qualified Control.Exception as Exception -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, left, newExceptT) import Data.Bifunctor (Bifunctor (..)) import Data.ByteString (ByteString) import qualified Data.ByteString as BS diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Node.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Node.hs index af2240a921..cef97c09f8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Node.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Node.hs @@ -22,9 +22,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.NodeCmdError import Cardano.CLI.Types.Key -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, newExceptT) import qualified Data.ByteString.Char8 as BS import Data.String (fromString) import Data.Word (Word64) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index ae83f0642f..ee445884e4 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -41,7 +41,6 @@ import Cardano.Api hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api as Api import Cardano.Api.Byron hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) import qualified Cardano.CLI.EraBased.Commands.Query as Cmd @@ -68,11 +67,6 @@ import Ouroboros.Network.Block (Serialised (..)) import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import Control.Monad (forM, forM_, join) -import Control.Monad.IO.Class (MonadIO) -import Control.Monad.IO.Unlift (MonadIO (..)) -import Control.Monad.Trans.Class -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import Data.Aeson as Aeson import qualified Data.Aeson as A import Data.Aeson.Encode.Pretty (encodePretty) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index f5a70f23ef..2cc9f724ab 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -31,11 +31,6 @@ import Cardano.CLI.Types.Errors.StakeAddressRegistrationError import Cardano.CLI.Types.Governance import Cardano.CLI.Types.Key -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans (lift) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, left, newExceptT, - onLeft) import qualified Data.ByteString.Char8 as BS import Data.Function ((&)) import qualified Data.Text.IO as Text diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs index f591512cfd..1023c744f7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs @@ -24,11 +24,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.StakePoolCmdError import Cardano.CLI.Types.Key (readVerificationKeyOrFile) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans (lift) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, handleIOExceptT, hoistEither, left, - newExceptT, onLeft) import qualified Data.ByteString.Char8 as BS import Data.Function ((&)) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/TextView.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/TextView.hs index 232d40883c..4c11600d6f 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/TextView.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/TextView.hs @@ -13,9 +13,6 @@ import Cardano.CLI.EraBased.Commands.TextView import Cardano.CLI.Helpers (pPrintCBOR) import Cardano.CLI.Types.Errors.TextViewFileError -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT, newExceptT) import qualified Data.ByteString.Lazy.Char8 as LBS runTextViewCmds :: TextViewCmds era -> ExceptT TextViewFileError IO () diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 071e93d675..0ade293acc 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -52,11 +52,6 @@ import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx import Control.Monad (forM) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans (MonadTrans (..)) -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra (firstExceptT, hoistEither, hoistMaybe, left, - newExceptT, onLeft, onNothing) import Data.Aeson.Encode.Pretty (encodePretty) import Data.Bifunctor (Bifunctor (..)) import qualified Data.ByteString.Char8 as BS diff --git a/cardano-cli/src/Cardano/CLI/Helpers.hs b/cardano-cli/src/Cardano/CLI/Helpers.hs index 7249b97ed8..78634e8c35 100644 --- a/cardano-cli/src/Cardano/CLI/Helpers.hs +++ b/cardano-cli/src/Cardano/CLI/Helpers.hs @@ -17,7 +17,7 @@ module Cardano.CLI.Helpers ) where import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty +import Cardano.CLI.Pretty (Doc, pretty, pshow) import Cardano.Chain.Block (decCBORABlockOrBoundary) import qualified Cardano.Chain.Delegation as Delegation diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index c36df87daf..5607b8d804 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -25,7 +25,6 @@ import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), ShelleyLedgerEra, StakeAddress (..), fromShelleyPaymentCredential, fromShelleyStakeReference, toShelleyLovelace, toShelleyStakeCredential) -import Control.Monad.Trans (MonadIO) import Data.Aeson (Value (..), object, toJSON, (.=)) import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty as Aeson diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 15fcd7866a..a1f81c395d 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -50,7 +50,7 @@ import Data.Word (Word64) import Options.Applicative hiding (help, str) import qualified Options.Applicative as Opt import qualified Options.Applicative.Help as H -import Prettyprinter (line, pretty) +import Prettyprinter (line) {- HLINT ignore "Use <$>" -} {- HLINT ignore "Move brackets to avoid $" -} diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Address.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Address.hs index 0aa940b4ed..bde7d168aa 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Address.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Address.hs @@ -20,8 +20,6 @@ import Cardano.CLI.Types.Errors.AddressInfoError import Cardano.CLI.Types.Key (PaymentVerifier (..), StakeIdentifier (..), VerificationKeyTextOrFile) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra (firstExceptT) import Data.Function import Data.Text (Text) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs index b69a5e526b..86b804cbc2 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs @@ -21,8 +21,6 @@ import Cardano.CLI.Legacy.Commands.Genesis import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.GenesisCmdError -import Control.Monad.Trans.Except (ExceptT) - runLegacyGenesisCmds :: LegacyGenesisCmds -> ExceptT GenesisCmdError IO () runLegacyGenesisCmds = \case GenesisKeyGenGenesis vk sk -> diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs index 59b1d4fa28..fafcc686dc 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs @@ -23,8 +23,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.GovernanceCmdError import Control.Monad -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Except.Extra import Data.Aeson (eitherDecode) import qualified Data.ByteString.Lazy as LB import Data.Function ((&)) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Key.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Key.hs index 80450fa268..42becd300b 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Key.hs @@ -13,7 +13,6 @@ import Cardano.CLI.Legacy.Commands.Key import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.KeyCmdError -import Control.Monad.Trans.Except (ExceptT) import Data.Text (Text) runLegacyKeyCmds :: () diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakeAddress.hs index d9ed1e287f..889bb029bf 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakeAddress.hs @@ -14,8 +14,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.StakeAddressCmdError import Cardano.CLI.Types.Key -import Control.Monad.Trans.Except (ExceptT) - runLegacyStakeAddressCmds :: () => LegacyStakeAddressCmds -> ExceptT StakeAddressCmdError IO () diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs index d82e51519e..0eaeb38d43 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/StakePool.hs @@ -17,8 +17,6 @@ import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.StakePoolCmdError import Cardano.CLI.Types.Key (VerificationKeyOrFile) -import Control.Monad.Trans.Except (ExceptT) - runLegacyStakePoolCmds :: () => LegacyStakePoolCmds -> ExceptT StakePoolCmdError IO () diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/TextView.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/TextView.hs index 53e367c08e..cc8a1e60b8 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/TextView.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/TextView.hs @@ -11,8 +11,6 @@ import Cardano.CLI.EraBased.Run.TextView import Cardano.CLI.Legacy.Commands.TextView import Cardano.CLI.Types.Errors.TextViewFileError -import Control.Monad.Trans.Except (ExceptT) - runLegacyTextViewCmds :: LegacyTextViewCmds -> ExceptT TextViewFileError IO () runLegacyTextViewCmds = \case TextViewInfo fpath mOutfile -> runLegacyTextViewInfoCmd fpath mOutfile diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs index 95b2e6e161..3852a816db 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs @@ -20,9 +20,6 @@ import Cardano.CLI.Types.Errors.TxCmdError import Cardano.CLI.Types.Errors.TxValidationError import Cardano.CLI.Types.Governance -import Control.Monad.Trans.Class -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import Data.Function runLegacyTransactionCmds :: LegacyTransactionCmds -> ExceptT TxCmdError IO () diff --git a/cardano-cli/src/Cardano/CLI/Pretty.hs b/cardano-cli/src/Cardano/CLI/Pretty.hs index 1e8e0c9150..652e330a3f 100644 --- a/cardano-cli/src/Cardano/CLI/Pretty.hs +++ b/cardano-cli/src/Cardano/CLI/Pretty.hs @@ -1,15 +1,38 @@ module Cardano.CLI.Pretty - ( module Pretty - , putLn + ( putLn , hPutLn - ) where -import Cardano.Api.Pretty -import qualified Cardano.Api.Pretty as Pretty + -- Re-exported functions from Cardano.Api related to pretty-printing + , black + , blue + , cyan + , docToLazyText + , docToString + , docToText + , green + , magenta + , prettyException + , pshow + , red + , white + , yellow + , (<+>) + , hsep + , vsep + , MonadIO(..) + , Ann + , ShowOf(..) + , Doc + , Pretty(..) + + ) where +import Cardano.Api (black, blue, cyan, docToLazyText, docToString, + docToText, green, magenta, prettyException, pshow, + red, white, yellow, (<+>), hsep, vsep, MonadIO(..), + Ann, ShowOf(..), Doc, Pretty(..)) import qualified Control.Concurrent.QSem as IO import Control.Exception (bracket_) -import Control.Monad.IO.Class (MonadIO, liftIO) import qualified Data.Text.Lazy.IO as TextLazy import Prettyprinter.Render.Terminal import qualified System.IO as IO diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 05c35494af..f430c2e091 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -100,7 +100,6 @@ module Cardano.CLI.Read import Cardano.Api as Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley as Api import qualified Cardano.Binary as CBOR @@ -116,10 +115,6 @@ import Prelude import Control.Exception (bracket, displayException) import Control.Monad (forM, unless, when) -import Control.Monad.IO.Class -import Control.Monad.Trans (MonadTrans (..)) -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import qualified Data.Aeson as Aeson import Data.Bifunctor import Data.ByteString (ByteString) diff --git a/cardano-cli/src/Cardano/CLI/Run/Ping.hs b/cardano-cli/src/Cardano/CLI/Run/Ping.hs index b466f82ea8..a52e96ac47 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Ping.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Ping.hs @@ -11,7 +11,7 @@ module Cardano.CLI.Run.Ping , parsePingCmd ) where -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import qualified Cardano.Network.Ping as CNP @@ -21,7 +21,6 @@ import qualified Control.Concurrent.Class.MonadSTM.Strict as STM import Control.Exception (SomeException) import Control.Monad (forM, unless) import Control.Monad.Class.MonadAsync (MonadAsync (async, wait, waitCatch)) -import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Except (ExceptT) import Control.Monad.Trans.Except.Extra (left) import Control.Tracer (Tracer (..)) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/AddressCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/AddressCmdError.hs index 06bd8dd80d..0a9b7f23b2 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/AddressCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/AddressCmdError.hs @@ -17,8 +17,6 @@ import Cardano.CLI.Types.Errors.AddressInfoError import Cardano.CLI.Types.Key (VerificationKeyTextOrFileError (..), renderVerificationKeyTextOrFileError) -import Prettyprinter - data AddressCmdError = AddressCmdAddressInfoError !AddressInfoError | AddressCmdReadKeyFileError !(FileError InputDecodeError) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/AddressInfoError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/AddressInfoError.hs index 7c1001a037..a0b0361929 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/AddressInfoError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/AddressInfoError.hs @@ -5,7 +5,6 @@ module Cardano.CLI.Types.Errors.AddressInfoError ) where import Cardano.Api -import Cardano.Api.Pretty import Data.Text (Text) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/CmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/CmdError.hs index fb9e482040..0099bfb3c7 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/CmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/CmdError.hs @@ -25,7 +25,6 @@ import Cardano.CLI.Types.Errors.TextViewFileError import Cardano.CLI.Types.Errors.TxCmdError import Data.Text (Text) -import Prettyprinter data CmdError = CmdAddressError !AddressCmdError diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs index 56e5bd9b6e..944cd40aa9 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GenesisCmdError.hs @@ -6,7 +6,6 @@ module Cardano.CLI.Types.Errors.GenesisCmdError ) where import Cardano.Api -import Cardano.Api.Pretty import Cardano.CLI.Byron.Genesis as Byron import Cardano.CLI.Types.Common diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceActionsError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceActionsError.hs index e7e9ad80ca..a7840ad3a1 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceActionsError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceActionsError.hs @@ -5,7 +5,6 @@ module Cardano.CLI.Types.Errors.GovernanceActionsError ) where import Cardano.Api -import Cardano.Api.Pretty import Cardano.CLI.Read diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceCmdError.hs index cce1d5492d..f67cf4daba 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceCmdError.hs @@ -5,7 +5,6 @@ module Cardano.CLI.Types.Errors.GovernanceCmdError where import Cardano.Api -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.Binary (DecoderError) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceHashError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceHashError.hs index b24af608e1..40ca1525e7 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceHashError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceHashError.hs @@ -4,7 +4,6 @@ module Cardano.CLI.Types.Errors.GovernanceHashError ) where import Cardano.Api -import Cardano.Api.Pretty import Cardano.CLI.Read (ScriptDecodeError) import Cardano.Prelude (Exception (displayException), IOException) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs index 614977a790..4be24f77a4 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceQueryError.hs @@ -2,7 +2,6 @@ module Cardano.CLI.Types.Errors.GovernanceQueryError where import Cardano.Api -import Cardano.Api.Pretty import Cardano.Api.Shelley import Ouroboros.Consensus.Cardano.Block (EraMismatch) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs index 2cca84fe12..0a3a7e4cba 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/GovernanceVoteCmdError.hs @@ -11,7 +11,6 @@ import Cardano.CLI.Read (VoteError) import qualified Data.Text.Lazy.Builder as TL import qualified Formatting.Buildable as B -import Prettyprinter data GovernanceVoteCmdError = GovernanceVoteCmdReadVerificationKeyError !(FileError InputDecodeError) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/ItnKeyConversionError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/ItnKeyConversionError.hs index 62a8c221ba..852d9c25e2 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/ItnKeyConversionError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/ItnKeyConversionError.hs @@ -10,7 +10,6 @@ module Cardano.CLI.Types.Errors.ItnKeyConversionError ) where import Cardano.Api -import Cardano.Api.Pretty import Control.Exception (Exception (..), IOException) import Data.ByteString (ByteString) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs index 3b498c1c9a..a708a80d2f 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/KeyCmdError.hs @@ -9,7 +9,6 @@ module Cardano.CLI.Types.Errors.KeyCmdError ) where import Cardano.Api -import Cardano.Api.Pretty import qualified Cardano.CLI.Byron.Key as Byron import Cardano.CLI.Types.Errors.CardanoAddressSigningKeyConversionError diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/NodeCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/NodeCmdError.hs index 08ac21b308..19680156de 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/NodeCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/NodeCmdError.hs @@ -7,7 +7,6 @@ module Cardano.CLI.Types.Errors.NodeCmdError ) where import Cardano.Api -import Cardano.Api.Pretty {- HLINT ignore "Reduce duplication" -} diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/ProtocolParamsError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/ProtocolParamsError.hs index 91490aef6c..ee62502103 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/ProtocolParamsError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/ProtocolParamsError.hs @@ -10,7 +10,6 @@ module Cardano.CLI.Types.Errors.ProtocolParamsError ) where import Cardano.Api -import Cardano.Api.Pretty import Data.Text (Text) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdError.hs index 116d96d5ca..edc730886f 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdError.hs @@ -14,7 +14,6 @@ module Cardano.CLI.Types.Errors.QueryCmdError ) where import Cardano.Api hiding (QueryInShelleyBasedEra (..)) -import Cardano.Api.Pretty import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) import Cardano.Binary (DecoderError) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs index 959e95811b..dd55616adc 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdLocalStateQueryError.hs @@ -7,7 +7,7 @@ module Cardano.CLI.Types.Errors.QueryCmdLocalStateQueryError ) where import Cardano.Api (Error (..)) -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import Cardano.CLI.Types.Errors.NodeEraMismatchError import Ouroboros.Consensus.Cardano.Block (EraMismatch (..)) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressDelegationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressDelegationError.hs index 56759c6a50..9a4c96e18b 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressDelegationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/StakeAddressDelegationError.hs @@ -6,7 +6,6 @@ module Cardano.CLI.Types.Errors.StakeAddressDelegationError ) where import Cardano.Api -import Cardano.Api.Pretty newtype StakeAddressDelegationError = VoteDelegationNotSupported (EraInEon ShelleyToBabbageEra) deriving Show diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/StakePoolCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/StakePoolCmdError.hs index b10526f92f..4715ff7e63 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/StakePoolCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/StakePoolCmdError.hs @@ -10,8 +10,6 @@ module Cardano.CLI.Types.Errors.StakePoolCmdError import Cardano.Api -import Prettyprinter - data StakePoolCmdError = StakePoolCmdReadFileError !(FileError TextEnvelopeError) | StakePoolCmdReadKeyFileError !(FileError InputDecodeError) diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TextViewFileError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TextViewFileError.hs index caba8b44b0..df558e284e 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TextViewFileError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TextViewFileError.hs @@ -10,8 +10,6 @@ import Cardano.Api import Cardano.CLI.Helpers (HelpersError, renderHelpersError) -import Prettyprinter - data TextViewFileError = TextViewReadFileError (FileError TextEnvelopeError) | TextViewCBORPrettyPrintError !HelpersError diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs index fbbf73d45a..e267a92674 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs @@ -14,7 +14,6 @@ module Cardano.CLI.Types.Errors.TxCmdError ) where import Cardano.Api -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Read diff --git a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs index 5a96a0aae9..5a1b1b2306 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Errors/TxValidationError.hs @@ -37,7 +37,6 @@ module Cardano.CLI.Types.Errors.TxValidationError import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common diff --git a/cardano-cli/src/Cardano/CLI/Types/Key.hs b/cardano-cli/src/Cardano/CLI/Types/Key.hs index 97784b22e5..6ab142bdd8 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Key.hs @@ -48,15 +48,11 @@ module Cardano.CLI.Types.Key import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common import Cardano.CLI.Types.Errors.DelegationError -import Control.Monad.Trans -import Control.Monad.Trans.Except -import Control.Monad.Trans.Except.Extra import Data.Bifunctor (Bifunctor (..)) import qualified Data.ByteString as BS import Data.Function diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index da9387b675..a8f9b797ac 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -14,7 +14,6 @@ module Cardano.CLI.Types.Output import Cardano.Api import qualified Cardano.Api.Ledger as L -import Cardano.Api.Pretty import Cardano.Api.Shelley import Cardano.CLI.Types.Common diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs index b074b77b2c..9dcf4e7c8d 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/SigningKeys.hs @@ -20,7 +20,6 @@ import qualified Cardano.Crypto.Signing as Crypto import Codec.CBOR.Read (deserialiseFromBytes) import Control.Monad (void) -import Control.Monad.Trans.Except (runExceptT) import qualified Data.ByteString.Lazy as LB import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs index 85d1356634..6c9e44e378 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Tx.hs @@ -3,14 +3,11 @@ module Test.Golden.Byron.Tx where import Cardano.Api -import Cardano.Api.Pretty import Cardano.Chain.UTxO (ATxAux) import Cardano.CLI.Byron.Tx import Control.Monad (void) -import Control.Monad.IO.Class (liftIO) -import Control.Monad.Trans.Except (runExceptT) import Data.ByteString (ByteString) import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs index fc53082187..0b22c94bb2 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/UpdateProposal.hs @@ -2,12 +2,11 @@ module Test.Golden.Byron.UpdateProposal where -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import Cardano.CLI.Byron.UpdateProposal import Control.Monad (void) -import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Trans.Except (runExceptT) import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs index 7330d04062..0257c91c0c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Byron/Vote.hs @@ -2,12 +2,11 @@ module Test.Golden.Byron.Vote where -import Cardano.Api.Pretty +import Cardano.CLI.Pretty import Cardano.CLI.Byron.Vote import Control.Monad (void) -import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Trans.Except (runExceptT) import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs index b171013934..fe05cf77a6 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/EraBased/Governance/VerifyPoll.hs @@ -4,12 +4,10 @@ module Test.Golden.EraBased.Governance.VerifyPoll where import Cardano.Api -import Cardano.Api.Pretty import Cardano.CLI.Types.Key (VerificationKeyOrFile (..), readVerificationKeyOrTextEnvFile) -import Control.Monad.IO.Class (liftIO) import qualified Data.ByteString.Char8 as BSC import Test.Cardano.CLI.Util diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash b/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash index 63b4adee4a..18a1b58d25 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/hash/foo.script.hash @@ -1 +1 @@ -2a7a40032759083907e43e145b770b467cfc0ddbc3c1266bc2c01b40 \ No newline at end of file +7dde1be4d1a2f617ac343dd7ef0388cf497c19ba8dab653a5b9eb1e2 diff --git a/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs b/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs index 3a472e4c9d..3c68330b81 100644 --- a/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs +++ b/cardano-cli/test/cardano-cli-test-lib/Test/Cardano/CLI/Util.hs @@ -15,14 +15,10 @@ module Test.Cardano.CLI.Util ) where import Cardano.Api -import Cardano.Api.Pretty import Cardano.CLI.Read import Control.Monad.Catch -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Class (lift) -import Control.Monad.Trans.Except (runExceptT) import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty as Aeson import qualified Data.Aeson.Key as Aeson diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/FilePermissions.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/FilePermissions.hs index adf961c3aa..8dc5620628 100644 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/FilePermissions.hs +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/FilePermissions.hs @@ -8,8 +8,6 @@ import Cardano.Api import Cardano.Api.IO (checkVrfFilePermissions) import Control.Monad (void) -import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Trans.Except (runExceptT) import Test.Cardano.CLI.Util (execCardanoCLI)