Skip to content

Commit

Permalink
Bump cardano-api & ouroboros-consensus (temporary)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhammann committed Nov 13, 2023
1 parent 4478e12 commit ed4a1ef
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 31 deletions.
19 changes: 19 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ write-ghc-environment-files: always
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-api.git
tag: e9b768ff0ae1298c84b9f7474b47377773bf9b7c
subdir:
cardano-api
--sha256: sha256-QieoQCTBSJVxCM71YXnqNTKxXWWMepJ6BmpoqgoiCGU=

source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-consensus.git
tag: ac8a4c0b34385e05616cc53212cad85bbe7ea415
subdir:
ouroboros-consensus
ouroboros-consensus-cardano
ouroboros-consensus-diffusion
ouroboros-consensus-protocol
--sha256: sha256-e5VtDfrSmrAMfpUNdXuLiaTE3p75cRF8EVjtM7oSntY=
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.31.0.0
, cardano-api ^>= 8.30.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 @@ -293,7 +293,7 @@ parseTxOut =
pLovelaceTxOut l =
if l > (maxBound :: Word64)
then error $ show l <> " lovelace exceeds the Word64 upper bound"
else TxOutValueByron ByronEraOnlyByron . Lovelace $ toInteger l
else TxOutAdaOnly ByronToAllegraEraByron . Lovelace $ toInteger l

readerFromAttoParser :: Atto.Parser a -> Opt.ReadM a
readerFromAttoParser p =
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ printUtxo sbe txInOutTuple =

printableValue :: TxOutValue era -> Text
printableValue = \case
TxOutValueByron _ (Lovelace i) -> Text.pack $ show i
TxOutValueShelleyBased sbe2 val -> renderValue $ Api.fromLedgerValue sbe2 val
TxOutAdaOnly _ (Lovelace i) -> Text.pack $ show i
TxOutValue _ val -> renderValue val

runQueryStakePoolsCmd :: ()
=> Cmd.QueryStakePoolsCmdArgs
Expand Down
17 changes: 3 additions & 14 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -690,29 +690,18 @@ toAddressInAnyEra era addrAny = runExcept $ do
pure (AddressInEra (ShelleyAddressInEra sbe) sAddr)


lovelaceToCoin :: Lovelace -> Ledger.Coin
lovelaceToCoin (Lovelace ll) = Ledger.Coin ll

toTxOutValueInAnyEra
:: CardanoEra era
-> Value
-> Either TxCmdError (TxOutValue era)
toTxOutValueInAnyEra era val =
caseByronOrShelleyBasedEra
caseByronToAllegraOrMaryEraOnwards
(\w ->
case valueToLovelace val of
Just l -> return (TxOutValueByron w l)
Just l -> return (TxOutAdaOnly w l)
Nothing -> txFeatureMismatchPure era TxFeatureMultiAssetOutputs
)
(\sbe ->
caseShelleyToAllegraOrMaryEraOnwards
(\_ -> case valueToLovelace val of
Just l -> return (TxOutValueShelleyBased sbe $ lovelaceToCoin l)
Nothing -> txFeatureMismatchPure era TxFeatureMultiAssetOutputs
)
(\w -> return (TxOutValueShelleyBased sbe (toLedgerValue w val))
)
sbe
(\w -> return (TxOutValue w val)
)
era

Expand Down
14 changes: 4 additions & 10 deletions cardano-cli/src/Cardano/CLI/Json/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -562,21 +562,15 @@ friendlyLovelace (Shelley.Coin value) = String $ textShow value <> " Lovelace"
friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value
friendlyMintValue = \case
TxMintNone -> Null
TxMintValue sbe v _ -> friendlyValue (maryEraOnwardsToShelleyBasedEra sbe) v
TxMintValue sbe v _ -> friendlyValue sbe v

friendlyTxOutValue :: TxOutValue era -> Aeson.Value
friendlyTxOutValue = \case
TxOutValueByron _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace
TxOutValueShelleyBased sbe v -> friendlyLedgerValue sbe v

friendlyLedgerValue :: ()
=> ShelleyBasedEra era
-> Ledger.Value (ShelleyLedgerEra era)
-> Aeson.Value
friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v
TxOutAdaOnly _ lovelace -> friendlyLovelace $ toShelleyLovelace lovelace
TxOutValue sbe v -> friendlyValue sbe v

friendlyValue :: ()
=> ShelleyBasedEra era
=> MaryEraOnwards era
-> Api.Value
-> Aeson.Value
friendlyValue _ v =
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed4a1ef

Please sign in to comment.