3

The cabal.project file for Week 5 of the Plutus Pioneer program points to commit 8f1a47674a99ac9bc2aba3231375d8d6de0641d2 for the Plutus repo but that commit seems to not exist based on:

 2:22PM /Users/paymahn/plutus master ✱
 ❯❯❯ git checkout 8f1a47674a99ac9bc2aba3231375d8d6de0641d2
fatal: reference is not a tree: 8f1a47674a99ac9bc2aba3231375d8d6de0641d2

and this github search for the commit. Is this known? What's the correct Plutus commit for the week 5 homework? This is preventing cabal build and cabal repl from running successfully:

 2:24PM /Users/paymahn/plutus-pioneer-program/code/week05 (nix) main ✱ ◼
 ❯❯❯ cabal build
remote: Enumerating objects: 728, done.
remote: Counting objects: 100% (728/728), done.
remote: Compressing objects: 100% (285/285), done.
remote: Total 728 (delta 451), reused 666 (delta 400), pack-reused 0
Receiving objects: 100% (728/728), 184.31 KiB | 174.00 KiB/s, done.
Resolving deltas: 100% (451/451), completed with 138 local objects.
From https://github.com/input-output-hk/plutus
   daeb13477..c5083fce6  master                             -> origin/master
 * [new branch]          SCP-2858-chain-index-securityParam -> origin/SCP-2858-chain-index-securityParam
 + b63ecf5b2...4b94768e7 bezirg/costparams-test             -> origin/bezirg/costparams-test  (forced update)
 + 1d4eb1d72...4bd02c105 bezirg/retained-csv                -> origin/bezirg/retained-csv  (forced update)
 + 9441f7f66...971377a54 component-modules                  -> origin/component-modules  (forced update)
   7f77abdb3..a0258b9ba  hkm/ghcjs-cross                    -> origin/hkm/ghcjs-cross
 + 4f24c5258...a8be7ab68 hrajchert/scp-2779-fix-toast-when-reloading -> origin/hrajchert/scp-2779-fix-toast-when-reloading  (forced update)
   a1db411af..ed7e61160  jmchapman/ck-cek-eq                -> origin/jmchapman/ck-cek-eq
   b59aebf75..fec18d337  kwxm/list-sort-benchmarks          -> origin/kwxm/list-sort-benchmarks
 * [new branch]          merivale/marlowe-run-architecture  -> origin/merivale/marlowe-run-architecture
   ffb13a295..116d4d116  scp-1582-actus-quick-check         -> origin/scp-1582-actus-quick-check
 + 5a78a0736...879fed306 scp-2782-sqlite-in-freer-extras    -> origin/scp-2782-sqlite-in-freer-extras  (forced update)
 + 9b1ca49b0...d3fb79c45 scp-2783-chain-index-pagination    -> origin/scp-2783-chain-index-pagination  (forced update)
 + 8d679192d...0b8e46ead scp-2796-chain-index-query-utxo-currenty -> origin/scp-2796-chain-index-query-utxo-currenty  (forced update)
 * [new branch]          scp-2883-actus-derivative-contracts -> origin/scp-2883-actus-derivative-contracts
fatal: reference is not a tree: 8f1a47674a99ac9bc2aba3231375d8d6de0641d2
3

You should be aware that plutus is changing constantly, so some commits aren't working anymore.

In this case, you can use this commit hash: 547e22a975d9b688ad2121f56e63691bead661cc (or this one 9ed85d6cc8e817270220f263a11e738135eb0ad3 as mentioned in following comment) but remember to update your cabal.project according to this, from Antonio Ibarra IOHK:

when you update the Plutus Hash in the cabal.project file, you will also need to update the hash of all source repositories. To do that you can go to the cabal.project original repository in the defined commit (in this case https://github.com/input-output-hk/plutus/blob/9ed85d6cc8e817270220f263a11e738135eb0ad3/cabal.project), copy from line 39 to the end of the file and then paste it in the cabal.project file of the week 10 replacing old source repositories below the note The following sections are copied from the 'plutus' repository

Also you should update the endpoints code, as it has changed (you can take for reference endpoints code from TokenSale.hs in Lesson 08). Consider that endpoint function returns a promise now.

endpoints :: Contract () FreeSchema Text ()
endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ endpoint @"mint" $ mint

------------ UPDATE ---------

547e22a975d9b688ad2121f56e63691bead661cc It's working for lessons 05, 08 and 10

5
  • Got it thanks. How did you arrive at the conclusion that 547e22a975d9b688ad2121f56e63691bead661cc is the appropriate commit? Is that documented somewhere or did you test out various commits until you found one that works? Oct 8 '21 at 15:21
  • 1
    Just tried it. It's working for lesson 05, 08 and 10.
    – georgeos
    Oct 8 '21 at 15:51
  • Great! I'm seeing the compilation problem generally fixed too but I can't seem to figure out how to update the endpoints function to work. Any chance you can provide that too? I see that in the TokenSale of lesson 8 they use forever and awaitPromise but trying to use that code isn't very straightforward for me as a haskell novice. Oct 8 '21 at 20:38
  • 1
    Sorry for the delay, I took a few days off. Check my updated answer.
    – georgeos
    Oct 11 '21 at 4:00
  • Much ❤ - thanks for the update Oct 11 '21 at 14:55
1

Turns out using the commit from Week06, 8a20664f00d8f396920385947903761a9a897fe0, is the cleanest solution (too bad it wasn't merged at the time of asking this question): https://github.com/input-output-hk/plutus-pioneer-program/pull/36

This commit doesn't require any changes to the endpoints or updating any imports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.