Skip to content

Commit 5cd3722

Browse files
committed
Merge branch 'gergely/vasil' into david/adjust-tx-test-2
2 parents 91735e2 + 9974aa3 commit 5cd3722

File tree

8 files changed

+22
-73
lines changed

8 files changed

+22
-73
lines changed

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
flake = false;
1212
};
1313
bot-plutus-interface.url =
14-
"github:mlabs-haskell/bot-plutus-interface?rev=d62bb6ee68c2be7fa5bc1afb9f6d6902c7bd400b";
14+
"github:mlabs-haskell/bot-plutus-interface?ref=vasil-compliant-v1.0.0";
1515
};
1616

1717
outputs =

local-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ As long as the cluster is not stopped, the relay node can be used for arbitrary
66

77
The node socket path can be obtained from console output.
88

9+
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).
10+
911
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.
1012

1113
## Usage

nix/haskell.nix

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/Test/Plutip/Internal/BotPlutusInterface/Setup.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Cardano.Api qualified as CAPI
1313
import Cardano.Launcher.Node (nodeSocketFile)
1414
import Data.Aeson (encodeFile)
1515
import Data.Foldable (traverse_)
16-
import Plutus.V2.Ledger.Api (PubKeyHash (PubKeyHash))
16+
import Plutus.V1.Ledger.Api (PubKeyHash (PubKeyHash))
1717
import PlutusTx.Builtins qualified as PlutusTx
1818
import System.Directory (createDirectoryIfMissing, doesDirectoryExist)
1919
import System.Environment (setEnv)

src/Test/Plutip/Internal/LocalCluster.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ waitForRelayNode trCluster rn =
256256
wait _ = do
257257
tip <- getTip
258258
case tip of
259-
(ChainTip (SlotNo _) _ _) -> pure ()
259+
ChainTip (SlotNo _) _ _ -> pure ()
260260
a -> throwString $ "Timeout waiting for node to start. Last 'tip' response:\n" <> show a
261261
pure ()
262262

@@ -277,7 +277,7 @@ launchChainIndex conf (RunningNode sp _block0 (netParams, _vData) _) dir = do
277277
& CIC.port .~ maybe (CIC.cicPort ChainIndex.defaultConfig) fromEnum (chainIndexPort conf)
278278
& CIC.slotConfig .~ (def {scSlotLength = toMilliseconds slotLen})
279279

280-
void . async $ void $ ChainIndex.runMainWithLog (const $ return ()) config chainIndexConfig
280+
void $ async $ void $ ChainIndex.runMainWithLog (const $ return ()) config chainIndexConfig
281281
waitForChainIndex port
282282
return $ chainIndexConfig ^. CIC.port
283283
where
@@ -292,7 +292,7 @@ launchChainIndex conf (RunningNode sp _block0 (netParams, _vData) _) dir = do
292292
a ->
293293
throwString $
294294
"Timeout waiting for chain-index to start indexing. Last response:\n"
295-
<> show a
295+
<> either show show a
296296

297297
queryTipWithChIndex port = do
298298
manager' <- newManager defaultManagerSettings

test/Spec/Integration.hs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ test =
109109
assertExecution
110110
"Pay from wallet to wallet"
111111
(initAda [100] <> initAndAssertAda [100, 13] 123)
112-
-- (initAda [100] <> initAda [100, 13])
113112
(withContract $ \[pkh1] -> payTo pkh1 10_000_000)
114113
[shouldSucceed]
115114
, assertExecution
@@ -193,8 +192,7 @@ test =
193192
"Fails because outside validity interval"
194193
(initAda [100])
195194
(withContract $ const failingTimeContract)
196-
[shouldFail] -- FIXME: add check that "OutsideValidityIntervalUTxO" is in error message
197-
-- [shouldSucceed]
195+
[shouldFail]
198196
, assertExecution
199197
"Passes validation with exact time range checks"
200198
(initAda [100])
@@ -223,7 +221,7 @@ testValueAssertionsOrderCorrectness =
223221
wallet1 = 200_000_000
224222
wallet2 = 300_000_000
225223

226-
payFee = 146000
224+
payFee = 146400
227225
payTo1Amt = 22_000_000
228226
payTo2Amt = 33_000_000
229227
wallet1After = wallet1 + payTo1Amt
@@ -253,7 +251,7 @@ testValueAssertionsOrderCorrectness =
253251
wallet1 = 200_000_000
254252
wallet2 = 300_000_000
255253

256-
payFee = 146000
254+
payFee = 146400
257255
payTo0Amt = 11_000_000
258256
payTo1Amt = 22_000_000
259257
payTo2Amt = 33_000_000

test/Spec/TestContract/ValidateTimeRange.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Ledger (
3131
import Ledger.Ada qualified as Ada
3232
import Ledger.Constraints qualified as Constraints
3333
import Ledger.Typed.Scripts (mkUntypedValidator)
34-
import Plutus.Contract (Contract, awaitTxConfirmed, submitTx, submitTxConstraintsWith)
34+
import Plutus.Contract (Contract)
3535
import Plutus.Contract qualified as Contract
3636
import Plutus.PAB.Effects.Contract.Builtin (EmptySchema)
3737
import Plutus.Script.Utils.V1.Address (mkValidatorAddress)
@@ -122,6 +122,9 @@ validatorAddr = mkValidatorAddress validator
122122
failingTimeContract :: Contract () EmptySchema Text Hask.String
123123
failingTimeContract = do
124124
startTime <- Contract.currentTime
125+
-- amount of seconds was picked empirically
126+
-- it is relatively small, but big enough so Tx won't be silently dropped
127+
-- from the node mempool coz it stayed there longer than validation range
125128
let timeDiff = POSIXTime 5_000
126129
endTime = startTime + timeDiff
127130

@@ -132,8 +135,8 @@ failingTimeContract = do
132135
<> Constraints.mustValidateIn validInterval
133136

134137
void $ Contract.awaitTime (endTime - POSIXTime 1_000)
135-
tx <- submitTx constr
136-
awaitTxConfirmed $ getCardanoTxId tx
138+
tx <- Contract.submitTx constr
139+
Contract.awaitTxConfirmed $ getCardanoTxId tx
137140
pure "Light debug done"
138141

139142
successTimeContract :: Contract () EmptySchema Text ()
@@ -146,7 +149,7 @@ lockAtScript = do
146149
(validatorHash validator)
147150
unitDatum
148151
(Ada.adaValueOf 10)
149-
tx <- submitTx constr
152+
tx <- Contract.submitTx constr
150153
Contract.awaitTxConfirmed $ getCardanoTxId tx
151154

152155
unlockWithTimeCheck :: Contract () EmptySchema Text ()
@@ -173,6 +176,6 @@ unlockWithTimeCheck = do
173176
[ Constraints.plutusV1OtherScript validator
174177
, Constraints.unspentOutputs (Map.fromList utxos)
175178
]
176-
tx <- submitTxConstraintsWith @TestTime lkps txc
179+
tx <- Contract.submitTxConstraintsWith @TestTime lkps txc
177180
Contract.awaitTxConfirmed (getCardanoTxId tx)
178181
rest -> Contract.throwError $ "Unlocking error: Unwanted set of utxos: " Hask.<> Text.pack (Hask.show rest)

0 commit comments

Comments
 (0)