Class/Object

sigmastate.Values

ErgoTree

Related Docs: object ErgoTree | package Values

Permalink

case class ErgoTree extends Product with Serializable

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.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ErgoTree
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ErgoTree(header: Byte, constants: IndexedSeq[Constant[SType]], root: Either[UnparsedErgoTree, SigmaPropValue])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. final def bytes: Array[Byte]

    Permalink

    Serialized bytes of this tree.

  6. def canEqual(that: Any): Boolean

    Permalink

    The default equality of case class is overridden to exclude complexity.

    The default equality of case class is overridden to exclude complexity.

    Definition Classes
    ErgoTree → Equals
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. lazy val complexity: Int

    Permalink

    Structural complexity estimation of this tree.

    Structural complexity estimation of this tree.

    See also

    ComplexityTable

  9. val constants: IndexedSeq[Constant[SType]]

    Permalink

    If isConstantSegregation == true contains the constants for which there may be ConstantPlaceholders in the tree.

    If isConstantSegregation == true contains the constants for which there may be ConstantPlaceholders in the tree. If isConstantSegregation == false this array should be empty and any placeholder in the tree will lead to exception.

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(obj: Any): Boolean

    Permalink
    Definition Classes
    ErgoTree → Equals → AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. lazy val hasDeserialize: Boolean

    Permalink

    Returns true if the tree contains at least one deserialization operation, false otherwise.

  15. final def hasSize: Boolean

    Permalink
    Annotations
    @inline()
  16. def hashCode(): Int

    Permalink
    Definition Classes
    ErgoTree → AnyRef → Any
  17. val header: Byte

    Permalink

    the first byte of serialized byte array which determines interpretation of the rest of the array

  18. final def isConstantSegregation: Boolean

    Permalink
    Annotations
    @inline()
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. final def isRightParsed: Boolean

    Permalink
    Annotations
    @inline()
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. val root: Either[UnparsedErgoTree, SigmaPropValue]

    Permalink

    On the right side it has valid expression of SigmaProp type.

    On the right side it has valid expression of SigmaProp type. Or alternatively, on the left side, it has unparsed bytes along with the ValidationException, which caused the deserializer to fail. Right(tree) if isConstantSegregation == true contains ConstantPlaceholder instead of some Constant nodes. Otherwise, it may not contain placeholders. It is possible to have both constants and placeholders in the tree, but for every placeholder there should be a constant in constants array.

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. lazy val template: Array[Byte]

    Permalink

    Serialized proposition expression of SigmaProp type with ConstantPlaceholder nodes instead of Constant nodes

  27. def toProposition(replaceConstants: Boolean): SigmaPropValue

    Permalink

    Get proposition expression from this contract.

    Get proposition expression from this contract. When root.isRight then if replaceConstants == false this is the same as root.right.get. Otherwise, it is equivalent to root.right.get where all placeholders are replaced by Constants. When root.isLeft then throws the error from UnparsedErgoTree. It does so on every usage of proposition because the lazy value remains uninitialized.

  28. final def version: Byte

    Permalink
    Annotations
    @inline()
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. lazy val proposition: SigmaPropValue

    Permalink

    Then it throws the error from UnparsedErgoTree.

    Then it throws the error from UnparsedErgoTree. It does so on every usage of proposition because the lazy value remains uninitialized.

    Annotations
    @deprecated
    Deprecated

    (Since version v2.1) Use toProposition instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped