I'm having some trouble figuring out the vesting logic in homework 1 of the Plutus pioneer program lecture. I eventually gave up and looked at the solution which seems to be exhibiting the same "bug" (I put bug in quotes because clearly I'm misunderstanding something).

As I understand the logic of the transaction construction, the giver (or beneficiary2) can claim the gift anytime after the deadline while the recipient (or beneficiary1) can claim the gift anytime before the deadline (inclusive). Is that correct?

If so, I'm having trouble understanding why the following simulation seems to succeed. I'll provide screenshots and then go through my understanding of it. Here are the values entered for the simulation that seems buggy to me:

enter image description here

and here the final state of the blockchain:

enter image description here

In this simulation, Wallet 1 is giving 10 ADA to 39f713d0a644253f04529421b9f51b9b08979d08295959c4f3990ee617f5139f which is the hash of Wallet 2 (this can be confirmed by looking at the hash of the wallets in the final state screenshot). This gift has a deadline of 1596059101000 which is slot 10 based on:

Prelude Ledger Wallet.Emulator Data.Default Ledger.TimeSlot Week03.Homework2> posixTimeToEnclosingSlot def 1596059101000
Slot {getSlot = 10}


Prelude Ledger Wallet.Emulator Data.Default Ledger.TimeSlot Week03.Homework2> slotToBeginPOSIXTime de
f 10
POSIXTime {getPOSIXTime = 1596059101000}

Curiously, it seems that Wallet 2 can grab the gift at slot 11 which is after the deadline. It's very possible that my understanding of the transaction logic is incorrect. To double check, I also ran the same code with the following simulation (the only difference is that the second step of the simulation waits until slot 5 instead of slot 11) and it also succeeded which confuses me even more. I expect that one of these simulations should fail but can't figure out why.

enter image description here

Is there a bug with the solution for homework 1 in lecture 3? Am I misunderstanding something about the logic of the solution?

EDIT: here's another interesting point, with the suggested solution I can't seem to get Wallet 1 to grab the gift it provides. I've tried waiting for 1 block after the gift, waiting until slot 5 and waiting until slot 15 before attempting for Wallet 1 to grab it's gift and in all cases it fails - the "grab" transaction never reaches the blockchain and seems to fail client side with found 0 gift(s) to grab.

  • 1
    On first glance, I don't see any flaws in your logic. Could be a bug in the Playground? I don't have time rn to dig in further. I'll try to come back to it. Oct 1, 2021 at 17:19
  • ah yeah, could be a bug in the playground. I'm running the playground on commit ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 but now I'm realizing that the required plutus commit changes from week to week. ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 is from week 1 while week 3 requires 219992289c6615e197069d022735cb4059d43229. Oct 1, 2021 at 20:27
  • Changing the commit of the local plutus repo to 219992289c6615e197069d022735cb4059d43229 doesn't fix this unfortunately 🙁 Oct 2, 2021 at 19:22
  • It was a long shot. I don't use the Playground at all, I just use the Emulator Trace: github.com/input-output-hk/plutus-pioneer-program/blob/… It might be easier to debug your code using that (but that's jumping ahead in the progam). Oct 2, 2021 at 20:08
  • Oops, checking out commit 219992289c6615e197069d022735cb4059d43229 does solve the problem, I must have fat fingered something in the earlier comment which said it doesn't. Commit ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 seems to have a broken notion of time: cardano.stackexchange.com/questions/3997/… Oct 2, 2021 at 20:37

1 Answer 1


Turns out I wasn't using the correct checkout of plutus. More details can be found at the following Cardano StackExchange answer: plutus-playground-server sense of time is incorrect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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