diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs index 173c0c2fdf..ff9c6e7231 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Query.hs @@ -5,6 +5,7 @@ module Cardano.CLI.EraBased.Commands.Query ( QueryCmds (..) + , QueryCommitteeStateCmdArgs(..) , QueryLeadershipScheduleCmdArgs(..) , QueryProtocolParametersCmdArgs(..) , QueryConstitutionHashCmdArgs(..) @@ -55,7 +56,7 @@ data QueryCmds era | QueryGovStateCmd !(QueryNoArgCmdArgs era) | QueryDRepStateCmd !(QueryDRepStateCmdArgs era) | QueryDRepStakeDistributionCmd !(QueryDRepStakeDistributionCmdArgs era) - | QueryCommitteeStateCmd !(QueryNoArgCmdArgs era) + | QueryCommitteeStateCmd !(QueryCommitteeStateCmdArgs era) deriving (Generic, Show) data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs @@ -199,6 +200,16 @@ data QueryDRepStakeDistributionCmdArgs era = QueryDRepStakeDistributionCmdArgs , mOutFile :: !(Maybe (File () Out)) } deriving Show +data QueryCommitteeStateCmdArgs era = QueryCommitteeStateCmdArgs + { eon :: !(ConwayEraOnwards era) + , nodeSocketPath :: !SocketPath + , consensusModeParams :: !AnyConsensusModeParams + , networkId :: !NetworkId + , committeeColdVerKeyFile :: ![VerificationKeyOrHashOrFile CommitteeColdKey] + , committeeHotVerKeyFile :: ![VerificationKeyOrHashOrFile CommitteeHotKey] + , mOutFile :: !(Maybe (File () Out)) + } deriving Show + renderQueryCmds :: QueryCmds era -> Text renderQueryCmds = \case QueryLeadershipScheduleCmd {} -> diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index ea09c516f6..e3dade44fb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -351,8 +351,18 @@ pQueryGetCommitteeStateCmd era envCli = do w <- forEraMaybeEon era pure $ subParser "committee-state" - $ Opt.info (QueryCommitteeStateCmd <$> pQueryNoArgCmdArgs w envCli) + $ Opt.info (QueryCommitteeStateCmd <$> pQueryCommitteeStateArgs w) $ Opt.progDesc "Get the committee state" + where + pQueryCommitteeStateArgs :: ConwayEraOnwards era -> Parser (QueryCommitteeStateCmdArgs era) + pQueryCommitteeStateArgs w = QueryCommitteeStateCmdArgs w + <$> pSocketPath envCli + <*> pConsensusModeParams + <*> pNetworkId envCli + <*> many pCommitteeColdVerificationKeyOrHashOrFile + <*> many pCommitteeHotKeyOrHashOrFile + <*> optional pOutputFile + pQueryNoArgCmdArgs :: () => ConwayEraOnwards era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs index cd8e309272..e1b0bfc227 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs @@ -1541,17 +1541,18 @@ runQueryDRepStakeDistribution Map.assocs drepStakeDistribution runQueryCommitteeState - :: Cmd.QueryNoArgCmdArgs era + :: Cmd.QueryCommitteeStateCmdArgs era -> ExceptT QueryCmdError IO () runQueryCommitteeState - Cmd.QueryNoArgCmdArgs + Cmd.QueryCommitteeStateCmdArgs { Cmd.eon , Cmd.nodeSocketPath , Cmd.consensusModeParams = AnyConsensusModeParams cModeParams , Cmd.networkId , Cmd.mOutFile - } - = conwayEraOnwardsConstraints eon $ do + -- , Cmd.committeeColdVerKeyFile -- = coldCredKeys + -- , Cmd.committeeHotVerKeyFile + } = conwayEraOnwardsConstraints eon $ do let localNodeConnInfo = LocalNodeConnectInfo cModeParams networkId nodeSocketPath sbe = conwayEraOnwardsToShelleyBasedEra eon cEra = conwayEraOnwardsToCardanoEra eon @@ -1560,9 +1561,8 @@ runQueryCommitteeState eraInMode <- toEraInMode cEra cMode & hoistMaybe (QueryCmdEraConsensusModeMismatch (AnyConsensusMode cMode) (AnyCardanoEra cEra)) - committeeState <- runQuery localNodeConnInfo $ queryCommitteeState eraInMode sbe - writeOutput mOutFile $ - Map.assocs $ committeeState ^. Ledger.csCommitteeCredsL + committeeState <- runQuery localNodeConnInfo $ queryCommitteeMembersState eraInMode sbe Set.empty Set.empty Set.empty + writeOutput mOutFile committeeState runQuery :: LocalNodeConnectInfo mode -> LocalStateQueryExpr diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 499fa84616..295585833c 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -79,6 +79,10 @@ module Cardano.CLI.Read -- * DRep credentials , getDRepCredentialFromVerKeyHashOrFile + -- * Committee credentials + , getCommitteeColdCredentialFromVerKeyHashOrFile + , getCommitteeHotCredentialFromVerKeyHashOrFile + , ReadSafeHashError(..) , readHexAsSafeHash , readSafeHash @@ -1020,6 +1024,16 @@ getDRepCredentialFromVerKeyHashOrFile = \case pure . Ledger.KeyHashObj . unDRepKeyHash $ verificationKeyHash drepVerKey VerificationKeyHash kh -> pure . Ledger.KeyHashObj $ unDRepKeyHash kh +getCommitteeColdCredentialFromVerKeyHashOrFile :: () + => VerificationKeyOrHashOrFile CommitteeColdKey + -> ExceptT (FileError InputDecodeError) IO (Ledger.Credential Ledger.ColdCommitteeRole Ledger.StandardCrypto) +getCommitteeColdCredentialFromVerKeyHashOrFile = undefined + +getCommitteeHotCredentialFromVerKeyHashOrFile :: () + => VerificationKeyOrHashOrFile CommitteeHotKey + -> ExceptT (FileError InputDecodeError) IO (Ledger.Credential Ledger.HotCommitteeRole Ledger.StandardCrypto) +getCommitteeHotCredentialFromVerKeyHashOrFile = undefined + data ReadSafeHashError = ReadSafeHashErrorNotHex ByteString String | ReadSafeHashErrorInvalidHash Text