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.
- Alphabetic
- By Inheritance
- ErgoTree
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ErgoTree(header: Byte, constants: IndexedSeq[Constant[SType]], root: Either[UnparsedErgoTree, SigmaPropValue])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
bytes: Array[Byte]
Serialized bytes of this tree.
-
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
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
lazy val
complexity: Int
Structural complexity estimation of this tree.
Structural complexity estimation of this tree.
- See also
ComplexityTable
- val constants: IndexedSeq[Constant[SType]]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(obj: Any): Boolean
- Definition Classes
- ErgoTree → Equals → AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
hasSize: Boolean
- Annotations
- @inline()
-
def
hashCode(): Int
- Definition Classes
- ErgoTree → AnyRef → Any
- val header: Byte
-
final
def
isConstantSegregation: Boolean
- Annotations
- @inline()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isRightParsed: Boolean
- Annotations
- @inline()
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val root: Either[UnparsedErgoTree, SigmaPropValue]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
lazy val
template: Array[Byte]
Serialized proposition expression of SigmaProp type with ConstantPlaceholder nodes instead of Constant nodes
-
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 toroot.right.get
where all placeholders are replaced by Constants. When root.isLeft then throws the error from UnparsedErgoTree. It does so on every usage ofproposition
because the lazy value remains uninitialized. -
final
def
version: Byte
- Annotations
- @inline()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
Deprecated Value Members
-
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