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.
ErgoTree node which converts a collection of expressions into a collection of data values.
ErgoTree node which converts a collection of expressions into a collection of data
values. Each data value of the resulting collection is obtained by evaluating the
corresponding expression in items
. All items must have the same type.
source collection of expressions
type descriptor of elements in the resulting collection
Base class for all constant literals whose data value is already known and never changes.
Base class for all constant literals whose data value is already known and never changes.
ConstantNode
ErgoTree node which represents data literals, i.e.
ErgoTree node which represents data literals, i.e. data values embedded in an expression.
data value of the underlying Scala type
type descriptor of the data value and also the type of the value represented by this node.
Constant
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.
Base type for evaluated tree nodes of Coll type.
Base class for ErgoTree nodes which represents a data value which has already been evaluated and no further evaluation (aka reduction) is necessary by the interpreter.
Base class for ErgoTree nodes which represents a data value which has already been evaluated and no further evaluation (aka reduction) is necessary by the interpreter.
Constant, ConcreteCollection, Tuple
Should be inherited by companion objects of operations with fixed cost kind.
parameters list, where each parameter has an id and a type.
expression, which refers function parameters with ValUse.
Should be inherited by companion objects of operations with per-item cost kind.
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.
ErgoTree node which converts a collection of expressions into a tuple of data values of different types.
ErgoTree node which converts a collection of expressions into a tuple of data values
of different types. Each data value of the resulting collection is obtained by
evaluating the corresponding expression in items
. All items may have different
types.
source collection of expressions
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 it was introduced as result of CSE.
Base class for all ErgoTree expression nodes.
Base class for all ErgoTree expression nodes.
Base class for all companion objects which are used as operation descriptors.
ErgoTree node which represents false
literal.
ErgoTree node that represents the operation of obtaining the generator of elliptic curve group.
ErgoTree node that represents the operation of obtaining the generator of elliptic curve group. The generator g of the group is an element of the group such that, when written multiplicative form, every element of the group is a power of g.
ErgoTree node which represents true
literal.
High-level interface to internal representation of Unit constants in ErgoTree.