Skip to content

Commit

Permalink
Merge pull request #957 from IntersectMBO/remove-transitive-deps-cons…
Browse files Browse the repository at this point in the history
…ensus

Remove direct dependencies from `ouroboros-*`
  • Loading branch information
palas authored Nov 14, 2024
2 parents 2a6b77b + 8329525 commit 5fc3d31
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 36 deletions.
5 changes: 0 additions & 5 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,6 @@ library
network,
network-uri,
optparse-applicative-fork,
ouroboros-consensus ^>=0.21,
ouroboros-consensus-cardano ^>=0.20,
ouroboros-consensus-protocol ^>=0.9.0.2,
ouroboros-network-api ^>=0.10,
ouroboros-network-protocols,
parsec,
prettyprinter,
prettyprinter-ansi-terminal,
Expand Down
7 changes: 3 additions & 4 deletions cardano-cli/src/Cardano/CLI/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ where

import Cardano.Api
import qualified Cardano.Api.Byron as Byron
import Cardano.Api.Consensus (ByronBlock, EraMismatch (..), GenTx (..))
import qualified Cardano.Api.Consensus as Byron
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Network as Net.Tx

import qualified Cardano.Binary as Binary
import Cardano.CLI.Byron.Key (byronWitnessToVerKey)
import Cardano.CLI.Types.Common (TxFile)
import qualified Cardano.Crypto.Signing as Crypto
import Ouroboros.Consensus.Byron.Ledger (ByronBlock, GenTx (..))
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 Data.Bifunctor (Bifunctor (..))
import Data.ByteString (ByteString)
Expand Down
3 changes: 1 addition & 2 deletions cardano-cli/src/Cardano/CLI/Byron/UpdateProposal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ import Cardano.Api
import Cardano.Api.Byron (AsType (AsByronUpdateProposal), ByronProtocolParametersUpdate,
ByronUpdateProposal, makeByronUpdateProposal, toByronLedgerUpdateProposal)
import qualified Cardano.Api.Byron as Byron
import Cardano.Api.Consensus (condense, txId)

import Cardano.CLI.Byron.Genesis (ByronGenesisError)
import Cardano.CLI.Byron.Key (ByronKeyFailure, readByronSigningKey)
import Cardano.CLI.Byron.Tx (ByronTxError, nodeSubmitTx)
import Cardano.CLI.Helpers (HelpersError, ensureNewFileLBS, renderHelpersError)
import Cardano.CLI.Types.Common
import Ouroboros.Consensus.Ledger.SupportsMempool (txId)
import Ouroboros.Consensus.Util.Condense (condense)

import Control.Exception (Exception (..))
import Control.Tracer (stdoutTracer, traceWith)
Expand Down
3 changes: 1 addition & 2 deletions cardano-cli/src/Cardano/CLI/Byron/Vote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Cardano.CLI.Byron.Vote
where

import Cardano.Api.Byron
import Cardano.Api.Consensus (condense, txId)

import qualified Cardano.Binary as Binary
import Cardano.CLI.Byron.Genesis (ByronGenesisError)
Expand All @@ -21,8 +22,6 @@ import Cardano.CLI.Byron.UpdateProposal (ByronUpdateProposalError,
readByronUpdateProposal)
import Cardano.CLI.Helpers (HelpersError, ensureNewFileLBS)
import Cardano.CLI.Types.Common
import Ouroboros.Consensus.Ledger.SupportsMempool (txId)
import Ouroboros.Consensus.Util.Condense (condense)

import Control.Tracer (stdoutTracer, traceWith)
import Data.Bifunctor (first)
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ module Cardano.CLI.EraBased.Commands.Query
)
where

import qualified Cardano.Api.Network as Consensus
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..))

import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Key
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus

import Data.Set (Set)
import Data.Text (Text)
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Cardano.CLI.EraBased.Options.Common where

import Cardano.Api
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Network as Consensus
import Cardano.Api.Shelley

import Cardano.CLI.Environment (EnvCli (..), envCliAnyEon)
Expand All @@ -23,7 +24,6 @@ import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Governance
import Cardano.CLI.Types.Key
import Cardano.CLI.Types.Key.VerificationKey
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus

import Control.Monad (void, when)
import qualified Data.Aeson as Aeson
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Cardano.Api
import Cardano.Api.Byron (toByronLovelace, toByronProtocolMagicId,
toByronRequiresNetworkMagic)
import qualified Cardano.Api.Byron as Byron hiding (GenesisParameters, SigningKey)
import Cardano.Api.Consensus (ShelleyGenesisStaking (..))
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley

Expand All @@ -55,7 +56,6 @@ import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Crypto.Signing as Byron
import Cardano.Prelude (canonicalEncodePretty)
import Cardano.Slotting.Slot (EpochSize (EpochSize))
import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..))

import Control.DeepSeq (NFData, force)
import Control.Exception (evaluate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Cardano.CLI.EraBased.Run.Genesis.CreateTestnetData
where

import Cardano.Api hiding (ConwayEra)
import Cardano.Api.Consensus (ShelleyGenesisStaking (..))
import Cardano.Api.Ledger (StrictMaybe (SNothing))
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley (Hash (..), KESPeriod (KESPeriod),
Expand Down Expand Up @@ -49,7 +50,6 @@ import Cardano.CLI.Types.Errors.GenesisCmdError
import Cardano.CLI.Types.Errors.NodeCmdError
import Cardano.CLI.Types.Errors.StakePoolCmdError
import Cardano.CLI.Types.Key
import Ouroboros.Consensus.Shelley.Node (ShelleyGenesisStaking (..))

import Control.DeepSeq (NFData, deepseq)
import Control.Monad (forM, forM_, unless, void, when)
Expand Down
15 changes: 5 additions & 10 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ where

import Cardano.Api hiding (QueryInShelleyBasedEra (..))
import qualified Cardano.Api as Api
import Cardano.Api.Ledger (strictMaybeToMaybe)
import qualified Cardano.Api.Consensus as Consensus
import Cardano.Api.Ledger (StandardCrypto, strictMaybeToMaybe)
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Network (Serialised (..))
import qualified Cardano.Api.Network as Consensus
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..))

import qualified Cardano.CLI.EraBased.Commands.Query as Cmd
Expand All @@ -56,15 +59,7 @@ import qualified Cardano.CLI.Types.Output as O
import Cardano.Crypto.Hash (hashToBytesAsHex)
import qualified Cardano.Crypto.Hash.Blake2b as Blake2b
import Cardano.Slotting.EpochInfo (EpochInfo (..), epochInfoSlotToUTCTime, hoistEpochInfo)
import Ouroboros.Consensus.BlockchainTime.WallClock.Types (RelativeTime (..),
toRelativeTime)
import qualified Ouroboros.Consensus.Cardano.Block as Consensus
import qualified Ouroboros.Consensus.HardFork.History as Consensus
import qualified Ouroboros.Consensus.Protocol.Abstract as Consensus
import qualified Ouroboros.Consensus.Protocol.Praos.Common as Consensus
import Ouroboros.Consensus.Protocol.TPraos (StandardCrypto)
import Ouroboros.Network.Block (Serialised (..))
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus
import Cardano.Slotting.Time (RelativeTime (..), toRelativeTime)

import Control.Monad (forM, forM_, join)
import Data.Aeson as Aeson
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import Cardano.Api
import qualified Cardano.Api.Byron as Byron
import qualified Cardano.Api.Experimental as Exp
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Network as Consensus
import qualified Cardano.Api.Network as Net.Tx
import Cardano.Api.Shelley

import qualified Cardano.Binary as CBOR
Expand All @@ -55,8 +57,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 Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus
import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx

import Control.Monad (forM)
import Data.Aeson ((.=))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
module Cardano.CLI.Types.Errors.GovernanceQueryError where

import Cardano.Api
import Cardano.Api.Consensus (EraMismatch)
import Cardano.Api.Shelley

import Ouroboros.Consensus.Cardano.Block (EraMismatch)

data GovernanceQueryError
= GovernanceQueryWriteFileError !(FileError ())
| GovernanceQueryAcqireFailureError !AcquiringFailure
Expand Down
5 changes: 2 additions & 3 deletions cardano-cli/src/Cardano/CLI/Types/Errors/QueryCmdError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ module Cardano.CLI.Types.Errors.QueryCmdError
where

import Cardano.Api hiding (QueryInShelleyBasedEra (..))
import Cardano.Api.Consensus as Consensus (EraMismatch (..), PastHorizonException)
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..))

import Cardano.Binary (DecoderError)
import Cardano.CLI.Helpers (HelpersError (..), renderHelpersError)
import Cardano.CLI.Types.Errors.GenesisCmdError
import Cardano.CLI.Types.Errors.QueryCmdLocalStateQueryError
import Ouroboros.Consensus.Cardano.Block as Consensus (EraMismatch (..))
import qualified Ouroboros.Consensus.HardFork.History.Qry as Qry

import qualified Data.ByteString.Lazy.Char8 as LBS
import Data.Text.Lazy.Builder (toLazyText)
Expand All @@ -39,7 +38,7 @@ data QueryCmdError
| QueryCmdAcquireFailure !AcquiringFailure
| QueryCmdByronEra
| QueryCmdEraMismatch !EraMismatch
| QueryCmdPastHorizon !Qry.PastHorizonException
| QueryCmdPastHorizon !Consensus.PastHorizonException
| QueryCmdSystemStartUnavailable
| QueryCmdGenesisReadError !GenesisCmdError
| QueryCmdLeaderShipError !LeadershipError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module Cardano.CLI.Types.Errors.QueryCmdLocalStateQueryError
where

import Cardano.Api
import Cardano.Api.Consensus (EraMismatch (..))

import Cardano.CLI.Types.Errors.NodeEraMismatchError
import Ouroboros.Consensus.Cardano.Block (EraMismatch (..))

-- | An error that can occur while querying a node's local state.
newtype QueryCmdLocalStateQueryError
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Types/Errors/TxCmdError.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Cardano.CLI.Types.Errors.TxCmdError
where

import Cardano.Api
import Cardano.Api.Consensus (EraMismatch (..))
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley

Expand All @@ -29,7 +30,6 @@ import Cardano.CLI.Types.Errors.TxValidationError
import Cardano.CLI.Types.Output
import Cardano.CLI.Types.TxFeature
import qualified Cardano.Prelude as List
import Ouroboros.Consensus.Cardano.Block (EraMismatch (..))

import Data.Text (Text)

Expand Down

0 comments on commit 5fc3d31

Please sign in to comment.