user5602: I have Homework1 of week 5, and it works in the repl (meaning, the test gives the expected result). However, when I try the script in the playground (and remove the test - I don't think that makes a big difference, though, and I removed the line module ...), it's stuck on slot 1, at the bottom:
("txSignatures",Array []),("txValidRange",Object (fromList [("ivFrom",Array [Object (fromList [("tag",String "NegInf")]),Bool True]),("ivTo",Array [Object (fromList [("tag",String "PosInf")]),Bool True])]))])),("unBalancedTxUtxoIndex",Array []),("unBalancedTxValidityTimeRange",Object (fromList [("ivFrom",Array [Object (fromList [("tag",String "NegInf")]),Bool True]),("ivTo",Array [Object (fromList [("contents",Number 1.596059152999e12),("tag",String "Finite")]),Bool True])]))]))])),("mkTxLogTxConstraints",Object (fromList [("txConstraints",Array [Object (fromList [("contents",Array [String "aea02b83a8e055c06b768c2fcbf1101422b78405892b5027144ddb3b",String "d87980",Object (fromList [("unTokenName",String "ABC")]),Number 5.0]),("tag",String "MustMintValue")]),Object (fromList [("contents",Object (fromList [("ivFrom",Array [Object (fromList [("tag",String "NegInf")]),Bool True]),("ivTo",Array [Object (fromList [("contents",Number 1.596059152999e12),("tag",String "Finite")]),Bool True])])),("tag",String "MustValidateIn")])]),("txOwnInputs",Array []),("txOwnOutputs",Array [])]))])
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Handled request:   Iteration 3 request ID 1
                               Response: "{\"contents\":1596059092999,\"tag\":\"CurrentTime
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Current requests (1):   Iteration 4 request ID 1
                                    Request: "{\"contents\":{\"unBalancedTxRequiredSignatories\
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Handled request:   Iteration 4 request ID 1
                               Response: "{\"contents\":{\"contents\":{\"contents\":{\"cont
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Current requests (0): 
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Contract instance stopped with error: "WalletError (ValidationError (ScriptFailure (EvaluationError [\"PT5\"] \"CekEvaluationFailure\")))" ]

I don't really understand why the script fails in the playground, while it works perfectly fine in the repl. How to try out the same script in the repl?
Thanks!
== EDIT 15/02/2022
The code: https://gitlab.com/moment-4/courses/plutus-pioneer/plutus-pioneer-program/-/blob/week05/code/week05/src/Week05/Homework1.hs
The important lines (I think):
mkPolicy :: PaymentPubKeyHash -> POSIXTime -> () -> ScriptContext -> Bool
mkPolicy pkh deadline () ctx = 
   txSignedBy txInfo (unPaymentPubKeyHash pkh) &&
      to deadline `contains` txInfoValidRange txInfo
         where txInfo :: TxInfo
               txInfo = scriptContextTxInfo ctx

policy :: PaymentPubKeyHash -> POSIXTime -> Scripts.MintingPolicy
policy pkh deadline = mkMintingPolicyScript $
   $$(PlutusTx.compile [|| mintingPolicyScript ||])
   `PlutusTx.applyCode`
   PlutusTx.liftCode pkh
   `PlutusTx.applyCode`
   PlutusTx.liftCode deadline
      where 
         mintingPolicyScript :: PaymentPubKeyHash -> POSIXTime -> Scripts.WrappedMintingPolicyType
         mintingPolicyScript = \pkh' deadline' -> Scripts.wrapMintingPolicy $ mkPolicy pkh' deadline' 

curSymbol :: PaymentPubKeyHash -> POSIXTime -> CurrencySymbol
curSymbol = \pkh' deadline' -> scriptCurrencySymbol (policy pkh' deadline')


user6113: I've reproduced exactly the same scenario in the tests (homework 1) over the playground with your code and it works as expected: first attempt mints and second one fails because deadline. Most probably the issue is related to your input. (deadline is posixtime, not slots)

deadline = 1596059191000 . I got it doing in the repl:
import Ledger.TimeSlot
import Data.Default 
slotToBeginPOSIXTime def 100  -- slot 100


EDIT 1
After reading your comment the issue comes from this line in offchain code:
Constraints.mustValidateIn (to $ now + 60000)
because the tx doesn't pass the validRange pre-validation phase. If you play using a lower value you'll this in action.
As a side note, this is not a playground thing. You can test with Emulator Trace and won't be able to mint (probably with a different error message).
Hope this is useful.

5602: <p>I have Homework1 of week 5, and it works in the repl (meaning, the test gives the expected result). However, when I try the script in the playground (and remove the test - I don't think that makes a big difference, though, and I removed the line <code>module ...</code>), it's stuck on slot 1, at the bottom:</p>
<pre><code>(&quot;txSignatures&quot;,Array []),(&quot;txValidRange&quot;,Object (fromList [(&quot;ivFrom&quot;,Array [Object (fromList [(&quot;tag&quot;,String &quot;NegInf&quot;)]),Bool True]),(&quot;ivTo&quot;,Array [Object (fromList [(&quot;tag&quot;,String &quot;PosInf&quot;)]),Bool True])]))])),(&quot;unBalancedTxUtxoIndex&quot;,Array []),(&quot;unBalancedTxValidityTimeRange&quot;,Object (fromList [(&quot;ivFrom&quot;,Array [Object (fromList [(&quot;tag&quot;,String &quot;NegInf&quot;)]),Bool True]),(&quot;ivTo&quot;,Array [Object (fromList [(&quot;contents&quot;,Number 1.596059152999e12),(&quot;tag&quot;,String &quot;Finite&quot;)]),Bool True])]))]))])),(&quot;mkTxLogTxConstraints&quot;,Object (fromList [(&quot;txConstraints&quot;,Array [Object (fromList [(&quot;contents&quot;,Array [String &quot;aea02b83a8e055c06b768c2fcbf1101422b78405892b5027144ddb3b&quot;,String &quot;d87980&quot;,Object (fromList [(&quot;unTokenName&quot;,String &quot;ABC&quot;)]),Number 5.0]),(&quot;tag&quot;,String &quot;MustMintValue&quot;)]),Object (fromList [(&quot;contents&quot;,Object (fromList [(&quot;ivFrom&quot;,Array [Object (fromList [(&quot;tag&quot;,String &quot;NegInf&quot;)]),Bool True]),(&quot;ivTo&quot;,Array [Object (fromList [(&quot;contents&quot;,Number 1.596059152999e12),(&quot;tag&quot;,String &quot;Finite&quot;)]),Bool True])])),(&quot;tag&quot;,String &quot;MustValidateIn&quot;)])]),(&quot;txOwnInputs&quot;,Array []),(&quot;txOwnOutputs&quot;,Array [])]))])
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Handled request:   Iteration 3 request ID 1
                               Response: &quot;{\&quot;contents\&quot;:1596059092999,\&quot;tag\&quot;:\&quot;CurrentTime
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Current requests (1):   Iteration 4 request ID 1
                                    Request: &quot;{\&quot;contents\&quot;:{\&quot;unBalancedTxRequiredSignatories\
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Handled request:   Iteration 4 request ID 1
                               Response: &quot;{\&quot;contents\&quot;:{\&quot;contents\&quot;:{\&quot;contents\&quot;:{\&quot;cont
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Current requests (0): 
, Slot 1: 00000000-0000-4000-8000-000000000000 {Wallet W872c}:
            Contract instance stopped with error: &quot;WalletError (ValidationError (ScriptFailure (EvaluationError [\&quot;PT5\&quot;] \&quot;CekEvaluationFailure\&quot;)))&quot; ]
</code></pre>
<p>I don't really understand why the script fails in the playground, while it works perfectly fine in the repl. How to try out the same script in the repl?</p>
<p>Thanks!</p>
<p><strong>== EDIT 15/02/2022</strong></p>
<p>The code: <a href="https://gitlab.com/moment-4/courses/plutus-pioneer/plutus-pioneer-program/-/blob/week05/code/week05/src/Week05/Homework1.hs" rel="nofollow noreferrer">https://gitlab.com/moment-4/courses/plutus-pioneer/plutus-pioneer-program/-/blob/week05/code/week05/src/Week05/Homework1.hs</a></p>
<p>The important lines (I think):</p>
<pre><code>mkPolicy :: PaymentPubKeyHash -&gt; POSIXTime -&gt; () -&gt; ScriptContext -&gt; Bool
mkPolicy pkh deadline () ctx = 
   txSignedBy txInfo (unPaymentPubKeyHash pkh) &amp;&amp;
      to deadline `contains` txInfoValidRange txInfo
         where txInfo :: TxInfo
               txInfo = scriptContextTxInfo ctx

policy :: PaymentPubKeyHash -&gt; POSIXTime -&gt; Scripts.MintingPolicy
policy pkh deadline = mkMintingPolicyScript $
   $$(PlutusTx.compile [|| mintingPolicyScript ||])
   `PlutusTx.applyCode`
   PlutusTx.liftCode pkh
   `PlutusTx.applyCode`
   PlutusTx.liftCode deadline
      where 
         mintingPolicyScript :: PaymentPubKeyHash -&gt; POSIXTime -&gt; Scripts.WrappedMintingPolicyType
         mintingPolicyScript = \pkh' deadline' -&gt; Scripts.wrapMintingPolicy $ mkPolicy pkh' deadline' 

curSymbol :: PaymentPubKeyHash -&gt; POSIXTime -&gt; CurrencySymbol
curSymbol = \pkh' deadline' -&gt; scriptCurrencySymbol (policy pkh' deadline')
</code></pre>
 6113: <p>I've reproduced exactly the same scenario in the tests (homework 1) over the playground with your code and it works as expected: first attempt mints and second one fails because deadline. Most probably the issue is related to your input. (deadline is posixtime, not slots)</p>
<p><a href="https://i.stack.imgur.com/tiaeU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tiaeU.png" alt="enter image description here" /></a></p>
<p>deadline = 1596059191000 . I got it doing in the repl:</p>
<pre><code>import Ledger.TimeSlot
import Data.Default 
slotToBeginPOSIXTime def 100  -- slot 100
</code></pre>
<p><a href="https://i.stack.imgur.com/Aj1fq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Aj1fq.png" alt="enter image description here" /></a></p>
<p><strong>EDIT 1</strong></p>
<p>After reading your comment the issue comes from this line in offchain code:</p>
<p><code>Constraints.mustValidateIn (to $ now + 60000)</code></p>
<p>because the tx doesn't pass the validRange pre-validation phase. If you play using a lower value you'll this in action.</p>
<p>As a side note, this is not a playground thing. You can test with Emulator Trace and won't be able to mint (probably with a different error message).</p>
<p>Hope this is useful.</p>
