Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This format is based on [Keep A Changelog](https://keepachangelog.com/en/1.0.0).
- Ability to set custom file where relay node log can be saved after tests run
- Ability to set to set custom port for `chain-idex`
- Ability to set custom directory for cluster data files
- Ability to set budget multiplier on estimated budget for rare case of incorrect estimation
- Default cluster data files delivered via `data-files` package property
- Contract execution result returns current contract state for failure cases too
- Implementing tasty integration
Expand Down
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
flake = false;
};
bot-plutus-interface.url =
"github:mlabs-haskell/bot-plutus-interface?rev=12b54288155f2a3f4e19b81484adf646e9737ff7";
"github:mlabs-haskell/bot-plutus-interface?rev=dc7b54a067744faabf90a5fc67ca4068caaec78c";
};

outputs =
Expand Down
4 changes: 3 additions & 1 deletion src/Test/Plutip/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion src/Test/Plutip/Internal/BotPlutusInterface/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import BotPlutusInterface.Types (
LogLevel (Error),
PABConfig (
PABConfig,
pcBudgetMultiplier,
pcChainIndexUrl,
pcCliLocation,
pcDryRun,
Expand Down Expand Up @@ -52,7 +53,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),
)
Expand Down Expand Up @@ -111,6 +112,7 @@ runContract cEnv bpiWallet contract = do
, pcMetadataDir = Text.pack $ BIS.metadataDir cEnv
, pcCollectStats = True
, pcCollectLogs = True
, pcBudgetMultiplier = bpiBudgetMultiplier cEnv
}

runContract' :: ContractEnvironment w -> m (ExecutionResult w e a)
Expand Down
4 changes: 3 additions & 1 deletion src/Test/Plutip/Internal/LocalCluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Test.Plutip.Internal.BotPlutusInterface.Setup qualified as BotSetup
import Test.Plutip.Internal.Types (
ClusterEnv (
ClusterEnv,
bpiBudgetMultiplier,
chainIndexUrl,
networkId,
runningNode,
Expand All @@ -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
Expand Down Expand Up @@ -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`
Expand Down
3 changes: 2 additions & 1 deletion src/Test/Plutip/Internal/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down