ScalusTag
Marker injected into a compiled UPLC program to identify it as Scalus-generated.
The tag replaces the first (error) node of the program with [(error) (con integer 3)]. The argument of an application is never evaluated when the function position is error, and an (error) node reached on a successful run would make the script fail, so every (error) node in a script that succeeds is unreachable by construction. The tag therefore costs zero execution budget: only the 3 extra bytes of the constant. (On the failing path it adds one Apply step, but that transaction is invalid anyway.)
3 is Scalus's compiler id in CIP-171 (compiler_type = 3, constructor #6.124).
A program with no (error) node - a pure computation that cannot fail - has nowhere to carry a free tag and is left untagged.
This is the same mechanism Aiken uses (delay [(error) (force (error))], the branch its validators take when the body returns False) and a cheaper variant of plu-ts's dead case branch (case (constr 0) (con integer 42)).
Injection must happen after the UPLC optimizer has run, so that the set of (error) nodes is final.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ScalusTag.type