Skip to content

Commit

Permalink
Restrict signing tests to recent eras
Browse files Browse the repository at this point in the history
Quick workaround for failure in the Shelley era. The proper solution is
to also restrict the implementation to only work in recent eras, for
which a JIRA task was created.

Techincally, hiding this failure is a API breaking change, but it would
be /highly/, highly unlikely for any user to care about signing txs in
the Shelley era... with non-compatibile timelock scripts. Besides, the
preceding constructTx endpoint only works in recent eras.
  • Loading branch information
Anviking committed Mar 16, 2023
1 parent 0345305 commit 8c362f7
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs
Expand Up @@ -504,28 +504,42 @@ spec = do
distributeSurplusSpec
estimateSignedTxSizeSpec
describe "Sign transaction" $ do
spec_forAllEras
-- TODO [ADP-2849] The implementation must be restricted to work only in
-- 'RecentEra's, not just the tests.
spec_forAllRecentEras
"signTransaction adds reward account witness when necessary"
prop_signTransaction_addsRewardAccountKey
spec_forAllEras
spec_forAllRecentEras
"signTransaction adds extra key witnesses when necessary"
prop_signTransaction_addsExtraKeyWitnesses
spec_forAllEras
spec_forAllRecentEras
"signTransaction adds tx in witnesses when necessary"
prop_signTransaction_addsTxInWitnesses
spec_forAllEras
spec_forAllRecentEras
"signTransaction adds collateral witnesses when necessary"
prop_signTransaction_addsTxInCollateralWitnesses
spec_forAllEras
spec_forAllRecentEras
"signTransaction never removes witnesses"
prop_signTransaction_neverRemovesWitnesses
spec_forAllEras
spec_forAllRecentEras
"signTransaction never changes tx body"
prop_signTransaction_neverChangesTxBody
spec_forAllEras
spec_forAllRecentEras
"signTransaction preserves script integrity"
prop_signTransaction_preservesScriptIntegrity

spec_forAllRecentEras
:: Testable prop => String -> (AnyCardanoEra -> prop) -> Spec
spec_forAllRecentEras description p =
describe description $
forAllRecentEras'
$ \(AnyCardanoEra era) -> it (show era)
$ property
$ p (AnyCardanoEra era)
where
forAllRecentEras' f = forAllRecentEras $ \(AnyRecentEra recentEra) ->
f $ AnyCardanoEra $ WriteTx.cardanoEraFromRecentEra recentEra

spec_forAllEras
:: Testable prop => String -> (AnyCardanoEra -> prop) -> Spec
spec_forAllEras description p =
Expand Down

0 comments on commit 8c362f7

Please sign in to comment.