IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
258 stars 158 forks source link

`translateUpperBoundForPlutusScripts` clarification #4331

Closed vsubhuman closed 5 months ago

vsubhuman commented 5 months ago

Hi! Can someone plz help clarify. In the Plutus function transValidityInterval there’s a hardfork check for HardForks.translateUpperBoundForPlutusScripts.

Am I getting it right that the only affected case is when NO validity_interval_start is specified in the transaction and SOME ttl is specified, and the only change is that an interval structure like Interval (NegInf, ttl_posix) is returned instead of TO ttl_posix ?

But the values are still in posix timestamps and the case when only validity_interval_start is specified with no TTL is not changing and it still returns FROM validity_start_posix and not an interval? Which also means the PosInf value is never returned at all?

https://github.com/IntersectMBO/cardano-ledger/blob/dbb9f4e846f17660f7690301a4f23da1dfb842df/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Plutus/TxInfo.hs#L177-L208

lehins commented 5 months ago

Am I getting it right that the only affected case is when NO validity_interval_start is specified in the transaction and SOME ttl is specified, and the only change is that an interval structure like Interval (NegInf, ttl_posix) is returned instead of TO ttl_posix ?

Yes, except the difference is Interval (NegInf, ttl_posix) vs Interval (NegInf, ttl_posix]

This whole translateUpperBoundForPlutusScripts only fixes the upper bound to being strict.

Which also means the PosInf value is never returned at all?

PosInf is only relevant when the upper bound is missing and it is returned by the means of always and from:

Does this answer your questions? Please, feel free to reopen the issue if this is still not clear.