From 8c362f75bcaa6212ec65a3ae38d339f315323c6f Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Thu, 16 Mar 2023 17:02:06 +0100 Subject: [PATCH] Restrict signing tests to recent eras 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. --- .../Cardano/Wallet/Shelley/TransactionSpec.hs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index 0810479e748..af6b7696fbe 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -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 =