diff --git a/local-cluster/Main.hs b/local-cluster/Main.hs index 3bf4139..277cf1b 100644 --- a/local-cluster/Main.hs +++ b/local-cluster/Main.hs @@ -32,6 +32,9 @@ import Plutip.Config ( WorkingDirectory (Fixed, Temporary), ecEpochSize, ecSlotLength, + ecRaiseExUnitsToMax, + ecMaxTxSize, + stdTxSize, ) import Plutip.DistributeFunds (Lovelace) import Plutip.Keys (KeyPair, mainnetAddress, saveKeyPair, showPkh) @@ -43,10 +46,15 @@ main = do case totalAmount config of Left e -> error e Right amt -> do - let ClusterConfig {numWallets, dirWallets, numUtxos, workDir, slotLength, epochSize} = config + let ClusterConfig {numWallets, dirWallets, numUtxos, workDir, slotLength, epochSize, maxTxSize, raiseUnitsToMax} = config workingDir = maybe Temporary (`Fixed` False) workDir -- todo: if needed pipe remaining extraConfig options from command line args - extraConf = def {ecSlotLength = slotLength, ecEpochSize = epochSize} + extraConf = def + { ecSlotLength = slotLength + , ecEpochSize = epochSize + , ecMaxTxSize = maxTxSize + , ecRaiseExUnitsToMax = raiseUnitsToMax + } plutipConfig = def {clusterWorkingDir = workingDir, extraConfig = extraConf} putStrLn "Starting cluster..." @@ -199,6 +207,23 @@ pInfoJson = <> Options.value "local-cluster-info.json" ) +pTxSize :: Parser Natural +pTxSize = + Options.option + Options.auto + ( Options.long "tx-size" + <> Options.short 't' + <> Options.metavar "MAX_TX_SIZE" + <> Options.value stdTxSize + ) + +pRaiseUnits :: Parser Bool +pRaiseUnits = + Options.switch + ( Options.long "max-units" + <> Options.help "Whether to raise budget to max units" + ) + pClusterConfig :: Parser ClusterConfig pClusterConfig = ClusterConfig @@ -211,6 +236,8 @@ pClusterConfig = <*> pSlotLen <*> pEpochSize <*> pInfoJson + <*> pTxSize + <*> pRaiseUnits -- | Basic info about the cluster, to -- be used by the command-line @@ -224,5 +251,7 @@ data ClusterConfig = ClusterConfig , slotLength :: NominalDiffTime , epochSize :: EpochSize , dumpInfo :: Maybe FilePath + , maxTxSize :: Natural + , raiseUnitsToMax :: Bool } deriving stock (Show, Eq) diff --git a/src/Plutip/Config.hs b/src/Plutip/Config.hs index 2133263..a960f18 100644 --- a/src/Plutip/Config.hs +++ b/src/Plutip/Config.hs @@ -4,13 +4,14 @@ module Plutip.Config ( ExtraConfig (..), NominalDiffTime, EpochSize (..), + stdTxSize, ) where import Cardano.Ledger.Slot (EpochSize (EpochSize, unEpochSize)) import Data.Default (Default, def) import Data.Time (NominalDiffTime) import GHC.Generics (Generic) -import Plutip.Launch.Extra.Types (ExtraConfig (ExtraConfig, ecEpochSize, ecMaxTxSize, ecRaiseExUnitsToMax, ecSlotLength)) +import Plutip.Launch.Extra.Types (ExtraConfig (ExtraConfig, ecEpochSize, ecMaxTxSize, ecRaiseExUnitsToMax, ecSlotLength), stdTxSize) -- | Configuration for the cluster working directory -- This determines where the node database, chain-index database,