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
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ If your project is importing and making use of `Plutip`s library you will need t

And the following ghc flag must to be set for the test execution: `-Wall -threaded -rtsopts`

NOTE: This branch launches local network in Vasil. Please use appropriate node version if running w/o Nix. It was tested with node `1.35.3`.

## Usage

Plutip provides a tasty interface for executing Plutus contracts on a local cluster.
Expand Down Expand Up @@ -55,7 +57,3 @@ tests =
For more, see `Test.Plutip.LocalCluster` `Test.Plutip.Contract`.

More examples could be found [here](test/Spec/Integration.hs).

## Known limitations

At the moment underlying mechanisms that execute contract do not support `awaitTxConfirmed`. As one possible solution, `waitNSlots n` can be used instead. We are working on it.
2 changes: 1 addition & 1 deletion local-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ As long as the cluster is not stopped, the relay node can be used for arbitrary

The node socket path can be obtained from console output.

NOTE: This branch currently starts local network in Alonzo era. Stable branch that not yet merged to master, but can start local network in Babbage era, can be found [here](https://github.com/mlabs-haskell/plutip/tree/gergely/vasil/local-cluster).
NOTE: This branch launches local network in Vasil. Please use appropriate node version if running w/o Nix. It was tested with node `1.35.3`.

The `Main.hs` module can also serve as an example of how to make your own executable for starting local cluster with funded wallets. Note that when wallet is added with `addSomeWallet` it is recommended to wait some time (1 or 2 seconds) with `waitSeconds` while funding transaction is sent and confirmed.

Expand Down
6 changes: 4 additions & 2 deletions src/Test/Plutip/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import GHC.Generics (Generic)
import GHC.Natural (Natural)

-- | Configuration for the cluster working directory
-- This determines where the node database, chain-index database, and bot-plutus-interface files will be stored for a running cluster
-- This determines where the node database, chain-index database,
-- and bot-plutus-interface files will be stored for a running cluster
--
-- @since 0.2
data WorkingDirectory
Expand All @@ -19,7 +20,8 @@ data WorkingDirectory
Fixed
{ -- | Path to store cluster data, can be relative or absolute
path :: FilePath
, -- | Should the working data be kept on disk after cluster shutdown. Full directory will be deleted on shutdown if False
, -- | Should the working data be kept on disk after cluster shutdown.
-- Full directory will be deleted on shutdown if False
shouldKeep :: Bool
}
deriving stock (Generic, Show)
Expand Down
2 changes: 1 addition & 1 deletion src/Test/Plutip/Contract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ withContractAs walletIdx toContract = do
valuesAtWallet :: Contract w s e (NonEmpty Value)
valuesAtWallet =
void (waitNSlots 1)
>> traverse (valueAt . (`pubKeyHashAddress` Nothing)) collectValuesPkhs -- debug: waiting exact time instead
>> traverse (valueAt . (`pubKeyHashAddress` Nothing)) collectValuesPkhs

-- run the test contract
execRes <- liftIO $ runContract cEnv ownWallet (toContract otherWalletsPkhs)
Expand Down
11 changes: 10 additions & 1 deletion src/Test/Plutip/Predicate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ import Data.Map (Map)
import Data.Map qualified as Map
import Ledger (ExBudget (ExBudget), ExCPU (ExCPU), ExMemory (ExMemory), TxId, Value)
import PlutusCore.Evaluation.Machine.ExMemory (CostingInteger)
import Prettyprinter (Doc, align, defaultLayoutOptions, indent, layoutPretty, viaShow, vsep, (<+>))
import Prettyprinter (
Doc,
align,
defaultLayoutOptions,
indent,
layoutPretty,
viaShow,
vsep,
(<+>),
)
import Prettyprinter.Render.String (renderString)
import Test.Plutip.Internal.Types (
ExecutionResult (ExecutionResult, contractState, outcome),
Expand Down
8 changes: 7 additions & 1 deletion test/Spec/Test/Plutip/BotPlutusInterface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import Network.HTTP.Client (
)
import Network.HTTP.Types.Status (status200)
import System.Directory (doesDirectoryExist, doesFileExist)
import Test.Plutip.Internal.BotPlutusInterface.Setup (keysDir, metadataDir, pParamsFile, scriptsDir, txsDir)
import Test.Plutip.Internal.BotPlutusInterface.Setup (
keysDir,
metadataDir,
pParamsFile,
scriptsDir,
txsDir,
)
import Test.Plutip.Internal.LocalCluster (withPlutusInterface)
import Test.Tasty (TestTree)
import Test.Tasty.HUnit (assertBool, testCase)
Expand Down