@@ -532,13 +532,22 @@ object ExtractCreationInfo extends SimpleTransformerCompanion {
532532
533533trait Deserialize [V <: SType ] extends NotReadyValue [V ]
534534
535- /** Extracts context variable as Coll[Byte], deserializes it to script and then executes this script in the current context.
536- * The original `Coll[Byte]` of the script is available as `getVar[Coll[Byte]](id)`
535+ /** This ErgoTree operation work as macros (i.e. executed before ErgoTree reduction) and
536+ * allows to inline arbitrary expression at the point where it is used in ErgoTree.
537+ *
538+ * This operation is executed before ErgoTree reduction as the following:
539+ * 1) the context variable `id` is checked to have type Coll[Byte], if not, then this
540+ * node remains in the ErgoTree which means the reduction will fail later.
541+ * 2) the bytes collection is deserialized to `expr: Value[V]` using ValueSerializer.deserialize
542+ * 3) `this` node is replaced with the deserialized `expr`
543+ *
544+ * This step are performed for each [[DeserializeContext ]] node via single traverse of
545+ * ErgoTree. The resulting ErgoTree is passed to reduction.
546+ *
547+ * NOTE, the original `Coll[Byte]` from context variables is available as `getVar[Coll[Byte]](id)`
548+ *
537549 * @param id identifier of the context variable
538- * @tparam V result type of the deserialized script.
539- * @throws InterpreterException if the actual script type doesn't conform to T
540- * @return result of the script execution in the current context
541- * @since 2.0
550+ * @param tpe expected type of the deserialized script (i.e. expected type of `expr`).
542551 */
543552case class DeserializeContext [V <: SType ](id : Byte , tpe : V ) extends Deserialize [V ] {
544553 override def companion = DeserializeContext
0 commit comments