The order of ValDefs in the block is used to assign ids to ValUse(id) nodes For all i: items(i).id == {number of ValDefs preceded in a graph} with respect to topological order.
The order of ValDefs in the block is used to assign ids to ValUse(id) nodes For all i: items(i).id == {number of ValDefs preceded in a graph} with respect to topological order. Specific topological order doesn't really matter, what is important is to preserve semantic linkage between ValUse(id) and ValDef with the corresponding id. This convention allow to valid serializing ids because we always serializing and deserializing in a fixed well defined order.
Placeholder for a constant in ErgoTree.
Placeholder for a constant in ErgoTree. Zero based index in ErgoTree.constants array.
Base class for references to context variables.
The root of ErgoScript IR.
The root of ErgoScript IR. Serialized instances of this class are self sufficient and can be passed around.
ErgoTreeSerializer defines top-level serialization format of the scripts.
The interpretation of the byte array depend on the first header
byte, which uses VLQ encoding up to 30 bits.
Currently we define meaning for only first byte, which may be extended in future versions.
7 6 5 4 3 2 1 0
-------------------------
| | | | | | | | |
-------------------------
Bit 7 == 1 if the header contains more than 1 byte (default == 0)
Bit 6 - reserved for GZIP compression (should be 0)
Bit 5 == 1 - reserved for context dependent costing (should be = 0)
Bit 4 == 1 if constant segregation is used for this ErgoTree (default = 0)
(see https://github.com/ScorexFoundation/sigmastate-interpreter/issues/264)
Bit 3 == 1 if size of the whole tree is serialized after the header byte (default = 0)
Bits 2-0 - language version (current version == 0)
Currently we don't specify interpretation for the second and other bytes of the header. We reserve the possibility to extend header by using Bit 7 == 1 and chain additional bytes as in VLQ. Once the new bytes are required, a new version of the language should be created and implemented. That new language will give an interpretation for the new bytes.
Consistency between fields is ensured by private constructor and factory methods in ErgoTree
object.
For performance reasons, ErgoTreeSerializer can be configured to perform additional constant segregation.
In such a case after deserialization there may be more constants segregated. This is done for example to
support caching optimization described in #264 mentioned above.
The default behavior of ErgoTreeSerializer is to preserve original structure of ErgoTree and check consistency. In case of any inconsistency the serializer throws exception.
parameters list, where each parameter has an id and a type.
expression, which refers function parameters with ValUse.
Algebraic data type of sigma proposition expressions.
Algebraic data type of sigma proposition expressions. Values of this type are used as values of SigmaProp type of SigmaScript and SigmaDsl
Reference a context variable by id.
This is alternative representation of ErgoTree expression when it cannot be parsed
due to error
.
This is alternative representation of ErgoTree expression when it cannot be parsed
due to error
. This is used by the nodes running old versions of code to recognize
soft-fork conditions and skip validation of box propositions which are unparsable.
IR node for let-bound expressions let x = rhs
which is ValDef, or let f[T] = rhs
which is FunDef.
IR node for let-bound expressions let x = rhs
which is ValDef, or let f[T] = rhs
which is FunDef.
These nodes are used to represent ErgoTrees after common sub-expression elimination.
This representation is more compact in serialized form.
unique identifier of the variable in the current scope.
Special node which represents a reference to ValDef in was introduced as result of CSE.