|
| 1 | +{-# LANGUAGE DataKinds #-} |
| 2 | +{-# LANGUAGE NamedFieldPuns #-} |
| 3 | +{-# LANGUAGE OverloadedStrings #-} |
| 4 | +{-# LANGUAGE ScopedTypeVariables #-} |
| 5 | + |
| 6 | +module Cardano.Testnet.Test.LedgerEvents.Gov.PredefinedAbstainDRep |
| 7 | + ( hprop_check_predefined_abstain_drep |
| 8 | + ) where |
| 9 | + |
| 10 | +import Cardano.Api as Api |
| 11 | + |
| 12 | +import Cardano.Testnet |
| 13 | + |
| 14 | +import Prelude |
| 15 | + |
| 16 | +import System.FilePath ((</>)) |
| 17 | + |
| 18 | +import Testnet.Components.Query (getEpochStateView) |
| 19 | +import qualified Testnet.Process.Run as H |
| 20 | +import qualified Testnet.Property.Utils as H |
| 21 | +import Testnet.Runtime |
| 22 | + |
| 23 | +import Hedgehog |
| 24 | +import qualified Hedgehog.Extras as H |
| 25 | +import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO |
| 26 | + |
| 27 | +-- | Execute me with: |
| 28 | +-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Predefined Abstain DRep/"'@ |
| 29 | +hprop_check_predefined_abstain_drep :: Property |
| 30 | +hprop_check_predefined_abstain_drep = H.integrationWorkspace "test-activity" $ \tempAbsBasePath' -> do |
| 31 | + -- Start a local test net |
| 32 | + conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' |
| 33 | + let tempAbsPath' = unTmpAbsPath tempAbsPath |
| 34 | + tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath |
| 35 | + |
| 36 | + work <- H.createDirectoryIfMissing $ tempAbsPath' </> "work" |
| 37 | + |
| 38 | + -- Create default testnet with 3 DReps and 3 stake holders delegated, one to each DRep. |
| 39 | + let sbe = ShelleyBasedEraConway |
| 40 | + era = toCardanoEra sbe |
| 41 | + cEra = AnyCardanoEra era |
| 42 | + fastTestnetOptions = cardanoDefaultTestnetOptions |
| 43 | + { cardanoEpochLength = 100 |
| 44 | + , cardanoNodeEra = cEra |
| 45 | + , cardanoNumDReps = 3 |
| 46 | + } |
| 47 | + |
| 48 | + testnetRuntime@TestnetRuntime |
| 49 | + { testnetMagic |
| 50 | + , poolNodes |
| 51 | + , wallets=_wallet0:_wallet1:_wallet2:_ |
| 52 | + , configurationFile |
| 53 | + } |
| 54 | + <- cardanoTestnetDefault fastTestnetOptions conf |
| 55 | + |
| 56 | + poolNode1 <- H.headM poolNodes |
| 57 | + poolSprocket1 <- H.noteShow $ nodeSprocket $ poolRuntime poolNode1 |
| 58 | + _execConfig <- H.mkExecConfig tempBaseAbsPath poolSprocket1 testnetMagic |
| 59 | + |
| 60 | + let socketName' = IO.sprocketName poolSprocket1 |
| 61 | + socketBase = IO.sprocketBase poolSprocket1 -- /tmp |
| 62 | + socketPath = socketBase </> socketName' |
| 63 | + |
| 64 | + _epochStateView <- getEpochStateView (File configurationFile) (File socketPath) |
| 65 | + |
| 66 | + startLedgerNewEpochStateLogging testnetRuntime tempAbsPath' |
| 67 | + |
| 68 | + H.note_ $ "Sprocket: " <> show poolSprocket1 |
| 69 | + H.note_ $ "Abs path: " <> tempAbsBasePath' |
| 70 | + H.note_ $ "Socketpath: " <> socketPath |
| 71 | + H.note_ $ "Foldblocks config file: " <> configurationFile |
| 72 | + |
| 73 | + _gov <- H.createDirectoryIfMissing $ work </> "governance" |
| 74 | + |
| 75 | + -- ToDo: Do some proposal and vote yes with the first DRep only. |
| 76 | + -- ToDo: ASSERT: Check that proposal does NOT pass. |
| 77 | + -- ToDo: Take the last two stake delegators and delegate them to "Abstain". |
| 78 | + -- ToDo: This can be done using cardano-cli conway stake-address vote-delegation-certificate --always-abstain |
| 79 | + -- ToDo: Do some other proposal and vote yes with first DRep only. |
| 80 | + -- ToDo: ASSERT: Check the new proposal passes now. |
| 81 | + |
| 82 | + success |
0 commit comments