Given that the function A contains B is true when all of B is contained in A, and false otherwise, wouldn't that mean that the txInfoValidRange info would have to move its "start point" in order to return true? Below is my thinking :)

checkDeadline = from (deadline p) `contains` txInfoValidRange info

In this code, from (deadline p) contains all of the slots from some deadline to pos infinity.

---Below is where I think I am wrong---

txInfoValidRange info is just a SlotRange from the creation of the transaction to pos infinity.

So how then can the deadline p contain the txInfoValidRange info without the txInfoValidRange info adjusting its starting point?


1 Answer 1


I hope I understood your question correctly. No, we don't move anything.

I think that the naming is confusing. It shouldn't be called deadline because in my opinion deadline is when something ends. In our case, it's the other way around. We allow taking funds only AFTER the deadline.

Please take a look at the picture. We shouldn't allow Tx1, only Tx2.

enter image description here

In our case [deadline, infinity] doesn't contain Tx1.validRange contains Tx2.validRange.

  • 1
    Thanks for the response! I think my confusion stems from the txInfoValidRange. Where does the valid range of a transaction start? And more importantly, what factors decide the valid range of a transaction? Commented Jun 4, 2021 at 13:16
  • 1
    From my understanding you should specify validRange yourself during transaction construction. It could be done with mustValidateIn function from Ledger.Contrains module. You can find an example here github.com/input-output-hk/plutus-pioneer-program/blob/main/… Commented Jun 4, 2021 at 17:56
  • Seems to me like this deadline thing is redundant then. If you can simply specify the range when a transaction should validate, you can just set the start of that somewhere in the future. Lars is trolling us! Commented Jun 4, 2021 at 20:35
  • @IsaacPadberg Hmm, I don't think that you can put totally random valid ranges. From my understanding current slot should be a member of validRange. Check out this function alpha.plutus.iohkdev.io/doc/haddock/plutus-ledger/html/src/… Commented Jun 5, 2021 at 19:20
  • I failed to keep in mind the structure of validation scripts and transactions. Simply by constructing a transaction after the deadline, the validRange of the transaction will be contained in the deadline->Infinity. So obvious! Thanks for the help Yanis :) Commented Jun 7, 2021 at 14:14

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.