Skip to content

Commit

Permalink
Create Testnet.Commands.Governance
Browse files Browse the repository at this point in the history
Implement createByronUpdateProposal
Reduce Babbage defaultTestnetOptions slot duration
  • Loading branch information
Jimbo4350 committed Feb 8, 2023
1 parent 26a411c commit 5cf5af1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
3 changes: 2 additions & 1 deletion cardano-testnet/cardano-testnet.cabal
Expand Up @@ -80,7 +80,8 @@ library
Testnet.Babbage
Testnet.Cardano
Testnet.Conf
Testnet.Genesis
Testnet.Commands.Genesis
Testnet.Commands.Governance
Testnet.Run
Testnet.Shelley
Testnet.Utils
Expand Down
4 changes: 2 additions & 2 deletions cardano-testnet/src/Testnet/Babbage.hs
Expand Up @@ -31,8 +31,8 @@ import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified System.Info as OS

import Testnet.Commands.Genesis
import qualified Testnet.Conf as H
import Testnet.Genesis
import qualified Testnet.Util.Assert as H
import Testnet.Util.Process (execCli_)
import Testnet.Util.Runtime (Delegator (..), NodeLoggingFormat (..), PaymentKeyPair (..),
Expand All @@ -53,7 +53,7 @@ data BabbageTestnetOptions = BabbageTestnetOptions
defaultTestnetOptions :: BabbageTestnetOptions
defaultTestnetOptions = BabbageTestnetOptions
{ babbageNumSpoNodes = 3
, babbageSlotDuration = 1000
, babbageSlotDuration = 200
, babbageSecurityParam = 10
, babbageTotalBalance = 10020000000
, babbageNodeLoggingFormat = NodeLoggingFormatAsJson
Expand Down
39 changes: 12 additions & 27 deletions cardano-testnet/src/Testnet/Cardano.hs
Expand Up @@ -63,8 +63,9 @@ import qualified Hedgehog.Extras.Test.Concurrent as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.Network as H

import Testnet.Commands.Genesis
import Testnet.Commands.Governance
import qualified Testnet.Conf as H
import Testnet.Genesis
import qualified Testnet.Util.Assert as H
import qualified Testnet.Util.Process as H
import Testnet.Util.Process (execCli_)
Expand Down Expand Up @@ -347,19 +348,11 @@ cardanoTestnet testnetOptions H.Conf {..} = do
]

-- Update Proposal and votes
execCli_
[ "byron", "governance", "create-update-proposal"
, "--filepath", tempAbsPath </> "update-proposal"
, "--testnet-magic", show @Int testnetMagic
, "--signing-key", tempAbsPath </> "byron/delegate-keys.000.key"
, "--protocol-version-major", "1"
, "--protocol-version-minor", "0"
, "--protocol-version-alt", "0"
, "--application-name", "cardano-sl"
, "--software-version-num", "1"
, "--system-tag", "linux"
, "--installer-hash", "0"
]
createByronUpdateProposal
testnetMagic
(tempAbsPath </> "byron/delegate-keys.000.key")
(tempAbsPath </> "update-proposal")
1

forM_ bftNodesN $ \n -> do
execCli_
Expand All @@ -371,19 +364,11 @@ cardanoTestnet testnetOptions H.Conf {..} = do
, "--output-filepath", tempAbsPath </> "update-vote.00" <> show @Int (n - 1)
]

execCli_
[ "byron", "governance", "create-update-proposal"
, "--filepath", tempAbsPath </> "update-proposal-1"
, "--testnet-magic", show @Int testnetMagic
, "--signing-key", tempAbsPath </> "byron/delegate-keys.000.key"
, "--protocol-version-major", "2"
, "--protocol-version-minor", "0"
, "--protocol-version-alt", "0"
, "--application-name", "cardano-sl"
, "--software-version-num", "1"
, "--system-tag", "linux"
, "--installer-hash", "0"
]
createByronUpdateProposal
testnetMagic
(tempAbsPath </> "byron/delegate-keys.000.key")
(tempAbsPath </> "update-proposal-1")
2

forM_ bftNodesN $ \n ->
execCli_
Expand Down
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE TypeApplications #-}

-- | All Byron and Shelley Genesis related functionality
module Testnet.Genesis
module Testnet.Commands.Genesis
( defaultByronGenesisJsonValue
, createShelleyGenesisInitialTxIn
) where
Expand Down
33 changes: 33 additions & 0 deletions cardano-testnet/src/Testnet/Commands/Governance.hs
@@ -0,0 +1,33 @@


module Testnet.Commands.Governance
( createByronUpdateProposal
) where

import Prelude

import Control.Monad.Catch
import Control.Monad.IO.Class

import Testnet.Util.Process (execCli_)

import Hedgehog.Internal.Property


createByronUpdateProposal
:: (MonadTest m, MonadCatch m, MonadIO m)
=> Int -> String -> String -> Int -> m ()
createByronUpdateProposal testnetMagic signingKeyFp updateProposalFp ptclMajorVersion =
execCli_
[ "byron", "governance", "create-update-proposal"
, "--filepath", updateProposalFp
, "--testnet-magic", show testnetMagic
, "--signing-key", signingKeyFp
, "--protocol-version-major", show ptclMajorVersion
, "--protocol-version-minor", "0"
, "--protocol-version-alt", "0"
, "--application-name", "cardano-sl"
, "--software-version-num", "1"
, "--system-tag", "linux"
, "--installer-hash", "0"
]
2 changes: 1 addition & 1 deletion cardano-testnet/src/Testnet/Shelley.hs
Expand Up @@ -54,8 +54,8 @@ import qualified Hedgehog.Extras.Test.Process as H
import qualified System.Directory as IO
import qualified System.Info as OS

import Testnet.Commands.Genesis
import qualified Testnet.Conf as H
import Testnet.Genesis
import qualified Testnet.Util.Base as H
import qualified Testnet.Util.Process as H
import Testnet.Util.Process (execCli_)
Expand Down

0 comments on commit 5cf5af1

Please sign in to comment.