Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1921 - Remove support for GHC8.10 #1922

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Add your description here, if it fixes a particular issue please provide a [link
- [ ] Commits have useful messages
- [ ] New tests are added if needed and existing tests are updated
- [ ] Any changes are noted in the [changelog](https://github.com/IntersectMBO/cardano-db-sync/blob/master/db-sync/CHANGELOG.md)
- [ ] Code is formatted with [`fourmolu`](https://github.com/fourmolu/fourmolu) on version 0.10.1.0 (which can be run with `scripts/fourmolize.sh`)
- [ ] Code is formatted with [`fourmolu`](https://github.com/fourmolu/fourmolu) on version 0.16.2.0 (which can be run with `scripts/fourmolize.sh`)
- [ ] Self-reviewed the diff

# Migrations
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-fourmolu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- name: Run fourmolu
uses: haskell-actions/run-fourmolu@v9
with:
version: "0.10.1.0"
version: "0.16.2.0"
2 changes: 1 addition & 1 deletion .github/workflows/check-hlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up HLint
uses: rwe/actions-hlint-setup@v1
with:
version: "3.2.7"
version: "3.8"

- name: Run HLint
uses: rwe/actions-hlint-run@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# TODO: Add ghc910 when input-output-hk/devx is fixed
compiler-nix-name: [ghc810, ghc96, ghc98]
compiler-nix-name: [ghc96, ghc98]
include:
# We want a single job, because macOS runners are scarce.
- os: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Babbage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ mkUTxOBabbage :: AlonzoTx StandardBabbage -> [(TxIn StandardCrypto, BabbageTxOut
mkUTxOBabbage = mkUTxOAlonzo

mkUTxOCollBabbage ::
(BabbageEraTxBody era) =>
BabbageEraTxBody era =>
AlonzoTx era ->
[(TxIn (EraCrypto era), TxOut era)]
mkUTxOCollBabbage tx = Map.toList $ unUTxO $ collOuts $ getField @"body" tx
Expand Down
146 changes: 73 additions & 73 deletions cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway.hs
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@ mkPaymentTx' inputIndex outputIndices fees donation state' = do
NoDatum
SNothing

pure $
mkSimpleTx True $
consPaymentTxBody
inputs
mempty
mempty
(StrictSeq.fromList $ outputs <> [change])
SNothing
(Coin fees)
mempty
(Coin donation)
pure
$ mkSimpleTx True
$ consPaymentTxBody
inputs
mempty
mempty
(StrictSeq.fromList $ outputs <> [change])
SNothing
(Coin fees)
mempty
(Coin donation)
where
mkOutputs (outIx, val) = do
addr <- resolveAddress outIx state'
Expand Down Expand Up @@ -268,17 +268,17 @@ mkLockByScriptTx inputIndex txOutTypes amount fees state' = do
NoDatum
SNothing

pure $
mkSimpleTx True $
consPaymentTxBody
inputs
mempty
mempty
(StrictSeq.fromList $ outputs <> [change])
SNothing
(Coin fees)
mempty
(Coin 0)
pure
$ mkSimpleTx True
$ consPaymentTxBody
inputs
mempty
mempty
(StrictSeq.fromList $ outputs <> [change])
SNothing
(Coin fees)
mempty
(Coin 0)

mkUnlockScriptTx ::
[ConwayUTxOIndex] ->
Expand Down Expand Up @@ -348,9 +348,9 @@ mkDCertPoolTx consDCert state' = do

mkDCertTxPools :: ConwayLedgerState -> Either ForgingError (AlonzoTx StandardConway)
mkDCertTxPools state' =
Right $
mkSimpleTx True $
consCertTxBody Nothing (allPoolStakeCert' state') (Withdrawals mempty)
Right
$ mkSimpleTx True
$ consCertTxBody Nothing (allPoolStakeCert' state') (Withdrawals mempty)

mkSimpleTx :: Bool -> ConwayTxBody StandardConway -> AlonzoTx StandardConway
mkSimpleTx isValid' txBody =
Expand Down Expand Up @@ -394,9 +394,9 @@ mkScriptDCertTx consCert isValid' state' = do
cred <- resolveStakeCreds stakeIndex state'
pure $ mkDCert cred

pure $
mkScriptTx isValid' (mapMaybe prepareRedeemer . zip [0 ..] $ consCert) $
consCertTxBody Nothing dcerts (Withdrawals mempty)
pure
$ mkScriptTx isValid' (mapMaybe prepareRedeemer . zip [0 ..] $ consCert)
$ consCertTxBody Nothing dcerts (Withdrawals mempty)
where
prepareRedeemer (n, (StakeIndexScript bl, shouldAddRedeemer, _))
| not shouldAddRedeemer = Nothing
Expand Down Expand Up @@ -428,24 +428,24 @@ mkMultiAssetsScriptTx inputIx colInputIx outputIx refInput minted succeeds fees
refInputs' = Set.fromList $ map (fst . fst) refs
colInputs' = Set.singleton $ fst colInput

pure $
mkScriptTx succeeds (mkScriptInps (map fst inputs) ++ mkScriptMint' minted) $
consTxBody
inputs'
colInputs'
refInputs'
(StrictSeq.fromList outputs)
SNothing
(Coin fees)
mempty
mempty -- TODO[sgillespie]: minted?
(Withdrawals mempty)
(Coin 0)
pure
$ mkScriptTx succeeds (mkScriptInps (map fst inputs) ++ mkScriptMint' minted)
$ consTxBody
inputs'
colInputs'
refInputs'
(StrictSeq.fromList outputs)
SNothing
(Coin fees)
mempty
mempty -- TODO[sgillespie]: minted?
(Withdrawals mempty)
(Coin 0)
where
mkOuts (outIx, val) = do
addr <- resolveAddress outIx state'
pure $
BabbageTxOut
pure
$ BabbageTxOut
addr
val
(DatumHash $ hashData @StandardConway plutusDataList)
Expand All @@ -468,19 +468,19 @@ mkDepositTxPools inputIndex deposit state' = do
NoDatum
SNothing

pure $
mkSimpleTx True $
consTxBody
input
mempty
mempty
(StrictSeq.fromList [change])
SNothing
(Coin 0)
mempty
(allPoolStakeCert' state')
(Withdrawals mempty)
(Coin 0)
pure
$ mkSimpleTx True
$ consTxBody
input
mempty
mempty
(StrictSeq.fromList [change])
SNothing
(Coin 0)
mempty
(allPoolStakeCert' state')
(Withdrawals mempty)
(Coin 0)

mkRegisterDRepTx ::
Credential 'DRepRole StandardCrypto ->
Expand Down Expand Up @@ -663,8 +663,8 @@ mkFullTx n m state' = do
refInputPairs <- fmap fst <$> mapM (`resolveUTxOIndex` state') refInputs
collateralInput <- Set.singleton . fst . fst <$> resolveUTxOIndex collateralInputs state'

pure $
AlonzoTx
pure
$ AlonzoTx
{ body =
txBody
(mkInputs inputPairs)
Expand Down Expand Up @@ -748,8 +748,8 @@ mkFullTx n m state' = do
, ConwayTxCertPool $ Core.RegPool poolParams1
, ConwayTxCertPool $ Core.RetirePool (Prelude.head unregisteredPools) (EpochNo 0)
, ConwayTxCertDeleg $ ConwayUnRegCert (unregisteredStakeCredentials !! 2) SNothing
, ConwayTxCertDeleg $
ConwayDelegCert
, ConwayTxCertDeleg
$ ConwayDelegCert
(unregisteredStakeCredentials !! 1)
(DelegStake $ unregisteredPools !! 2)
]
Expand All @@ -766,8 +766,8 @@ mkFullTx n m state' = do

-- Withdrawals
withdrawals =
Withdrawals $
Map.fromList
Withdrawals
$ Map.fromList
[ (RewardAccount Testnet (unregisteredStakeCredentials !! 1), Coin 100)
, (RewardAccount Testnet (unregisteredStakeCredentials !! 1), Coin 100)
]
Expand Down Expand Up @@ -899,17 +899,17 @@ mkUnlockScriptTx' inputIndex colInputIndex outputIndex refInput colOut succeeds
NoDatum
SNothing

pure $
mkScriptTx succeeds (mkScriptInps inputPairs) $
consPaymentTxBody
inputs
colInputs
refInputs
(StrictSeq.singleton output)
(maybeToStrictMaybe colOut)
(Coin fees)
mempty
(Coin 0)
pure
$ mkScriptTx succeeds (mkScriptInps inputPairs)
$ consPaymentTxBody
inputs
colInputs
refInputs
(StrictSeq.singleton output)
(maybeToStrictMaybe colOut)
(Coin fees)
mempty
(Coin 0)

allPoolStakeCert' :: ConwayLedgerState -> [ConwayTxCert StandardConway]
allPoolStakeCert' st = map (mkRegTxCert SNothing) (getCreds st)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
stakeCreds = createStakeCredentials n
payCreds = createPaymentCredentials n
addresses =
map

Check warning on line 55 in cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in delegateAndSendBlocks in module Cardano.Mock.Forging.Tx.Conway.Scenarios: Use zipWith ▫︎ Found: "map\n (\\ (payCred, stakeCred)\n -> Addr Testnet payCred (StakeRefBase stakeCred))\n (zip payCreds stakeCreds)" ▫︎ Perhaps: "Prelude.zipWith\n (Prelude.curry\n (\\ (payCred, stakeCred)\n -> Addr Testnet payCred (StakeRefBase stakeCred)))\n payCreds stakeCreds"
(\(payCred, stakeCred) -> Addr Testnet payCred (StakeRefBase stakeCred))
(zip payCreds stakeCreds)

Expand All @@ -66,7 +66,7 @@
mkDelegateBlocks :: [StakeCredential StandardCrypto] -> Interpreter -> IO [CardanoBlock]
mkDelegateBlocks creds interpreter = forgeBlocksChunked interpreter creds $ \txCreds state' ->
Conway.mkDCertTx
(map (mkDelegCert state') $ zip (cycle [0, 1, 2]) txCreds)

Check warning on line 69 in cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Conway/Scenarios.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in mkDelegateBlocks in module Cardano.Mock.Forging.Tx.Conway.Scenarios: Use zipWith ▫︎ Found: "map (mkDelegCert state') $ zip (cycle [0, 1, 2]) txCreds" ▫︎ Perhaps: "Prelude.zipWith\n (Prelude.curry (mkDelegCert state')) (cycle [0, 1, 2]) txCreds"
(Withdrawals mempty)
Nothing
where
Expand Down Expand Up @@ -97,8 +97,8 @@
registerDRepsAndDelegateVotes :: Interpreter -> IO CardanoBlock
registerDRepsAndDelegateVotes interpreter = do
blockTxs <-
withConwayLedgerState interpreter $
registerDRepAndDelegateVotes'
withConwayLedgerState interpreter
$ registerDRepAndDelegateVotes'
(Prelude.head unregisteredDRepIds)
(StakeIndex 4)

Expand Down
34 changes: 18 additions & 16 deletions cardano-chain-gen/src/Cardano/Mock/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
(distr :& hash) <-
from
$ table @Db.DrepDistr
`innerJoin` table @Db.DrepHash
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))
`innerJoin` table @Db.DrepHash
`on` (\(distr :& hash) -> (hash ^. Db.DrepHashId) ==. (distr ^. Db.DrepDistrHashId))

where_ $ hash ^. Db.DrepHashRaw ==. just (val drepHash)
where_ $ distr ^. Db.DrepDistrEpochNo ==. val epochNo
Expand Down Expand Up @@ -138,16 +138,16 @@
queryConstitutionAnchor epochNo = do
res <- selectOne $ do
(_ :& anchor :& epochState) <-
from

Check warning on line 141 in cardano-chain-gen/src/Cardano/Mock/Query.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in queryConstitutionAnchor in module Cardano.Mock.Query: Fuse on/on ▫︎ Found: "from $ table @Db.Constitution `innerJoin` table @Db.VotingAnchor\n `on`\n (\\ (constit :& anchor)\n -> (constit ^. Db.ConstitutionVotingAnchorId)\n ==. (anchor ^. Db.VotingAnchorId))\n `innerJoin` table @Db.EpochState\n `on`\n (\\ (constit :& _ :& epoch)\n -> just (constit ^. Db.ConstitutionId)\n ==. (epoch ^. Db.EpochStateConstitutionId))" ▫︎ Perhaps: "(from $ table @Db.Constitution `innerJoin` table @Db.VotingAnchor)\n `on`\n (((\\ (constit :& anchor)\n -> (constit ^. Db.ConstitutionVotingAnchorId)\n ==. (anchor ^. Db.VotingAnchorId))\n `innerJoin` table @Db.EpochState)\n . (\\ (constit :& _ :& epoch)\n -> just (constit ^. Db.ConstitutionId)\n ==. (epoch ^. Db.EpochStateConstitutionId)))"
$ table @Db.Constitution
`innerJoin` table @Db.VotingAnchor
`on` ( \(constit :& anchor) ->
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
)
`innerJoin` table @Db.EpochState
`on` ( \(constit :& _ :& epoch) ->
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
)
`innerJoin` table @Db.VotingAnchor
`on` ( \(constit :& anchor) ->
(constit ^. Db.ConstitutionVotingAnchorId) ==. (anchor ^. Db.VotingAnchorId)
)
`innerJoin` table @Db.EpochState
`on` ( \(constit :& _ :& epoch) ->
just (constit ^. Db.ConstitutionId) ==. (epoch ^. Db.EpochStateConstitutionId)
)

where_ (epochState ^. Db.EpochStateEpochNo ==. val epochNo)

Expand All @@ -173,7 +173,7 @@
txs <- from $ table @Db.Tx
pure $ sum_ (txs ^. Db.TxTreasuryDonation)

let total = join (unValue <$> res)

Check warning on line 176 in cardano-chain-gen/src/Cardano/Mock/Query.hs

View workflow job for this annotation

GitHub Actions / build

Suggestion in queryTreasuryDonations in module Cardano.Mock.Query: Use =<< ▫︎ Found: "join (unValue <$> res)" ▫︎ Perhaps: "unValue =<< res"
pure $ maybe 0 Db.unDbLovelace total

queryVoteCounts ::
Expand All @@ -193,11 +193,13 @@
(vote :& tx) <-
from
$ table @Db.VotingProcedure
`innerJoin` table @Db.Tx
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
where_ $
vote ^. Db.VotingProcedureVote ==. val v
&&. tx ^. Db.TxHash ==. val txHash
&&. vote ^. Db.VotingProcedureIndex ==. val idx
`innerJoin` table @Db.Tx
`on` (\(vote :& tx) -> vote ^. Db.VotingProcedureTxId ==. tx ^. Db.TxId)
where_
$ vote
^. Db.VotingProcedureVote
==. val v
&&. tx ^. Db.TxHash ==. val txHash
&&. vote ^. Db.VotingProcedureIndex ==. val idx
pure countRows
pure (maybe 0 unValue res)
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ checkEpochDisabledArg =
-- Forge some blocks
void $ forgeAndSubmitBlocks interpreter mockServer 50
-- Add two blocks with transactions
void $
withConwayFindLeaderAndSubmitTx interpreter mockServer $
Conway.mkPaymentTx (UTxOIndex 0) (UTxOIndex 1) 10_000 10_000 0
void $
withConwayFindLeaderAndSubmitTx interpreter mockServer $
Conway.mkPaymentTx (UTxOIndex 1) (UTxOIndex 0) 10_000 10_000 0
void
$ withConwayFindLeaderAndSubmitTx interpreter mockServer
$ Conway.mkPaymentTx (UTxOIndex 0) (UTxOIndex 1) 10_000 10_000 0
void
$ withConwayFindLeaderAndSubmitTx interpreter mockServer
$ Conway.mkPaymentTx (UTxOIndex 1) (UTxOIndex 0) 10_000 10_000 0
-- Add some more empty blocks
void $ forgeAndSubmitBlocks interpreter mockServer 60

Expand All @@ -48,12 +48,12 @@ checkEpochEnabled =
-- Forge some blocks
void $ forgeAndSubmitBlocks interpreter mockServer 50
-- Add two blocks with transactions
void $
withConwayFindLeaderAndSubmitTx interpreter mockServer $
Conway.mkPaymentTx (UTxOIndex 0) (UTxOIndex 1) 10_000 10_000 0
void $
withConwayFindLeaderAndSubmitTx interpreter mockServer $
Conway.mkPaymentTx (UTxOIndex 1) (UTxOIndex 0) 10_000 10_000 0
void
$ withConwayFindLeaderAndSubmitTx interpreter mockServer
$ Conway.mkPaymentTx (UTxOIndex 0) (UTxOIndex 1) 10_000 10_000 0
void
$ withConwayFindLeaderAndSubmitTx interpreter mockServer
$ Conway.mkPaymentTx (UTxOIndex 1) (UTxOIndex 0) 10_000 10_000 0
-- Add some more empty blocks
void $ forgeAndSubmitBlocks interpreter mockServer 60

Expand Down
Loading
Loading