IntersectMBO / plutus-apps

The Plutus application platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Playground wallets don't make subsequent requests after the first error

schwa423 opened this issue · comments

Summary

This is filed against Plutus 81ba78e, the version referred to by plutus-pioneer-program/code/week02; it may have been subsequently fixed, but I'm a n00b so I'm not going to figure out how to test against HEAD, sorry.

If a wallet submits an erroneous request, such that an error is thrown during execution of the request, then no subsequent requests for that wallet are processed. For example, in the Auction example (plutus-pioneer-program/code/week02/src/Week02/Solution1.hs) if I make Wallet 3 submit a Grab(False,True) request, which expectedly fails because the two bools are unequal, then a subsequent Grab(True,True) request by Wallet 2 is not processed. Other wallets can still submit requests.

Steps to reproduce the behavior

(these instructions are derived from https://forum.cardano.org/t/guide-for-installing-plutus-playground-locally-on-macos-monterey-with-m1-chip/84840)

  1. Check out Plutus version 34aa9c323ed6da68a11f41d41d5aca9f469aaf4b.
  2. Start nix-shell in two terminals. cd to your local Plutus repo dir.
  3. Obtain the Plutus version hash from plutus-pioneer-program/code/week02/cabal.project (this is 81ba78edb1d634a13371397d8c8b19829345ce0d)
  4. In your local Plutus repo, check out the version mentioned in Step 3.
  5. Run the Playground:
    5a. in bothnix-shell, do cd $PLUTUS_REPO/plutus-playground-client
    5b. in one shell, run plutus-playground-server
    5c. in the other shell, run npm run start
    5d. in a browser window, navigate to localhost:8009
    5e. paste the contract source code fromplutus-pioneer-program/code/week02/src/Week02/Solution1.hs
  6. set up actions in the Playground so that it looks like:

Plutus Playground Issue

Actual Result

The actual result is that Wallet 2 grabs the 6000000 Lovelace gift, even though Wallet 3 should get it first.

Here are the logs:

Add slot 1
Contract instance for wallet 1: (ReceiveEndpointCall (EndpointDescription { getEndpointDescription: "give" }) (RawJson "{\"contents\":[{\"getEndpointDescription\":\"give\"},{\"unEndpointValue\":6000000}],\"tag\":\"ExposeEndpointResp\"}"))
Validating transaction: 14e3d8263424f7057b1089e314c83b5a9e6caffaf558ec3f27868d2b0a0cc215
Add slot 2
Contract instance for wallet 1: (ContractLog (RawJson "made a gift of 6000000 lovelace"))
Contract instance for wallet 3: (ReceiveEndpointCall (EndpointDescription { getEndpointDescription: "grab" }) (RawJson "{\"contents\":[{\"getEndpointDescription\":\"grab\"},{\"unEndpointValue\":[false,true]}],\"tag\":\"ExposeEndpointResp\"}"))
Add slot 3
Add slot 4
Contract instance for wallet 2: (ReceiveEndpointCall (EndpointDescription { getEndpointDescription: "grab" }) (RawJson "{\"contents\":[{\"getEndpointDescription\":\"grab\"},{\"unEndpointValue\":[false,false]}],\"tag\":\"ExposeEndpointResp\"}"))
Validating transaction: 5faddad23c5a8f2eeba06f72926a4ae8cd45b43431107996f74c805e584a8883
Add slot 5
Contract instance for wallet 2: (ContractLog (RawJson "collected gifts"))```
... as you can see, there is no `Grab(False,False)` request from Wallet 3, only from Wallet 2 in Slot 4.

Here is the full trace:
```[ Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Contract instance started
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Current requests (2):   Iteration 1 request ID 2
                                    Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
              Iteration 1 request ID 1
              Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Receive endpoint call on 'give' for Object (fromList [("contents",Array [Object (fromList [("getEndpointDescription",String "give")]),Object (fromList [("unEndpointValue",Number 6000000.0)])]),("tag",String "ExposeEndpointResp")])
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Handled request:   Iteration 1 request ID 1
                               Response: "{\"contents\":[{\"getEndpointDescription\":\"give
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Current requests (1):   Iteration 2 request ID 1
                                    Request: "{\"contents\":{\"unBalancedTxTx\":{\"txData\":[[\
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Handled request:   Iteration 2 request ID 1
                               Response: "{\"contents\":{\"contents\":{\"txData\":[[\"2cdb2
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Current requests (1):   Iteration 3 request ID 1
                                    Request: "{\"contents\":{\"getTxId\":\"14e3d8263424f7057b10
, Slot 1: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Contract log: String "made a gift of 6000000 lovelace"
, Slot 2: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Handled request:   Iteration 3 request ID 1
                               Response: "{\"contents\":{\"getTxId\":\"14e3d8263424f7057b10
, Slot 2: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            Current requests (2):   Iteration 4 request ID 2
                                    Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
              Iteration 4 request ID 1
              Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
, Slot 2: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 3: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 3: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 4: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 4: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled
, Slot 5: 00000000-0000-4000-8000-000000000000 {Contract instance for wallet 1}:
            No requests handled ]
[ Slot 1: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Contract instance started
, Slot 1: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Current requests (2):   Iteration 1 request ID 2
                                    Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
              Iteration 1 request ID 1
              Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
, Slot 1: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 1: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 3: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 3: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Receive endpoint call on 'grab' for Object (fromList [("contents",Array [Object (fromList [("getEndpointDescription",String "grab")]),Object (fromList [("unEndpointValue",Array [Bool False,Bool False])])]),("tag",String "ExposeEndpointResp")])
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Handled request:   Iteration 1 request ID 2
                               Response: "{\"contents\":[{\"getEndpointDescription\":\"grab
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Current requests (1):   Iteration 2 request ID 1
                                    Request: "{\"contents\":{\"addressStakingCredential\":null,
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Handled request:   Iteration 2 request ID 1
                               Response: "{\"contents\":{\"address\":{\"addressStakingCrede
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Current requests (1):   Iteration 3 request ID 1
                                    Request: "{\"contents\":{\"unBalancedTxTx\":{\"txData\":[[\
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Handled request:   Iteration 3 request ID 1
                               Response: "{\"contents\":{\"contents\":{\"txData\":[[\"2cdb2
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Current requests (1):   Iteration 4 request ID 1
                                    Request: "{\"contents\":{\"getTxId\":\"5faddad23c5a8f2eeba0
, Slot 4: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled
, Slot 5: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Contract log: String "collected gifts"
, Slot 5: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Handled request:   Iteration 4 request ID 1
                               Response: "{\"contents\":{\"getTxId\":\"5faddad23c5a8f2eeba0
, Slot 5: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            Current requests (2):   Iteration 5 request ID 2
                                    Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
              Iteration 5 request ID 1
              Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
, Slot 5: 00000000-0000-4000-8000-000000000001 {Contract instance for wallet 2}:
            No requests handled ]
[ Slot 1: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Contract instance started
, Slot 1: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Current requests (2):   Iteration 1 request ID 2
                                    Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
              Iteration 1 request ID 1
              Request: "{\"contents\":{\"aeMetadata\":null,\"aeDescriptio
, Slot 1: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            No requests handled
, Slot 1: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            No requests handled
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Receive endpoint call on 'grab' for Object (fromList [("contents",Array [Object (fromList [("getEndpointDescription",String "grab")]),Object (fromList [("unEndpointValue",Array [Bool False,Bool True])])]),("tag",String "ExposeEndpointResp")])
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Handled request:   Iteration 1 request ID 2
                               Response: "{\"contents\":[{\"getEndpointDescription\":\"grab
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Current requests (1):   Iteration 2 request ID 1
                                    Request: "{\"contents\":{\"addressStakingCredential\":null,
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Handled request:   Iteration 2 request ID 1
                               Response: "{\"contents\":{\"address\":{\"addressStakingCrede
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Current requests (1):   Iteration 3 request ID 1
                                    Request: "{\"contents\":{\"unBalancedTxTx\":{\"txData\":[[\
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Handled request:   Iteration 3 request ID 1
                               Response: "{\"contents\":{\"contents\":{\"contents\":{\"cont
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Current requests (0): 
, Slot 2: 00000000-0000-4000-8000-000000000002 {Contract instance for wallet 3}:
            Contract instance stopped with error: "WalletError (ValidationError (ScriptFailure (EvaluationError [\"wrong redeemer\"])))" ]```

### Expected Result

In Slot 3, Wallet 3 should submit a Grab(False,False) request and successfully grab the gift from the smart contract.

### Describe the approach you would take to fix this

_No response_

### System info

OS: MacOS 12.1
Plutus: `81ba78edb1d634a13371397d8c8b19829345ce0d`
commented

Thanks for the issue!

That's correct behaviour as the contract instance of the third wallet fails with an error it can't continue to proceed. That's why the second one succeeds.