-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create scafolding for "Predefined No Confidence DRep" test
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
.../cardano-testnet-test/Cardano/Testnet/Test/LedgerEvents/Gov/PredefinedNoConfidenceDRep.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Cardano.Testnet.Test.LedgerEvents.Gov.PredefinedNoConfidenceDRep | ||
( hprop_check_predefined_no_confidence_drep | ||
) where | ||
|
||
import Cardano.Api as Api | ||
|
||
import Cardano.Testnet | ||
|
||
import Prelude | ||
|
||
import System.FilePath ((</>)) | ||
|
||
import Testnet.Components.Query (getEpochStateView) | ||
import qualified Testnet.Process.Run as H | ||
import qualified Testnet.Property.Utils as H | ||
import Testnet.Runtime | ||
|
||
import Hedgehog | ||
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 "/Predefined No Confidence DRep/"'@ | ||
hprop_check_predefined_no_confidence_drep :: Property | ||
hprop_check_predefined_no_confidence_drep = H.integrationWorkspace "test-activity" $ \tempAbsBasePath' -> do | ||
-- Start a local test net | ||
conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath' | ||
let tempAbsPath' = unTmpAbsPath tempAbsPath | ||
tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath | ||
|
||
work <- H.createDirectoryIfMissing $ tempAbsPath' </> "work" | ||
|
||
-- Create default testnet with 3 DReps and 3 stake holders delegated, one to each DRep. | ||
let sbe = ShelleyBasedEraConway | ||
era = toCardanoEra sbe | ||
cEra = AnyCardanoEra era | ||
fastTestnetOptions = cardanoDefaultTestnetOptions | ||
{ cardanoEpochLength = 100 | ||
, cardanoNodeEra = cEra | ||
, cardanoNumDReps = 3 | ||
} | ||
|
||
testnetRuntime@TestnetRuntime | ||
{ testnetMagic | ||
, poolNodes | ||
, wallets=_wallet0:_wallet1:_wallet2:_ | ||
, configurationFile | ||
} | ||
<- cardanoTestnetDefault fastTestnetOptions conf | ||
|
||
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' | ||
|
||
_epochStateView <- getEpochStateView (File configurationFile) (File socketPath) | ||
|
||
startLedgerNewEpochStateLogging testnetRuntime tempAbsPath' | ||
|
||
H.note_ $ "Sprocket: " <> show poolSprocket1 | ||
H.note_ $ "Abs path: " <> tempAbsBasePath' | ||
H.note_ $ "Socketpath: " <> socketPath | ||
H.note_ $ "Foldblocks config file: " <> configurationFile | ||
|
||
_gov <- H.createDirectoryIfMissing $ work </> "governance" | ||
|
||
-- ToDo: Do some proposal and vote yes with all the DReps. | ||
-- ToDo: ASSERT: that proposal passes. | ||
-- ToDo: Take the last two stake delegators and delegate them to "No Confidence". | ||
-- ToDo: This can be done using cardano-cli conway stake-address vote-delegation-certificate --always-no-confidence | ||
-- ToDo: Do some other proposal and vote yes with all the DReps. | ||
-- ToDo: ASSERT: the new proposal does NOT pass. | ||
-- ToDo: Create a no confidence proposal. | ||
-- ToDo: This can be done using cardano-cli conway governance action create-no-confidence | ||
-- ToDo: Vote no to the no confidence proposal with all DReps. | ||
-- ToDo: ASSERT: the no confidence proposal passes. | ||
|
||
success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters