title_body: Blockchain Simulator Chokes on Validation Error I'm working through Plutus pioneer homework week 2 file Homework1.hs. I believe I've setup the script correctly, but I find that when running the simulator with a transaction that's expected to fail, the simulator sort of breaks after encountering the validation error. As a reminder, the scripts basically acts like a faucet with &quot;Give&quot; and &quot;Grab&quot; functions, and the validation function is to take two bools and return false if they're not equal to each other. Here's my sequence of transactions:
  0: Wallet1 Give 5
  1: Wait 1
  2: Wallet2 Grab (True, False) // this should fail validation
  3: Wait 1
  4: Wallet2 Grab (False, False) // should pass
  5: Wait 1
  6: Wallet1 Give 5
  7: Wait 1
  8: Wallet2 Grab (True, True) // should pass
  9: Wait 1
  
  I'd expect the balances on each step to be:
  Genesis: Wallet1 10 Wallet2 10 Script 0
  0: Wallet1 5 Wallet2 10 Script 5
  2: Wallet1 5 Wallet2 10 Script 5 // Wallet2 fails to Grab
  4: Wallet1 5 Wallet2 15 Script 0 // Wallet2 Grabs
  6: Wallet1 0 Wallet2 15 Script 5 // Wallet1 Gives
  8: Wallet1 0 Wallet2 20 Script 0 // Wallet2 Grabs
  
  But when running in the simulator, it stops at Slot 4, Tx 0 at the top. The Logs however seem to continue to slot 6.
  Validating transaction: 4c1f4f09fbfcf30b38e33dcb8759a4c56c7fc1958ccc7f816608fbf49a2fe0a1
  Add slot 1
  Contract instance for wallet 1: (ReceiveEndpointCall (RawJson &quot;{\&quot;value\&quot;:{\&quot;unEndpointValue\&quot;:5},\&quot;tag\&quot;:\&quot;give\&quot;}&quot;))
  Validating transaction: b3e4aae77f5fd3e0a6e2d2b38e80e5971b3a010ae432aa2bf8f576a3ac6c8f1e
  Add slot 2
  Contract instance for wallet 1: (ContractLog (RawJson &quot;made a gift of 5 lovelace&quot;))
  Contract instance for wallet 2: (ReceiveEndpointCall (RawJson &quot;{\&quot;value\&quot;:{\&quot;unEndpointValue\&quot;:[true,false]},\&quot;tag\&quot;:\&quot;grab\&quot;}&quot;))
  Validation failed: 033c6c4ae71e507fe66149eb1860cafdebbd7f8eafcd560bed41c400bd275b84
   (ScriptFailure (EvaluationError []))
  Add slot 3
  Contract instance for wallet 2: (ReceiveEndpointCall (RawJson &quot;{\&quot;value\&quot;:{\&quot;unEndpointValue\&quot;:[false,false]},\&quot;tag\&quot;:\&quot;grab\&quot;}&quot;))
  Add slot 4
  Contract instance for wallet 1: (ReceiveEndpointCall (RawJson &quot;{\&quot;value\&quot;:{\&quot;unEndpointValue\&quot;:5},\&quot;tag\&quot;:\&quot;give\&quot;}&quot;))
  Validating transaction: 217d02eb52b162569b40d20de7f8135ea7ba11f0fab08fd0a80e4f23d6df179e
  Add slot 5
  Contract instance for wallet 1: (ContractLog (RawJson &quot;made a gift of 5 lovelace&quot;))
  Contract instance for wallet 2: (ReceiveEndpointCall (RawJson &quot;{\&quot;value\&quot;:{\&quot;unEndpointValue\&quot;:[true,true]},\&quot;tag\&quot;:\&quot;grab\&quot;}&quot;))
  Add slot 6
  
  The other odd thing is that the Balances Carried Forward on Slot 4, Tx 0 (this is as far as the top section runs) shows:
  Wallet1 Balance 0
  Wallet2 Balance 10
  Script Balance 10
  
  Here's a screenshot of the final state of the simulation:
  
  It's as if the top part of the simulation ignores function calls from any wallet that had a validation error result, and only represents wallets that never had a validation error. I wouldn't expect the Script balance to ever reach 10, as Wallet2 should be able to take 5 lovelace after its first failed Grab.
  Is this just a bug in the simulator or do I misunderstand how the simulator / blockchain should work?
  Thanks!
upvoted_answer: The problem is that in the off-chain wallet code, after submitting the transaction, there is a line of code that waits for the transaction to be confirmed. Seeing as the transaction is invalid, it will never be confirmed, so the wallet contract blocks on that line forever.
  There would be workarounds, but in the final version of Plutus, it will be possible to check the status of validation from the wallet and for example detect if the transaction was invalid.
  This means handling this and similar situations will be much easier in future.