From 159a0180713c5a819cda43ab4525e8c67d71fe6f Mon Sep 17 00:00:00 2001 From: TotallyNotChase <44284917+TotallyNotChase@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:32:04 -0600 Subject: [PATCH 1/2] Add budget raise cli arg to local-server --- local-cluster/Main.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/local-cluster/Main.hs b/local-cluster/Main.hs index 3bf4139..ce53f0e 100644 --- a/local-cluster/Main.hs +++ b/local-cluster/Main.hs @@ -31,7 +31,7 @@ import Plutip.Config ( PlutipConfig (clusterWorkingDir, extraConfig), WorkingDirectory (Fixed, Temporary), ecEpochSize, - ecSlotLength, + ecSlotLength, ecRaiseExUnitsToMax ) import Plutip.DistributeFunds (Lovelace) import Plutip.Keys (KeyPair, mainnetAddress, saveKeyPair, showPkh) @@ -43,10 +43,10 @@ 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, 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, ecRaiseExUnitsToMax = raiseUnitsToMax} plutipConfig = def {clusterWorkingDir = workingDir, extraConfig = extraConf} putStrLn "Starting cluster..." @@ -199,6 +199,13 @@ pInfoJson = <> Options.value "local-cluster-info.json" ) +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 +218,7 @@ pClusterConfig = <*> pSlotLen <*> pEpochSize <*> pInfoJson + <*> pRaiseUnits -- | Basic info about the cluster, to -- be used by the command-line @@ -224,5 +232,6 @@ data ClusterConfig = ClusterConfig , slotLength :: NominalDiffTime , epochSize :: EpochSize , dumpInfo :: Maybe FilePath + , raiseUnitsToMax :: Bool } deriving stock (Show, Eq) From dcee10dc248764d1ea158b14d9120f56a575da72 Mon Sep 17 00:00:00 2001 From: TotallyNotChase <44284917+TotallyNotChase@users.noreply.github.com> Date: Thu, 7 Sep 2023 18:06:20 -0600 Subject: [PATCH 2/2] Add option to configure max tx size --- local-cluster/Main.hs | 26 +++++++++++++++++++++++--- src/Plutip/Config.hs | 3 ++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/local-cluster/Main.hs b/local-cluster/Main.hs index ce53f0e..277cf1b 100644 --- a/local-cluster/Main.hs +++ b/local-cluster/Main.hs @@ -31,7 +31,10 @@ import Plutip.Config ( PlutipConfig (clusterWorkingDir, extraConfig), WorkingDirectory (Fixed, Temporary), ecEpochSize, - ecSlotLength, ecRaiseExUnitsToMax + 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, raiseUnitsToMax} = 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, ecRaiseExUnitsToMax = raiseUnitsToMax} + extraConf = def + { ecSlotLength = slotLength + , ecEpochSize = epochSize + , ecMaxTxSize = maxTxSize + , ecRaiseExUnitsToMax = raiseUnitsToMax + } plutipConfig = def {clusterWorkingDir = workingDir, extraConfig = extraConf} putStrLn "Starting cluster..." @@ -199,6 +207,16 @@ 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 @@ -218,6 +236,7 @@ pClusterConfig = <*> pSlotLen <*> pEpochSize <*> pInfoJson + <*> pTxSize <*> pRaiseUnits -- | Basic info about the cluster, to @@ -232,6 +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,