Skip to content

Commit 9f1256a

Browse files
committed
fourmolu and pr stuff
1 parent 3552440 commit 9f1256a

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module Cardano.Mock.Forging.Tx.Conway (
3131
mkDepositTxPools,
3232
mkDummyRegisterTx,
3333
mkDummyTxBody,
34-
mkDummyTxBodyWithCoin,
34+
mkDummyTxBodyWithFee,
3535
mkTxDelegCert,
3636
mkRegTxCert,
3737
mkUnRegTxCert,
@@ -484,10 +484,10 @@ mkDummyTxBody =
484484
mempty
485485
(Withdrawals mempty)
486486

487-
mkDummyTxBodyWithCoin ::
487+
mkDummyTxBodyWithFee ::
488488
Coin ->
489489
ConwayTxBody StandardConway
490-
mkDummyTxBodyWithCoin coin' =
490+
mkDummyTxBodyWithFee coin' =
491491
consTxBody
492492
mempty
493493
mempty

cardano-chain-gen/test/Test/Cardano/Db/Mock/Config.hs

+6-7
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import Control.Concurrent.STM.TMVar (
6767
tryPutTMVar,
6868
tryReadTMVar,
6969
)
70-
import Control.Exception (SomeException, bracket)
70+
import Control.Exception (SomeException, bracket, catch)
7171
import Control.Monad (void)
7272
import Control.Monad.Extra (eitherM)
7373
import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
@@ -85,9 +85,8 @@ import Ouroboros.Consensus.Shelley.Node (ShelleyLeaderCredentials)
8585
import System.Directory (createDirectoryIfMissing, removePathForcibly)
8686
import System.FilePath.Posix (takeDirectory, (</>))
8787
import System.IO.Silently (hSilence)
88-
import Test.Tasty.HUnit (Assertion, testCase, assertFailure)
89-
import Control.Exception (catch)
9088
import Test.Tasty (TestTree)
89+
import Test.Tasty.HUnit (Assertion, assertFailure, testCase)
9190

9291
data Config = Config
9392
{ topLevelConfig :: TopLevelConfig CardanoBlock
@@ -523,7 +522,7 @@ replaceConfigFile newFilename dbSync@DBSyncEnv {..} = do
523522

524523
expectFailSilent :: String -> Assertion -> TestTree
525524
expectFailSilent name action = testCase name $ do
526-
result <- catch (Right <$> action) (\(_ :: SomeException) -> pure $ Left ())
527-
case result of
528-
Left _ -> pure () -- Test failed as expected, do nothing
529-
Right _ -> assertFailure "Expected test to fail but it succeeded"
525+
result <- catch (Right <$> action) (\(_ :: SomeException) -> pure $ Left ())
526+
case result of
527+
Left _ -> pure () -- Test failed as expected, do nothing
528+
Right _ -> assertFailure "Expected test to fail but it succeeded"

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Tx.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ addTxMetadataWhitelist ioManager metadata = do
181181
-- Add transactions with metadata
182182
void $ do
183183
UnifiedApi.withConwayFindLeaderAndSubmitTx interpreter mockServer $ \_ ->
184-
let txBody = Conway.mkDummyTxBodyWithCoin $ Coin 1_000
184+
let txBody = Conway.mkDummyTxBodyWithFee $ Coin 1_000
185185
auxData = Map.fromList [(1, I 1), (2, I 2), (3, I 3), (4, I 4)]
186186
in Right (Conway.mkAuxDataTx True txBody auxData)
187187
void $ do
188188
UnifiedApi.withConwayFindLeaderAndSubmitTx interpreter mockServer $ \_ ->
189-
let txBody = Conway.mkDummyTxBodyWithCoin $ Coin 2_000
189+
let txBody = Conway.mkDummyTxBodyWithFee $ Coin 2_000
190190
auxData = Map.fromList [(5, I 5), (6, I 6), (7, I 7), (8, I 8)]
191191
in Right (Conway.mkAuxDataTx True txBody auxData)
192192

@@ -222,12 +222,12 @@ addTxMetadataWhitelistMultiple ioManager metadata = do
222222
-- Add transactions with metadata
223223
void $ do
224224
UnifiedApi.withConwayFindLeaderAndSubmitTx interpreter mockServer $ \_ ->
225-
let txBody = Conway.mkDummyTxBodyWithCoin $ Coin 1_000
225+
let txBody = Conway.mkDummyTxBodyWithFee $ Coin 1_000
226226
auxData = Map.fromList [(1, I 1), (2, I 2), (3, I 3), (4, I 4)]
227227
in Right (Conway.mkAuxDataTx True txBody auxData)
228228
void $ do
229229
UnifiedApi.withConwayFindLeaderAndSubmitTx interpreter mockServer $ \_ ->
230-
let txBody = Conway.mkDummyTxBodyWithCoin $ Coin 2_000
230+
let txBody = Conway.mkDummyTxBodyWithFee $ Coin 2_000
231231
auxData = Map.fromList [(5, I 5), (6, I 6), (7, I 7), (8, I 8)]
232232
in Right (Conway.mkAuxDataTx True txBody auxData)
233233

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/Other.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,12 @@ insertStakeAddressRefIfMissing _trce cache addr =
164164

165165
insertMultiAsset ::
166166
(MonadBaseControl IO m, MonadIO m) =>
167-
Trace IO Text ->
168167
Cache ->
169168
Maybe (NonEmpty ShortByteString) ->
170169
PolicyID StandardCrypto ->
171170
AssetName ->
172171
ReaderT SqlBackend m (Maybe DB.MultiAssetId)
173-
insertMultiAsset _tracer cache mWhitelist policy aName = do
172+
insertMultiAsset cache mWhitelist policy aName = do
174173
mId <- queryMAWithCache cache policy aName
175174
case mId of
176175
Right maId -> pure $ Just maId

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/Tx.hs

+8-10
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ insertTx syncEnv isMember blkId epochNo slotNo applyResult blockIndex tx grouped
175175
maTxMint <-
176176
case ioMultiAssets iopts of
177177
MultiAssetDisable -> pure mempty
178-
MultiAssetEnable -> insertMaTxMint tracer cache Nothing txId $ Generic.txMint tx
179-
MultiAssetPolicies whitelist -> insertMaTxMint tracer cache (Just whitelist) txId $ Generic.txMint tx
178+
MultiAssetEnable -> insertMaTxMint cache Nothing txId $ Generic.txMint tx
179+
MultiAssetPolicies whitelist -> insertMaTxMint cache (Just whitelist) txId $ Generic.txMint tx
180180

181181
when (isPlutusEnabled $ ioPlutus iopts) $
182182
mapM_ (lift . insertScript tracer txId) $
@@ -244,10 +244,10 @@ insertTxOut tracer cache iopts (txId, txHash) (Generic.TxOut index addr value ma
244244
case ioMultiAssets iopts of
245245
MultiAssetDisable -> pure (eutxo, mempty)
246246
MultiAssetEnable -> do
247-
!maTxOuts <- insertMaTxOuts tracer cache Nothing maMap
247+
!maTxOuts <- insertMaTxOuts cache Nothing maMap
248248
pure (eutxo, maTxOuts)
249249
MultiAssetPolicies whitelist -> do
250-
!maTxOuts <- insertMaTxOuts tracer cache (Just whitelist) maMap
250+
!maTxOuts <- insertMaTxOuts cache (Just whitelist) maMap
251251
pure (eutxo, maTxOuts)
252252

253253
hasScript :: Bool
@@ -310,13 +310,12 @@ prepareTxMetadata tracer mWhitelist txId mmetadata =
310310
--------------------------------------------------------------------------------------
311311
insertMaTxMint ::
312312
(MonadBaseControl IO m, MonadIO m) =>
313-
Trace IO Text ->
314313
Cache ->
315314
Maybe (NonEmpty ShortByteString) ->
316315
DB.TxId ->
317316
MultiAsset StandardCrypto ->
318317
ExceptT SyncNodeError (ReaderT SqlBackend m) [DB.MaTxMint]
319-
insertMaTxMint tracer cache mWhitelist txId (MultiAsset mintMap) =
318+
insertMaTxMint cache mWhitelist txId (MultiAsset mintMap) =
320319
concatMapM (lift . prepareOuter) $ Map.toList mintMap
321320
where
322321
prepareOuter ::
@@ -332,7 +331,7 @@ insertMaTxMint tracer cache mWhitelist txId (MultiAsset mintMap) =
332331
(AssetName, Integer) ->
333332
ReaderT SqlBackend m (Maybe DB.MaTxMint)
334333
prepareInner policy (aname, amount) = do
335-
maybeMaId <- insertMultiAsset tracer cache mWhitelist policy aname
334+
maybeMaId <- insertMultiAsset cache mWhitelist policy aname
336335
pure $ case maybeMaId of
337336
Just maId ->
338337
Just $
@@ -345,12 +344,11 @@ insertMaTxMint tracer cache mWhitelist txId (MultiAsset mintMap) =
345344

346345
insertMaTxOuts ::
347346
(MonadBaseControl IO m, MonadIO m) =>
348-
Trace IO Text ->
349347
Cache ->
350348
Maybe (NonEmpty ShortByteString) ->
351349
Map (PolicyID StandardCrypto) (Map AssetName Integer) ->
352350
ExceptT SyncNodeError (ReaderT SqlBackend m) [MissingMaTxOut]
353-
insertMaTxOuts tracer cache mWhitelist maMap =
351+
insertMaTxOuts cache mWhitelist maMap =
354352
concatMapM (lift . prepareOuter) $ Map.toList maMap
355353
where
356354
prepareOuter ::
@@ -366,7 +364,7 @@ insertMaTxOuts tracer cache mWhitelist maMap =
366364
(AssetName, Integer) ->
367365
ReaderT SqlBackend m (Maybe MissingMaTxOut)
368366
prepareInner policy (aname, amount) = do
369-
mMaId <- insertMultiAsset tracer cache mWhitelist policy aname
367+
mMaId <- insertMultiAsset cache mWhitelist policy aname
370368
pure $ case mMaId of
371369
Just maId ->
372370
Just $

0 commit comments

Comments
 (0)