2

It is a known fact that you can calculate time inside a plutus validator script by looking at the txInfoValidRange attribute. Now, since this value is a range and not an exact time, it makes me wonder how large can this range be and who determines it?

This is important for me, because I might want to add a deadline of 5 days, or a deadline of 5 hours and I don't know how reliable this attribute can be.

1 Answer 1

3

The range is determined by the party that builds the transaction. So anybody can specify it.

A range [t1, t2] —where t1 and t2 are integers, or infinite, standing for the slot number— can include any t2 that satisfies t2 >= t1. The only additional restriction is that transactions will be dropped if t1 lies too much in the future - I think the maximum is 2 days in the future. More explanations can be found in chapter 3.3.1 here: https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week3.html

For the smart contract validator this means that the current slot is always in the range [t1, t2] (the blockchain will make sure that the transaction will not be processed outside this range) and that this range is potentially unbounded. If your smart contract needs a smaller range, this is however no problem, it just needs to be known and followed by the one building the transaction. Your off-chain code for instance would implement this and choose a proper range needed by your validator.

2
  • What about t2? Can it be any value?
    – Mateus
    May 9, 2022 at 10:13
  • 1
    I edited the response. Yes, t2 can basically be any slot after t1 including the infinite value.
    – Jey
    May 9, 2022 at 11:26

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.