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])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. final def bytes: Array[Byte]

    Serialized bytes of this tree.

  6. def canEqual(that: Any): Boolean

    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
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  8. lazy val complexity: Int

    Structural complexity estimation of this tree.

    Structural complexity estimation of this tree.

    See also

    ComplexityTable

  9. val constants: IndexedSeq[Constant[SType]]
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(obj: Any): Boolean
    Definition Classes
    ErgoTree → Equals → AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def hasSize: Boolean
    Annotations
    @inline()
  15. def hashCode(): Int
    Definition Classes
    ErgoTree → AnyRef → Any
  16. val header: Byte
  17. final def isConstantSegregation: Boolean
    Annotations
    @inline()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def isRightParsed: Boolean
    Annotations
    @inline()
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. val root: Either[UnparsedErgoTree, SigmaPropValue]
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. lazy val template: Array[Byte]

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

  26. def toProposition(replaceConstants: Boolean): SigmaPropValue

    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.

  27. final def version: Byte
    Annotations
    @inline()
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Deprecated Value Members

  1. lazy val proposition: SigmaPropValue

    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