IntersectMBO / plutus-apps

The Plutus application platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emulator log not working for QuickCheck and Plutus.Contract.Test.ContractModel

tferariu opened this issue · comments

Summary

After updating to plutus-apps v1.2.0, the ContractModel QuickCheck code no longer provides logs of the Emulator trace. This makes it almost impossible to figure out what the problem is with the property tests. I have talked with someone Quviq which said that the bug is likely to have been introduced in the emulator, since their side of the code concerning the ContractModel all seems in order.

Steps to reproduce the behavior

  • Introduce a bug in some existing model such as Escrow ContractModel. E.g. replace line 144 with Trace.callEndpoint @"pay-escrow" (h $ WalletKey w) (Ada.adaValueOf $ fromInteger 10)
  • Run the code using nix develop, cabal repl, and then quickCheck prop_Escrow

Actual Result

>quickCheck prop_Escrow
*** Failed! Falsified (after 1 test):                  
Actions 
 [Pay (Wallet 5) 17]
Balance changes don't match:
  Predicted symbolic balance changes: Wallet 5: {-17000000 Lovelace}
  Predicted actual balance changes: Wallet 5: {-17000000 Lovelace}
  Actual balance changes: Wallet 5: {-10000000 Lovelace}
  Sum of min Lovelace: Lovelace 1892090

The value you get is probably going to be something different than 17, but that doesn't really matter.

Expected Result

This is for a different error that can be found on this readthedocs tutorial, but a log should be appended at the end with the emulator trace.

>quickCheck prop_Escrow
*** Failed! Assertion failed (after 5 tests and 7 shrinks):
Actions
 [Init (Slot {getSlot = 0}) [],
  Pay (Wallet 1) 2]
Expected funds of W[1] to change by
  Value (Map [(,Map [("",-2000000)])])
but they did not change
Test failed.
Emulator log:
[INFO] Slot 0: TxnValidate ee3a44b98e0325e19bc6be1e6f25cdb269301666a3473758296e96cd7ea9a851
[INFO] Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W[1]}:
                 Contract instance started
[INFO] Slot 1: 00000000-0000-4000-8000-000000000001 {Wallet W[2]}:
                 Contract instance started
...

Describe the approach you would take to fix this

No response

System info

OS: Ubuntu 20.04
Plutus-Apps v1.2.0

We've investigated it and the issue seems to be in the quickchek-contractmodel library, which is discarding the log. We're discussing with their team to see if they can come with a fix.