diff --git a/.github/workflows/actionlint-exceptions.txt b/.github/workflows/actionlint-exceptions.txt new file mode 100644 index 00000000000..74f116c2684 --- /dev/null +++ b/.github/workflows/actionlint-exceptions.txt @@ -0,0 +1,4 @@ +.github/workflows/haskell.yml +.github/workflows/release-ghcr.yaml +.github/workflows/release-upload.yaml +.github/workflows/stylish-haskell.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 00000000000..d75c99dd254 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,39 @@ +name: Actionlint + +on: + pull_request: + +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # We want to install Nix to provision shellcheck, so that actionlint doesn't install + # its own shellcheck. This will also make sure that this pipeline runs using + # the same shellcheck as the ones in Nix shells of developers. + - name: Install Nix with good defaults + uses: input-output-hk/install-nix-action@v20 + with: + extra_nix_config: | + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= + substituters = https://cache.nixos.org/ https://cache.iog.io/ + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/install-nix-action@v18 + with: + nix_path: nixpkgs=channel:nixos-unstable + # Make the Nix environment available to next steps + - uses: rrbutani/use-nix-shell-action@v1 + + - name: actionlint + run: | + for file in $(git ls-files ".github/workflows/*.y*ml") + do + if grep -q "$file" ".github/workflows/actionlint-exceptions.txt" + then + echo "⚠️ $file is ignored from actionlint's verifications. Please consider fixing it." + else + echo "actionlint $file" + actionlint "$file" + fi + done diff --git a/.github/workflows/github-page.yml b/.github/workflows/github-page.yml index 8d2f6bdf6f1..576924df371 100644 --- a/.github/workflows/github-page.yml +++ b/.github/workflows/github-page.yml @@ -50,7 +50,7 @@ jobs: tar -czf haddocks.tgz -C haddocks . - name: Upload haddocks artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ always() }} continue-on-error: true with: diff --git a/.github/workflows/shellcheck-exceptions.txt b/.github/workflows/shellcheck-exceptions.txt new file mode 100644 index 00000000000..ef1749c6a3b --- /dev/null +++ b/.github/workflows/shellcheck-exceptions.txt @@ -0,0 +1,60 @@ +.github/bin/haddocks.sh +scripts/ci/check-cabal-files.sh +bench/process/process.sh +bench/script/probe.sh +cardano-submit-api/test/run.sh +cardano-tracer/demo/multi/run.sh +cardano-tracer/demo/ssh/run.sh +ci/check-dependencies-merged-to-master.sh +ci/check-hydra.sh +configuration/cardano/update-config-files.sh +nix/regenerate.sh +nix/workbench/analyse/analyse.sh +nix/workbench/backend/backend.sh +nix/workbench/backend/nomad.sh +nix/workbench/backend/nomad/cloud.sh +nix/workbench/backend/nomad/exec.sh +nix/workbench/backend/nomad/podman.sh +nix/workbench/backend/supervisor.sh +nix/workbench/chaindb.sh +nix/workbench/env.sh +nix/workbench/lib-cabal.sh +nix/workbench/lib.sh +nix/workbench/manifest.sh +nix/workbench/nomad.sh +nix/workbench/profile/pparams/apiPparamsImport.sh +nix/workbench/profile/pparams/diffLatest.sh +nix/workbench/profile/pparams/diffLatestWithOverlay.sh +nix/workbench/profile/pparams/pparamsLastWithOverlay.sh +nix/workbench/profile/profile.sh +nix/workbench/publish.sh +nix/workbench/run.sh +nix/workbench/scenario.sh +nix/workbench/topology/topology.sh +scripts/babbage/example-babbage-script-usage.sh +scripts/babbage/mkfiles.sh +scripts/babbage/script-context-equivalance-test.sh +scripts/babbage/script-mint-context-equivalance-test.sh +scripts/babbage/staking-example/claim-script-staking-rewards.sh +scripts/babbage/staking-example/register-and-delegate-script-staking-address.sh +scripts/bin-path.sh +scripts/byron-to-alonzo/burn.sh +scripts/byron-to-alonzo/mint.sh +scripts/byron-to-alonzo/mkfiles.sh +scripts/byron-to-alonzo/update-3.sh +scripts/byron-to-alonzo/update-4.sh +scripts/byron-to-alonzo/update-5.sh +scripts/ci/check-cabal-files.sh +scripts/gen-merge-summary.sh +scripts/lite/example-build-cmd.sh +scripts/lite/shelley-testnet-2.sh +scripts/lite/shelley-testnet.sh +scripts/lite/shutdown-ipc-example.sh +scripts/lite/split-txouts.sh +scripts/plutus/always-fails.sh +scripts/plutus/example-txin-locking-plutus-script.sh +scripts/plutus/script-context-equivalance-test.sh +scripts/plutus/script-context-equivalence-test-minting.sh +scripts/plutus/simple-minting-policy.sh +scripts/plutus/staking-example/claim-script-staking-rewards.sh +scripts/test-stake-cred-script/create-collateral.sh diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 00000000000..613b79e6715 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,40 @@ +name: Shellcheck +# This pipeline runs shellcheck on all files with extension .sh, +# except the ones listed in .github/workflows/shellcheck-exceptions.txt. +# +# This pipeline uses Nix, so that the shellcheck version used is the same +# ones as used by developers in Nix shells. This ensures the CI's behavior +# is consistent with the one of developers. + +on: + pull_request: + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Nix with good defaults + uses: input-output-hk/install-nix-action@v20 + with: + extra_nix_config: | + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= + substituters = https://cache.nixos.org/ https://cache.iog.io/ + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/install-nix-action@v18 + with: + nix_path: nixpkgs=channel:nixos-unstable + # Make the Nix environment available to next steps + - uses: rrbutani/use-nix-shell-action@v1 + - name: shellcheck + run: | + for file in $(git ls-files "*.sh") + do + if grep -q "$file" ".github/workflows/shellcheck-exceptions.txt" + then + echo "⚠️ $file is ignored from shellcheck's verifications. Please consider fixing it." + else + echo "shellcheck $file" + shellcheck "$file" + fi + done diff --git a/cardano-testnet/cardano-testnet.cabal b/cardano-testnet/cardano-testnet.cabal index d34ff4a71e1..31762be8e27 100644 --- a/cardano-testnet/cardano-testnet.cabal +++ b/cardano-testnet/cardano-testnet.cabal @@ -192,6 +192,7 @@ test-suite cardano-testnet-test Cardano.Testnet.Test.Gov.DRepDeposit Cardano.Testnet.Test.Gov.DRepRetirement Cardano.Testnet.Test.Gov.InfoAction + Cardano.Testnet.Test.Gov.NoConfidence Cardano.Testnet.Test.Gov.ProposeNewConstitution Cardano.Testnet.Test.Gov.ProposeNewConstitutionSPO Cardano.Testnet.Test.Gov.TreasuryGrowth diff --git a/cardano-testnet/src/Testnet/Defaults.hs b/cardano-testnet/src/Testnet/Defaults.hs index e8d15f911a8..4d232d3412f 100644 --- a/cardano-testnet/src/Testnet/Defaults.hs +++ b/cardano-testnet/src/Testnet/Defaults.hs @@ -14,10 +14,16 @@ module Testnet.Defaults , defaultByronProtocolParamsJsonValue , defaultYamlConfig , defaultConwayGenesis + , defaultCommitteeKeyPair + , defaultCommitteeVkeyFp + , defaultCommitteeSkeyFp + , defaultDRepSkeyFp , defaultDRepKeyPair , defaultDelegatorStakeKeyPair - , defaultSpoKeys , defaultSpoColdKeyPair + , defaultSPOColdVKeyFp + , defaultSPOColdSKeyFp + , defaultSpoKeys , defaultShelleyGenesis , defaultGenesisFilepath , defaultYamlHardforkViaConfig @@ -491,6 +497,16 @@ defaultGenesisFilepath era = -- This path is actually generated by create-testnet-data. Don't change it. eraToString era <> "-genesis.json" +defaultCommitteeVkeyFp + :: Int -- ^ The Committee's index (starts at 1) + -> FilePath +defaultCommitteeVkeyFp n = "committee-keys" "committee" <> show n <> ".vkey" + +defaultCommitteeSkeyFp + :: Int -- ^ The Committee's index (starts at 1) + -> FilePath +defaultCommitteeSkeyFp n = "committee-keys" "committee" <> show n <> ".skey" + -- | The relative path to DRep keys in directories created by cardano-testnet defaultDRepKeyPair :: Int -- ^ The DRep's index (starts at 1) @@ -501,6 +517,27 @@ defaultDRepKeyPair n = , signingKey = File $ "drep-keys" ("drep" <> show n) "drep.skey" } +-- | The relative path to DRep secret keys in directories created by cardano-testnet +defaultDRepSkeyFp + :: Int -- ^ The DRep's index (starts at 1) + -> FilePath +defaultDRepSkeyFp n = "drep-keys" ("drep" <> show n) "drep.skey" + +defaultCommitteeKeyPair :: Int -> KeyPair PaymentKey +defaultCommitteeKeyPair n = + KeyPair + { verificationKey = File $ defaultCommitteeVkeyFp n + , signingKey = File $ defaultCommitteeSkeyFp n + } + +-- | The relative path to SPO cold verification key in directories created by cardano-testnet +defaultSPOColdVKeyFp :: Int -> FilePath +defaultSPOColdVKeyFp n = "pools-keys" "pool" <> show n "cold.vkey" + +-- | The relative path to SPO cold secret key in directories created by cardano-testnet +defaultSPOColdSKeyFp :: Int -> FilePath +defaultSPOColdSKeyFp n = "pools-keys" "pool" <> show n "cold.skey" + -- | The relative path to SPO keys in directories created by cardano-testnet defaultSpoColdKeyPair :: Int diff --git a/cardano-testnet/src/Testnet/Process/Run.hs b/cardano-testnet/src/Testnet/Process/Run.hs index 9cf8fcf4543..18619f39ac8 100644 --- a/cardano-testnet/src/Testnet/Process/Run.hs +++ b/cardano-testnet/src/Testnet/Process/Run.hs @@ -15,6 +15,7 @@ module Testnet.Process.Run , procSubmitApi , procChairman , mkExecConfig + , mkExecConfigOffline , ProcessError(..) , ExecutableError(..) ) where @@ -190,6 +191,24 @@ mkExecConfig tempBaseAbsPath sprocket networkId = do , H.execConfigCwd = Last $ Just tempBaseAbsPath } +-- | Creates an 'ExecConfig' that can be used to run a process offline. +-- e.g cardano-cli without a node running. +mkExecConfigOffline :: () + => MonadTest m + => MonadIO m + => FilePath + -> m ExecConfig +mkExecConfigOffline tempBaseAbsPath = do + env' <- H.evalIO IO.getEnvironment + + return H.ExecConfig + { H.execConfigEnv = Last $ Just + -- The environment must be passed onto child process on Windows in order to + -- successfully start that process. + env' + , H.execConfigCwd = Last $ Just tempBaseAbsPath + } + data ProcessError = ProcessIOException IOException diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepDeposit.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepDeposit.hs index 776d023b4b9..90c4dcd962d 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepDeposit.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/DRepDeposit.hs @@ -32,7 +32,7 @@ import qualified Hedgehog.Extras as H hprop_ledger_events_drep_deposits :: Property hprop_ledger_events_drep_deposits = integrationWorkspace "drep-deposits" $ \tempAbsBasePath' -> runWithDefaultWatchdog_ $ do - -- Start a local test net + conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' let tempAbsPath' = unTmpAbsPath tempAbsPath tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs index 92383502126..eb2178c0fdd 100644 --- a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/InfoAction.hs @@ -47,7 +47,7 @@ import qualified Hedgehog.Extras as H hprop_ledger_events_info_action :: Property hprop_ledger_events_info_action = integrationRetryWorkspace 0 "info-hash" $ \tempAbsBasePath' -> runWithDefaultWatchdog_ $ do - -- Start a local test net + conf@Conf { tempAbsPath } <- H.noteShowM $ mkConf tempAbsBasePath' let tempAbsPath' = unTmpAbsPath tempAbsPath tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath diff --git a/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs new file mode 100644 index 00000000000..b1c268283f0 --- /dev/null +++ b/cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Gov/NoConfidence.hs @@ -0,0 +1,263 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +module Cardano.Testnet.Test.Gov.NoConfidence + ( hprop_gov_no_confidence + ) where + +import Cardano.Api as Api +import Cardano.Api.Error +import Cardano.Api.Ledger +import Cardano.Api.Shelley + +import qualified Cardano.Ledger.Conway.Genesis as L +import qualified Cardano.Ledger.Conway.Governance as L +import qualified Cardano.Ledger.Credential as L +import qualified Cardano.Ledger.Shelley.LedgerState as L +import Cardano.Testnet + +import Prelude + +import Control.Monad +import Data.Bifunctor +import qualified Data.ByteString.Char8 as BSC +import qualified Data.Map.Strict as Map +import Data.Maybe.Strict +import Data.String +import qualified Data.Text as Text +import GHC.Stack +import Lens.Micro +import System.FilePath (()) + +import Testnet.Components.Configuration +import Testnet.Components.Query +import Testnet.Components.TestWatchdog +import Testnet.Defaults +import qualified Testnet.Process.Cli.DRep as DRep +import Testnet.Process.Cli.Keys +import qualified Testnet.Process.Cli.SPO as SPO +import Testnet.Process.Cli.Transaction +import qualified Testnet.Process.Run as H +import Testnet.Property.Util (integrationWorkspace) +import Testnet.Types + +import Hedgehog +import qualified Hedgehog as H +import qualified Hedgehog.Extras as H +import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO + +-- | Execute me with: +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Committee Motion Of No Confidence/"'@ +-- Generate a testnet with a committee defined in the Conway genesis. Submit a motion of no confidence +-- and have the required threshold of SPOs and DReps vote yes on it. +hprop_gov_no_confidence :: Property +hprop_gov_no_confidence = integrationWorkspace "no-confidence" $ \tempAbsBasePath' -> runWithDefaultWatchdog_ $ do + + conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' + let tempAbsPath' = unTmpAbsPath tempAbsPath + tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath + + work <- H.createDirectoryIfMissing $ tempAbsPath' "work" + + + let ceo = ConwayEraOnwardsConway + sbe = conwayEraOnwardsToShelleyBasedEra ceo + era = toCardanoEra sbe + cEra = AnyCardanoEra era + fastTestnetOptions = cardanoDefaultTestnetOptions + { cardanoEpochLength = 100 + , cardanoNodeEra = cEra + } + execConfigOffline <- H.mkExecConfigOffline tempBaseAbsPath + + -- Step 1. Define generate and define a committee in the genesis file + + -- Create committee cold key + H.createDirectoryIfMissing_ $ tempAbsPath' work "committee-keys" + H.forConcurrently_ [1] $ \n -> do + H.execCli' execConfigOffline + [ anyEraToString cEra, "governance", "committee" + , "key-gen-cold" + , "--cold-verification-key-file", work defaultCommitteeVkeyFp n + , "--cold-signing-key-file", work defaultCommitteeSkeyFp n + ] + + committeeVkey1Fp <- H.noteShow $ work defaultCommitteeVkeyFp 1 + + -- Read committee cold keys from disk to put into conway genesis + + comKeyHash1Str <- filter (/= '\n') <$> H.execCli' execConfigOffline + [ anyEraToString cEra, "governance", "committee" + , "key-hash" + , "--verification-key-file", committeeVkey1Fp + ] + + CommitteeColdKeyHash comKeyHash1 <- + H.evalEither + $ deserialiseFromRawBytesHex (AsHash AsCommitteeColdKey) + $ BSC.pack comKeyHash1Str + + let comKeyCred1 = L.KeyHashObj comKeyHash1 + committeeThreshold = unsafeBoundedRational 0.5 + committee = L.Committee (Map.fromList [(comKeyCred1, EpochNo 100)]) committeeThreshold + + alonzoGenesis <- evalEither $ first prettyError defaultAlonzoGenesis + (startTime, shelleyGenesis') <- getDefaultShelleyGenesis fastTestnetOptions + let conwayGenesisWithCommittee = + defaultConwayGenesis { L.cgCommittee = committee } + + TestnetRuntime + { testnetMagic + , poolNodes + , wallets=wallet0:_wallet1:_ + , configurationFile + } <- cardanoTestnet + fastTestnetOptions + conf startTime shelleyGenesis' + alonzoGenesis conwayGenesisWithCommittee + + poolNode1 <- H.headM poolNodes + poolSprocket1 <- H.noteShow $ nodeSprocket $ poolRuntime poolNode1 + execConfig <- H.mkExecConfig tempBaseAbsPath poolSprocket1 testnetMagic + + let socketName' = IO.sprocketName poolSprocket1 + socketBase = IO.sprocketBase poolSprocket1 -- /tmp + socketPath = socketBase socketName' + + H.note_ $ "Sprocket: " <> show poolSprocket1 + H.note_ $ "Abs path: " <> tempAbsBasePath' + H.note_ $ "Socketpath: " <> socketPath + + mCommitteePresent + <- H.leftFailM $ findCondition (committeeIsPresent True) configurationFile (File socketPath) (EpochNo 3) + H.nothingFail mCommitteePresent + + -- Step 2. Propose motion of no confidence. DRep and SPO voting thresholds must be met. + + -- Create proposal to add a new member to the committee + + proposalAnchorFile <- H.note $ work "sample-proposal-anchor" + H.writeFile proposalAnchorFile "dummy anchor data" + + proposalAnchorDataHash <- H.execCli' execConfig + [ eraToString era, "governance" + , "hash", "anchor-data", "--file-text", proposalAnchorFile + ] + + + proposalFile <- H.note $ work "sample-proposal-anchor" + stakeVkeyFp <- H.note $ work "stake.vkey" + stakeSKeyFp <- H.note $ work "stake.skey" + + cliStakeAddressKeyGen + $ KeyPair (File stakeVkeyFp) (File stakeSKeyFp) + + epochStateView <- getEpochStateView configurationFile (File socketPath) + minActDeposit <- getMinGovActionDeposit epochStateView ceo + + void $ H.execCli' execConfig $ + [ eraToString era, "governance", "action", "create-no-confidence" + , "--testnet" + , "--governance-action-deposit", show @Integer minActDeposit + , "--deposit-return-stake-verification-key-file", stakeVkeyFp + , "--anchor-url", "https://tinyurl.com/3wrwb2as" + , "--anchor-data-hash", proposalAnchorDataHash + , "--out-file", proposalFile + ] + + txbodyFp <- H.note $ work "tx.body" + + txin1 <- findLargestUtxoForPaymentKey epochStateView sbe wallet0 + + void $ H.execCli' execConfig + [ eraToString era, "transaction", "build" + , "--change-address", Text.unpack $ paymentKeyInfoAddr wallet0 + , "--tx-in", Text.unpack $ renderTxIn txin1 + , "--tx-out", Text.unpack (paymentKeyInfoAddr wallet0) <> "+" <> show @Int 5_000_000 + , "--proposal-file", proposalFile + , "--out-file", txbodyFp + ] + + signedProposalTx <- signTx execConfig cEra work "signed-proposal" + (File txbodyFp) [SomeKeyPair $ paymentKeyInfoPair wallet0] + + submitTx execConfig cEra signedProposalTx + + -- Step 3. Create and submit votes on motion of no confidence proposal. + -- Proposal was successfully submitted, now we vote on the proposal + -- and confirm it was ratified. + + governanceActionTxId <- retrieveTransactionId execConfig signedProposalTx + + !propSubmittedResult <- findCondition (maybeExtractGovernanceActionIndex (fromString governanceActionTxId)) + configurationFile + (File socketPath) + (EpochNo 10) + + governanceActionIndex <- case propSubmittedResult of + Left e -> + H.failMessage callStack + $ "findCondition failed with: " <> displayError e + Right Nothing -> + H.failMessage callStack "Couldn't find proposal." + Right (Just a) -> return a + + let spoVotes :: [(String, Int)] + spoVotes = [("yes", 1), ("yes", 2), ("yes", 3)] + drepVotes :: [(String, Int)] + drepVotes = [("yes", 1), ("yes", 2), ("yes", 3)] + + spoVoteFiles <- SPO.generateVoteFiles ceo execConfig work "spo-vote-files" + governanceActionTxId governanceActionIndex + [(defaultSpoKeys idx, vote) | (vote, idx) <- spoVotes] + drepVoteFiles <- DRep.generateVoteFiles execConfig work "drep-vote-files" + governanceActionTxId governanceActionIndex + [(defaultDRepKeyPair idx, vote) | (vote, idx) <- drepVotes] + + let allVoteFiles = spoVoteFiles ++ drepVoteFiles + annotateShow allVoteFiles + + -- Submit votes + voteTxBodyFp <- DRep.createVotingTxBody execConfig epochStateView sbe work "vote-tx-body" + allVoteFiles wallet0 + let spoSigningKeys = [SomeKeyPair $ defaultSpoColdKeyPair n | (_, n) <- spoVotes] + drepSigningKeys = [SomeKeyPair $ defaultDRepKeyPair n | (_, n) <- drepVotes] + allVoteSigningKeys = spoSigningKeys ++ drepSigningKeys + + voteTxFp <- signTx execConfig cEra work "signed-vote-tx" voteTxBodyFp + (SomeKeyPair (paymentKeyInfoPair wallet0) : allVoteSigningKeys) + + submitTx execConfig cEra voteTxFp + + -- Step 4. We confirm the no confidence motion has been ratified by checking + -- for an empty constitutional committee. + + mCommitteeEmpty + <- H.leftFailM $ findCondition (committeeIsPresent False) configurationFile (File socketPath) (EpochNo 5) + H.nothingFail mCommitteeEmpty + +-- | Checks if the committee is empty or not. +committeeIsPresent :: Bool -> AnyNewEpochState -> Maybe () +committeeIsPresent committeeExists (AnyNewEpochState sbe newEpochState) = + caseShelleyToBabbageOrConwayEraOnwards + (const $ error "Constitutional committee does not exist pre-Conway era") + (const $ let mCommittee = newEpochState + ^. L.nesEsL + . L.esLStateL + . L.lsUTxOStateL + . L.utxosGovStateL + . L.cgsCommitteeL + in if committeeExists + then if isSJust mCommittee + then Just () -- The committee is non empty and we terminate. + else Nothing + else if mCommittee == SNothing + then Just () -- The committee is empty and we terminate. + else Nothing + ) + sbe + diff --git a/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs b/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs index 5a568843d9d..859875dadd3 100644 --- a/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs +++ b/cardano-testnet/test/cardano-testnet-test/cardano-testnet-test.hs @@ -16,6 +16,7 @@ import qualified Cardano.Testnet.Test.FoldEpochState import qualified Cardano.Testnet.Test.Gov.CommitteeAddNew as Gov import qualified Cardano.Testnet.Test.Gov.DRepDeposit as Gov import qualified Cardano.Testnet.Test.Gov.DRepRetirement as Gov +import qualified Cardano.Testnet.Test.Gov.NoConfidence as Gov import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitution as Gov import qualified Cardano.Testnet.Test.Gov.ProposeNewConstitutionSPO as Gov import qualified Cardano.Testnet.Test.Gov.TreasuryGrowth as Gov @@ -51,6 +52,7 @@ tests = do [ ignoreOnMacAndWindows "Committee Add New" Gov.hprop_constitutional_committee_add_new -- FIXME: This test is broken - drepActivity is not updated within the expeted period -- , ignoreOnWindows "DRep Activity" Gov.hprop_check_drep_activity + , ignoreOnMacAndWindows "Committee Motion Of No Confidence" Gov.hprop_gov_no_confidence , ignoreOnWindows "DRep Deposits" Gov.hprop_ledger_events_drep_deposits -- FIXME Those tests are flaky -- , ignoreOnWindows "InfoAction" LedgerEvents.hprop_ledger_events_info_action diff --git a/configuration/cardano/mainnet-config.json b/configuration/cardano/mainnet-config.json index 189f335a128..10a51793c21 100644 --- a/configuration/cardano/mainnet-config.json +++ b/configuration/cardano/mainnet-config.json @@ -10,7 +10,7 @@ "LastKnownBlockVersion-Major": 3, "LastKnownBlockVersion-Minor": 0, "MaxKnownMajorProtocolVersion": 2, - "MinNodeVersion": "8.10.0", + "MinNodeVersion": "8.11.0", "PeerSharing": true, "Protocol": "Cardano", "RequiresNetworkMagic": "RequiresNoMagic", diff --git a/configuration/cardano/mainnet-config.yaml b/configuration/cardano/mainnet-config.yaml index 7b426c26096..343b4e2b9bd 100644 --- a/configuration/cardano/mainnet-config.yaml +++ b/configuration/cardano/mainnet-config.yaml @@ -42,7 +42,7 @@ TargetNumberOfRootPeers: 60 ##### Version Information ##### -MinNodeVersion: 8.10.0 +MinNodeVersion: 8.11.0 ##### Logging configuration ##### diff --git a/configuration/cardano/shelley_qa-config.json b/configuration/cardano/shelley_qa-config.json index db55440802c..fdecc0a704b 100644 --- a/configuration/cardano/shelley_qa-config.json +++ b/configuration/cardano/shelley_qa-config.json @@ -11,7 +11,7 @@ "LastKnownBlockVersion-Alt": 0, "LastKnownBlockVersion-Major": 3, "LastKnownBlockVersion-Minor": 1, - "MinNodeVersion": "8.10.0", + "MinNodeVersion": "8.11.0", "PeerSharing": true, "Protocol": "Cardano", "RequiresNetworkMagic": "RequiresMagic", diff --git a/flake.lock b/flake.lock index 92216d82fd1..4264c1762a4 100644 --- a/flake.lock +++ b/flake.lock @@ -921,16 +921,15 @@ "sodium": "sodium" }, "locked": { - "lastModified": 1715311504, - "narHash": "sha256-Jxma8/3WMb++2V1sp/iMF+6azv8cBR+ZbkLr61p2R24=", + "lastModified": 1715898223, + "narHash": "sha256-G1LFsvP53twrqaC1FVard/6rjJJ3oitnpJ1E+mTZDGM=", "owner": "input-output-hk", "repo": "iohk-nix", - "rev": "47727032a26ed92438afef6bdd45c95cd7399694", + "rev": "29f19cd41dc593cf17bbc24194e34e7c20889fc9", "type": "github" }, "original": { "owner": "input-output-hk", - "ref": "node-8.11", "repo": "iohk-nix", "type": "github" } diff --git a/flake.nix b/flake.nix index 9b272ae3a4f..5f9bac94f86 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ }; utils.url = "github:numtide/flake-utils"; iohkNix = { - url = "github:input-output-hk/iohk-nix/node-8.11"; + url = "github:input-output-hk/iohk-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; ops-lib = { diff --git a/nix/haskell.nix b/nix/haskell.nix index cdc1ed2b97f..305a6026850 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -48,6 +48,8 @@ let ghcid haskell-language-server cabal + actionlint + shellcheck ]; withHoogle = true;