From c4ffa722f318a00d52fb442b0cb9752ad46bffef Mon Sep 17 00:00:00 2001 From: Pawel Jakubas Date: Fri, 2 Dec 2022 21:39:21 +0100 Subject: [PATCH] more hlint --- lib/dbvar/src/Database/Persist/Delta.hs | 2 +- lib/wallet/exe/cardano-wallet.hs | 3 +-- lib/wallet/integration/src/Test/Integration/Faucet.hs | 2 +- lib/wallet/integration/src/Test/Integration/Framework/DSL.hs | 2 +- .../src/Test/Integration/Scenario/API/Shared/Wallets.hs | 2 +- .../Test/Integration/Scenario/API/Shelley/TransactionsNew.hs | 4 ++-- lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs | 5 ++--- .../test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs | 4 ++-- 8 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/dbvar/src/Database/Persist/Delta.hs b/lib/dbvar/src/Database/Persist/Delta.hs index ac651e0fac9..9afc57ef13b 100644 --- a/lib/dbvar/src/Database/Persist/Delta.hs +++ b/lib/dbvar/src/Database/Persist/Delta.hs @@ -160,7 +160,7 @@ newDatabaseStore db = do rememberSupply (apply ds table) -- need to use updated supply } where - debug m = when False m + debug = when False update1 _ (InsertManyDB zs) = void $ repsertMany db zs update1 _ (DeleteManyDB ks) = forM_ ks $ deleteOne db diff --git a/lib/wallet/exe/cardano-wallet.hs b/lib/wallet/exe/cardano-wallet.hs index d58938a5163..4546eeeba99 100644 --- a/lib/wallet/exe/cardano-wallet.hs +++ b/lib/wallet/exe/cardano-wallet.hs @@ -229,7 +229,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ Left err -> do logError tr (MsgFailedToParseGenesis $ T.pack err) exitWith $ ExitFailure 33 - whenJust databaseDir $ + forM_ databaseDir $ setupDirectory (logInfo tr . MsgSetupDatabases) blockchainSource <- case mode of @@ -264,7 +264,6 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ block0 (beforeMainLoop tr) - whenJust m fn = Data.Foldable.forM_ m fn withShutdownHandlerMaybe :: Trace IO MainLog -> Bool -> IO () -> IO () withShutdownHandlerMaybe _ False = void withShutdownHandlerMaybe tr True = void . withShutdownHandler trShutdown diff --git a/lib/wallet/integration/src/Test/Integration/Faucet.hs b/lib/wallet/integration/src/Test/Integration/Faucet.hs index a5caa1db5fa..cc7d43df2c2 100644 --- a/lib/wallet/integration/src/Test/Integration/Faucet.hs +++ b/lib/wallet/integration/src/Test/Integration/Faucet.hs @@ -2391,7 +2391,7 @@ shelleyIntegrationTestFunds = mconcat , mirWallets ] where - defaultAmt = Coin 100000000000 + defaultAmt = Coin 100_000_000_000 -- NOTE: Generating e.g. 100 addresses for inclusion in the shelley genesis -- sgInitialFunds could theoretically cause some funds not to be diff --git a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs index a16cbf3359c..7e422564da6 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs @@ -1007,7 +1007,7 @@ sharedAccPubKeyFromMnemonics -> Text sharedAccPubKeyFromMnemonics mnemonic1 mnemonic2 ix passphrase = T.decodeUtf8 $ encode (EBech32 hrp) $ xpubToBytes $ getRawKey $ publicKey $ - deriveAccountPrivateKey passphrase rootXPrv (Index $ 2147483648 + ix) + deriveAccountPrivateKey passphrase rootXPrv (Index $ 2_147_483_648 + ix) where hrp = [Bech32.humanReadablePart|acct_shared_xvk|] rootXPrv = Shared.generateKeyFromSeed (mnemonic1, mnemonic2) passphrase diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs index 41dd135cdf2..3cfab0b16e3 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs @@ -468,7 +468,7 @@ spec = describe "SHARED_WALLETS" $ do (`shouldBe` Nothing) , expectField (traverse . #accountIndex . #getApiT) - (`shouldBe` DerivationIndex 2147483658) + (`shouldBe` DerivationIndex 2_147_483_658) ] let wal = getFromResponse id rPost diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs index c27479ee245..e18d5a1fcde 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs @@ -2759,7 +2759,7 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do (Link.createUnsignedTransaction @'Shelley src) Default delegationJoin verify rTx1 [ expectResponseCode HTTP.status202 - , expectField (#coinSelection . #depositsTaken) (`shouldBe` [Quantity 1000000]) + , expectField (#coinSelection . #depositsTaken) (`shouldBe` [Quantity 1_000_000]) , expectField (#coinSelection . #depositsReturned) (`shouldBe` []) ] @@ -2771,7 +2771,7 @@ spec = describe "NEW_SHELLEY_TRANSACTIONS" $ do (Link.decodeTransaction @'Shelley src) Default decodePayload1 verify rDecodedTx1 [ expectResponseCode HTTP.status202 - , expectField #depositsTaken (`shouldBe` [Quantity 1000000]) + , expectField #depositsTaken (`shouldBe` [Quantity 1_000_000]) , expectField #depositsReturned (`shouldBe` []) ] diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs index 3d4ab591de4..a5f83b25393 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs @@ -1122,9 +1122,8 @@ instance (Arbitrary a, Ord a) => Arbitrary (NonSingletonRange a) where arbitrary = do -- Iterate through the infinite list of arbitrary ranges and return -- the first range that is not a singleton range: - ranges <- infiniteList - pure $ head $ mapMaybe - (makeNonSingletonRangeValid . NonSingletonRange) ranges + head . mapMaybe (makeNonSingletonRangeValid . NonSingletonRange) + <$> infiniteList shrink (NonSingletonRange r) = mapMaybe (makeNonSingletonRangeValid . NonSingletonRange) (shrink r) diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index 64705823fce..e0b4ee3e87a 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -2101,8 +2101,8 @@ mockProtocolParameters = dummyProtocolParameters (577 % 10_000) , txParameters = TxParameters { getFeePolicy = mockFeePolicy - , getTxMaxSize = Quantity 16384 - , getTokenBundleMaxSize = TokenBundleMaxSize $ TxSize 4000 + , getTxMaxSize = Quantity 16_384 + , getTokenBundleMaxSize = TokenBundleMaxSize $ TxSize 4_000 , getMaxExecutionUnits = ExecutionUnits 10_000_000_000 14_000_000 } , minimumUTxO = minimumUTxOForShelleyBasedEra Cardano.ShelleyBasedEraAlonzo