Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement missing ops and predefined functions for 2.0 #400

Merged
merged 30 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
49dbe17
add byteArrayToLong;
greenhat Feb 19, 2019
0bc2c2b
add xorOf;
greenhat Feb 19, 2019
60fde65
add (de)serialization roundtrip into compilation pipeline in tests;
greenhat Feb 20, 2019
6f3f4e4
fix numeric casts test (got reduced to constants);
greenhat Feb 20, 2019
9cc74ba
add MethodCall.typeSubst (map of concrete types for each generic type…
greenhat Feb 20, 2019
699d55c
fix SOption.method to have generic types (don't substitute for SOptio…
greenhat Feb 21, 2019
3899508
fix build after rebase;
greenhat Feb 21, 2019
4a2f89b
enable tests for Coll.patch, .updated, .updateMany;
greenhat Feb 21, 2019
cd0d4e8
add BitOp serialization;
greenhat Feb 21, 2019
6fbeb9b
add BinXor serialization;
greenhat Feb 21, 2019
a8625a0
add LogicalNotSerializer;
greenhat Feb 21, 2019
be490bf
add SigmaDslBuilder.byteArrayToLong;
greenhat Feb 21, 2019
3745d2e
add SigmaDslBuilder.byteArrayToLong implementation (codegen);
greenhat Feb 21, 2019
9668338
disable (de)serialization roundtrip for ZProofBlock test;
greenhat Feb 22, 2019
2f3cd15
add sigma API for xorOf, logicalNot, negation, logicalXor;
greenhat Feb 22, 2019
edcf2c0
add codegen for sigma API xorOf, logicalNot, negation, logicalXor;
greenhat Feb 22, 2019
24de39f
add xorOf handling in costing;
greenhat Feb 22, 2019
fcf3058
add logicalNot full implementation;
greenhat Feb 22, 2019
2abd8ec
add numeric negate full implementation;
greenhat Feb 22, 2019
f4e6ba6
fix SigmaCompilerTest;
greenhat Feb 22, 2019
823e0cd
disable SigmaDslTest xor test;
greenhat Feb 22, 2019
1daf285
build fix after rebase;
greenhat Feb 22, 2019
a81ffea
remove adaptSigmaBoolean in XorOf costing;
greenhat Feb 22, 2019
55eb2d1
add special.sigma.BigInt test (failing);
greenhat Feb 23, 2019
237de80
fix byteArrayToLong and xorOf tests to test against SigmaDsl;
greenhat Feb 23, 2019
391cec0
make SOption a SGenericType;
greenhat Feb 24, 2019
eb4b3c1
remove type param index in MethodCall serialization (only concrete ty…
greenhat Feb 25, 2019
37804f6
add Box.getReg handling via MethodCall throughout the whole pipeline
greenhat Feb 26, 2019
772a030
fix build;
greenhat Feb 26, 2019
2a5524a
fix and enable special.sigma.BigInt negation SigmaDsl test;
greenhat Feb 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/LangSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ def allOf(conditions: Coll[Boolean]): Boolean
/** Returns true if at least on element of the conditions is true */
def anyOf(conditions: Coll[Boolean]): Boolean

/** Similar to allOf, but performing logical XOR operation instead of `||`
/** Similar to allOf, but performing logical XOR operation instead of `&&`
* @since 2.0
*/
def xorOf(conditions: Coll[Boolean]): Boolean
Expand Down
2 changes: 2 additions & 0 deletions sigma-api/src/main/resources/special/sigma/SigmaDsl.scalan
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ package special.sigma {
def allZK(conditions: Rep[Coll[SigmaProp]]): Rep[SigmaProp];
def anyOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean];
def anyZK(conditions: Rep[Coll[SigmaProp]]): Rep[SigmaProp];
def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean];
def PubKey(base64String: Rep[String]): Rep[SigmaProp];
def sigmaProp(b: Rep[Boolean]): Rep[SigmaProp];
def blake2b256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]];
def sha256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]];
def byteArrayToBigInt(bytes: Rep[Coll[Byte]]): Rep[BigInt];
def longToByteArray(l: Rep[Long]): Rep[Coll[Byte]];
def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long];
def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp];
def proveDHTuple(g: Rep[GroupElement], h: Rep[GroupElement], u: Rep[GroupElement], v: Rep[GroupElement]): Rep[SigmaProp];
def isMember(tree: Rep[AvlTree], key: Rep[Coll[Byte]], proof: Rep[Coll[Byte]]): Rep[Boolean];
Expand Down
5 changes: 5 additions & 0 deletions sigma-api/src/main/scala/sigma/types/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ trait Boolean extends PrimView[scala.Boolean] {
* @since 2.0
*/
def toByte: Byte

/** Logical XOR
* @since 2.0
*/
def xor(y: Boolean): Boolean
}

trait Byte extends PrimView[scala.Byte] {
Expand Down
6 changes: 6 additions & 0 deletions sigma-api/src/main/scala/special/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ trait SigmaContract {
def anyOf(conditions: Coll[Boolean]): Boolean = this.builder.anyOf(conditions)
def anyZK(conditions: Coll[SigmaProp]): SigmaProp = this.builder.anyZK(conditions)

def xorOf(conditions: Coll[Boolean]): Boolean = this.builder.xorOf(conditions)

def PubKey(base64String: String): SigmaProp = this.builder.PubKey(base64String)

def sigmaProp(b: Boolean): SigmaProp = this.builder.sigmaProp(b)
Expand All @@ -443,6 +445,7 @@ trait SigmaContract {

def byteArrayToBigInt(bytes: Coll[Byte]): BigInt = this.builder.byteArrayToBigInt(bytes)
def longToByteArray(l: Long): Coll[Byte] = this.builder.longToByteArray(l)
def byteArrayToLong(bytes: Coll[Byte]): Long = this.builder.byteArrayToLong(bytes)

def proveDlog(g: GroupElement): SigmaProp = this.builder.proveDlog(g)
def proveDHTuple(g: GroupElement, h: GroupElement, u: GroupElement, v: GroupElement): SigmaProp = this.builder.proveDHTuple(g, h, u, v)
Expand Down Expand Up @@ -482,6 +485,8 @@ trait SigmaDslBuilder {
def anyOf(conditions: Coll[Boolean]): Boolean
def anyZK(conditions: Coll[SigmaProp]): SigmaProp

def xorOf(conditions: Coll[Boolean]): Boolean

def PubKey(base64String: String): SigmaProp

def sigmaProp(b: Boolean): SigmaProp
Expand All @@ -491,6 +496,7 @@ trait SigmaDslBuilder {

def byteArrayToBigInt(bytes: Coll[Byte]): BigInt
def longToByteArray(l: Long): Coll[Byte]
def byteArrayToLong(bytes: Coll[Byte]): Long

def proveDlog(g: GroupElement): SigmaProp
def proveDHTuple(g: GroupElement, h: GroupElement, u: GroupElement, v: GroupElement): SigmaProp
Expand Down
1 change: 1 addition & 0 deletions sigma-api/src/main/scala/special/sigma/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package sigma {

case class WrapperType[Wrapper](cWrapper: ClassTag[Wrapper]) extends RType[Wrapper] {
override def classTag: ClassTag[Wrapper] = cWrapper
override def toString: String = cWrapper.toString
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ package special.sigma {
@NeverInline def anyOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = delayInvoke;
@NeverInline def allZK(props: Rep[Coll[SigmaProp]]): Rep[SigmaProp] = delayInvoke;
@NeverInline def anyZK(props: Rep[Coll[SigmaProp]]): Rep[SigmaProp] = delayInvoke;
@NeverInline override def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = delayInvoke;
@NeverInline def sigmaProp(b: Rep[Boolean]): Rep[SigmaProp] = delayInvoke;
@NeverInline def blake2b256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def sha256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def PubKey(base64String: Rep[String]): Rep[SigmaProp] = delayInvoke;
@NeverInline def byteArrayToBigInt(bytes: Rep[Coll[Byte]]): Rep[BigInt] = delayInvoke;
@NeverInline def longToByteArray(l: Rep[Long]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long] = delayInvoke;
@NeverInline def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp] = delayInvoke;
@NeverInline def proveDHTuple(g: Rep[GroupElement], h: Rep[GroupElement], u: Rep[GroupElement], v: Rep[GroupElement]): Rep[SigmaProp] = delayInvoke;
@NeverInline def isMember(tree: Rep[AvlTree], key: Rep[Coll[Byte]], proof: Rep[Coll[Byte]]): Rep[Boolean] = delayInvoke;
Expand Down
1 change: 1 addition & 0 deletions sigma-impl/src/main/scala/sigma/types/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import special.collection.{Coll, Builder}

case class CBoolean(value: scala.Boolean) extends Boolean {
override def toByte: Byte = CByte(if (value) 1 else 0)
override def xor(y: Boolean): Boolean = CBoolean(value ^ y.value)
}

case class CByte(value: scala.Byte) extends Byte {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class TestSigmaDslBuilder extends SigmaDslBuilder {
@NeverInline
def anyZK(props: Coll[SigmaProp]): SigmaProp = MockSigma(props.exists(p => p.isValid))

@NeverInline
override def xorOf(conditions: Coll[Boolean]): Boolean = conditions.toArray.distinct.length == 2

@NeverInline
def sigmaProp(b: Boolean): SigmaProp = MockSigma(b)

Expand All @@ -98,6 +101,8 @@ class TestSigmaDslBuilder extends SigmaDslBuilder {

@NeverInline
def longToByteArray(l: Long): Coll[Byte] = Colls.fromArray(Longs.toByteArray(l))
@NeverInline
def byteArrayToLong(bytes: Coll[Byte]): Long = Longs.fromByteArray(bytes.toArray)

@NeverInline
def proveDlog(g: GroupElement): SigmaProp = MockProveDlog(true, Colls.emptyColl[Byte])
Expand Down
2 changes: 2 additions & 0 deletions sigma-library/src/main/scala/special/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ package special.sigma {
def allZK(conditions: Rep[Coll[SigmaProp]]): Rep[SigmaProp];
def anyOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean];
def anyZK(conditions: Rep[Coll[SigmaProp]]): Rep[SigmaProp];
def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean];
def PubKey(base64String: Rep[String]): Rep[SigmaProp];
def sigmaProp(b: Rep[Boolean]): Rep[SigmaProp];
def blake2b256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]];
def sha256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]];
def byteArrayToBigInt(bytes: Rep[Coll[Byte]]): Rep[BigInt];
def longToByteArray(l: Rep[Long]): Rep[Coll[Byte]];
def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long];
def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp];
def proveDHTuple(g: Rep[GroupElement], h: Rep[GroupElement], u: Rep[GroupElement], v: Rep[GroupElement]): Rep[SigmaProp];
def isMember(tree: Rep[AvlTree], key: Rep[Coll[Byte]], proof: Rep[Coll[Byte]]): Rep[Boolean];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ package special.sigma {
@NeverInline def anyOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = delayInvoke;
@NeverInline def allZK(props: Rep[Coll[SigmaProp]]): Rep[SigmaProp] = delayInvoke;
@NeverInline def anyZK(props: Rep[Coll[SigmaProp]]): Rep[SigmaProp] = delayInvoke;
@NeverInline override def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = delayInvoke;
@NeverInline def sigmaProp(b: Rep[Boolean]): Rep[SigmaProp] = delayInvoke;
@NeverInline def blake2b256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def sha256(bytes: Rep[Coll[Byte]]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def PubKey(base64String: Rep[String]): Rep[SigmaProp] = delayInvoke;
@NeverInline def byteArrayToBigInt(bytes: Rep[Coll[Byte]]): Rep[BigInt] = delayInvoke;
@NeverInline def longToByteArray(l: Rep[Long]): Rep[Coll[Byte]] = delayInvoke;
@NeverInline def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long] = delayInvoke;
@NeverInline def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp] = delayInvoke;
@NeverInline def proveDHTuple(g: Rep[GroupElement], h: Rep[GroupElement], u: Rep[GroupElement], v: Rep[GroupElement]): Rep[SigmaProp] = delayInvoke;
@NeverInline def isMember(tree: Rep[AvlTree], key: Rep[Coll[Byte]], proof: Rep[Coll[Byte]]): Rep[Boolean] = delayInvoke;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4222,6 +4222,13 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, false, element[SigmaProp]))
}

override def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = {
asRep[Boolean](mkMethodCall(self,
SigmaDslBuilderClass.getMethod("xorOf", classOf[Sym]),
List(conditions),
true, false, element[Boolean]))
}

override def PubKey(base64String: Rep[String]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(self,
SigmaDslBuilderClass.getMethod("PubKey", classOf[Sym]),
Expand Down Expand Up @@ -4264,6 +4271,13 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, false, element[Coll[Byte]]))
}

override def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long] = {
asRep[Long](mkMethodCall(self,
SigmaDslBuilderClass.getMethod("byteArrayToLong", classOf[Sym]),
List(bytes),
true, false, element[Long]))
}

override def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(self,
SigmaDslBuilderClass.getMethod("proveDlog", classOf[Sym]),
Expand Down Expand Up @@ -4450,6 +4464,13 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, true, element[SigmaProp]))
}

def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = {
asRep[Boolean](mkMethodCall(source,
thisClass.getMethod("xorOf", classOf[Sym]),
List(conditions),
true, true, element[Boolean]))
}

def PubKey(base64String: Rep[String]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(source,
thisClass.getMethod("PubKey", classOf[Sym]),
Expand Down Expand Up @@ -4492,6 +4513,13 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, true, element[Coll[Byte]]))
}

def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long] = {
asRep[Long](mkMethodCall(source,
thisClass.getMethod("byteArrayToLong", classOf[Sym]),
List(bytes),
true, true, element[Long]))
}

def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(source,
thisClass.getMethod("proveDlog", classOf[Sym]),
Expand Down Expand Up @@ -4579,7 +4607,7 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
override protected def collectMethods: Map[java.lang.reflect.Method, MethodDesc] = {
super.collectMethods ++
Elem.declaredMethods(classOf[SigmaDslBuilder], classOf[SSigmaDslBuilder], Set(
"Colls", "Monoids", "Costing", "CostModel", "costBoxes", "costColWithConstSizedItem", "costOption", "verifyZK", "atLeast", "allOf", "allZK", "anyOf", "anyZK", "PubKey", "sigmaProp", "blake2b256", "sha256", "byteArrayToBigInt", "longToByteArray", "proveDlog", "proveDHTuple", "isMember", "treeLookup", "treeModifications", "groupGenerator", "substConstants", "decodePoint", "BigInt", "toBigInteger"
"Colls", "Monoids", "Costing", "CostModel", "costBoxes", "costColWithConstSizedItem", "costOption", "verifyZK", "atLeast", "allOf", "allZK", "anyOf", "anyZK", "xorOf", "PubKey", "sigmaProp", "blake2b256", "sha256", "byteArrayToBigInt", "longToByteArray", "byteArrayToLong", "proveDlog", "proveDHTuple", "isMember", "treeLookup", "treeModifications", "groupGenerator", "substConstants", "decodePoint", "BigInt", "toBigInteger"
))
}

Expand Down Expand Up @@ -4791,6 +4819,19 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
}
}

object xorOf {
def unapply(d: Def[_]): Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Boolean]])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] && method.getName == "xorOf" =>
val res = (receiver, args(0))
Nullable(res).asInstanceOf[Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Boolean]])]]
case _ => Nullable.None
}
def unapply(exp: Sym): Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Boolean]])] = exp match {
case Def(d) => unapply(d)
case _ => Nullable.None
}
}

object PubKey {
def unapply(d: Def[_]): Nullable[(Rep[SigmaDslBuilder], Rep[String])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] && method.getName == "PubKey" =>
Expand Down Expand Up @@ -4869,6 +4910,19 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
}
}

object byteArrayToLong {
def unapply(d: Def[_]): Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Byte]])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] && method.getName == "byteArrayToLong" =>
val res = (receiver, args(0))
Nullable(res).asInstanceOf[Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Byte]])]]
case _ => Nullable.None
}
def unapply(exp: Sym): Nullable[(Rep[SigmaDslBuilder], Rep[Coll[Byte]])] = exp match {
case Def(d) => unapply(d)
case _ => Nullable.None
}
}

object proveDlog {
def unapply(d: Def[_]): Nullable[(Rep[SigmaDslBuilder], Rep[GroupElement])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] && method.getName == "proveDlog" =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ object TestSigmaDslBuilder extends EntityObject("TestSigmaDslBuilder") {
true, false, element[SigmaProp]))
}

override def xorOf(conditions: Rep[Coll[Boolean]]): Rep[Boolean] = {
asRep[Boolean](mkMethodCall(self,
thisClass.getMethod("xorOf", classOf[Sym]),
List(conditions),
true, false, element[Boolean]))
}

override def sigmaProp(b: Rep[Boolean]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(self,
thisClass.getMethod("sigmaProp", classOf[Sym]),
Expand Down Expand Up @@ -314,6 +321,13 @@ object TestSigmaDslBuilder extends EntityObject("TestSigmaDslBuilder") {
true, false, element[Coll[Byte]]))
}

override def byteArrayToLong(bytes: Rep[Coll[Byte]]): Rep[Long] = {
asRep[Long](mkMethodCall(self,
thisClass.getMethod("byteArrayToLong", classOf[Sym]),
List(bytes),
true, false, element[Long]))
}

override def proveDlog(g: Rep[GroupElement]): Rep[SigmaProp] = {
asRep[SigmaProp](mkMethodCall(self,
thisClass.getMethod("proveDlog", classOf[Sym]),
Expand Down Expand Up @@ -662,6 +676,19 @@ object TestSigmaDslBuilder extends EntityObject("TestSigmaDslBuilder") {
}
}

object xorOf {
def unapply(d: Def[_]): Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Boolean]])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[TestSigmaDslBuilderElem] && method.getName == "xorOf" =>
val res = (receiver, args(0))
Nullable(res).asInstanceOf[Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Boolean]])]]
case _ => Nullable.None
}
def unapply(exp: Sym): Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Boolean]])] = exp match {
case Def(d) => unapply(d)
case _ => Nullable.None
}
}

object sigmaProp {
def unapply(d: Def[_]): Nullable[(Rep[TestSigmaDslBuilder], Rep[Boolean])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[TestSigmaDslBuilderElem] && method.getName == "sigmaProp" =>
Expand Down Expand Up @@ -740,6 +767,19 @@ object TestSigmaDslBuilder extends EntityObject("TestSigmaDslBuilder") {
}
}

object byteArrayToLong {
def unapply(d: Def[_]): Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Byte]])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[TestSigmaDslBuilderElem] && method.getName == "byteArrayToLong" =>
val res = (receiver, args(0))
Nullable(res).asInstanceOf[Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Byte]])]]
case _ => Nullable.None
}
def unapply(exp: Sym): Nullable[(Rep[TestSigmaDslBuilder], Rep[Coll[Byte]])] = exp match {
case Def(d) => unapply(d)
case _ => Nullable.None
}
}

object proveDlog {
def unapply(d: Def[_]): Nullable[(Rep[TestSigmaDslBuilder], Rep[GroupElement])] = d match {
case MethodCall(receiver, method, args, _) if receiver.elem.isInstanceOf[TestSigmaDslBuilderElem] && method.getName == "proveDlog" =>
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/sigmastate/eval/Evaluation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ object Evaluation {
case StringType => SString
case AnyType => SAny
case BigIntegerRType => SBigInt
case BigIntRType => SBigInt
case ECPointRType => SGroupElement
case AvlTreeRType => SAvlTree
case ot: OptionType[_] => sigmastate.SOption(rtypeToSType(ot.tA))
Expand Down
Loading