From 2af6a58bc4f7ccfcc52610b0e051ef529f97882b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 14 Jun 2022 14:42:22 +0100 Subject: [PATCH 1/2] Update BPI, add budget multiplier to various configs --- flake.lock | 6 +++--- flake.nix | 2 +- src/Test/Plutip/Config.hs | 4 +++- src/Test/Plutip/Internal/BotPlutusInterface/Run.hs | 4 +++- src/Test/Plutip/Internal/LocalCluster.hs | 4 +++- src/Test/Plutip/Internal/Types.hs | 3 ++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 90fe0fca..11cf8f68 100644 --- a/flake.lock +++ b/flake.lock @@ -80,16 +80,16 @@ }, "locked": { "lastModified": 1654259683, - "narHash": "sha256-6wRxq/Odw9dcto2OvU1B/1ZVPrCKz35EdGn7HQA22xM=", + "narHash": "sha256-wuzA4Nh7eQSWElR2yDKu7dUthpgNSXjYVSpwx+fqJEE=", "owner": "mlabs-haskell", "repo": "bot-plutus-interface", - "rev": "0908ade1ef013f3197e3db77ea93b82b2769bac5", + "rev": "76d8178a03f29bba689d91e543f3667b85a7b6ec", "type": "github" }, "original": { "owner": "mlabs-haskell", "repo": "bot-plutus-interface", - "rev": "0908ade1ef013f3197e3db77ea93b82b2769bac5", + "rev": "76d8178a03f29bba689d91e543f3667b85a7b6ec", "type": "github" } }, diff --git a/flake.nix b/flake.nix index f8d241d0..b8c8fb18 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ flake = false; }; bot-plutus-interface.url = - "github:mlabs-haskell/bot-plutus-interface?rev=0908ade1ef013f3197e3db77ea93b82b2769bac5"; + "github:mlabs-haskell/bot-plutus-interface?rev=76d8178a03f29bba689d91e543f3667b85a7b6ec"; }; outputs = diff --git a/src/Test/Plutip/Config.hs b/src/Test/Plutip/Config.hs index dc3a8496..4b9174a8 100644 --- a/src/Test/Plutip/Config.hs +++ b/src/Test/Plutip/Config.hs @@ -16,8 +16,10 @@ data PlutipConfig = PlutipConfig relayNodeLogs :: Maybe FilePath , -- | in case of `Nothing` port from `Plutus.ChainIndex.Config.defaultConfig` is used chainIndexPort :: Maybe Natural + , -- | Multiplier on all BPI transaction budgets + budgetMultiplier :: Rational } deriving stock (Generic) instance Default PlutipConfig where - def = PlutipConfig Nothing Nothing Nothing + def = PlutipConfig Nothing Nothing Nothing 1 diff --git a/src/Test/Plutip/Internal/BotPlutusInterface/Run.hs b/src/Test/Plutip/Internal/BotPlutusInterface/Run.hs index 46a8bc33..cf57fc27 100644 --- a/src/Test/Plutip/Internal/BotPlutusInterface/Run.hs +++ b/src/Test/Plutip/Internal/BotPlutusInterface/Run.hs @@ -13,6 +13,7 @@ import BotPlutusInterface.Types ( LogLevel (Info), PABConfig ( PABConfig, + pcBudgetMultiplier, pcChainIndexUrl, pcCliLocation, pcDryRun, @@ -50,7 +51,7 @@ import Plutus.PAB.Core.ContractInstance.STM (Activity (Active)) import Test.Plutip.Internal.BotPlutusInterface.Setup qualified as BIS import Test.Plutip.Internal.BotPlutusInterface.Wallet (BpiWallet (walletPkh)) import Test.Plutip.Internal.Types ( - ClusterEnv (chainIndexUrl, networkId), + ClusterEnv (bpiBudgetMultiplier, chainIndexUrl, networkId), ExecutionResult (ExecutionResult), FailureReason (CaughtException, ContractExecutionError), ) @@ -108,6 +109,7 @@ runContract cEnv bpiWallet contract = do , pcEnableTxEndpoint = False , pcMetadataDir = Text.pack $ BIS.metadataDir cEnv , pcCollectStats = True + , pcBudgetMultiplier = bpiBudgetMultiplier cEnv } runContract' :: ContractEnvironment w -> m (ExecutionResult w e a) diff --git a/src/Test/Plutip/Internal/LocalCluster.hs b/src/Test/Plutip/Internal/LocalCluster.hs index 45e3c37f..4ca05338 100644 --- a/src/Test/Plutip/Internal/LocalCluster.hs +++ b/src/Test/Plutip/Internal/LocalCluster.hs @@ -40,6 +40,7 @@ import Test.Plutip.Internal.BotPlutusInterface.Setup qualified as BotSetup import Test.Plutip.Internal.Types ( ClusterEnv ( ClusterEnv, + bpiBudgetMultiplier, chainIndexUrl, networkId, runningNode, @@ -56,7 +57,7 @@ import UnliftIO.STM (TVar, atomically, newTVarIO, readTVar, retrySTM, writeTVar) import Data.Foldable (for_) import GHC.Stack.Types (HasCallStack) import Paths_plutip (getDataFileName) -import Test.Plutip.Config (PlutipConfig (chainIndexPort, clusterDataDir, relayNodeLogs)) +import Test.Plutip.Config (PlutipConfig (budgetMultiplier, chainIndexPort, clusterDataDir, relayNodeLogs)) import Text.Printf (printf) -- | Starting a cluster with a setup action @@ -129,6 +130,7 @@ withPlutusInterface conf action = do , networkId = CAPI.Mainnet , supportDir = dir , tracer = trCluster + , bpiBudgetMultiplier = budgetMultiplier conf } BotSetup.runSetup cEnv -- run preparations to use `bot-plutus-interface` diff --git a/src/Test/Plutip/Internal/Types.hs b/src/Test/Plutip/Internal/Types.hs index 6d92719c..f8fbe93f 100644 --- a/src/Test/Plutip/Internal/Types.hs +++ b/src/Test/Plutip/Internal/Types.hs @@ -31,11 +31,12 @@ data ClusterEnv = ClusterEnv -- files created by `cardano-cli`, `chain-index` and `bot-plutus-interface` supportDir :: FilePath , tracer :: Trace IO Text -- not really used anywhere now + , bpiBudgetMultiplier :: Rational } -- | Helper function to get socket path from nodeSocket :: ClusterEnv -> CardanoNodeConn -nodeSocket (ClusterEnv (RunningNode sp _ _) _ _ _ _) = sp +nodeSocket (ClusterEnv (RunningNode sp _ _) _ _ _ _ _) = sp -- | Result of `Contract` execution. Returns contract observable state -- and either `Contract` return value, or error of type `FailureReason`. From 92e5f2b02f999a9c9b7e09523577aad81450fff5 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 15 Jun 2022 11:08:54 +0100 Subject: [PATCH 2/2] Update to master BPI --- flake.lock | 6 +++--- flake.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 11cf8f68..733bc1d7 100644 --- a/flake.lock +++ b/flake.lock @@ -80,16 +80,16 @@ }, "locked": { "lastModified": 1654259683, - "narHash": "sha256-wuzA4Nh7eQSWElR2yDKu7dUthpgNSXjYVSpwx+fqJEE=", + "narHash": "sha256-6/eeXXTWqBpJIYcXNx4cvJFUiU9xluVOt1Jb585ZNKk=", "owner": "mlabs-haskell", "repo": "bot-plutus-interface", - "rev": "76d8178a03f29bba689d91e543f3667b85a7b6ec", + "rev": "405bfc909d8274084a379dc718283094526e091b", "type": "github" }, "original": { "owner": "mlabs-haskell", "repo": "bot-plutus-interface", - "rev": "76d8178a03f29bba689d91e543f3667b85a7b6ec", + "rev": "405bfc909d8274084a379dc718283094526e091b", "type": "github" } }, diff --git a/flake.nix b/flake.nix index b8c8fb18..e47c25b3 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ flake = false; }; bot-plutus-interface.url = - "github:mlabs-haskell/bot-plutus-interface?rev=76d8178a03f29bba689d91e543f3667b85a7b6ec"; + "github:mlabs-haskell/bot-plutus-interface?rev=405bfc909d8274084a379dc718283094526e091b"; }; outputs =