PrepareForSerialization
scalus.uplc.transform.PrepareForSerialization
object PrepareForSerialization
Prepares a UPLC term for flat serialization by replacing BLS12-381 constants that cannot be directly flat-encoded with equivalent runtime expressions.
Standalone BLS constants become uncompress(compressed_bytes):
Const(BLS12_381_G1_Element(v))→Apply(Builtin(Bls12_381_G1_uncompress), Const(ByteString(compress(v))))
List constants containing BLS elements are unrolled into MkCons chains:
Const(List(G1, [v1, v2]))→MkCons(uncompress(compress(v1)), MkCons(uncompress(compress(v2)), Const(List(G1, []))))The emptyList[G1Element]at the end is flat-serializable because the stub Flat instance for BLS types is never invoked for empty lists.
Applied automatically before flat encoding in DeBruijnedProgram.flatEncoded.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Members list
In this article