Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
Fixed `transaction assemble` (also known as `transaction sign-witness`) rejecting witness files from eras after Conway: witness files from every supported era, including Dijkstra, are now accepted.
kind:
- bugfix
pr: 1426
project: cardano-cli
34 changes: 10 additions & 24 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,16 @@ readFileTxKeyWitness
-> IO (Either (FileError TextEnvelopeError) (InAnyShelleyBasedEra KeyWitness))
readFileTxKeyWitness fp = do
file <- fileOrPipe fp
readFileInAnyShelleyBasedEra AsKeyWitness file
readFileOrPipeTextEnvelopeAnyOf fromSomeShelleyTxWitness file

fromSomeShelleyTxWitness :: [FromSomeType HasTextEnvelope (InAnyShelleyBasedEra KeyWitness)]
fromSomeShelleyTxWitness =
[ shelleyBasedEraConstraints sbe $ FromSomeType (makeWitnessProxy sbe) (InAnyShelleyBasedEra sbe)
| AnyShelleyBasedEra sbe <- [minBound .. maxBound]
]
where
makeWitnessProxy :: HasTypeProxy era => ShelleyBasedEra era -> AsType (KeyWitness era)
makeWitnessProxy _ = AsKeyWitness (proxyToAsType (Proxy :: Proxy era))

txWitnessTextEnvelopeTypes :: [Text]
txWitnessTextEnvelopeTypes =
Expand Down Expand Up @@ -614,29 +623,6 @@ readCostModels (File fp) = do
when (null $ fromAlonzoCostModels costModels) $ throwE $ CostModelsErrorEmpty fp
return costModels

-- Misc

readFileInAnyShelleyBasedEra
:: ( HasTextEnvelope (thing ShelleyEra)
, HasTextEnvelope (thing AllegraEra)
, HasTextEnvelope (thing MaryEra)
, HasTextEnvelope (thing AlonzoEra)
, HasTextEnvelope (thing BabbageEra)
, HasTextEnvelope (thing ConwayEra)
)
=> (forall era. AsType era -> AsType (thing era))
-> FileOrPipe
-> IO (Either (FileError TextEnvelopeError) (InAnyShelleyBasedEra thing))
readFileInAnyShelleyBasedEra asThing =
readFileOrPipeTextEnvelopeAnyOf
[ FromSomeType (asThing AsShelleyEra) (InAnyShelleyBasedEra ShelleyBasedEraShelley)
, FromSomeType (asThing AsAllegraEra) (InAnyShelleyBasedEra ShelleyBasedEraAllegra)
, FromSomeType (asThing AsMaryEra) (InAnyShelleyBasedEra ShelleyBasedEraMary)
, FromSomeType (asThing AsAlonzoEra) (InAnyShelleyBasedEra ShelleyBasedEraAlonzo)
, FromSomeType (asThing AsBabbageEra) (InAnyShelleyBasedEra ShelleyBasedEraBabbage)
, FromSomeType (asThing AsConwayEra) (InAnyShelleyBasedEra ShelleyBasedEraConway)
]

-- | We need a type for handling files that may be actually be things like
-- pipes. Currently the CLI makes no guarantee that a "file" will only
-- be read once. This is a problem for a user who who expects to be able to pass
Expand Down
Loading