tweag / cooked-validators

MIT License
39 stars 11 forks source link

TestTree to check the richness of a wallet #113

Closed GuillaumeGen closed 9 months ago

GuillaumeGen commented 2 years ago

I would like to be able to state not only that the transaction validates, but also to check that the result is the one I expect, especially to check that a specific wallet has received the token I wanted to give them.

GuillaumeGen commented 2 years ago

I currently often use variants of:

Tasty.testProperty @Bool
        "Comments here" $
          Cooked.testAllSatisfiesFrom
            (\state ->
              case state of
                Left _ -> False -- The transaction should validate, but refund one of the sender.
                Right (_, utxoState)->
                  let aliceVal = richnessOf utxoState alice
                      bobVal = richnessOf utxoState bob in
                  aliceVal `Plutus.geq` (euros 10_000 Plutus.+ dollars 10_000) ||
                    bobVal `Plutus.geq` (euros 5_500 Plutus.+ dollars 20_000)
            )
            initialDistrib
            theTraceToTest

This would benefit from being directly incorporated to Cooked.

mmontin commented 9 months ago

Closing because it is outdated. We now see the full outcome of running a trace, including which wallet owns what.