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

6.0.0 candidate for testnet #1025

Closed
wants to merge 164 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
0843902
DecodeNBitsMethod definition
kushti Apr 2, 2024
49dce78
ToNBits def
kushti Apr 2, 2024
1c1049e
merging w. 6.0.0
kushti Apr 3, 2024
37bb86c
toNBits added to SigmaDsl
kushti Apr 4, 2024
6f8981f
NBitsUtils
kushti Apr 4, 2024
d0f1b7d
unused import removed
kushti Apr 5, 2024
fcc7f0f
merging latest 5.0.14 commits
kushti Apr 6, 2024
6e47167
nbits impl
kushti Apr 9, 2024
9e4e098
failing roundtrip test for deserialization roundtrip
kushti Apr 10, 2024
1016323
importing method def from i675
kushti Apr 10, 2024
93748f1
removing decode nbits
kushti Apr 10, 2024
a3cb64d
versioned nbits serialization roundtrip test
kushti Apr 12, 2024
8941a8e
nbits evaluation test
kushti Apr 15, 2024
92e2d77
close #974 : Header.bytes method implementation
kushti May 6, 2024
98e2756
moving failing test from #612 to here
kushti May 6, 2024
2c6bd15
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti May 6, 2024
624558f
executeFromVar tests are passing
kushti May 7, 2024
690a3e2
Global.deserialize method
kushti May 7, 2024
023ad09
deserialize int - test passing
kushti May 8, 2024
7648182
unused code removal
kushti May 9, 2024
79b4d11
executeFromVar is passing for SigmaProp
kushti May 9, 2024
a470406
more executeFromVar and deserialize tests, all passing
kushti May 9, 2024
c1947d4
negative test for DeserializeContext in executeFromVar, new stubs for…
kushti May 9, 2024
cec0add
long roundtrip
kushti May 9, 2024
838a617
box rouundtrip test
kushti May 10, 2024
fd589a8
bigInt test
kushti May 10, 2024
4404741
Short test
kushti May 10, 2024
7d69ebc
group elem impl & test
kushti May 10, 2024
48f112a
sigmaprop test & impl
kushti May 12, 2024
63f8ccc
non evaluated sigmaprop test
kushti May 12, 2024
516f05d
avltree test & impl
kushti May 12, 2024
5f3a1ad
removing executeFromVar from i443 and some code cleaning
kushti May 13, 2024
50f5b87
merging w. i974
kushti May 13, 2024
126bc05
header impl & test
kushti May 13, 2024
5bf4704
renaming to deserializeRaw, LangSpec.md update
kushti May 13, 2024
4004cc9
i486-toBytes: tests added to SigmaTyperTest
aslesarenko May 14, 2024
b55d336
i486-toBytes: ExactNumeric.toBytes implemented
aslesarenko May 14, 2024
9d83125
Merge branch 'develop' into i486-toBytes
aslesarenko May 14, 2024
e865264
Merge remote-tracking branch 'origin/v6.0.0-fix-tests' into i486-toBytes
aslesarenko May 14, 2024
35c9375
DataSerializer WIP #1
kushti May 16, 2024
48f11e7
coll allowed
kushti May 16, 2024
d4ff7b5
Merge remote-tracking branch 'refs/remotes/origin/v6.0.0-refactor-ir-…
aslesarenko May 16, 2024
7fd601b
.propBytes test
kushti May 16, 2024
e1873fe
merging w. i659, header option test
kushti May 17, 2024
a2ffc2d
all types rely on DataSerializer
kushti May 17, 2024
ae271cd
deserializeRaw -> deserializeTo
kushti May 17, 2024
779a9eb
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti May 17, 2024
60a111b
unused import fix
kushti May 18, 2024
d3e4040
MethodCall deserialization roundtrip for Global.deserializeTo[]
kushti May 20, 2024
727be9b
Merge remote-tracking branch 'refs/remotes/origin/i994-fix-subst-cons…
aslesarenko May 23, 2024
3ccf11e
i486-toBytes: fixes after merge
aslesarenko May 23, 2024
3d47f2a
initial raw, buggy & unversioned unsigned bit int impl
kushti May 24, 2024
b13cef6
failing schnorr sig check w. unsigned
kushti May 24, 2024
e5a32c8
i486-toBytes: Versioned.scala added
aslesarenko May 25, 2024
bba2230
i486-toBytes: ensure VersionContext.current in tests
aslesarenko May 25, 2024
dc361a1
i486-toBytes: ErgoTreeSpecification versioned and updated
aslesarenko May 25, 2024
70786a0
i486-toBytes: clarified description of demotion of SNumericType
aslesarenko May 25, 2024
c76ac1a
i486-toBytes: GraphBuilding to handle numeric methods
aslesarenko May 25, 2024
2427db3
i486-toBytes: added userDefinedInvoke handler to SMethod
aslesarenko May 25, 2024
02e2d06
i486-toBytes: toBigEndianBytes implemented
aslesarenko May 25, 2024
c8d75cd
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti May 26, 2024
c9d0889
first pow check test
kushti May 26, 2024
299fdd5
merging w. nbits encoding PR
kushti May 26, 2024
a90e7be
pow check test passing
kushti May 26, 2024
2e23a2c
v6.0-serialize: CheckMinimalErgoTreeVersion rule removed
aslesarenko May 28, 2024
fe68c66
v6.0-serialize: cleanup + ScalaDocs
aslesarenko May 28, 2024
a5321af
v6.0-serialize: added CoreByteWriter.checkCostLimit
aslesarenko May 28, 2024
37b23cd
hit <= diff
kushti May 29, 2024
69e8d9e
merging w. 6.0.0
kushti May 29, 2024
432addc
v6.0-serialize: cost accumulation in SigmaByteWriter and serialize_ev…
aslesarenko May 29, 2024
97377c2
v6.0-serialize: cleanup + ScalaDocs
aslesarenko Jun 3, 2024
767fbb4
v6.0-serialize: tests for cost trace
aslesarenko Jun 3, 2024
7ce2446
merging w. 6.0.0
kushti Jun 3, 2024
744d8a5
conversion test stub
kushti Jun 3, 2024
a30e068
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jun 3, 2024
2acc6db
more todos
kushti Jun 4, 2024
4735aed
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jun 4, 2024
0478069
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jun 6, 2024
e2faf71
merging with newfeature pr
kushti Jun 6, 2024
37ac921
BasicOpsSpecification tests for serialize
kushti Jun 6, 2024
074d609
MethodCall deserialization round trip for Global.serialize
kushti Jun 6, 2024
bf53a6b
spam tests, test for serialize(long) producing different result from …
kushti Jun 6, 2024
dd7bdc6
removing serialize
kushti Jun 7, 2024
4b27c86
merging w. 6.0-newfeature
kushti Jun 7, 2024
e1bfb1c
remove serialize from GraphBuilding and ErgoTreeSpecification
kushti Jun 7, 2024
15e21a4
importing new test for ErgoTreeSpecification from i486
kushti Jun 7, 2024
15f4f67
removing modq methods
kushti Jun 7, 2024
303f969
expUnsigned impl (test still failing)
kushti Jun 8, 2024
982f32f
schnorr sig example passed
kushti Jun 9, 2024
eb47d17
eq test, DataValueComparer
kushti Jun 9, 2024
33033fc
importing CheckMinimalErgoTreeVersion from i994
kushti Jun 10, 2024
d7fd8e1
merging w. 6.0.0
kushti Jun 10, 2024
312167b
merging w. 6.0.0
kushti Jun 10, 2024
dd62bd7
failing tests
kushti Jun 11, 2024
aaef77e
close #906: lazy evaluation of default in Option.getOrElse and Coll.g…
kushti Jun 11, 2024
ea468c9
initial stubs along first todos for bulletproofs contracts
kushti Jun 11, 2024
e9b3253
original code
kushti Jun 12, 2024
e71d7c2
modInverse
kushti Jun 13, 2024
e989665
plusMod
kushti Jun 13, 2024
d776db3
multiplyMod
kushti Jun 13, 2024
72db85b
toUnsigned & toUnsignedMod
kushti Jun 14, 2024
fc6d856
mod, toSigned, subtractMod
kushti Jun 17, 2024
a731962
simplifying the code
kushti Jul 5, 2024
cb7e262
initial toBits failing tests
kushti Jul 6, 2024
f577fd3
passing test (compilation fixed)
kushti Jul 8, 2024
cadf53d
tests for Byte and BigInt
kushti Jul 8, 2024
81ed008
Merge branch 'i486-toBytes' of github.com:ScorexFoundation/sigmastate…
kushti Jul 8, 2024
ee59083
Byte.toBits test passing
kushti Jul 8, 2024
3fde5fa
toBits tests for Long and BigInt(failing)
kushti Jul 8, 2024
9ea7597
BigInt.toBits test passing
kushti Jul 8, 2024
be77315
bitwise inversion
kushti Jul 9, 2024
a575d38
bitwiseInverse tests for Long and Byte
kushti Jul 9, 2024
7ff3542
bitwise or impl
kushti Jul 10, 2024
868fbb1
bitwiseAnd
kushti Jul 10, 2024
f21436d
bitwiseXor
kushti Jul 10, 2024
ced229f
shiftLeft
kushti Jul 11, 2024
9519ef6
shiftRight
kushti Jul 16, 2024
8f9b549
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jul 30, 2024
4c63a60
LSV5 & LSV6 tests
kushti Jul 30, 2024
61f90cd
assertEXceptionThrown
kushti Jul 31, 2024
aaa2aa9
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Jul 31, 2024
a20c04f
moving to Global, finalizing costing
kushti Jul 31, 2024
2c8df31
updating collectMethods
kushti Jul 31, 2024
6981c34
fixing JS test
kushti Jul 31, 2024
26809c9
passing but improper changedFeature test
kushti Aug 2, 2024
2bf10bb
merging w. 6.0.0
kushti Aug 5, 2024
57ba522
merging w. 6.0.0
kushti Aug 8, 2024
8da3575
fixed tests in LSV6
kushti Aug 9, 2024
26b2b77
merging header.checkPoW
kushti Aug 12, 2024
65144a9
merging w. 6.0.0
kushti Aug 13, 2024
3fe6e50
merging v6.0-serialize into
kushti Aug 14, 2024
b4aa573
mmerging w. 6.0.0
kushti Aug 14, 2024
d8cc09d
deserializeCostKind
kushti Aug 14, 2024
6eba58d
deserialize merged
kushti Aug 14, 2024
fc056d8
nbits PR merged into
kushti Aug 14, 2024
57e39be
Header.bytes removed
kushti Aug 18, 2024
a8f1d66
merging deserialize PR updates into
kushti Aug 20, 2024
6bb7fe7
merging w. 6.0.0
kushti Aug 20, 2024
bcfb24d
removing unused CSigmaDslBuilder.validationSettings
kushti Aug 25, 2024
3037f1a
merging w 6.0.0, fixing ErgoTreeSpec
kushti Aug 27, 2024
016262b
removing unused SNumericTypeMethods.getMethods
kushti Aug 27, 2024
baef87f
more efficient toBits impl
kushti Sep 2, 2024
c7918ad
merging v6.0.0
kushti Sep 2, 2024
5a983b3
merging w. 6.0.0
kushti Sep 3, 2024
2e8d8f4
optimizing imports, polishing
kushti Sep 3, 2024
0c674fe
Merge branch 'v6.0.0' of github.com:ScorexFoundation/sigmastate-inter…
kushti Sep 4, 2024
ed5b8f5
fixing SigmaTyperTest
kushti Sep 4, 2024
b2de9cf
scaladoc
kushti Sep 6, 2024
9a10d17
merging w. i1006 (numeric methods)
kushti Sep 9, 2024
eccc9ca
6.0 methods for Byte in LSV6
kushti Sep 10, 2024
f566b7b
6.0 methods for Short in LSV6
kushti Sep 10, 2024
8cf4264
6.0 methods for Int in LSV6
kushti Sep 10, 2024
fa2c2df
Long tests in LSV6, shift check in shiftRight
kushti Sep 11, 2024
48db432
shiftLeft/shiftRight shift limit
kushti Sep 11, 2024
a2f3030
bigint - LSV6 tests
kushti Sep 11, 2024
297265f
arg descs, 2.11 comp fix, BOS tests fixed
kushti Sep 12, 2024
89d4477
Merge branch 'i1006' of github.com:ScorexFoundation/sigmastate-interp…
kushti Sep 12, 2024
55d03cd
addressing review comments
kushti Sep 16, 2024
343a385
Merge branch 'i1006' of github.com:ScorexFoundation/sigmastate-interp…
kushti Sep 17, 2024
1c2b99d
more polishing in UnsignedBigInt impl
kushti Sep 17, 2024
cb51ba8
removing access to type before 6.0, more tests
kushti Sep 17, 2024
3f6f8d5
merging w. 6.0.0
kushti Sep 17, 2024
c63ade1
merging with unsigned big int PR
kushti Sep 17, 2024
6c59ce0
imports fix
kushti Sep 17, 2024
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
Prev Previous commit
Next Next commit
deserializeRaw -> deserializeTo
kushti committed May 17, 2024

Verified

This commit was signed with the committer’s verified signature.
kushti Alexander Chepurnoy
commit ae271cd6ffa68f7903d20ef7e05c0aefcf20e9ac
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
@@ -739,6 +739,6 @@ trait SigmaDslBuilder {
/** Returns a byte-wise XOR of the two collections of bytes. */
def xor(l: Coll[Byte], r: Coll[Byte]): Coll[Byte]

def deserializeRaw[T](tpe: SType, bytes: Coll[Byte])(implicit cT: RType[T]): T
def deserializeTo[T](tpe: SType, bytes: Coll[Byte])(implicit cT: RType[T]): T
}

Original file line number Diff line number Diff line change
@@ -450,8 +450,8 @@ object ReflectionData {
mkMethod(clazz, "decodePoint", Array[Class[_]](cColl)) { (obj, args) =>
obj.asInstanceOf[SigmaDslBuilder].decodePoint(args(0).asInstanceOf[Coll[Byte]])
},
mkMethod(clazz, "deserializeRaw", Array[Class[_]](classOf[SType], cColl, classOf[RType[_]])) { (obj, args) =>
obj.asInstanceOf[SigmaDslBuilder].deserializeRaw(args(0).asInstanceOf[SType], args(1).asInstanceOf[Coll[Byte]])(args(2).asInstanceOf[RType[_]])
mkMethod(clazz, "deserializeTo", Array[Class[_]](classOf[SType], cColl, classOf[RType[_]])) { (obj, args) =>
obj.asInstanceOf[SigmaDslBuilder].deserializeTo(args(0).asInstanceOf[SType], args(1).asInstanceOf[Coll[Byte]])(args(2).asInstanceOf[RType[_]])
}
)
)
12 changes: 6 additions & 6 deletions data/shared/src/main/scala/sigma/ast/methods.scala
Original file line number Diff line number Diff line change
@@ -1533,10 +1533,10 @@ case object SGlobalMethods extends MonoTypeMethods {
.withInfo(Xor, "Byte-wise XOR of two collections of bytes",
ArgInfo("left", "left operand"), ArgInfo("right", "right operand"))

lazy val desJava = ownerType.reprClass.getMethod("deserializeRaw", classOf[SType], classOf[Coll[Byte]], classOf[RType[_]])
lazy val desJava = ownerType.reprClass.getMethod("deserializeTo", classOf[SType], classOf[Coll[Byte]], classOf[RType[_]])

lazy val deserializeRawMethod = SMethod(
this, "deserializeRaw", SFunc(Array(SGlobal, SByteArray), tT, Array(paramT)), 3, Xor.costKind) // todo: cost
lazy val deserializeToMethod = SMethod(
this, "deserializeTo", SFunc(Array(SGlobal, SByteArray), tT, Array(paramT)), 3, Xor.costKind) // todo: cost
.copy(irInfo = MethodIRInfo(None, Some(desJava), None))
.withInfo(Xor, "Byte-wise XOR of two collections of bytes", // todo: desc
ArgInfo("left", "left operand"), ArgInfo("right", "right operand"))
@@ -1551,12 +1551,12 @@ case object SGlobalMethods extends MonoTypeMethods {
}


def deserializeRaw_eval(mc: MethodCall, G: SigmaDslBuilder, bytes: Coll[Byte])
def deserializeTo_eval(mc: MethodCall, G: SigmaDslBuilder, bytes: Coll[Byte])
(implicit E: ErgoTreeEvaluator): Any = {
val tpe = mc.tpe
val cT = stypeToRType(tpe)
E.addSeqCost(Xor.costKind, bytes.length, Xor.opDesc) { () => // todo: cost
G.deserializeRaw(tpe, bytes)(cT)
G.deserializeTo(tpe, bytes)(cT)
}
}

@@ -1565,7 +1565,7 @@ case object SGlobalMethods extends MonoTypeMethods {
Seq(
groupGeneratorMethod,
xorMethod,
deserializeRawMethod
deserializeToMethod
)
} else {
Seq(
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ class CSigmaDslBuilder extends SigmaDslBuilder { dsl =>
this.GroupElement(p)
}

def deserializeRaw[T](tpe: SType, bytes: Coll[Byte])(implicit cT: RType[T]): T = {
def deserializeTo[T](tpe: SType, bytes: Coll[Byte])(implicit cT: RType[T]): T = {
val reader = new SigmaByteReader(new VLQByteBufferReader(ByteBuffer.wrap(bytes.toArray)), new ConstantStore(), false)
val res = DataSerializer.deserialize(tpe, reader)
res.asInstanceOf[T]
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ case class MethodCallSerializer(cons: (Value[SType], SMethod, IndexedSeq[Value[S
w.putValue(mc.obj, objInfo)
assert(mc.args.nonEmpty)
w.putValues(mc.args, argsInfo, argsItemInfo)
if(mc.method.name == SGlobalMethods.deserializeRawMethod.name){
if(mc.method.name == SGlobalMethods.deserializeToMethod.name){
w.putType(mc.tpe, typeInfo)
}
}
@@ -62,7 +62,7 @@ case class MethodCallSerializer(cons: (Value[SType], SMethod, IndexedSeq[Value[S

val specMethod = method.specializeFor(obj.tpe, types)

val subst: STypeSubst = if(method.name == SGlobalMethods.deserializeRawMethod.name) {
val subst: STypeSubst = if(method.name == SGlobalMethods.deserializeToMethod.name) {
val tpe = r.getType()
Map(tT -> tpe)
} else {
4 changes: 2 additions & 2 deletions docs/LangSpec.md
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ The following sections describe ErgoScript and its operations.
#### Operations and constructs overview

- Binary operations: `>, <, >=, <=, +, -, &&, ||, ==, !=, |, &, *, /, %, ^, ++`
- predefined primitives: `deserializeRaw`, `blake2b256`, `byteArrayToBigInt`, `proveDlog` etc.
- predefined primitives: `deserializeTo`, `blake2b256`, `byteArrayToBigInt`, `proveDlog` etc.
- val declarations: `val h = blake2b256(pubkey)`
- if-then-else clause: `if (x > 0) 1 else 0`
- collection literals: `Coll(1, 2, 3, 4)`
@@ -901,7 +901,7 @@ def sha256(input: Coll[Byte]): Coll[Byte]

/** Create an instance of type T from bytes of its wrapped type.
See https://github.com/ScorexFoundation/sigmastate-interpreter/pull/979 for more details */
def deserializeRaw[T](input: Coll[Byte]): T
def deserializeTo[T](input: Coll[Byte]): T

/** Create BigInt from a collection of bytes. */
def byteArrayToBigInt(input: Coll[Byte]): BigInt
10 changes: 5 additions & 5 deletions sc/shared/src/main/scala/sigmastate/eval/GraphBuilding.scala
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import sigma.serialization.OpCodes
import scala.collection.mutable.ArrayBuffer


case class DeserializeRawBytes[V <: SType](bytes: Value[SByteArray], tpe: V) extends NotReadyValue[V] {
case class deserializeToBytes[V <: SType](bytes: Value[SByteArray], tpe: V) extends NotReadyValue[V] {
/** The companion node descriptor with opCode, cost and other metadata. */
override def companion: ValueCompanion = ???

@@ -556,8 +556,8 @@ trait GraphBuilding extends SigmaLibrary { IR: IRContext =>
val e = stypeToElem(optTpe.elemType)
ctx.getVar(id)(e)

case DeserializeRawBytes(bytes, tpe) =>
sigmaDslBuilder.deserializeRaw(asRep[Coll[Byte]](eval(bytes)))(stypeToElem(tpe))
case deserializeToBytes(bytes, tpe) =>
sigmaDslBuilder.deserializeTo(asRep[Coll[Byte]](eval(bytes)))(stypeToElem(tpe))

case ValUse(valId, _) =>
env.getOrElse(valId, !!!(s"ValUse $valId not found in environment $env"))
@@ -1160,10 +1160,10 @@ trait GraphBuilding extends SigmaLibrary { IR: IRContext =>
val c1 = asRep[Coll[Byte]](argsV(0))
val c2 = asRep[Coll[Byte]](argsV(1))
g.xor(c1, c2)
case SGlobalMethods.deserializeRawMethod.name if VersionContext.current.isV6SoftForkActivated =>
case SGlobalMethods.deserializeToMethod.name if VersionContext.current.isV6SoftForkActivated =>
val c1 = asRep[Coll[Byte]](argsV(0))
val c2 = stypeToElem(method.stype.tRange.withSubstTypes(typeSubst))
g.deserializeRaw(c1)(c2)
g.deserializeTo(c1)(c2)
case _ => throwError
}
case _ => throwError
4 changes: 2 additions & 2 deletions sc/shared/src/main/scala/sigmastate/eval/TreeBuilding.scala
Original file line number Diff line number Diff line change
@@ -219,9 +219,9 @@ trait TreeBuilding extends SigmaLibrary { IR: IRContext =>
val tpe = elemToSType(eVar)
mkGetVar(id, tpe)

case SDBM.deserializeRaw(g, bytes, eVar) =>
case SDBM.deserializeTo(g, bytes, eVar) =>
val tpe = elemToSType(eVar)
builder.mkMethodCall(recurse(g), SGlobalMethods.deserializeRawMethod, IndexedSeq(recurse(bytes)), Map(tT -> tpe): STypeSubst)
builder.mkMethodCall(recurse(g), SGlobalMethods.deserializeToMethod, IndexedSeq(recurse(bytes)), Map(tT -> tpe): STypeSubst)

case BIM.subtract(In(x), In(y)) =>
mkArith(x.asNumValue, y.asNumValue, MinusCode)
6 changes: 3 additions & 3 deletions sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import SigmaPredef._
import sigma.ast.syntax._
import sigma.exceptions.TyperException
import sigma.serialization.OpCodes
import sigmastate.eval.DeserializeRawBytes
import sigmastate.eval.deserializeToBytes

import scala.collection.mutable.ArrayBuffer

@@ -137,8 +137,8 @@ class SigmaTyper(val builder: SigmaBuilder,
SGlobalMethods.method(n) match {
case Some(method) =>
val srcCtx = sel.sourceContext
if(method.name == SGlobalMethods.deserializeRawMethod.name) {
DeserializeRawBytes(args(0).asInstanceOf[Value[SByteArray]], rangeTpe)
if(method.name == SGlobalMethods.deserializeToMethod.name) {
deserializeToBytes(args(0).asInstanceOf[Value[SByteArray]], rangeTpe)
} else {
processGlobalMethod(srcCtx, method, newArgs)
}
2 changes: 1 addition & 1 deletion sc/shared/src/main/scala/special/sigma/SigmaDslUnit.scala
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ package sigma {
/** This method will be used in v6.0 to handle CreateAvlTree operation in GraphBuilding */
def avlTree(operationFlags: Ref[Byte], digest: Ref[Coll[Byte]], keyLength: Ref[Int], valueLengthOpt: Ref[WOption[Int]]): Ref[AvlTree];
def xor(l: Ref[Coll[Byte]], r: Ref[Coll[Byte]]): Ref[Coll[Byte]]
def deserializeRaw[T](bytes: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T]
def deserializeTo[T](bytes: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T]
};
trait CostModelCompanion;
trait BigIntCompanion;
14 changes: 7 additions & 7 deletions sc/shared/src/main/scala/special/sigma/impl/SigmaDslImpl.scala
Original file line number Diff line number Diff line change
@@ -1970,9 +1970,9 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, false, element[Coll[Byte]]))
}

override def deserializeRaw[T](l: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T] = {
override def deserializeTo[T](l: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T] = {
asRep[T](mkMethodCall(self,
SigmaDslBuilderClass.getMethod("deserializeRaw", classOf[Sym], classOf[Elem[T]]),
SigmaDslBuilderClass.getMethod("deserializeTo", classOf[Sym], classOf[Elem[T]]),
Array[AnyRef](l, cT),
true, false, element[T]))
}
@@ -2136,9 +2136,9 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
true, true, element[Coll[Byte]]))
}

def deserializeRaw[T](bytes: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T] = {
def deserializeTo[T](bytes: Ref[Coll[Byte]])(implicit cT: Elem[T]): Ref[T] = {
asRep[T](mkMethodCall(source,
SigmaDslBuilderClass.getMethod("deserializeRaw", classOf[Sym], classOf[Elem[T]]),
SigmaDslBuilderClass.getMethod("deserializeTo", classOf[Sym], classOf[Elem[T]]),
Array[AnyRef](bytes, cT),
true, true, element[T]))
}
@@ -2161,7 +2161,7 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
Elem.declaredMethods(RClass(classOf[SigmaDslBuilder]), RClass(classOf[SSigmaDslBuilder]), Set(
"Colls", "verifyZK", "atLeast", "allOf", "allZK", "anyOf", "anyZK", "xorOf", "sigmaProp", "blake2b256", "sha256",
"byteArrayToBigInt", "longToByteArray", "byteArrayToLong", "proveDlog", "proveDHTuple", "groupGenerator", "substConstants",
"decodePoint", "avlTree", "xor", "deserializeRaw"
"decodePoint", "avlTree", "xor", "deserializeTo"
))
}
}
@@ -2340,9 +2340,9 @@ object SigmaDslBuilder extends EntityObject("SigmaDslBuilder") {
def unapply(exp: Sym): Nullable[(Ref[SigmaDslBuilder], Ref[Coll[Byte]])] = unapply(exp.node)
}

object deserializeRaw {
object deserializeTo {
def unapply(d: Def[_]): Nullable[(Ref[SigmaDslBuilder], Ref[Coll[Byte]], Elem[T]) forSome {type T}] = d match {
case MethodCall(receiver, method, args, _) if method.getName == "deserializeRaw" && receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] =>
case MethodCall(receiver, method, args, _) if method.getName == "deserializeTo" && receiver.elem.isInstanceOf[SigmaDslBuilderElem[_]] =>
val res = (receiver, args(0), args(1))
Nullable(res).asInstanceOf[Nullable[(Ref[SigmaDslBuilder], Ref[Coll[Byte]], Elem[T]) forSome {type T}]]
case _ => Nullable.None
Loading