Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .changes/20261016_cardano-cli_ledger_6189.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project: cardano-cli
pr: 1473
kind:
- bugfix
description: Pin cardano-ledger to PR 6189 to fix Plutus data decoding for required top-level guards.
55 changes: 53 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,61 @@ write-ghc-environment-files: always
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

-- Allow network-mux 0.11 from SRP (cardano-ping 0.10 on CHaP expects ^>=0.10)
-- Allow grapesy deps with updated bounds (matching cardano-node)
-- Temporary pin for the Plutus data decoder fix in https://github.com/IntersectMBO/cardano-ledger/pull/6189
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
tag: a2041c4bd73995fb4ab3b90db03fdf8ff464e104
--sha256: 0syndgsgzhzg1wk3k4lf4anfvv9wvvzf437wk8c890mlk4g69vjn
subdir:
eras/allegra/impl
eras/alonzo/impl
eras/babbage/impl
eras/byron/crypto
eras/byron/ledger/impl
eras/conway/impl
eras/dijkstra/impl
eras/mary/impl
eras/shelley/impl
eras/shelley/test-suite
libs/cardano-data
libs/cardano-ledger-api
libs/cardano-ledger-binary
libs/cardano-ledger-core
libs/cardano-protocol
libs/cardano-protocol-tpraos
libs/non-integral
libs/small-steps
libs/vector-map

-- Temporary cardano-api compatibility branch: srp/cardano-ledger-6189
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-api
tag: 326a8f02df4ff1bb8a862aba23ed7e0cbe40a32c
--sha256: 0gn5ad80qp7i5bvyjrsqrm2hq6ifmvcjhnzf6yys30286y94km5l
subdir: cardano-api

-- Temporary ouroboros-consensus compatibility branch: srp/cardano-ledger-6189
source-repository-package
type: git
location: https://github.com/IntersectMBO/ouroboros-consensus
tag: 7ef5dc2474d42eeccc8244c9d2a5379ea2405df7
--sha256: 073rxsv3p5wr9n6kj4hbksa5mirmkpxasayv6h221v1frswp0mr7

allow-newer:
-- Temporary ledger SRP versions exceed the bounds in these released packages.
, cardano-config:cardano-ledger-alonzo
, cardano-config:cardano-ledger-conway
, cardano-config:cardano-ledger-core
, cardano-config:cardano-ledger-dijkstra
, cardano-config:cardano-ledger-shelley
, cardano-keys:cardano-ledger-core
, cardano-keys:cardano-ledger-shelley
, cardano-keys:cardano-protocol
-- Allow network-mux 0.11 from SRP (cardano-ping 0.10 on CHaP expects ^>=0.10)
, cardano-ping:network-mux
-- Allow grapesy deps with updated bounds (matching cardano-node)
, grapesy:aeson
, grapesy:crypton-x509
, grapesy:crypton-x509-store
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ library
cardano-git-rev ^>=0.2.2,
cardano-ledger-api,
cardano-ledger-conway,
cardano-ledger-core,
cardano-ledger-dijkstra,
cardano-ledger-shelley,
cardano-ledger-core >=1.23,
cardano-ledger-dijkstra >=0.5,
cardano-ledger-shelley >=1.21,
cardano-prelude,
cardano-protocol-tpraos,
cardano-slotting ^>=0.2.0.0,
Expand Down
6 changes: 4 additions & 2 deletions cardano-cli/src/Cardano/CLI/Orphan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import Cardano.Api.Ledger qualified as L

import Cardano.CLI.Type.Error.ScriptDecodeError
import Cardano.Ledger.Conway.State qualified as L
import Cardano.Ledger.Shelley.LedgerState qualified as L

import Control.Exception
import Data.Aeson
import Data.List qualified as List
import Data.Typeable
import Data.Word
import Lens.Micro ((^.))

instance Error [Bech32DecodeError] where
prettyError errs = vsep $ map prettyError errs
Expand All @@ -34,14 +36,14 @@ instance
(L.EraTxOut ledgerera, L.EraGov ledgerera, L.EraCertState ledgerera, L.EraStake ledgerera)
=> ToJSON (L.NewEpochState ledgerera)
where
toJSON (L.NewEpochState nesEL nesBprev nesBCur nesEs nesRu nesPd _stashedAvvm) =
toJSON nes@(L.NewEpochState nesEL nesBprev nesBCur nesEs nesRu _stashedAvvm) =
object
[ "currentEpoch" .= nesEL
, "priorBlocks" .= nesBprev
, "currentEpochBlocks" .= nesBCur
, "currentEpochState" .= nesEs
, "rewardUpdate" .= nesRu
, "currentStakeDistribution" .= nesPd
, "currentStakeDistribution" .= (nes ^. L.nesStakePoolDistrG)
]

instance ToJSON HashableScriptData where
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Type/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ mkPoolStates
stakingCredentials = mempty -- QueryPoolStateResult does not provide delegators
PoolParams
{ poolParameters =
(\deposit -> L.mkStakePoolState currentEpoch deposit stakingCredentials pp) <$> mDeposit
(\deposit -> L.mkStakePoolState currentEpoch L.SNothing deposit stakingCredentials pp) <$> mDeposit
, futurePoolParameters = do
futurePp <- Map.lookup kh qpsrFutureStakePoolParams
-- Future parameters only take effect at the next epoch boundary.
(\deposit -> L.mkStakePoolState (succ currentEpoch) deposit stakingCredentials futurePp)
(\deposit -> L.mkStakePoolState (succ currentEpoch) L.SNothing deposit stakingCredentials futurePp)
<$> mDeposit
, retiringEpoch = Map.lookup kh qpsrRetiring
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ hprop_dijkstra_sub_transaction_top_level_key_guard_forms =
forM_ [keyArgs ++ scriptArgs, scriptArgs ++ keyArgs] $ \args -> do
H.noteShow_ args
Exp.UnsignedSubTx tx <- buildSubTransaction outFile args
tx ^. L.bodyTxL . L.requiredTopLevelGuardsL H.=== expected
tx ^. L.bodyTxL . L.requiredTopLevelGuardsTxBodyL H.=== expected
tx ^. L.bodyTxL . L.guardsTxBodyL H.=== mempty
tx ^. L.witsTxL H.=== mempty

Expand Down Expand Up @@ -1089,7 +1089,7 @@ hprop_dijkstra_sub_transaction_top_level_guard_hashes =
expected <- forM [('0', L.SNothing), ('1', L.SJust datum), ('2', L.SNothing)] $ \(digit, mDatum) -> do
ScriptHash hash <- H.evalEither $ deserialiseFromRawBytesHex $ BSC.pack $ replicate 56 digit
pure (L.ScriptHashObj hash, mDatum)
tx ^. L.bodyTxL . L.requiredTopLevelGuardsL H.=== Map.fromList expected
tx ^. L.bodyTxL . L.requiredTopLevelGuardsTxBodyL H.=== Map.fromList expected

-- | Inline, JSON-file and CBOR-file datums produce the same guard entry.
hprop_dijkstra_sub_transaction_top_level_guard_datum_formats :: Property
Expand All @@ -1110,7 +1110,7 @@ hprop_dijkstra_sub_transaction_top_level_guard_datum_formats =
inline H.=== cbor
ScriptHash hash <- H.evalEither $ deserialiseFromRawBytesHex (BSC.replicate 56 '0')
let Exp.UnsignedSubTx tx = inline
tx ^. L.bodyTxL . L.requiredTopLevelGuardsL
tx ^. L.bodyTxL . L.requiredTopLevelGuardsTxBodyL
H.=== Map.singleton (L.ScriptHashObj hash) (L.SJust $ toAlonzoData guardDatum)

-- | Script files resolve to the same guard entries as their hashes, for both
Expand All @@ -1131,7 +1131,7 @@ hprop_dijkstra_sub_transaction_top_level_guard_script_files =
-- A top-level requirement contributes no local guard or witness data.
let Exp.UnsignedSubTx tx = fromFile
ScriptHash hash <- H.evalEither $ deserialiseFromRawBytesHex (BSC.pack scriptHash)
tx ^. L.bodyTxL . L.requiredTopLevelGuardsL
tx ^. L.bodyTxL . L.requiredTopLevelGuardsTxBodyL
H.=== Map.singleton (L.ScriptHashObj hash) expectedDatum
tx ^. L.bodyTxL . L.guardsTxBodyL H.=== mempty
tx ^. L.witsTxL H.=== mempty
Expand Down Expand Up @@ -1164,7 +1164,7 @@ hprop_dijkstra_sub_transaction_top_level_guard_coexists_with_local_guard =
, "42"
]
[credential] <- pure $ toList (local ^. L.bodyTxL . L.guardsTxBodyL)
combined ^. L.bodyTxL . L.requiredTopLevelGuardsL
combined ^. L.bodyTxL . L.requiredTopLevelGuardsTxBodyL
H.=== Map.singleton credential (L.SJust $ toAlonzoData guardDatum)
combined ^. L.bodyTxL . L.guardsTxBodyL H.=== local ^. L.bodyTxL . L.guardsTxBodyL
combined ^. L.witsTxL H.=== local ^. L.witsTxL
Expand Down
Loading