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

Use node queries with tighter eons. Simplify prettyprinting. #481

Merged
merged 1 commit into from
Nov 29, 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
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-11-09T23:50:15Z
, cardano-haskell-packages 2023-11-24T10:15:21Z
, cardano-haskell-packages 2023-11-28T17:03:30Z

packages:
cardano-cli
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/app/cardano-cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ main = toplevelExceptionHandler $ do
#endif
co <- Opt.customExecParser pref (opts envCli)

orDie (prettyToText . renderClientCommandError) $ runClientCommand co
orDie (docToText . renderClientCommandError) $ runClientCommand co
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.34.1.0
, cardano-api ^>= 8.35.0.0
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Byron/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ parseTxIdAtto = (<?> "Transaction ID (hexadecimal)") $ do
bstr <- Atto.takeWhile1 Char.isHexDigit
case deserialiseFromRawBytesHex AsTxId bstr of
Right addr -> return addr
Left e -> fail $ prettyToString $ "Incorrect transaction id format: " <> prettyError e
Left e -> fail $ docToString $ "Incorrect transaction id format: " <> prettyError e

parseTxIxAtto :: Atto.Parser TxIx
parseTxIxAtto = toEnum <$> Atto.decimal
Expand Down
48 changes: 24 additions & 24 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ parseTxId = do
str' <- some Parsec.hexDigit <?> "transaction id (hexadecimal)"
case deserialiseFromRawBytesHex AsTxId (BSC.pack str') of
Right addr -> return addr
Left e -> fail $ prettyToString $ "Incorrect transaction id format: " <> prettyError e
Left e -> fail $ docToString $ "Incorrect transaction id format: " <> prettyError e

parseTxIx :: Parsec.Parser TxIx
parseTxIx = TxIx . fromIntegral <$> decimal
Expand Down Expand Up @@ -260,7 +260,7 @@ readVerificationKey asType =
:: String
-> Either String (VerificationKey keyrole)
deserialiseFromBech32OrHex str' =
first (prettyToString . renderInputDecodeError) $
first (docToString . renderInputDecodeError) $
deserialiseInput (AsVerificationKey asType) keyFormats (BSC.pack str')

-- | The first argument is the optional prefix.
Expand Down Expand Up @@ -498,14 +498,14 @@ pHexHash
:: SerialiseAsRawBytes (Hash a) => AsType a -> ReadM (Hash a)
pHexHash a =
Opt.eitherReader $
first (prettyToString . prettyError)
first (docToString . prettyError)
. deserialiseFromRawBytesHex (AsHash a)
. BSC.pack

pBech32KeyHash :: SerialiseAsBech32 (Hash a) => AsType a -> ReadM (Hash a)
pBech32KeyHash a =
Opt.eitherReader $
first (prettyToString . prettyError)
first (docToString . prettyError)
. deserialiseFromBech32 (AsHash a)
. Text.pack

Expand All @@ -522,7 +522,7 @@ pGenesisDelegateVerificationKey =
-> Either String (VerificationKey GenesisDelegateKey)
deserialiseFromHex =
first
(\e -> prettyToString $ "Invalid genesis delegate verification key: " <> prettyError e)
(\e -> docToString $ "Invalid genesis delegate verification key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsGenesisDelegateKey)
. BSC.pack

Expand Down Expand Up @@ -619,7 +619,7 @@ pAddCommitteeColdVerificationKeyHash =
where
deserialiseFromHex :: String -> Either String (Hash CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsCommitteeColdKey)
. BSC.pack

Expand All @@ -640,7 +640,7 @@ pAddCommitteeColdVerificationKey =
where
deserialiseFromHex :: String -> Either String (VerificationKey CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
first (\e -> docToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsCommitteeColdKey)
. BSC.pack

Expand Down Expand Up @@ -671,7 +671,7 @@ pRemoveCommitteeColdVerificationKeyHash =
where
deserialiseFromHex :: String -> Either String (Hash CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsCommitteeColdKey)
. BSC.pack

Expand All @@ -692,7 +692,7 @@ pRemoveCommitteeColdVerificationKey =
where
deserialiseFromHex :: String -> Either String (VerificationKey CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
first (\e -> docToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsCommitteeColdKey)
. BSC.pack

Expand Down Expand Up @@ -731,7 +731,7 @@ pCommitteeColdVerificationKey =
where
deserialiseFromHex :: String -> Either String (VerificationKey CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
first (\e -> docToString $ "Invalid Constitutional Committee cold key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsCommitteeColdKey)
. BSC.pack

Expand All @@ -745,7 +745,7 @@ pCommitteeColdVerificationKeyHash =
where
deserialiseFromHex :: String -> Either String (Hash CommitteeColdKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid Consitutional Committee cold key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsCommitteeColdKey)
. BSC.pack

Expand Down Expand Up @@ -809,7 +809,7 @@ pCommitteeHotVerificationKey =

deserialiseHotCCKeyFromHex :: String -> Either String (VerificationKey CommitteeHotKey)
deserialiseHotCCKeyFromHex =
first (\e -> prettyToString $ "Invalid Constitutional Committee hot key: " <> prettyError e)
first (\e -> docToString $ "Invalid Constitutional Committee hot key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsCommitteeHotKey)
. BSC.pack

Expand Down Expand Up @@ -842,7 +842,7 @@ pCommitteeHotKeyHash prefix =
where
deserialiseFromHex :: String -> Either String (Hash CommitteeHotKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid Consitutional Committee hot key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid Consitutional Committee hot key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsCommitteeHotKey)
. BSC.pack

Expand Down Expand Up @@ -1162,7 +1162,7 @@ pScriptDataOrFile dataFlagPrefix helpTextForValue helpTextForFile =
Left e -> fail $ "readerScriptData: " <> e
Right sDataValue ->
case scriptDataJsonToHashable ScriptDataJsonNoSchema sDataValue of
Left err -> fail $ prettyToString $ prettyError err
Left err -> fail $ docToString $ prettyError err
Right sd -> return sd

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -1648,7 +1648,7 @@ pGenesisVerificationKeyHash =
where
deserialiseFromHex :: String -> Either String (Hash GenesisKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid genesis verification key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid genesis verification key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsGenesisKey)
. BSC.pack

Expand All @@ -1662,7 +1662,7 @@ pGenesisVerificationKey =
where
deserialiseFromHex :: String -> Either String (VerificationKey GenesisKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid genesis verification key: " <> prettyError e)
first (\e -> docToString $ "Invalid genesis verification key: " <> prettyError e)
. deserialiseFromRawBytesHex (AsVerificationKey AsGenesisKey)
. BSC.pack

Expand Down Expand Up @@ -1701,7 +1701,7 @@ pGenesisDelegateVerificationKeyHash =
deserialiseFromHex =
first
(\e ->
prettyToString $ "Invalid genesis delegate verification key hash: " <> prettyError e)
docToString $ "Invalid genesis delegate verification key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsGenesisDelegateKey)
. BSC.pack

Expand Down Expand Up @@ -1745,15 +1745,15 @@ pKesVerificationKey =
Right res -> Right res

-- The input was valid Bech32, but some other error occurred.
Left err@(Bech32UnexpectedPrefix _ _) -> Left (prettyToString $ prettyError err)
Left err@(Bech32DataPartToBytesError _) -> Left (prettyToString $ prettyError err)
Left err@(Bech32DeserialiseFromBytesError _) -> Left (prettyToString $ prettyError err)
Left err@(Bech32WrongPrefix _ _) -> Left (prettyToString $ prettyError err)
Left err@(Bech32UnexpectedPrefix _ _) -> Left (docToString $ prettyError err)
Left err@(Bech32DataPartToBytesError _) -> Left (docToString $ prettyError err)
Left err@(Bech32DeserialiseFromBytesError _) -> Left (docToString $ prettyError err)
Left err@(Bech32WrongPrefix _ _) -> Left (docToString $ prettyError err)

-- The input was not valid Bech32. Attempt to deserialise it as hex.
Left (Bech32DecodingError _) ->
first
(\e -> prettyToString $ "Invalid stake pool verification key: " <> prettyError e) $
(\e -> docToString $ "Invalid stake pool verification key: " <> prettyError e) $
deserialiseFromRawBytesHex asType (BSC.pack str)

pKesVerificationKeyFile :: Parser (VerificationKeyFile In)
Expand Down Expand Up @@ -2318,7 +2318,7 @@ pVrfVerificationKeyHash =
where
deserialiseFromHex :: String -> Either String (Hash VrfKey)
deserialiseFromHex =
first (\e -> prettyToString $ "Invalid VRF verification key hash: " <> prettyError e)
first (\e -> docToString $ "Invalid VRF verification key hash: " <> prettyError e)
. deserialiseFromRawBytesHex (AsHash AsVrfKey)
. BSC.pack

Expand Down Expand Up @@ -2535,7 +2535,7 @@ pStakePoolMetadataHash =
where
metadataHash :: String -> Either String (Hash StakePoolMetadata)
metadataHash =
first (prettyToString . prettyError)
first (docToString . prettyError)
. deserialiseFromRawBytesHex (AsHash AsStakePoolMetadata)
. BSC.pack

Expand Down
Loading