Class

sigmastate.eval

CostingDataContext

Related Doc: package eval

Permalink

case class CostingDataContext(_dataInputs: Coll[Box], headers: Coll[Header], preHeader: PreHeader, inputs: Coll[Box], outputs: Coll[Box], height: Int, selfBox: Box, selfIndex: Int, lastBlockUtxoRootHash: AvlTree, _minerPubKey: Coll[Byte], vars: Coll[AnyValue], activatedScriptVersion: Byte, currentErgoTreeVersion: Byte) extends Context with Product with Serializable

A default implementation of Context interface.

See also

Context for detailed descriptions

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

Instance Constructors

  1. new CostingDataContext(_dataInputs: Coll[Box], headers: Coll[Header], preHeader: PreHeader, inputs: Coll[Box], outputs: Coll[Box], height: Int, selfBox: Box, selfIndex: Int, lastBlockUtxoRootHash: AvlTree, _minerPubKey: Coll[Byte], vars: Coll[AnyValue], activatedScriptVersion: Byte, currentErgoTreeVersion: Byte)

    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. def HEIGHT: Int

    Permalink

    Height (block number) of the block which is currently being validated.

    Height (block number) of the block which is currently being validated.

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  5. def INPUTS: Coll[Box]

    Permalink

    A collection of inputs of the current transaction, the transaction where selfBox is one of the inputs.

    A collection of inputs of the current transaction, the transaction where selfBox is one of the inputs.

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  6. def LastBlockUtxoRootHash: AvlTree

    Permalink

    Authenticated dynamic dictionary digest representing Utxo state before current state.

    Authenticated dynamic dictionary digest representing Utxo state before current state.

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  7. def OUTPUTS: Coll[Box]

    Permalink

    A collection of outputs of the current transaction.

    A collection of outputs of the current transaction.

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  8. def SELF: Box

    Permalink

    Box whose proposition is being currently executing

    Box whose proposition is being currently executing

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  9. val _dataInputs: Coll[Box]

    Permalink
  10. val _minerPubKey: Coll[Byte]

    Permalink
  11. val activatedScriptVersion: Byte

    Permalink

    Maximum version of ErgoTree currently activated on the network.

    Maximum version of ErgoTree currently activated on the network. See ErgoLikeContext class for details.

    Definition Classes
    CostingDataContextContext
  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def builder: SigmaDslBuilder

    Permalink
    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. val currentErgoTreeVersion: Byte

    Permalink

    The version of ErgoTree currently executed by interpreter.

    The version of ErgoTree currently executed by interpreter. See ErgoLikeContext class for details.

    Definition Classes
    CostingDataContextContext
  16. def dataInputs: Coll[Box]

    Permalink

    A collection of inputs of the current transaction that will not be spent.

    A collection of inputs of the current transaction that will not be spent.

    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  20. def getVar[T](id: Byte)(implicit tT: RType[T]): Option[T]

    Permalink

    Extracts Context variable by id and type.

    Extracts Context variable by id and type. ErgoScript is typed, so accessing a the variables is an operation which involves some expected type given in brackets. Thus getVar[Int](id) expression should evaluate to a valid value of the Option[Int] type.

    For example val x = getVar[Int](10) expects the variable, if it is present, to have type Int. At runtime the corresponding type descriptor is passed as cT parameter.

    There are three cases: 1) If the variable doesn't exist. Then val x = getVar[Int](id) succeeds and returns the None value, which conforms to any value of type Option[T] for any T. (In the example above T is equal to Int). Calling x.get fails when x is equal to None, but x.isDefined succeeds and returns false. 2) If the variable contains a value v of type Int. Then val x = getVar[Int](id) succeeds and returns Some(v), which is a valid value of type Option[Int]. In this case, calling x.get succeeds and returns the value v of type Int. Calling x.isDefined returns true. 3) If the variable contains a value v of type T other then Int. Then val x = getVar[Int](id) fails, because there is no way to return a valid value of type Option[Int]. The value of variable is present, so returning it as None would break the typed semantics of variables collection.

    In some use cases one variable may have values of different types. To access such variable an additional variable can be used as a tag.

      val tagOpt = getVar[Int](id)
      val res = if (tagOpt.isDefined) {
        val tag = tagOpt.get
        if (tag == 1) {
          val x = getVar[Int](id2).get
          // compute res using value x is of type Int
        } else if (tag == 2) {
          val x = getVar[GroupElement](id2).get
          // compute res using value x is of type GroupElement
        } else if (tag == 3) {
          val x = getVar[ Array[Byte] ](id2).get
          // compute res using value x of type Array[Byte]
        } else {
          // compute `res` when `tag` is not 1, 2 or 3
        }
      }
      else {
        // compute value of res when the variable is not present
      }
    

    T

    expected type of the variable.

    id

    zero-based identifier of the variable.

    returns

    Some(value) if the variable is defined in the context AND has the given type. None otherwise

    Definition Classes
    CostingDataContextContext
    Exceptions thrown

    special.sigma.InvalidType exception when the type of the variable value is different from cT.

  21. val headers: Coll[Header]

    Permalink

    A fixed number of last block headers in descending order (first header is the newest one)

    A fixed number of last block headers in descending order (first header is the newest one)

    Definition Classes
    CostingDataContextContext
    Since

    2.0

  22. val height: Int

    Permalink
  23. val inputs: Coll[Box]

    Permalink
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. val lastBlockUtxoRootHash: AvlTree

    Permalink
  26. def minerPubKey: Coll[Byte]

    Permalink
    Definition Classes
    CostingDataContextContext
    Annotations
    @inline()
  27. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  30. val outputs: Coll[Box]

    Permalink
  31. val preHeader: PreHeader

    Permalink

    Definition Classes
    CostingDataContextContext
    Since

    2.0

  32. val selfBox: Box

    Permalink
  33. def selfBoxIndex: Int

    Permalink

    Zero based index in inputs of selfBox.

    Zero based index in inputs of selfBox. -1 if self box is not in the INPUTS collection.

    Definition Classes
    CostingDataContextContext
  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  35. val vars: Coll[AnyValue]

    Permalink
    Definition Classes
    CostingDataContextContext
  36. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. def withUpdatedVars(bindings: (Int, AnyValue)*): CostingDataContext

    Permalink

    Return a new context instance with variables collection updated.

    Return a new context instance with variables collection updated.

    bindings

    a new binding of the context variables with new values.

    returns

    a new instance (if bindings non-empty) with the specified bindings. other existing bindings are copied to the new instance

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Context

Inherited from AnyRef

Inherited from Any

Ungrouped