At the time the Plutus validator script runs, the transaction is not yet part of the blockchain. But the targeted slot of a transaction is known when a node processes the script. Is it possible to access the target slot inside the validator script?
The context of a validator script Plutus.V1.Ledger.Contexts.ScriptContext gives access to the transaction where
txInfoValidRangemay provide upper/lower bounds of the slot. This, however, requires that a Ledger.Constraints.mustValidateIn constraint has been specified when the transaction was submitted (as done in this example).
I understand that it is considered to be bad practice for a Plutus validator script to depend on the state of the whole blockchain or unpredictable input such as the target slot because it limits verification/testing possibilities.
Nevertheless, there might be plenty of good use cases for using the current slot; for example, an oracle might check if its data is expired and does not want to enforce its users to provide an upper limit in the