Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTxO-HD: Make devops-shell compile again and fix cli parser #4843

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev
sudo apt-get -y install libsystemd0 libsystemd-dev
sudo apt-get -y install liblmdb
sudo apt-get -y install liblmdb-dev
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove

Expand All @@ -86,6 +86,7 @@ jobs:
if: runner.os == 'macOS'
run: |
brew install libsodium lmdb
cp ./.github/workflows/lmdb.pc /usr/local/lib/pkgconfig

- name: "MAC: Install build environment (for secp256k1)"
if: runner.os == 'macOS'
Expand Down
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ source-repository-package
ouroboros-consensus
ouroboros-consensus-byron
ouroboros-consensus-cardano
ouroboros-consensus-cardano-tools
ouroboros-consensus-diffusion
ouroboros-consensus-protocol
ouroboros-consensus-shelley
Expand Down
7 changes: 7 additions & 0 deletions cardano-cli/src/Cardano/CLI/Helpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

module Cardano.CLI.Helpers
( HelpersError(..)
, Some(..)
, printWarning
, deprecationWarning
, ensureNewFile
Expand Down Expand Up @@ -129,3 +130,9 @@ hushM :: forall e m a. Monad m => Either e a -> (e -> m ()) -> m (Maybe a)
hushM r f = case r of
Right a -> return (Just a)
Left e -> f e >> return Nothing

data Some (f :: k -> Type) where
Some :: f a -> Some f

instance Show (Some f) where
show = const "Some(..)"
10 changes: 4 additions & 6 deletions cardano-cli/src/Cardano/CLI/Shelley/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ import Cardano.Api.Shelley

import Data.Text (Text)

import Ouroboros.Network.Protocol.LocalStateQuery.Type

import Cardano.CLI.Helpers (Some(..))
import Cardano.CLI.Shelley.Key (PaymentVerifier, StakeVerifier, VerificationKeyOrFile,
VerificationKeyOrHashOrFile, VerificationKeyTextOrFile)
import Cardano.CLI.Types

import Cardano.Chain.Common (BlockCount)
import Cardano.Ledger.Shelley.TxBody (MIRPot)

--
-- Shelley CLI command data types
--
Expand Down Expand Up @@ -361,8 +361,7 @@ data QueryCmd =
| QueryStakePools' AnyConsensusModeParams NetworkId (Maybe OutputFile)
| QueryStakeDistribution' AnyConsensusModeParams NetworkId (Maybe OutputFile)
| QueryStakeAddressInfo AnyConsensusModeParams StakeAddress NetworkId (Maybe OutputFile)
| QueryUTxOWhole' AnyConsensusModeParams (QueryUTxOFilter 'WholeL) NetworkId (Maybe OutputFile)
| QueryUTxOLarge' AnyConsensusModeParams (QueryUTxOFilter 'LargeL) NetworkId (Maybe OutputFile)
| QueryUTxO' AnyConsensusModeParams (Some QueryUTxOFilter) NetworkId (Maybe OutputFile)
| QueryDebugLedgerState' AnyConsensusModeParams NetworkId (Maybe OutputFile)
| QueryProtocolState' AnyConsensusModeParams NetworkId (Maybe OutputFile)
| QueryStakeSnapshot'
Expand All @@ -389,8 +388,7 @@ renderQueryCmd cmd =
QueryStakePools' {} -> "query stake-pools"
QueryStakeDistribution' {} -> "query stake-distribution"
QueryStakeAddressInfo {} -> "query stake-address-info"
QueryUTxOWhole' {} -> "query utxo"
QueryUTxOLarge' {} -> "query utxo"
QueryUTxO' {} -> "query utxo"
QueryDebugLedgerState' {} -> "query ledger-state"
QueryProtocolState' {} -> "query protocol-state"
QueryStakeSnapshot' {} -> "query stake-snapshot"
Expand Down
36 changes: 12 additions & 24 deletions cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import Cardano.Api.Shelley

import Cardano.Chain.Common (BlockCount (BlockCount))
import Cardano.CLI.Shelley.Commands
import Cardano.CLI.Shelley.Helpers (Some (..))
import Cardano.CLI.Shelley.Key (PaymentVerifier (..), StakeVerifier (..),
VerificationKeyOrFile (..), VerificationKeyOrHashOrFile (..),
VerificationKeyTextOrFile (..))
Expand Down Expand Up @@ -951,23 +952,13 @@ pQueryCmd =
<*> pMaybeOutputFile

pQueryUTxO :: Parser QueryCmd
pQueryUTxO = pQueryUTxOWhole <|> pQueryUTxOLarge
pQueryUTxO =
(QueryUTxO'
<$> pConsensusModeParams
<*> pQueryUTxOFilterWhole
<*> pNetworkId
<*> pMaybeOutputFile)

pQueryUTxOWhole :: Parser QueryCmd
pQueryUTxOWhole =
QueryUTxOWhole'
<$> pConsensusModeParams
<*> pQueryUTxOFilterWhole
<*> pNetworkId
<*> pMaybeOutputFile

pQueryUTxOLarge :: Parser QueryCmd
pQueryUTxOLarge =
QueryUTxOLarge'
<$> pConsensusModeParams
<*> pQueryUTxOFilterLarge
<*> pNetworkId
<*> pMaybeOutputFile

pQueryStakePools :: Parser QueryCmd
pQueryStakePools =
Expand Down Expand Up @@ -2471,10 +2462,11 @@ pTxByronWitnessCount =
<> Opt.value 0
)

pQueryUTxOFilterWhole :: Parser (QueryUTxOFilter 'WholeL)
pQueryUTxOFilterWhole =
pQueryUTxOWhole
<|> pQueryUTxOByAddress
pQueryUTxOFilterWhole :: Parser (Some QueryUTxOFilter)
pQueryUTxOFilterWhole = (
Some <$> pQueryUTxOWhole
<|> Some <$> pQueryUTxOByAddress
<|> Some <$> pQueryUTxOByTxIn)
where
pQueryUTxOWhole =
Opt.flag' QueryUTxOWhole
Expand All @@ -2493,10 +2485,6 @@ pQueryUTxOFilterWhole =
<> Opt.help "Filter by Cardano address(es) (Bech32-encoded)."
)

pQueryUTxOFilterLarge :: Parser (QueryUTxOFilter 'LargeL)
pQueryUTxOFilterLarge =
pQueryUTxOByTxIn
where
pQueryUTxOByTxIn :: Parser (QueryUTxOFilter 'LargeL)
pQueryUTxOByTxIn = QueryUTxOByTxIn . Set.fromList <$> some pByTxIn

Expand Down
11 changes: 5 additions & 6 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ import qualified System.IO as IO
import Text.Printf (printf)

import Cardano.Binary (DecoderError)
import Cardano.CLI.Helpers (HelpersError (..), hushM, pPrintCBOR, renderHelpersError)
import Cardano.CLI.Helpers (HelpersError (..), Some (..), hushM,
pPrintCBOR, renderHelpersError)
import Cardano.CLI.Shelley.Commands
import Cardano.CLI.Shelley.Key (VerificationKeyOrHashOrFile,
readVerificationKeyOrHashOrFile)
Expand Down Expand Up @@ -190,9 +191,7 @@ runQueryCmd cmd =
runQueryStakeSnapshot consensusModeParams network allOrOnlyPoolIds mOutFile
QueryProtocolState' consensusModeParams network mOutFile ->
runQueryProtocolState consensusModeParams network mOutFile
QueryUTxOWhole' consensusModeParams qFilter networkId mOutFile ->
runQueryUTxO consensusModeParams qFilter networkId mOutFile
QueryUTxOLarge' consensusModeParams qFilter networkId mOutFile ->
QueryUTxO' consensusModeParams qFilter networkId mOutFile ->
runQueryUTxO consensusModeParams qFilter networkId mOutFile
QueryKesPeriodInfo consensusModeParams network nodeOpCert mOutFile ->
runQueryKesPeriodInfo consensusModeParams network nodeOpCert mOutFile
Expand Down Expand Up @@ -366,12 +365,12 @@ runQueryTip (AnyConsensusModeParams cModeParams) network mOutFile = do

runQueryUTxO
:: AnyConsensusModeParams
-> QueryUTxOFilter fp
-> Some QueryUTxOFilter
-> NetworkId
-> Maybe OutputFile
-> ExceptT ShelleyQueryCmdError IO ()
runQueryUTxO (AnyConsensusModeParams cModeParams)
qfilter network mOutFile = do
(Some qfilter) network mOutFile = do
SocketPath sockPath <- firstExceptT ShelleyQueryCmdEnvVarSocketErr
$ newExceptT readEnvSocketPath
let localNodeConnInfo = LocalNodeConnectInfo cModeParams network sockPath
Expand Down
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
inherit (ouroboros-consensus-cardano-tools.components.exes) db-analyser db-synthesizer;
inherit (bech32.components.exes) bech32;
} // lib.optionalAttrs hostPlatform.isUnix {
inherit (network-mux.components.exes) cardano-ping;
inherit plutus-example;
});
};
Expand Down
2 changes: 0 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ let
nixWrapped
cardano-cli
bech32
cardano-ping
cardano-cli
cardano-node
cardano-topology
cardano-tracer
Expand Down