user2514: Working through the Plutus Pioneer Week2 homework and getting the following error in the locally served playground.
error:
    • Couldn't match expected type ‘BuiltinData’
                  with actual type ‘PlutusTx.Data’
    • In the second argument of ‘($)’, namely ‘PlutusTx.toData bs’
      In the second argument of ‘($)’, namely
        ‘Redeemer $ PlutusTx.toData bs’
      In the expression:
        mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs
   |
77 |         tx      = mconcat [mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs | oref <- orefs]
   |                 


Validator code in question
import           Plutus.Contract
import qualified PlutusTx
import           PlutusTx.Prelude     hiding (Semigroup(..), unless)

...

grab :: forall w s e. AsContractError e => (Bool, Bool) -> Contract w s e ()
grab bs = do
    utxos <- utxoAt scrAddress
    let orefs   = fst <$> Map.toList utxos
        lookups = Constraints.unspentOutputs utxos      <>
                  Constraints.otherScript validator
        tx :: TxConstraints Void Void
        tx      = mconcat [mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs | oref <- orefs]
    ledgerTx <- submitTxConstraintsWith @Void lookups tx
    void $ awaitTxConfirmed $ txId ledgerTx
    logInfo @String $ "collected gifts"


user2201: The local playground code is compiled to a version that is too recent for week 2. It needs to be compile to the correct commit for week 2. The change to BuiltinData only happened at week 04.
Check the Plutus repo out at the week 2 commit, before executing nix-shell. The commit can be found in the plutus-pioneer-program repo in folder code/week02, file cabal.project at line 28.

2514: <p>Working through the Plutus Pioneer Week2 homework and getting the following error in the locally served playground.</p>
<pre><code>error:
    • Couldn't match expected type ‘BuiltinData’
                  with actual type ‘PlutusTx.Data’
    • In the second argument of ‘($)’, namely ‘PlutusTx.toData bs’
      In the second argument of ‘($)’, namely
        ‘Redeemer $ PlutusTx.toData bs’
      In the expression:
        mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs
   |
77 |         tx      = mconcat [mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs | oref &lt;- orefs]
   |                 

</code></pre>
<p>Validator code in question</p>
<pre><code>import           Plutus.Contract
import qualified PlutusTx
import           PlutusTx.Prelude     hiding (Semigroup(..), unless)

...

grab :: forall w s e. AsContractError e =&gt; (Bool, Bool) -&gt; Contract w s e ()
grab bs = do
    utxos &lt;- utxoAt scrAddress
    let orefs   = fst &lt;$&gt; Map.toList utxos
        lookups = Constraints.unspentOutputs utxos      &lt;&gt;
                  Constraints.otherScript validator
        tx :: TxConstraints Void Void
        tx      = mconcat [mustSpendScriptOutput oref $ Redeemer $ PlutusTx.toData bs | oref &lt;- orefs]
    ledgerTx &lt;- submitTxConstraintsWith @Void lookups tx
    void $ awaitTxConfirmed $ txId ledgerTx
    logInfo @String $ &quot;collected gifts&quot;
</code></pre>
 2201: <p>The local playground code is compiled to a version that is too recent for week 2. It needs to be compile to the correct commit for week 2. The change to BuiltinData only happened at week 04.</p>
<p>Check the Plutus repo out at the week 2 commit, before executing nix-shell. The commit can be found in the plutus-pioneer-program repo in folder code/week02, file cabal.project at line 28.</p>
