0

I think my plutus-playground-server has an incorrect notion of time. I'm working on the homework for lecture 3 and keep running into issues with the simulator.

Here's a screenshot of what I'm simulating for homework 2 of week 3:

enter image description here

I've verified that, according to the cabal repl, 1596059101000 is slot 10.

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

Note that in the example simulation I Wait Until Slot 11.

I've changed the following line when constructing transactions clientside to show now: https://github.com/paymog/plutus-pioneer-program/commit/4098f73bef4191ebc976fb8c2c3d46ee53f97b5e#diff-7fd9bde64b988d6aa9520167ed285990ed737f5dbda967ac19c786ff4160bb36R105

Interesting, when I execute the above simulation, I see the following output:

Add slot 11
Contract instance for wallet 2: (ReceiveEndpointCall (EndpointDescription { getEndpointDescription: "grab" }) (RawJson "{\"contents\":[{\"getEndpointDescription\":\"grab\"},{\"unEndpointValue\":[]}],\"tag\":\"ExposeEndpointResp\"}"))
Contract instance for wallet 2: (ContractLog (RawJson "no gifts available at time POSIXTime {getPOSIXTime = 1596059102}"))

Note that the value of now is 1596059102 which is missing three trailing zeroes compared to 1596059101000. If I check the posix time of slot 11 in the cabal repl I see

Prelude Ledger.TimeSlot Data.Default Week03.Homework1> slotToBeginPOSIXTime def 11
POSIXTime {getPOSIXTime = 1596059102000}

which is the value reported by the simulation with 3 extra trailing zeroes.

Does my instance of the plutus-playground-server have a "incorrect" notion of time?

1 Answer 1

0

As is typical, I figured out what's wrong almost immediately after posting the question. I was on the wrong commit for my local checkout of the plutus repo. I was using commit ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 which comes from the week 1 cabal.project file.

The week 3 cabal.project file requires plutus at commit 219992289c6615e197069d022735cb4059d43229. After I made that change, the issue resolved itself.

Your Answer

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

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